Example #1
0
        public static void Postfix(NetInfo info, int maxSegments, bool testEnds,
                                   bool autoFix, bool invert, bool switchDir, ushort relocateBuildingID, ref CallState __state)
        {
            if (!__state.valid)
            {
                return;
            }

            ArrayHandler.StopCollecting();
            IgnoreHelper.EndIgnore();

            ushort prefab = (ushort)Mathf.Clamp(info.m_prefabDataIndex, 0, 65535);

            Command.SendToAll(new NodeCreateCommand()
            {
                Array16Ids         = ArrayHandler.Collected16,
                Array32Ids         = ArrayHandler.Collected32,
                Prefab             = prefab,
                StartPoint         = __state.start,
                MiddlePoint        = __state.middle,
                EndPoint           = __state.end,
                MaxSegments        = maxSegments,
                TestEnds           = testEnds,
                AutoFix            = autoFix,
                Invert             = invert,
                SwitchDir          = switchDir,
                RelocateBuildingId = relocateBuildingID
            });
        }
Example #2
0
        public static void Postfix(bool __result, ref ushort building, ref bool __state)
        {
            if (!__state)
            {
                return;
            }

            IgnoreHelper.EndIgnore();
            ArrayHandler.StopCollecting();

            if (__result)
            {
                Building b = BuildingManager.instance.m_buildings.m_buffer[building];

                Command.SendToAll(new BuildingCreateCommand
                {
                    Array16Ids = ArrayHandler.Collected16,
                    Array32Ids = ArrayHandler.Collected32,
                    Position   = b.m_position,
                    InfoIndex  = b.m_infoIndex,
                    Angle      = b.m_angle,
                    Length     = b.Length
                });
            }
        }
Example #3
0
        public static void Postfix(object __instance, ref bool __state)
        {
            if (IgnoreHelper.IsIgnored("NewLine"))
            {
                return;
            }

            if (!__state)
            {
                return;
            }

            IgnoreHelper.EndIgnore("NewLine");
            ArrayHandler.StopCollecting();

            TransportTool tool = ReflectionHelper.GetAttr <TransportTool>(__instance, "$this");

            ushort prefab   = (ushort)Mathf.Clamp(tool.m_prefab.m_prefabDataIndex, 0, 65535);
            int    building = tool.m_building;

            Command.SendToAll(new TransportLineCreateCommand()
            {
                Array16Ids = ArrayHandler.Collected16,
                Prefab     = prefab,
                Building   = building
            });
        }
Example #4
0
        public static void Postfix(ushort lineID)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            ArrayHandler.StopCollecting();

            Command.SendToAll(new TransportLineReleaseCommand()
            {
                Array16Ids = ArrayHandler.Collected16,
                Line       = lineID
            });
        }
Example #5
0
        public static void Postfix()
        {
            if (IgnoreHelper.IsIgnored("ResetTool"))
            {
                return;
            }

            IgnoreHelper.EndIgnore("ResetTool");
            ArrayHandler.StopCollecting();

            Command.SendToAll(new TransportLineResetCommand()
            {
                Array16Ids = ArrayHandler.Collected16
            });
        }
Example #6
0
        public static void Postfix(ushort building, ref Building.Flags changeMask, ref bool __state)
        {
            if (!__state)
            {
                return;
            }

            IgnoreHelper.EndIgnore();
            ArrayHandler.StopCollecting();

            Command.SendToAll(new BuildingUpdateFlagsCommand()
            {
                Building   = building,
                ChangeMask = changeMask
            });
        }
Example #7
0
        public static void Postfix(ushort buildingID, ref bool __state)
        {
            if (!__state)
            {
                return;
            }

            IgnoreHelper.EndIgnore();
            ArrayHandler.StopCollecting();

            Command.SendToAll(new BuildingUpgradeCommand()
            {
                Array16Ids = ArrayHandler.Collected16,
                Array32Ids = ArrayHandler.Collected32,
                Building   = buildingID
            });
        }
Example #8
0
        public static void Postfix(TransportInfo info, ushort buildingID)
        {
            if (IgnoreHelper.IsIgnored("StartEditingBuildingLine"))
            {
                return;
            }

            IgnoreHelper.EndIgnore("StartEditingBuildingLine");
            ArrayHandler.StopCollecting();

            Command.SendToAll(new TransportLineStartEditBuildingCommand()
            {
                Array16Ids = ArrayHandler.Collected16,
                Prefab     = (ushort)Mathf.Clamp(info.m_prefabDataIndex, 0, 65535),
                Building   = buildingID
            });
        }
Example #9
0
        public static void Postfix(object __instance, ref bool __state)
        {
            if (!__state)
            {
                return;
            }

            IgnoreHelper.EndIgnore();
            ArrayHandler.StopCollecting();

            ushort building = ReflectionHelper.GetAttr <ushort>(__instance, "buildingID");

            Command.SendToAll(new BuildingRebuildCommand()
            {
                Building   = building,
                Array16Ids = ArrayHandler.Collected16
            });
        }
