UnregisterObjectPos() public method

public UnregisterObjectPos ( FSO.SimAntics.VMEntity obj ) : void
obj FSO.SimAntics.VMEntity
return void
Exemplo n.º 1
0
        public override void PositionChange(VMContext context, bool noEntryPoint)
        {
            if (GhostImage)
            {
                return;
            }

            var room = context.GetObjectRoom(this);

            SetRoom(room);

            if (HandObject != null)
            {
                context.UnregisterObjectPos(HandObject);
                HandObject.Position = Position;
                HandObject.PositionChange(context, noEntryPoint);
            }

            context.RegisterObjectPos(this);
            if (Container != null)
            {
                return;
            }
            if (Position == LotTilePos.OUT_OF_WORLD)
            {
                return;
            }

            base.PositionChange(context, noEntryPoint);
        }
Exemplo n.º 2
0
        public override void PrePositionChange(VMContext context)
        {
            Footprint = null;
            if (GhostImage && UseWorld)
            {
                if (WorldUI.Container != null)
                {
                    WorldUI.Container     = null;
                    WorldUI.ContainerSlot = 0;
                }
                return;
            }

            context.UnregisterObjectPos(this);
            if (Container != null)
            {
                Container.ClearSlot(ContainerSlot);
                return;
            }
            if (Position == LotTilePos.OUT_OF_WORLD)
            {
                return;
            }
            base.PrePositionChange(context);
        }
Exemplo n.º 3
0
        public override void PrePositionChange(VMContext context)
        {
            Footprint = null;
            if (GhostImage && UseWorld)
            {
                if (WorldUI.Container != null)
                {
                    WorldUI.Container     = null;
                    WorldUI.ContainerSlot = 0;
                }
                return;
            }
            context.UnregisterObjectPos(this);
            if (Container != null)
            {
                Container.ClearSlot(ContainerSlot);
                return;
            }
            if (Position == LotTilePos.OUT_OF_WORLD)
            {
                return;
            }

            var arch      = context.Architecture;
            var exclusive = GetValue(VMStackObjectVariable.ExclusivePlacementFlags);

            if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & (VMEntityFlags2.ArchitectualWindow | VMEntityFlags2.ArchitectualDoor)) > 0)
            { //if wall or door, attempt to place style on wall
                var placeFlags = (WallPlacementFlags)ObjectData[(int)VMStackObjectVariable.WallPlacementFlags];
                var dir        = DirectionToWallOff(Direction);
                if ((placeFlags & WallPlacementFlags.WallRequiredInFront) > 0)
                {
                    SetWallStyle((dir) % 4, arch, 0);
                }
                if ((placeFlags & WallPlacementFlags.WallRequiredOnRight) > 0)
                {
                    SetWallStyle((dir + 1) % 4, arch, 0);
                }
                if ((placeFlags & WallPlacementFlags.WallRequiredBehind) > 0)
                {
                    SetWallStyle((dir + 2) % 4, arch, 0);
                }
                if ((placeFlags & WallPlacementFlags.WallRequiredOnLeft) > 0)
                {
                    SetWallStyle((dir + 3) % 4, arch, 0);
                }
            }
            SetWallUse(arch, false, ((exclusive & 2) > 0));
            if (GetValue(VMStackObjectVariable.Category) == 8)
            {
                context.Architecture.SetObjectSupported(Position.TileX, Position.TileY, Position.Level, false);
            }
            base.PrePositionChange(context);
        }
