private static void UpdateListOfBurningAndCurrentlyExtinguishedSims(Lot lot) { Firefighter.FirefighterInformation information = null; if ((lot != null) && Firefighter.sFirefighterDictionary.TryGetValue(lot.LotId, out information)) { List <Sim> .Enumerator enumerator = information.SimsThatAreBurning.GetEnumerator(); while (enumerator.MoveNext()) { Sim current = enumerator.Current; if ((current != null) && (current.HasBeenDestroyed || !Sims3.Gameplay.Services.FirefighterSituation.IsSimOnFireAndNotBeingHelped(current))) { information.SimsThatAreBurning.Remove(current); enumerator = information.SimsThatAreBurning.GetEnumerator(); } } List <Sim> .Enumerator enumerator2 = information.SimsThatAreBeingExtinguished.GetEnumerator(); while (enumerator2.MoveNext()) { if ((enumerator2.Current != null) && enumerator2.Current.HasBeenDestroyed) { information.SimsThatAreBeingExtinguished.Remove(enumerator2.Current); enumerator2 = information.SimsThatAreBeingExtinguished.GetEnumerator(); } } } }
public override void Init(FirefighterSituation parent) { Firefighter.FirefighterInformation information = null; if ((parent.Worker != null) && Firefighter.sFirefighterDictionary.TryGetValue(parent.Lot.LotId, out information)) { RequestWalkStyle(parent.Worker, Sim.WalkStyle.FastRun); parent.Worker.SimDescription.ShowSocialsOnSim = false; if (mSimToExtinguish == null) { UpdateListOfBurningAndCurrentlyExtinguishedSims(parent.Lot); if (information.SimsThatAreBurning.Count > 0x0) { Sim randomObjectFromList = RandomUtil.GetRandomObjectFromList <Sim>(information.SimsThatAreBurning); if (randomObjectFromList != null) { information.SimsThatAreBurning.Remove(randomObjectFromList); if (!information.SimsThatAreBeingExtinguished.Contains(randomObjectFromList)) { information.SimsThatAreBeingExtinguished.Add(randomObjectFromList); } mSimToExtinguish = randomObjectFromList; } } } if (mSimToExtinguish != null) { ForceSituationSpecificInteraction(mSimToExtinguish, parent.Worker, Sim.ExtinguishSim.Singleton, null, ExtinguishSuccessful, FailedToExtinguish, new InteractionPriority(InteractionPriorityLevel.Fire, 6f)); } else { parent.SetState(new ExtinguishFire(Parent)); } } }
public override void Init(FirefighterSituation parent) { Firefighter.FirefighterInformation information = null; if ((parent.Worker != null) && Firefighter.sFirefighterDictionary.TryGetValue(parent.Lot.LotId, out information)) { if (!parent.TryRestartFirefighting(information)) { Exit(); } } }
private bool TryRestartFirefighting(Firefighter.FirefighterInformation firefighterInfo) { if (Sims3.Gameplay.Services.FirefighterSituation.DoesFireExistOnLot(Lot)) { SetStateExtinguishSim(null); firefighterInfo.ValidFirefighterRequest = true; return(true); } return(false); }
private void FailedToExtinguish(Sim actor, float x) { if (Simulator.CheckYieldingContext(false)) { Firefighter.FirefighterInformation information = null; if (((Lot != null) && Firefighter.sFirefighterDictionary.TryGetValue(Lot.LotId, out information)) && ((mSimToExtinguish != null) && !mSimToExtinguish.HasBeenDestroyed)) { information.SimsThatAreBeingExtinguished.Remove(mSimToExtinguish); if (!information.SimsThatAreBurning.Contains(mSimToExtinguish)) { information.SimsThatAreBurning.Add(mSimToExtinguish); } } Parent.SetState(new HangAroundThenExtinguish(Parent, mSimToExtinguish, true)); } }
private void OnFailToAccessFire() { if (Parent.mFailedAttemptsToReachBurningObject >= Sims3.Gameplay.Services.FirefighterSituation.kNumAttemptsBeforeFirefighterLeaves) { Firefighter.FirefighterInformation information = null; if (Firefighter.sFirefighterDictionary.TryGetValue(Parent.Lot.LotId, out information)) { information.KnownUnreachableFiresLeftOnLot = true; } Exit(); } else { Parent.SetStateExtinguishSim(mBurningObject as Sim); } }
private void ExtinguishSuccessful(Sim actor, float x) { try { Occupation.SimCompletedTask(Parent.Worker, TaskId.TrappedSims, mSimToExtinguish); EventTracker.SendEvent(EventTypeId.kFirefighterSaveSims, Parent.Worker, mSimToExtinguish); Firefighter.FirefighterInformation information = null; if ((Lot != null) && Firefighter.sFirefighterDictionary.TryGetValue(Lot.LotId, out information)) { information.SimsThatAreBeingExtinguished.Remove(mSimToExtinguish); } Parent.SetState(new ExtinguishSim(Parent, null)); } catch (Exception e) { Common.Exception(Parent.Worker, Parent.Lot, e); } }
private void OnLeaving(Sim actor, float x) { if (Simulator.CheckYieldingContext(false)) { Firefighter.FirefighterInformation information = null; if ((Parent.Worker != null) && Firefighter.sFirefighterDictionary.TryGetValue(Parent.Lot.LotId, out information)) { if (!information.KnownUnreachableFiresLeftOnLot && Sims3.Gameplay.Services.FirefighterSituation.DoesFireExistOnLot(Parent.Lot)) { Parent.SetStateExtinguishSim(null); information.ValidFirefighterRequest = true; } else { information.SimThatRequestedService = null; information.KnownUnreachableFiresLeftOnLot = false; mAlarmHandle = AlarmManager.AddAlarm(Firefighter.DelayBeforeLeaving, TimeUnit.Hours, TimeToGo, "Firefighter waiting to leave", AlarmType.DeleteOnReset, Parent.Worker); Parent.Worker.SimDescription.ShowSocialsOnSim = true; } } } }