public override void Init(MyObjectBuilder_EntityBase objectBuilder) { base.Init(objectBuilder); try { _objectBuilder = objectBuilder; NeedsUpdate = MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.BEFORE_NEXT_FRAME; // this.m_missileAmmoDefinition = weaponProperties.GetCurrentAmmoDefinitionAs<MyMissileAmmoDefinition>(); SetPowerSink(); cube = (IMyCubeBlock)Entity; block = (IMyFunctionalBlock)Entity; GetAmmoProperties(); //get shoot time for initial check _lastShootTime = GetLastShootTime(); GetTurretMaxRange(); soundEmitter = new MyEntity3DSoundEmitter((MyEntity)Entity, true); projectileData = new RailgunProjectileData() { DesiredSpeed = _desiredSpeed, MaxTrajectory = _maxTrajectory, ExplosionDamage = 0f, ExplosionRadius = 0f, PenetrationDamage = _projectileDamage, PenetrationRange = 50f, ProjectileTrailColor = _trailColor, ProjectileTrailScale = _trailScale, DrawTracer = true, Explode = true, Penetrate = true }; RailgunCore.RegisterRailgun(Entity.EntityId, projectileData); } catch (Exception e) { MyAPIGateway.Utilities.ShowNotification("Exception in init", 10000, MyFontEnum.Red); MyLog.Default.WriteLine(e); } }
public static void RegisterRailgun(long entityID, RailgunProjectileData data) { railgunDataDict[entityID] = data; }