GetMOFromID for a device in a craft
So, I made
this mod. I modified the code to not check if it's held by an actor and tried to load it into a craft and the invisible brain lost track of the TDExplosive.
I'm not exactly sure how everything works, but GetMOFromID returns MO of the Actor if the device is held by him, but why does it return nil if it's inside a craft? How can I get MO of the craft in such case?
Code:
function Create(self)
self.tracker = CreateTDExplosive("Brain","PocketBrain.rte");
self.tracker.Pos = self.Pos;
MovableMan:AddMO(self.tracker);
end
function Update(self)
local newHolder = MovableMan:GetMOFromID(self.tracker.RootID);
--if MovableMan:IsActor(newHolder) then
self.Pos = newHolder.Pos;
--else self.Pos = self.tracker.Pos;
--end
if self.tracker.ToDelete == true then
self.GibThis(self);
end
end