Open SickBoySB opened 7 years ago
Initial tests work great! Rubbish is spawnable, triggerable whenever desired (chance based, guaranteed, whatever).
TODO:
Put the function in FSM.lua for now. Probably the ideal place, since colonists are the dirty birds and their actions are what is most likely to trigger it.
Z-index isn't possible to get. Another solution is needed.
Forcing the item into their hands then performing drop_item.fsm may work? Hrm.. needs some consideration and may not actually be possible, unfortunately. Turning a clearable into an actual item seems like a bad idea.
Maybe take a look at how bandit tents are spawned?
Okay so using ITEM creation rather than CLEARABLE creation works like a charm. The item is subsequently placed on top of anything... stockpiles, floors in buildings, etc.
local results = query("scriptManager", "scriptCreateGameObjectRequest", "item", { legacyString = "logs"} )[1]
send(results,"ClaimItem")
local positionResult = query("gameSpatialDictionary", "nearbyEmptyGridSquare", state.AI.position, 2)[1]
local x = positionResult.x --+ rand(-1,1)
local y = positionResult.y --+ rand(-1,1)
send(results,"GameObjectPlace",positionResult.x,positionResult.y )
send("rendCommandManager", "odinRendererCreateParticleSystemMessage", "DustPuffV1", x, y)
This means implementation is possible, but would change how things work.
Example code is in module.go and clearable.go. Rotting tags and whatnot are in edb files.
The idea is to utilize the plethora of debris models in a way where they periodically spawn with the boundaries of the civilization, then periodically create an "off shift" job of very low priority to clean it up.