Basically, I want to be able to edit a turfs contents that a mob is standing on (so I can delete stacking objects for a build code).
ID:157980
Nov 23 2009, 11:10 pm
|
|
Nov 23 2009, 11:12 pm
|
|
http://www.byond.com/docs/ref/info.html#/atom/var/loc
|
In response to Jp
|
|
Thanks for the quick response.
Also, how do you search the contents to find if that type of object is already created? My current code is; obj/build/Click() |
In response to Strong123488
|
|
I'm not following precisely what you're trying to do here, but I suspect you'd benefit from the locate() procedure. For example:
for(var/obj/build/X in usr.contents) is better written as:
X.togglebuild = !(locate(/obj/build) in usr.contents)
locate reference: http://www.byond.com/docs/ref/info.html#/proc/locate Are you looking specifically for any subclass of /obj/build, or one that matches src.type? |
In response to Jp
|
|
obj/build/Click() Basically, I am trying to prevent more than 1 turf-like object being on that turf at once. Without doing this, it will just continue placing objects down even when I'm standing still and that is unessessary. The if(B.type==/obj) code works, but it will become broken when I add items, and they are lying on the floor. |
In response to Strong123488
|
|
I see.
Assuming all of your 'turflike' objects are of type /obj/build: mob Completely untested. Will post explanation/fix bugs after dinner. EDIT: Okay, thought about this slightly more, and you seem to have a player's-mob-passes-attributes-onto-construction paradigm for this thing that I'll attempt to emulate. Assume all 'turflike' objects are of type /obj/build: mob The advantage of this approach is that you don't have that infinite loop spinning all the time. And it should work for 'item-like' build objects when you throw those in. Note that I'm not an expert on the building-game genre, and don't know quite how this is all supposed to work - this is mostly supposition based on your responses and the code you've shown. |