Exemplo n.º 4
0
        public override void PositionChange(VMContext context, bool noEntryPoint)
        {
            if (GhostImage)
            {
                return;
            }

            var room = context.GetObjectRoom(this);

            SetRoom(room);
            for (int i = 0; i < Contained.Length; i++)
            {
                if (Contained[i] != null)
                {
                    context.UnregisterObjectPos(Contained[i]);
                    Contained[i].Position = Position;
                    Contained[i].PositionChange(context, noEntryPoint); //recursive
                }
            }

            context.RegisterObjectPos(this);

            if (Container != null)
            {
                return;
            }
            if (Position == LotTilePos.OUT_OF_WORLD)
            {
                return;
            }

            var arch = context.Architecture;

            if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & (VMEntityFlags2.ArchitectualWindow | VMEntityFlags2.ArchitectualDoor)) > 0)
            {     //if wall or door, attempt to place style on wall
                if (Object.OBJ.WallStyle > 21 && Object.OBJ.WallStyle < 256)
                { //first thing's first, is the style between 22-255 inclusive? If it is, then the style is stored in the object. Need to load its sprites and change the id for the objd.
                    var id   = Object.OBJ.WallStyleSpriteID;
                    var sprs = new SPR[6];
                    for (int i = 0; i < 6; i++)
                    {
                        sprs[i] = Object.Resource.Get <SPR>((ushort)(id + i));
                        if (sprs[i] != null)
                        {
                            sprs[i].WallStyle = true;
                        }
                    }
                    var style = new WallStyle()
                    {
                        WallsUpFar      = sprs[0],
                        WallsUpMedium   = sprs[1],
                        WallsUpNear     = sprs[2],
                        WallsDownFar    = sprs[3],
                        WallsDownMedium = sprs[4],
                        WallsDownNear   = sprs[5]
                    };
                    Object.OBJ.WallStyle = FSO.Content.Content.Get().WorldWalls.AddDynamicWallStyle(style);
                }

                var placeFlags = (WallPlacementFlags)ObjectData[(int)VMStackObjectVariable.WallPlacementFlags];
                var dir        = DirectionToWallOff(Direction);
                if ((placeFlags & WallPlacementFlags.WallRequiredInFront) > 0)
                {
                    SetWallStyle((dir) % 4, arch, Object.OBJ.WallStyle);
                }
                if ((placeFlags & WallPlacementFlags.WallRequiredOnRight) > 0)
                {
                    SetWallStyle((dir + 1) % 4, arch, Object.OBJ.WallStyle);
                }
                if ((placeFlags & WallPlacementFlags.WallRequiredBehind) > 0)
                {
                    SetWallStyle((dir + 2) % 4, arch, Object.OBJ.WallStyle);
                }
                if ((placeFlags & WallPlacementFlags.WallRequiredOnLeft) > 0)
                {
                    SetWallStyle((dir + 3) % 4, arch, Object.OBJ.WallStyle);
                }
            }
            var exclusive = GetValue(VMStackObjectVariable.ExclusivePlacementFlags);

            SetWallUse(arch, true, ((exclusive & 2) > 0));
            if (GetValue(VMStackObjectVariable.Category) == 8)
            {
                context.Architecture.SetObjectSupported(Position.TileX, Position.TileY, Position.Level, true);
            }

            if (EntryPoints[8].ActionFunction != 0)
            {
                UpdateDynamicMultitile(context);
            }

            base.PositionChange(context, noEntryPoint);
        }
Exemplo n.º 5
0
        public override void PrePositionChange(VMContext context)
        {
            Footprint = null;
            if (GhostImage && UseWorld)
            {
                if (WorldUI.Container != null)
                {
                    WorldUI.Container = null;
                    WorldUI.ContainerSlot = 0;
                }
                return;
            }
            if (Container != null)
            {
                Container.ClearSlot(ContainerSlot);
                return;
            }
            if (Position == LotTilePos.OUT_OF_WORLD) return;

            var arch = context.Architecture;
            if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & (VMEntityFlags2.ArchitectualWindow | VMEntityFlags2.ArchitectualDoor)) > 0)
            { //if wall or door, attempt to place style on wall
                var placeFlags = (WallPlacementFlags)ObjectData[(int)VMStackObjectVariable.WallPlacementFlags];
                var dir = DirectionToWallOff(Direction);
                if ((placeFlags & WallPlacementFlags.WallRequiredInFront) > 0) SetWallStyle((dir) % 4, arch, 0);
                if ((placeFlags & WallPlacementFlags.WallRequiredOnRight) > 0) SetWallStyle((dir + 1) % 4, arch, 0);
                if ((placeFlags & WallPlacementFlags.WallRequiredBehind) > 0) SetWallStyle((dir + 2) % 4, arch, 0);
                if ((placeFlags & WallPlacementFlags.WallRequiredOnLeft) > 0) SetWallStyle((dir + 3) % 4, arch, 0);
            }
            SetWallUse(arch, false);
            if (GetValue(VMStackObjectVariable.Category) == 8) context.Architecture.SetObjectSupported(Position.TileX, Position.TileY, Position.Level, false);

            context.UnregisterObjectPos(this);
            base.PrePositionChange(context);
        }
Exemplo n.º 6
0
        public override void PrePositionChange(VMContext context)
        {
            Footprint = null;
            if (GhostImage && UseWorld)
            {
                if (WorldUI.Container != null)
                {
                    WorldUI.Container = null;
                    WorldUI.ContainerSlot = 0;
                }
                return;
            }
            if (Container != null)
            {
                Container.ClearSlot(ContainerSlot);
                return;
            }
            if (Position == LotTilePos.OUT_OF_WORLD) return;

            context.UnregisterObjectPos(this);
            base.PrePositionChange(context);
        }
Exemplo n.º 7
0
 public void RecurseSlotPositionChange(VMContext context, bool noEntryPoint)
 {
     context.UnregisterObjectPos(this);
     var total = TotalSlots();
     for (int i=0; i<total; i++)
     {
         var obj = GetSlot(i);
         if (obj != null) obj.RecurseSlotPositionChange(context, noEntryPoint);
     }
     Position = Position;
     PositionChange(context, noEntryPoint);
 }