public WeaponComponent(Session session, MyCubeBlock myCube, MyStringHash subtype) { Session = session; MyCube = myCube; Slim = myCube.SlimBlock; SubtypeHash = subtype; MaxIntegrity = Slim.MaxIntegrity; var turret = MyCube as IMyLargeTurretBase; if (turret != null) { TurretBase = turret; TurretBase.EnableIdleRotation = false; BaseType = BlockType.Turret; } else if (MyCube is IMyConveyorSorter) { BaseType = BlockType.Sorter; } else { BaseType = BlockType.Fixed; } TerminalBlock = myCube as IMyTerminalBlock; FunctionalBlock = myCube as IMyFunctionalBlock; BlockInventory = (MyInventory)MyCube.GetInventoryBase(); SinkPower = IdlePower; Platform = session.PlatFormPool.Get(); Platform.Setup(this); Monitors = new List <Action <long, int, ulong, long, Vector3D, bool> > [Platform.Weapons.Length]; for (int i = 0; i < Monitors.Length; i++) { Monitors[i] = new List <Action <long, int, ulong, long, Vector3D, bool> >(); } Data = new CompData(this); MyCube.OnClose += Session.CloseComps; }
public WeaponComponent(Session session, GridAi ai, MyCubeBlock myCube, MyStringHash subtype) { Ai = ai; Session = session; MyCube = myCube; Seed = MyCube.EntityId.GetHashCode(); Slim = myCube.SlimBlock; SubtypeHash = subtype; MaxIntegrity = Slim.MaxIntegrity; var turret = MyCube as IMyLargeTurretBase; if (turret != null) { TurretBase = turret; TurretBase.EnableIdleRotation = false; BaseType = BlockType.Turret; } else if (MyCube is IMyConveyorSorter) { BaseType = BlockType.Sorter; } else { BaseType = BlockType.Fixed; } TerminalBlock = myCube as IMyTerminalBlock; FunctionalBlock = myCube as IMyFunctionalBlock; BlockInventory = (MyInventory)MyCube.GetInventoryBase(); SinkPower = IdlePower; Platform = session.PlatFormPool.Get(); Platform.Setup(this); State = new CompState(this); Set = new CompSettings(this); MyCube.OnClose += Session.CloseComps; }