Пример #1
0
        internal static void DoDamageSynced(MySlimBlock block, float damage, MyDamageType damageType)
        {
            Debug.Assert(Sync.IsServer);
            var msg = new DoDamageSlimBlockMsg();
            msg.GridEntityId = block.CubeGrid.EntityId;
            msg.Position = block.Position;
            msg.Damage = damage;

            block.DoDamage(damage, damageType);
            Sync.Layer.SendMessageToAll<DoDamageSlimBlockMsg>(ref msg);
        }
Пример #2
0
        static void DoDamageSynced(MySlimBlock block, float damage, MyStringHash damageType, MyHitInfo? hitInfo, long attackerId)
        {
            var msg = new DoDamageSlimBlockMsg();
            msg.GridEntityId = block.CubeGrid.EntityId;
            msg.Position = block.Position;
            msg.Damage = damage;
            msg.HitInfo = hitInfo;
            msg.AttackerEntityId = attackerId;
            msg.CompoundBlockId = 0xFFFFFFFF;

            // Get compound block id
            var blockOnPosition = block.CubeGrid.GetCubeBlock(block.Position);
            if (blockOnPosition != null && block != blockOnPosition && blockOnPosition.FatBlock is MyCompoundCubeBlock)
            {
                MyCompoundCubeBlock compound = blockOnPosition.FatBlock as MyCompoundCubeBlock;
                ushort? compoundBlockId = compound.GetBlockId(block);
                if (compoundBlockId != null)
                    msg.CompoundBlockId = compoundBlockId.Value;
            }

            block.DoDamage(damage, damageType, hitInfo: hitInfo, attackerId: attackerId);
#if !XB1_NOMULTIPLAYER
            MyMultiplayer.RaiseStaticEvent(s => MySlimBlock.DoDamageSlimBlock, msg);
#endif // !XB1_NOMULTIPLAYER
        }
Пример #3
0
        internal static void DoDamageSynced(MySlimBlock block, float damage, MyStringHash damageType, MyHitInfo? hitInfo, long attackerId)
        {
            Debug.Assert(Sync.IsServer);
            var msg = new DoDamageSlimBlockMsg();
            msg.GridEntityId = block.CubeGrid.EntityId;
            msg.Position = block.Position;
            msg.Damage = damage;
            msg.HitInfo = hitInfo;
            msg.AttackerEntityId = attackerId;

            block.DoDamage(damage, damageType, hitInfo: hitInfo, attackerId: attackerId);
            Sync.Layer.SendMessageToAll<DoDamageSlimBlockMsg>(ref msg);
        }