questions about handling turfs in Developer Help
|
|
I realized I don't have much experience with adding/deleting turfs at runtime, so I could use some advice on this:
My map is setup with a block of locations like this:
ABBBC (A,B,C are different turf types)
Based on the number of players in the current game, I'd like to change the turfs to either of these:
ABBC or ABC
Thus, I first need to identify if turf A or B is at a given location, then add/del turfs as necessary. This is further complicated because I will also have a separate background turf in addition to the above, so I don't want to delete ALL turfs at a location. Is there a list of turfs for a given map location that I can access?
If there is a good library/tutorial that would help me get familiar with this, please let me know.
|
<code> obj A B C New() while(world.Players > x-initial(x)) new /obj/B(loc) x++ var/Players mob Login() Players++ ..() Logout() Players-- ..() </code>
Untested, but it should work. Just start it off with no B objects, and just have it like:
<code>AC</code>
And it will adjust itself. If you want it to change as players join and leave, replace <code>New()</code> with <code>proc/Adjust()</code> , and put in <code>for(var/obj/C/C) C.Adjust()</code> into the Login() and Logout() procs.
Or, if you want the number of B's to be based on the number of players, not the exact number of players, you can use round(Players/2) or whatever.