I am trying to make a mod for surgery automation, but i need to know how to check if there is a medical bed in front of the object.
Hello,
I know you can get a list of all a colonists buildings with Find.VisibleMap.listerBuildings.allBuildingsColonist
then it should just be a case of comparing the location of your object to the location of the medical bed using .position on the building objects.
Something like (Pseudo code)
List<Building> colonistBuildings;
colonistBuildings = Find.VisibleMap.listerBuildings.allBuildingsColonist;
colonistMedicalBeds = colonistBuildings.Find(x => x.LabelCap == "Medical Bed")
foreach(var medbed in colonistMedicalBeds)
{
// yourObjects position + 1 unit to right should check if any of the medical beds are to the right of your object
var myObjectPositionwithOffset = new Vector2(myObject.position.x + 1, myObject.position.y);
if(medbed.position == myObjectPositionwithOffset)
{
//do stuff
}
}
I'm not sure if this will work as I haven't tested it but this is how I would go about it.
how do I set a position vector, I don't know where the person is placing it, I'm getting how to place the object with https://github.com/HaploX1/ExampleDllMod (https://github.com/HaploX1/ExampleDllMod) as a reference, also, new vector2 doesn't work, and colonistbuildings.find doesn't return an array