static void DetonateRequest(ref DetonateMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) { warhead.Detonate(); } }
public static void Detonate(MyWarhead warhead) { // Armed state is checked only locally. Otherwise, it could happen that server does not detonate the warhead even though it was armed on the client if (!warhead.IsArmed) { return; } DetonateMsg msg = new DetonateMsg(); msg.EntityId = warhead.EntityId; Sync.Layer.SendMessageToServer(ref msg); }
static void DetonateRequest(ref DetonateMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) { warhead.Detonate(); } }
public static void Detonate(MyWarhead warhead) { // Armed state is checked only locally. Otherwise, it could happen that server does not detonate the warhead even though it was armed on the client if (!warhead.IsArmed) return; DetonateMsg msg = new DetonateMsg(); msg.EntityId = warhead.EntityId; Sync.Layer.SendMessageToServer(ref msg); }