Example #10
0
        public static void Postfix(ushort lineID, int index, Vector3 newPos, bool fixedPlatform)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            ArrayHandler.StopCollecting();

            Command.SendToAll(new TransportLineMoveStopManCommand()
            {
                Array16Ids    = ArrayHandler.Collected16,
                Line          = lineID,
                Index         = index,
                NewPos        = newPos,
                FixedPlatform = fixedPlatform
            });
        }
Example #11
0
        public static void Postfix(ref bool __state)
        {
            if (IgnoreHelper.IsIgnored("AddStop"))
            {
                return;
            }

            if (!__state)
            {
                return;
            }

            IgnoreHelper.EndIgnore("AddStop");
            ArrayHandler.StopCollecting();

            Command.SendToAll(new TransportLineAddStopCommand()
            {
                Array16Ids = ArrayHandler.Collected16
            });
        }
Example #12
0
        public static void Postfix(ref bool __state, bool ___applyChanges)
        {
            if (IgnoreHelper.IsIgnored("MoveStop"))
            {
                return;
            }

            if (!__state)
            {
                return;
            }

            IgnoreHelper.EndIgnore("MoveStop");
            ArrayHandler.StopCollecting();

            Command.SendToAll(new TransportLineMoveStopCommand()
            {
                Array16Ids   = ArrayHandler.Collected16,
                ApplyChanges = ___applyChanges
            });
        }
Example #13
0
        public static void Postfix(ref CallState __state, object __instance)
        {
            if (!__state.run)
            {
                return;
            }

            ArrayHandler.StopCollecting();
            IgnoreHelper.EndIgnore();

            BuildingTool   tool       = ReflectionHelper.GetAttr <BuildingTool>(__instance, "$this");
            ToolController controller = ReflectionHelper.GetAttr <ToolController>(tool, "m_toolController");

            ushort prefab = 0;

            if (__state.relocate == 0)
            {
                prefab = (ushort)Mathf.Clamp(tool.m_prefab.m_prefabDataIndex, 0, 65535);
            }

            Vector3 mousePosition = ReflectionHelper.GetAttr <Vector3>(tool, "m_mousePosition");
            float   mouseAngle    = ReflectionHelper.GetAttr <float>(tool, "m_mouseAngle");
            int     elevation     = ReflectionHelper.GetAttr <int>(tool, "m_elevation");

            ulong[] collidingSegments  = ReflectionHelper.GetAttr <ulong[]>(controller, "m_collidingSegments1");
            ulong[] collidingBuildings = ReflectionHelper.GetAttr <ulong[]>(controller, "m_collidingBuildings1");

            Command.SendToAll(new BuildingToolCreateCommand()
            {
                Array16Ids         = ArrayHandler.Collected16,
                Array32Ids         = ArrayHandler.Collected32,
                Prefab             = prefab,
                Relocate           = __state.relocate,
                CollidingSegments  = collidingSegments,
                CollidingBuildings = collidingBuildings,
                MousePosition      = mousePosition,
                MouseAngle         = mouseAngle,
                Elevation          = elevation
            });
        }
Example #14
0
        public static void Postfix(TransportInfo info, ushort sourceLine, int moveIndex, int addIndex, Vector3 addPos, bool fixedPlatform, ushort ___m_lastEditLine, ushort ___m_tempLine, ref DataStore __state)
        {
            if (IgnoreHelper.IsIgnored("EnsureTempLine") || !TransportHandler.TrackSimulationStep)
            {
                return;
            }

            IgnoreHelper.EndIgnore("EnsureTempLine");
            ArrayHandler.StopCollecting();

            // Make sure we send the command only when needed (Otherwise it would be really often!)
            if (ArrayHandler.Collected16.Length > 0 ||
                __state.tempLine != ___m_tempLine ||
                __state.editLine != ___m_lastEditLine ||
                __state.move != moveIndex ||
                __state.add != addIndex ||
                __state.addP != addPos)
            {
                if ((__state.addP == Vector3.zero || addPos == Vector3.zero) &&
                    moveIndex == __state.moveLast && addIndex == __state.addLast && addPos == __state.addPLast)
                {
                    return;
                }

                __state.addPLast = addPos;
                __state.moveLast = moveIndex;
                __state.addLast  = addIndex;

                Command.SendToAll(new TransportLineTempCommand()
                {
                    InfoIndex     = (ushort)Mathf.Clamp(info.m_prefabDataIndex, 0, 65535),
                    SourceLine    = sourceLine,
                    MoveIndex     = moveIndex,
                    AddIndex      = addIndex,
                    AddPos        = addPos,
                    FixedPlatform = fixedPlatform,
                    Array16Ids    = ArrayHandler.Collected16
                });
            }
        }