private void handler(object target, MyDamageInformation info) { if (target is IMySlimBlock) { var entity = target as IMySlimBlock; { if (entity.FatBlock is MyJumpDrive) { if (explodelist.Contains(entity.FatBlock.EntityId)) { return; } var explode = ((entity.CurrentDamage + info.Amount)) > entity.MaxIntegrity * 0.1; var block = entity.FatBlock as MyJumpDrive; if (block.Closed) { return; } var blockObj = (MyObjectBuilder_JumpDrive)entity.GetObjectBuilder(); var power = blockObj.StoredPower; if (blockObj.StoredPower < Math.Min(1.0, block.BlockDefinition.PowerNeededForJump / 3f)) { return; } if (explode) { power *= 5000f; var damageblock = (IMyDestroyableObject)entity; explodelist.Add(block.EntityId); var exploder = new MyJumpExplode(damageblock, power, entity.FatBlock.WorldAABB.Center, block.EntityId); if (!(MyAPIGateway.Session.OnlineMode == MyOnlineModeEnum.OFFLINE)) { sendExpl(entity.FatBlock.WorldAABB.Center); } if (!isDedicated) { var explodeEffect = new ExplosionEffect(entity.FatBlock.WorldAABB.Center); explosioneffects.Add(explodeEffect); } exploderlist.Add(exploder); block.Close(); } } } } }
private void mhandler(byte[] obj) { if (obj.Length == sizeof(double) * 3) { var x = BitConverter.ToDouble(obj, 0); var y = BitConverter.ToDouble(obj, sizeof(double)); var z = BitConverter.ToDouble(obj, sizeof(double) * 2); var explodeEffect = new ExplosionEffect(new Vector3D(x, y, z)); explosioneffects.Add(explodeEffect); } else { } }