ID:2051263
 
(See the best response by Nadrew.)
Code:
/obj/spacepod/verb/exit_pod()
set name = "Exit pod"
set category = "Spacepod"
set src = usr.loc

/obj/spacepod/verb/move_inside()
set category = "Object"
set name = "Enter Pod"
set src in oview(1)


Problem description:

Hey there, some of our users say they dislike the way our verb system for this object works but I'm banging my head against the wall trying to make this work properly.

Essentially we want
1. An enter verb to appear to a usr when they are outside this object (and not exit)
2. An exit verb to appear to a usr when they are inside this object (and not enter)

Right now the exit verb never appears in the right click menu, and the enter verb is always there. Rather unfortunate stuff as people will first intuitively right click to enter/leave it despite any other options we give them.

I can understand that because the enter verb has an src setting "set src in oview(1)", it wouldn't really prevent a usr who is inside of src.contents from having the verb show up to them (assuming oview() being on the usr who doesn't have the object in contents). But is there such a way to prevent a verb from showing up to a usr within contents?

But the exit verb is rather more mysterious, even though it properly appears in the category/command bar correctly when you are inside src, it never shows up in the right click menu with this src scope setting. Is this just a quirk of how verbs interact with right click menus or is this intentional?
Best response
If the pod was a mob you could utilize the "group" variable to selectively show/hide the verbs as needed 'in group' is a valid src setting, but the group variable is exclusive to mobs.

Outside of that, manually adding/removing the verbs from mob.verbs could work, but I can only see that becoming a massive headache that's far more complex than it's worth.

Other than that, you could always consolidate the two commands into a single verb that's accessible from view(1) that would remove you if you were inside and vise versa.
A fairly dirty fix would be to use a second object.

obj/spacepod
var
obj/spacepodinterior/interior
verb
enter_pod()
set src in view(1)
if(!interior) interior = new/obj/spacepodinterior(null,src)
usr.loc = interior
usr.client.eye = src

obj/spacepodinterior
var
obj/owner
New(loc,owner)
src.owner = owner
verb
exit_pod()
set src = usr.loc
usr.loc = owner.loc
usr.client.eye = usr
if(!contents.len)
owner.interior = null


It may not be ideal, but it should do the trick.
Unfortunately we just ended up combining the two verbs into one since finding a way to always show only one or the other seems to not be very feasible.