Exemplo n.º 1
0
        internal static void PacketizeEnforcements(IMyCubeBlock block, ulong senderId)
        {
            var data  = new DataEnforce(MyAPIGateway.Multiplayer.MyId, block.EntityId, Enforced);
            var bytes = MyAPIGateway.Utilities.SerializeToBinary(data);

            MyAPIGateway.Multiplayer.SendMessageTo(PacketIdEnforce, bytes, senderId);
        }
        public override bool Received(bool isServer)
        {
            if (!isServer)
            {
                Session.Enforced    = State;
                Session.EnforceInit = true;
                if (State.Debug >= 2)
                {
                    Log.Line($"Saving Enforcement version: {State.Version}");
                }
                return(false);
            }
            if (State.Debug >= 2)
            {
                Log.Line($"Sending Enforcement version: {Session.Enforced.Version}");
            }
            var data  = new DataEnforce(0, Session.Enforced);
            var bytes = MyAPIGateway.Utilities.SerializeToBinary(data);

            MyAPIGateway.Multiplayer.SendMessageTo(Session.PACKET_ID, bytes, State.SenderId);
            return(false);
        }