Esempio n. 1
0
            private static void DestroyBarricade(BarricadeRegion region, ushort index)
            {
                ThreadUtil.assertIsGameThread();

                var data = region.barricades[index];
                var drop = region.drops[index];

                OnBarricadeDestroyed?.Invoke(data, drop);
            }
Esempio n. 2
0
            private static void DestroyStructure(StructureRegion region, ushort index)
            {
                ThreadUtil.assertIsGameThread();

                var data = region.structures[index];
                var drop = region.drops[index];

                OnStructureDestroyed?.Invoke(data, drop);
            }
Esempio n. 3
0
        /// <inheritdoc />
        public override void UnsafeDestroy()
        {
            ThreadUtil.assertIsGameThread();
            if (!StructureManager.tryGetInfo(Model, out var x, out var y, out var index, out var sRegion))
            {
                return;
            }

            StructureManager.destroyStructure(sRegion, x, y, index, Vector3.zero);
        }
Esempio n. 4
0
        /// <inheritdoc />
        public override void UnsafeDestroy()
        {
            ThreadUtil.assertIsGameThread();
            if (!BarricadeManager.tryGetInfo(Model, out var x, out var y, out var plant, out var index,
                                             out var bRegion))
            {
                return;
            }

            BarricadeManager.destroyBarricade(bRegion, x, y, plant, index);
        }
            private static void AskTransformStructure(byte x, byte y, uint instanceID)
            {
                ThreadUtil.assertIsGameThread();

                if (!StructureManager.tryGetRegion(x, y, out var region))
                {
                    return;
                }

                var index = region.structures.FindIndex(k => k.instanceID == instanceID);
                var data  = region.structures[index];
                var drop  = region.drops[index];

                OnStructureTransformed?.Invoke(data, drop);
            }
            private static void AskTransformBarricade(byte x, byte y, ushort plant, uint instanceID)
            {
                ThreadUtil.assertIsGameThread();

                if (!BarricadeManager.tryGetRegion(x, y, plant, out var region))
                {
                    return;
                }

                var index = region.barricades.FindIndex(k => k.instanceID == instanceID);
                var data  = region.barricades[index];
                var drop  = region.drops[index];

                OnBarricadeTransformed?.Invoke(data, drop);
            }
Esempio n. 7
0
            private static void TellTransformStructure(StructureManager __instance, CSteamID steamID, byte x, byte y, uint instanceID)
            {
                ThreadUtil.assertIsGameThread();

                if (!__instance.channel.checkServer(steamID) ||
                    !StructureManager.tryGetRegion(x, y, out var region))
                {
                    return;
                }

                var index = region.structures.FindIndex(k => k.instanceID == instanceID);

                if (index < 0)
                {
                    return;
                }

                var data = region.structures[index];
                var drop = region.drops[index];

                OnStructureTransformed?.Invoke(data, drop, CurrentTransformingPlayerId);
            }
Esempio n. 8
0
 internal static void DestroyStructure(StructureRegion region, ushort index)
 {
     ThreadUtil.assertIsGameThread();
     OnBuildableDestroyed?.Invoke(region.drops[index].instanceID, true);
 }
Esempio n. 9
0
 internal static void DestroyBarricade(BarricadeRegion region, ushort index)
 {
     ThreadUtil.assertIsGameThread();
     OnBuildableDestroyed?.Invoke(region.drops[index].instanceID, false);
 }
Esempio n. 10
0
 /// <inheritdoc />
 public override void UnsafeHeal(ushort amount)
 {
     ThreadUtil.assertIsGameThread();
     StructureManager.repair(Model, amount, 1);
 }
Esempio n. 11
0
 /// <inheritdoc />
 public override void UnsafeDamage(ushort damage)
 {
     ThreadUtil.assertIsGameThread();
     StructureManager.damage(Model, Vector3.zero, damage, 1, false, damageOrigin: EDamageOrigin.Unknown);
 }
Esempio n. 12
0
 /// <inheritdoc />
 public override void UnsafeDamage(ushort damage)
 {
     ThreadUtil.assertIsGameThread();
     BarricadeManager.damage(Model, damage, 1, false, damageOrigin: EDamageOrigin.Unknown);
 }