I'm stuck on a few things for my mod, I'm currently missing API functionality for switching materials and for my custom entities to find/do (custom) Jobs.
-I've increased the time it takes to normally dismantle brick/cement/perimeter walls and tunnels. Next I created explosive charges for optional fast (but potentially dangerous) demolition... Allas atm my script behind the charges can only damage (or kill) prisoners, staff and nearby objects. The entities in the blastzone also get accelerated away, and I spawn some debris all of which looks quite cool.
BUT the idea behind the charges is to demolish walls and (exposed) tunnels; and that is what I cannot achieve in script with the current API.
Code: Select all
--exert from my Detonate() function:
function Detonate()
local objectTypes = { "BrickWall", "ConcreteWall", "BuildingConcrete", "BuildingFrame", "PerimeterWall", "Fence" }
--local objectTypes = { "Wall" }
for i,objectType in ipairs( objectTypes ) do
FindObjectsToDestroy(objectType, 5.0, 1.0)
end
end
function FindObjectsToDestroy(typeName, distance, damage)
local objects = Object.GetNearbyObjects(typeName, distance) --doesn't return any wall/tunnel(!)
for obj, dist in pairs(objects) do
--obj.Damage=1;
obj.Delete(); --these lines are never reached
end
end
I've tried other ways of getting rid of walls, tried to see if the existing function GetMaterial(x,y) has a Settable counterpart;
But Object.SetMaterial(x, y, "ConcreteFloor") doesn't exist.
Tried to spawn stuff at this (wall/charge) position;
Object.Spawn( "Rubble", this.Pos.x, this.Pos.y ); doesn't effect wall
Object.Spawn( "BurntFloor", this.Pos.x, this.Pos.y ); doesn't do anything
I've even tried temporarily (and during testing permanently) moving nearby doors to the position of a wall to see if that would get the walls to go away;
Code: Select all
local objects = Object.GetNearbyObjects("JailDoor", 10)
for obj, dist in pairs(objects) do
local doorX, doorY = obj.Pos.x, obj.Pos.y;
obj.Pos.x, obj.Pos.y = this.Pos.x, this.Pos.y;
obj.Pos.x, obj.Pos.y = doorX, doorY;
return
end
Sadly this makes a door move to a nearby empty space (for an instant and then back to where it was).
-> So I'm stuck on destroying walls/tunnels; I would need GetNearbyObjects or a newly created function to return wall/tunnel objects... or to have a SetMaterial function or perhaps to be able to just spawn materials to positions.
(The alpha 36 random events do manage to randomly cause portions of wall to crumble, but the way it accomplishes that seems obfuscated to me. So perhaps there is already a way and I am just lacking information on this.)
-Next I have a similar problem with script behind my custom surgeon and psychiatrist entities; If I spawn (create) any job, custom or not, currently only workmen, janitors, doctors and prisoners will try fulfill it. I cannot for instance get the foreman to do a custom construction job (place explosive charge). Nor does the warden respond to any jobs with "Worker Warden" detailed.
And as you might know custom entities are completely inert without script... I have seen others make new staff members "wander" around the place, but have yet to see anyone make a custom entity do a single job.
-> For my mod to function as intended, I need to be able to get nearby jobs from script... GetNearbyObjects will not return any Jobs. I'd like it very much if GetNearbyObjects or a newly created function would return (my custom) jobs...
From there I would need even more; I could have the entity navigate to a job, but currently don't know of a way get an entity to start doing that job. (I have not tried forcing an entity's id's into slots and setting an objects inUse flag, as I can't navigate to a specific slot with any degree of precision atm.)
Thanks for reading my API requests, if you are introversion and/or can help me in any way; I would be even more thankfull!!