// Token: 0x06000010 RID: 16 RVA: 0x00002634 File Offset: 0x00000834 public override void Tick() { base.Tick(); if (ticksToExplode <= 0) { return; } if (wickSustainer == null) { StartWickSustainer(); } else { wickSustainer.Maintain(); } ticksToExplode--; if (ticksToExplode != 0) { return; } var randomCell = this.OccupiedRect().RandomCell; var radius = Rand.Range(0.5f, 1f) * 3f; GenExplosion.DoExplosion(randomCell, Map, radius, DamageDefOf.Flame, null); GetComp <CompPowerBattery>().DrawPower(400f); }
public static bool AggregateOrSpawnSustainerFor(ref Sustainer __result, ISizeReporter reporter, SoundDef def, SoundInfo info) { Sustainer sustainer = null; Sustainer allSustainer; for (int i = 0; i < Find.SoundRoot.sustainerManager.AllSustainers.Count; i++) { try { allSustainer = Find.SoundRoot.sustainerManager.AllSustainers[i]; } catch (ArgumentOutOfRangeException) { break; } if (allSustainer != null && allSustainer.def == def && allSustainer.info.Maker.Map == info.Maker.Map && allSustainer.info.Maker.Cell.InHorDistOf(info.Maker.Cell, AggregateRadius)) { sustainer = allSustainer; break; } } if (sustainer == null) { sustainer = def.TrySpawnSustainer(info); } else { sustainer.Maintain(); } if (sustainer.externalParams.sizeAggregator == null) { sustainer.externalParams.sizeAggregator = new SoundSizeAggregator(); } sustainer.externalParams.sizeAggregator.RegisterReporter(reporter); __result = sustainer; return false; }
public override void CompTick() { var batteryProps = BatteryProps; if (batteryProps.passiveDischargeWatts > 0f) { DrawPower(Mathf.Min(batteryProps.passiveDischargeWatts * WattsToWattDaysPerTick, StoredEnergy)); } if (!parent.Spawned) { return; } if (ticksToExplode > 0) { if (wickSustainer == null) { StartWickSustainer(); } else { wickSustainer.Maintain(); } ticksToExplode--; if (ticksToExplode == 0) { var randomCell = parent.OccupiedRect().RandomCell; float radius = Rand.Range(0.5f, 1f) * 3f; GenExplosion.DoExplosion(randomCell, parent.Map, radius, DamageDefOf.Flame, null); DrawPower(Mathf.Max(ChargeToLoseWhenExplode * statMaxEnergy, StoredEnergy)); } } }
//Unmodified public override void Tick() { base.Tick(); if (landed) { return; } Vector3 exactPosition = ExactPosition; ticksToImpact--; if (!ExactPosition.InBounds(base.Map)) { ticksToImpact++; Position = ExactPosition.ToIntVec3(); Destroy(DestroyMode.Vanish); return; } Vector3 exactPosition2 = ExactPosition; if (!def.projectile.flyOverhead && canFreeIntercept && CheckForFreeInterceptBetween(exactPosition, exactPosition2)) { return; } Position = ExactPosition.ToIntVec3(); if (ticksToImpact == 60f && Find.TickManager.CurTimeSpeed == TimeSpeed.Normal && def.projectile.soundImpactAnticipate != null) { def.projectile.soundImpactAnticipate.PlayOneShot(this); } if (ticksToImpact <= 0) { if (DestinationCell.InBounds(base.Map)) { Position = DestinationCell; } ImpactSomething(); return; } if (ambientSustainer != null) { ambientSustainer.Maintain(); } // attack shooting expression if (this.launcher is Building_TurretGunCR == false) { if (Rand.Value > 0.7 && this.launcher.def.race.Humanlike && !robotBodyList.Contains(this.launcher.def.race.body.defName) && Gen.IsHashIntervalTick(launcher, Rand.Range(280, 700))) { AGAIN : string rndswear = RulePackDef.Named("AttackMote").Rules.RandomElement().Generate(); if (rndswear == "[swear]" || rndswear == "" || rndswear == " ") { goto AGAIN; } MoteMaker.ThrowText(launcher.Position.ToVector3Shifted(), this.launcher.Map, rndswear); } } }
public void DraggerUpdate() { if (!dragging) { return; } List <IntVec3> list = DragCells; SelDes.RenderHighlight(list); if (list.Count != lastFrameDragCellsDrawn) { lastDragRealTime = Time.realtimeSinceStartup; lastFrameDragCellsDrawn = list.Count; if (SelDes.soundDragChanged != null) { SelDes.soundDragChanged.PlayOneShotOnCamera(); } } if (sustainer == null || sustainer.Ended) { if (SelDes.soundDragSustain != null) { sustainer = SelDes.soundDragSustain.TrySpawnSustainer(SoundInfo.OnCamera(MaintenanceType.PerFrame)); } } else { sustainer.externalParams["TimeSinceDrag"] = Time.realtimeSinceStartup - lastDragRealTime; sustainer.Maintain(); } }
public override void CompTick() { if (countdownTicksLeft > 0) { countdownTicksLeft--; if (countdownTicksLeft == 0) { StartWick(); countdownTicksLeft = -1; } } if (wickStarted) { if (wickSoundSustainer == null) { StartWickSustainer(); } else { wickSoundSustainer.Maintain(); } wickTicksLeft--; if (wickTicksLeft <= 0) { Detonate(parent.MapHeld); } } }
public static Sustainer AggregateOrSpawnSustainerFor(ISizeReporter reporter, SoundDef def, SoundInfo info) { Sustainer sustainer = null; foreach (Sustainer allSustainer in Find.SoundRoot.sustainerManager.AllSustainers) { if (allSustainer.def == def && allSustainer.info.Maker.Map == info.Maker.Map && allSustainer.info.Maker.Cell.InHorDistOf(info.Maker.Cell, AggregateRadius)) { sustainer = allSustainer; break; } } if (sustainer == null) { sustainer = def.TrySpawnSustainer(info); } else { sustainer.Maintain(); } if (sustainer.externalParams.sizeAggregator == null) { sustainer.externalParams.sizeAggregator = new SoundSizeAggregator(); } sustainer.externalParams.sizeAggregator.RegisterReporter(reporter); return(sustainer); }
public override void CompTick() { if (ReactivatedThisTick && Props.reactivateEffect != null) { Effecter effecter = new Effecter(Props.reactivateEffect); effecter.Trigger(parent, TargetInfo.Invalid); effecter.Cleanup(); } if (Find.TickManager.TicksGame >= nextChargeTick + Props.chargeDurationTicks) { nextChargeTick += Props.chargeIntervalTicks; } stunner.StunHandlerTick(); if (Props.activeSound.NullOrUndefined()) { return; } if (Active) { if (sustainer == null || sustainer.Ended) { sustainer = Props.activeSound.TrySpawnSustainer(SoundInfo.InMap(parent)); } sustainer.Maintain(); } else if (sustainer != null && !sustainer.Ended) { sustainer.End(); } }
public virtual void WindowUpdate() { if (sustainerAmbient != null) { sustainerAmbient.Maintain(); } }
protected void MeditationTick() { pawn.skills.Learn(SkillDefOf.Intellectual, 0.0180000011f); pawn.GainComfortFromCellIfPossible(); if (pawn.needs.joy != null) { JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.None); } if (pawn.IsHashIntervalTick(100)) { MoteMaker.ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Meditating); } if (!ModsConfig.RoyaltyActive) { return; } pawn.psychicEntropy.Notify_Meditated(); if (pawn.HasPsylink && pawn.psychicEntropy.PsychicSensitivity > float.Epsilon) { if (psyfocusMote == null || psyfocusMote.Destroyed) { psyfocusMote = MoteMaker.MakeAttachedOverlay(pawn, ThingDefOf.Mote_PsyfocusPulse, Vector3.zero); } psyfocusMote.Maintain(); if (sustainer == null || sustainer.Ended) { sustainer = SoundDefOf.MeditationGainPsyfocus.TrySpawnSustainer(SoundInfo.InMap(pawn, MaintenanceType.PerTick)); } sustainer.Maintain(); pawn.psychicEntropy.GainPsyfocus(Focus.Thing); } }
public override void Tick() { if (Spawned) { sustainer.Maintain(); Vector3 vector = Position.ToVector3Shifted(); IntVec3 c; if (Rand.MTBEventOccurs(FilthSpawnMTB, 1f, 5.TicksToSeconds()) && CellFinder.TryFindRandomReachableCellNear(Position, Map, FilthSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), null, null, out c, 999999)) { FilthMaker.TryMakeFilth(c, Map, RatkinTunnelUtility.filthTypes.RandomElement <ThingDef>(), 1); } if (Rand.MTBEventOccurs(DustMoteSpawnMTB, 1f, 1.TicksToSeconds())) { MoteMaker.ThrowDustPuffThick(new Vector3(vector.x, 0f, vector.z) { y = AltitudeLayer.MoteOverhead.AltitudeFor() }, Map, Rand.Range(1.5f, 3f), new Color(1f, 1f, 1f, 2.5f)); } if (secondarySpawnTick <= Find.TickManager.TicksGame) { sustainer.End(); Map map = Map; IntVec3 position = Position; Destroy(DestroyMode.Vanish); if (spawnTunnel) { Building_ThiefTunnel tunnel = (Building_ThiefTunnel)GenSpawn.Spawn(ThingMaker.MakeThing(RatkinBuildingDefOf.RK_ThiefTunnel, null), position, map, WipeMode.Vanish); tunnel.SetFaction(Find.FactionManager.FirstFactionOfDef(RatkinFactionDefOf.Rakinia), null); } } } }
public static Toil PlaySustainerOrSound(this Toil toil, Func <SoundDef> soundDefGetter) { Sustainer sustainer = null; toil.AddPreInitAction(delegate { SoundDef soundDef2 = soundDefGetter(); if (soundDef2 != null && !soundDef2.sustain) { soundDef2.PlayOneShot(new TargetInfo(toil.GetActor().Position, toil.GetActor().Map, false)); } }); toil.AddPreTickAction(delegate { if (sustainer == null || sustainer.Ended) { SoundDef soundDef = soundDefGetter(); if (soundDef != null && soundDef.sustain) { SoundInfo info = SoundInfo.InMap(toil.actor, MaintenanceType.PerTick); sustainer = soundDef.TrySpawnSustainer(info); } } else { sustainer.Maintain(); } }); return(toil); }
public override void ExtraCrafterTickAction() { if (!powerComp.PowerOn && soundSustainer != null && !soundSustainer.Ended) { soundSustainer.End(); } //Make construction effects switch (crafterStatus) { case CrafterStatus.Filling: //Emit smoke if (powerComp.PowerOn && Current.Game.tickManager.TicksGame % 300 == 0) { MoteMaker.ThrowSmoke(Position.ToVector3(), Map, 1f); } break; case CrafterStatus.Crafting: //Emit smoke if (powerComp.PowerOn && Current.Game.tickManager.TicksGame % 100 == 0) { for (int i = 0; i < 5; i++) { MoteMaker.ThrowMicroSparks(Position.ToVector3() + new Vector3(Rand.Range(-1, 1), 0f, Rand.Range(-1, 1)), Map); } for (int i = 0; i < 3; i++) { MoteMaker.ThrowSmoke(Position.ToVector3() + new Vector3(Rand.Range(-1f, 1f), 0f, Rand.Range(-1f, 1f)), Map, Rand.Range(0.5f, 0.75f)); } MoteMaker.ThrowHeatGlow(Position, Map, 1f); if (soundSustainer == null || soundSustainer.Ended) { SoundDef soundDef = printerProperties.craftingSound; if (soundDef != null && soundDef.sustain) { SoundInfo info = SoundInfo.InMap(this, MaintenanceType.PerTick); soundSustainer = soundDef.TrySpawnSustainer(info); } } } if (soundSustainer != null && !soundSustainer.Ended) { soundSustainer.Maintain(); } break; default: { if (soundSustainer != null && !soundSustainer.Ended) { soundSustainer.End(); } } break; } }
protected override IEnumerable <Toil> MakeNewToils() { if (!ModLister.RoyaltyInstalled) { Log.ErrorOnce("Bestowing cermonies are a Royalty-specific game system. If you want to use this code please check ModLister.RoyaltyInstalled before calling it. See rules on the Ludeon forum for more info.", 5464564); yield break; } AddFailCondition(() => Bestower.GetLord() == null || Bestower.GetLord().CurLordToil == null || !(Bestower.GetLord().CurLordToil is LordToil_BestowingCeremony_Wait)); yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell)); Toil waitToil = Toils_General.Wait(471); waitToil.AddPreInitAction(delegate { Messages.Message("MessageBestowingCeremonyStarted".Translate(pawn.Named("PAWN")), Bestower, MessageTypeDefOf.PositiveEvent); }); waitToil.AddPreInitAction(delegate { if (!AnalyzeThroneRoom(Bestower, pawn)) { Messages.Message("BestowingCeremonyThroneroomRequirementsNotSatisfied".Translate(pawn.Named("PAWN"), pawn.royalty.GetTitleAwardedWhenUpdating(Bestower.Faction, pawn.royalty.GetFavor(Bestower.Faction)).label.Named("TITLE")), pawn, MessageTypeDefOf.NegativeEvent); ((LordJob_BestowingCeremony)Bestower.GetLord().LordJob).MakeCeremonyFail(); } }); waitToil.AddPreInitAction(delegate { SoundDefOf.Bestowing_Start.PlayOneShot(pawn); }); waitToil.tickAction = delegate { pawn.rotationTracker.FaceTarget(Bestower); if (mote == null || mote.Destroyed) { Vector3 loc = (pawn.TrueCenter() + Bestower.TrueCenter()) / 2f; mote = MoteMaker.MakeStaticMote(loc, pawn.Map, ThingDefOf.Mote_Bestow); } mote.Maintain(); if ((sound == null || sound.Ended) && waitToil.actor.jobs.curDriver.ticksLeftThisToil <= 307) { sound = SoundDefOf.Bestowing_Warmup.TrySpawnSustainer(SoundInfo.InMap(new TargetInfo(pawn.Position, pawn.Map), MaintenanceType.PerTick)); } if (sound != null) { sound.Maintain(); } }; waitToil.handlingFacing = false; waitToil.socialMode = RandomSocialMode.Off; waitToil.WithProgressBarToilDelay(TargetIndex.A); yield return(waitToil); yield return(Toils_General.Do(delegate { CeremonyJob.FinishCeremony(pawn); MoteMaker.MakeStaticMote((pawn.TrueCenter() + Bestower.TrueCenter()) / 2f, pawn.Map, ThingDefOf.Mote_PsycastAreaEffect, 2f); SoundDefOf.Bestowing_Finished.PlayOneShot(pawn); })); }
public override string LabelNoCount => "occult " + GenLabel.ThingLabel(this, 1); // Doesn't work! // Make it harder to extinguish //--------------------------- public override void Tick() { ticksSinceSpawn++; // Probably the best way is to use reflection and modify base class field [ticksSinceSpawn] // [ticksSinceSpawn] is used in [ExposeData] and [Rimworld.Verb_BeatFire] // Vanilla code passes fire as [Fire] class, therefore it's important to [ticksSinceSpawn] variable FieldInfo fieldInfo = typeof(Fire).GetField("ticksSinceSpawn", BindingFlags.Instance | BindingFlags.NonPublic); fieldInfo.SetValue(this as Fire, ticksSinceSpawn); if (lastFireCountUpdateTick != Find.TickManager.TicksGame) { fireCount = base.Map.listerThings.ThingsOfDef(def).Count; lastFireCountUpdateTick = Find.TickManager.TicksGame; } if (sustainer != null) { sustainer.Maintain(); } else if (!base.Position.Fogged(base.Map)) { SoundInfo info = SoundInfo.InMap(new TargetInfo(base.Position, base.Map), MaintenanceType.PerTick); sustainer = SustainerAggregatorUtility.AggregateOrSpawnSustainerFor(this, SoundDefOf.FireBurning, info); } ticksUntilSmoke--; if (ticksUntilSmoke <= 0) { //SpawnSmokeParticles(); } if (fireCount < 15 && fireSize > 0.7f && Rand.Value < fireSize * 0.01f) { MoteMaker.ThrowMicroSparks(DrawPos, base.Map); } if (fireSize > 1f) { ticksSinceSpread++; if ((float)ticksSinceSpread >= SpreadInterval) { TrySpread(); ticksSinceSpread = 0; } } if (this.IsHashIntervalTick(150)) { DoComplexCalcs(); } if (ticksSinceSpawn >= 7500) { TryBurnFloor(); } }
public override void CompTick() { base.CompTick(); if (sustainer != null) { sustainer.Maintain(); if (TicksLeft < fadeOutDuration) { sustainer.End(); sustainer = null; } } }
public override void Tick() { base.Tick(); if (landed) { return; } LastPos = ExactPosition; ticksToImpact--; if (!ExactPosition.InBounds(Map)) { Position = LastPos.ToIntVec3(); Destroy(); return; } if (CheckForCollisionBetween()) { return; } Position = ExactPosition.ToIntVec3(); if (ticksToImpact == 60 && Find.TickManager.CurTimeSpeed == TimeSpeed.Normal && def.projectile.soundImpactAnticipate != null) { def.projectile.soundImpactAnticipate.PlayOneShot(this); } //TODO : It appears that the final steps in the arc (past ticksToImpact == 0) don't CheckForCollisionBetween. if (ticksToImpact <= 0) { ImpactSomething(); return; } if (ambientSustainer != null) { ambientSustainer.Maintain(); } if (def.HasModExtension <TrailerProjectileExtension>()) { var trailer = def.GetModExtension <TrailerProjectileExtension>(); if (trailer != null) { if (ticksToImpact % trailer.trailerMoteInterval == 0) { for (int i = 0; i < trailer.motesThrown; i++) { TrailThrower.ThrowSmoke(DrawPos, trailer.trailMoteSize, Map, trailer.trailMoteDef); } } } } }
public override void Tick() { if (AllComps != null) { int i = 0; int count = AllComps.Count; while (i < count) { AllComps[i].CompTick(); i++; } } if (landed) { return; } Vector3 exactPosition = ExactPosition; ticksToImpact--; if (!ExactPosition.InBounds(Map)) { ticksToImpact++; Position = ExactPosition.ToIntVec3(); Destroy(DestroyMode.Vanish); return; } Vector3 exactPosition2 = ExactPosition; if (CheckForFreeInterceptBetween(exactPosition, exactPosition2)) { return; } Position = ExactPosition.ToIntVec3(); if (ticksToImpact == 60 && Find.TickManager.CurTimeSpeed == TimeSpeed.Normal && this.def.projectile.soundImpactAnticipate != null) { def.projectile.soundImpactAnticipate.PlayOneShot(this); } if (ticksToImpact <= 0) { if (DestinationCell.InBounds(Map)) { Position = DestinationCell; } ImpactSomething(); return; } if (ambientSustainer != null) { ambientSustainer.Maintain(); } }
public override void Tick() { // Sounds if (ambientSustainer == null && !ShellDef.projectile.soundAmbient.NullOrUndefined()) { ambientSustainer = ShellDef.projectile.soundAmbient.TrySpawnSustainer(SoundInfo.InMap(this, MaintenanceType.PerTick)); } if (ambientSustainer != null) { ambientSustainer.Maintain(); } base.Tick(); }
public override void CompTick() { if (ProximityComp == null || ProximityComp.Sent) { if (sustainer != null && !sustainer.Ended) { sustainer.End(); } return; } if (mote == null) { Emit(); } if (!Props.soundEmitting.NullOrUndefined()) { if (sustainer == null || sustainer.Ended) { sustainer = Props.soundEmitting.TrySpawnSustainer(SoundInfo.InMap(parent)); } sustainer.Maintain(); } if (mote == null) { return; } mote?.Maintain(); float num = 1f; if (!ProximityComp.Enabled) { if (ticksSinceLastEmitted >= Props.emissionInterval) { ticksSinceLastEmitted = 0; } else { ticksSinceLastEmitted++; } float num2 = (float)ticksSinceLastEmitted / 60f; num = ((num2 <= Props.warmupPulseFadeInTime) ? ((!(Props.warmupPulseFadeInTime > 0f)) ? 1f : (num2 / Props.warmupPulseFadeInTime)) : ((num2 <= Props.warmupPulseFadeInTime + Props.warmupPulseSolidTime) ? 1f : ((!(Props.warmupPulseFadeOutTime > 0f)) ? 1f : (1f - Mathf.InverseLerp(Props.warmupPulseFadeInTime + Props.warmupPulseSolidTime, Props.warmupPulseFadeInTime + Props.warmupPulseSolidTime + Props.warmupPulseFadeOutTime, num2))))); } else { num = 1f; } mote.instanceColor.a = num; }
public override void SubEffectTick(TargetInfo A, TargetInfo B) { age++; if (age > def.ticksBeforeSustainerStart) { if (sustainer == null) { SoundInfo info = SoundInfo.InMap(A, MaintenanceType.PerTick); sustainer = def.soundDef.TrySpawnSustainer(info); } else { sustainer.Maintain(); } } }
public override void CompTickRare() { base.CompTickRare(); if (!Props.soundWorking.NullOrUndefined() && base.Working && base.CurrentRadius < Props.radius - 0.0001f) { if (sustainer == null || sustainer.Ended) { sustainer = Props.soundWorking.TrySpawnSustainer(SoundInfo.InMap(parent)); } sustainer.Maintain(); } else if (sustainer != null && !sustainer.Ended) { sustainer.End(); } }
public override void Tick() { if (Spawned) { sustainer.Maintain(); Vector3 vector = Position.ToVector3Shifted(); IntVec3 c; if (Rand.MTBEventOccurs(FilthSpawnMTB, 1f, 1.TicksToSeconds()) && CellFinder.TryFindRandomReachableCellNear(Position, Map, FilthSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), null, null, out c, 999999)) { FilthMaker.MakeFilth(c, Map, filthTypes.RandomElement(), 1); } if (Rand.MTBEventOccurs(DustMoteSpawnMTB, 1f, 1.TicksToSeconds())) { MoteMaker.ThrowDustPuffThick(new Vector3(vector.x, 0f, vector.z) { y = AltitudeLayer.MoteOverhead.AltitudeFor() }, Map, Rand.Range(1.5f, 3f), new Color(1f, 1f, 1f, 2.5f)); } if (secondarySpawnTick <= Find.TickManager.TicksGame) { sustainer.End(); Map map = Map; IntVec3 position = Position; Destroy(DestroyMode.Vanish); if (faction == null) { faction = HiveUtility.GetRandomInsectFaction(); } PawnKindDef kindDef = HiveUtility.GetFactionKindDef(PawnKindDef.Named("BI_Megascarab_Brown"), faction); Insect insect = PawnGenerator.GeneratePawn(kindDef, faction) as Insect; insect.stealFood = true; GenSpawn.Spawn(insect, CellFinder.RandomClosewalkCellNear(position, map, 4, null), map); if (queen != null) { queen.spawnedInsects.Add(insect); Lord lord = queen.Lord; if (lord == null) { lord = queen.CreateNewLord(); } lord.AddPawn(insect); } } } }
public override void Tick() { ticksSinceSpawn++; if (lastFireCountUpdateTick != Find.TickManager.TicksGame) { fireCount = base.Map.listerThings.ThingsOfDef(def).Count; lastFireCountUpdateTick = Find.TickManager.TicksGame; } if (sustainer != null) { sustainer.Maintain(); } else if (!base.Position.Fogged(base.Map)) { SoundInfo info = SoundInfo.InMap(new TargetInfo(base.Position, base.Map), MaintenanceType.PerTick); sustainer = SustainerAggregatorUtility.AggregateOrSpawnSustainerFor(this, SoundDefOf.FireBurning, info); } ticksUntilSmoke--; if (ticksUntilSmoke <= 0) { SpawnSmokeParticles(); } if (fireCount < 15 && fireSize > 0.7f && Rand.Value < fireSize * 0.01f) { MoteMaker.ThrowMicroSparks(DrawPos, base.Map); } if (fireSize > 1f) { ticksSinceSpread++; if ((float)ticksSinceSpread >= SpreadInterval) { TrySpread(); ticksSinceSpread = 0; } } if (this.IsHashIntervalTick(150)) { DoComplexCalcs(); } if (ticksSinceSpawn >= 7500) { TryBurnFloor(); } }
public override void AbilityTick() { base.AbilityTick(); if (moteCast != null && !moteCast.Destroyed && base.verb.WarmingUp) { moteCast.Maintain(); } if (base.verb.WarmingUp) { if (soundCast == null || soundCast.Ended) { soundCast = SoundDefOf.PsycastCastLoop.TrySpawnSustainer(SoundInfo.InMap(new TargetInfo(pawn.Position, pawn.Map), MaintenanceType.PerTick)); } else { soundCast.Maintain(); } } }
public void DoEditWidgets(WidgetRow widgetRow) { if (testSustainer == null) { if (!widgetRow.ButtonIcon(TexButton.Play)) { return; } ResolveReferences(); SoundInfo info; if (HasSubSoundsInWorld) { IntVec3 mapPosition = Find.CameraDriver.MapPosition; info = SoundInfo.InMap(new TargetInfo(mapPosition, Find.CurrentMap), MaintenanceType.PerFrame); for (int i = 0; i < 5; i++) { MoteMaker.ThrowDustPuff(mapPosition, Find.CurrentMap, 1.5f); } } else { info = SoundInfo.OnCamera(MaintenanceType.PerFrame); } info.testPlay = true; if (sustain) { testSustainer = this.TrySpawnSustainer(info); } else { this.PlayOneShot(info); } } else { testSustainer.Maintain(); if (widgetRow.ButtonIcon(TexButton.Stop)) { testSustainer.End(); testSustainer = null; } } }
public override void Tick() { base.Tick(); if (currentPlayer != null) { if (def.soundPlayInstrument != null && soundPlaying == null) { soundPlaying = def.soundPlayInstrument.TrySpawnSustainer(SoundInfo.InMap(new TargetInfo(base.Position, base.Map), MaintenanceType.PerTick)); } } else { soundPlaying = null; } if (soundPlaying != null) { soundPlaying.Maintain(); } }
public override void CompTick() { if (wickStarted) { if (wickSoundSustainer == null) { StartWickSustainer(); //or sustainer is missing on load } else { wickSoundSustainer.Maintain(); } wickTicksLeft--; if (wickTicksLeft <= 0) { Detonate(parent.MapHeld); } } }
public override void Tick() { base.Tick(); if (landed) { return; } Vector3 exactPosition = ExactPosition; ticksToImpact--; if (!ExactPosition.InBounds(base.Map)) { ticksToImpact++; base.Position = ExactPosition.ToIntVec3(); Destroy(); return; } Vector3 exactPosition2 = ExactPosition; if (CheckForFreeInterceptBetween(exactPosition, exactPosition2)) { return; } base.Position = ExactPosition.ToIntVec3(); if (ticksToImpact == 60 && Find.TickManager.CurTimeSpeed == TimeSpeed.Normal && def.projectile.soundImpactAnticipate != null) { def.projectile.soundImpactAnticipate.PlayOneShot(this); } if (ticksToImpact <= 0) { if (DestinationCell.InBounds(base.Map)) { base.Position = DestinationCell; } ImpactSomething(); } else if (ambientSustainer != null) { ambientSustainer.Maintain(); } }
public override void Tick() { base.Tick(); //BackstoryCracker.TestforIncorrectChildhood(); if (ticksToExplode > 0) { if (wickSustainer == null) { StartWickSustainer(); } else { wickSustainer.Maintain(); } ticksToExplode--; if (ticksToExplode == 0) { IntVec3 randomCell = this.OccupiedRect().RandomCell; float radius = Rand.Range(0.5f, 1f) * 3f * 1.7320508075688772935274463415059f; GenExplosion.DoExplosion(randomCell, Map, radius, DamageDefOf.Flame, instigator: null, damAmount: -1, armorPenetration: -1f, explosionSound: null, weapon: null, projectile: null, intendedTarget: null, postExplosionSpawnThingDef: null, postExplosionSpawnChance: 0f, postExplosionSpawnThingCount: 1, applyDamageToExplosionCellsNeighbors: false, preExplosionSpawnThingDef: null, preExplosionSpawnChance: 0f, preExplosionSpawnThingCount: 1, chanceToStartFire: 0f, damageFalloff: false ); GetComp <CompPowerBattery>().DrawPower(EnergyToLoseWhenExplode); } } }