ID:149859
 
I'm stuck at a place in my code where I'm not sure how to proceed. What I need to happen is when the turf is entered and the condition that the mob/pc hands have a clay tool in it, it shows the Dig() verb. and only if they have the tool in their hands, otherwise it won't show. verb += is what I'm thinking I need but not sure.. anyways heres the code:

clay
icon = 'sand.dmi'
icon_state = "clay"
Entered(mob/pc/M)
if (M.hands == "clay tool")
verb/Dig()

LJR
Every /atom/movable has a list called 'verbs', all you have to do is add to that list. Heres an example:

turf/Musical_/Entered(O)
..()
var/mob/M = O
M.verbs += /obj/musical_/verb/play_music

Hope that helps.
Alathon
In response to Alathon
If it doesn't, look at any of the admin libs.....
In response to unimatrix
clay
icon = 'sand.dmi'
icon_state = "clay"
Entered(mob/pc/M)
verb/Dig()
..()
if (M.hands == "clay tool")
M.verbs +=/mob/hidden/verb/dig
else
..()
Exited(mob/pc/M)
M.verbs-=-/mob/hidden/verb/dig

// Hidden Verbs
mob/hidden
verb
Dig()

This is what I'm trying to do now.. The mob/hidden is a mob that will never be created on the map, but will contain all my hidden verbs that can be added.

LJR
In response to LordJR
Ok I got the Entered(), Exited() one working.
Now I need to do kind of the same thing, but not with the person Entering the tile. When they get within oview(1) of the tile which has a density of 1, it will give you the option to mine the mountain. But since the mountain has a density of 1, you can't enter it, so just when u get close the verb will be added if you are holding a pick.

Any ideas??
In response to LordJR
Try something like this:

turf
mountain
verb
Mine()
var/has_pick = locate(/obj/pick) in usr.contents
if(has_pick) set src in oview(1)
//mining stuff here


This is untested, so tell me how it works out.

-Rcet
In response to Rcet
You may be onto something here, but I don't even want the verb to show up if they don't have a pick in hand.
I got the code too add and remove verbs, just not how to check if they are nearby opposed to entering to activate the check.

LJR
In response to LordJR
Ok, i can fix that code if you supply the code for the equip pick axe verb, or whatever.

-Rcet
In response to Rcet
Well

if(M.hands == "pick") && (need code here- if oview(1))
Mining()
In response to LordJR
LordJR wrote:
Well

if(M.hands == "pick") && (need code here- if oview(1))
Mining()

ok, then you need something like this:
turf
mountain
verb
Mine()
if(usr.hands == "pick") set src in oview(1)
//mining stuff here


Try that.

-Rcet
In response to Rcet
nope that don't work
In response to LordJR
Two possibilities I can think of off hand...

1) create an /area/mountain_view or something like that, and place it around all your mountains. Then go back to the Entered() proc soloution.

2)
mob
Move()
if(hands = "pick")
if(var/turf/mountain/M in view(1))
verbs += /mob/hidden/verb/dig
else
verbs -= /mob/hidden/verb/dig
return ..()


I'm not sure how efficient that second one would be... You might need to test if /dig is in verbs before adding or removing it, but it might work. This also would fail if you use src.loc = locate to teleport and such, so you would have to set up a seperate /proc to test the location after that type of direct move.

flick()

In response to Rcet
Rcet wrote:

> turf
> mountain
> verb
> Mine()
> if(usr.hands == "pick") set src in oview(1)
> //mining stuff here
>

You can't set src at runtime, only at compile time I believe. And in this case, the only way there would be a usr, is if they had already used the verb.
In response to Flick
yeah I got it all working now, not like I wanted it to, but it works fine for now.

LJR