protected override bool PrivateUpdate(ScenarioFrame frame) { bool success = false; List <Bookshelf> shelves = new List <Bookshelf>(Lot.GetObjects <Bookshelf>()); foreach (Bookshelf shelf in shelves) { RepairableComponent repairable = shelf.Repairable; if ((repairable != null) && (repairable.Broken)) { continue; } if (Inventories.QuickFind <Book>(shelf.Inventory).Count == 0) { shelf.mHasAddedBooks = false; shelf.AddBooksIfNeeded(); int newCount = Inventories.QuickFind <Book>(shelf.Inventory).Count; AddStat("Books Added", newCount); if (newCount > 0) { success = true; } } } return(success); }
//used to get the current sat and then enabled the screen - dont use SetActive on stationrepair.gameobject directly public void OpenScreen(RepairableComponent newSat) { AkSoundEngine.PostEvent("Octo_Systems_Text", gameObject); currentSat = newSat; currentSatInfo = currentSat.gameObject.GetComponentInParent <RepairableInfo>(); this.gameObject.SetActive(true); }
public void OnRepairScreenHotkey(InputAction.CallbackContext context) { if (LastPressedTime + AntiSpamDelay > Time.unscaledTime) { return; //anti spam } LastPressedTime = Time.unscaledTime; //Debug.LogError("Pressed"); if (canOpen && !GameManager.isPaused) { RepairableComponent satComponent = currentSat.GetComponentInParent <RepairableComponent>(); //Debug.LogWarning("Can Open"); //EVAN - menu open sound if (satComponent != null) { StationRepairScreen.OpenScreen(satComponent); GameManager.Pause(); Debug.Log("Paused"); } else { var repairedComponent = currentSat.GetComponentInParent <RepairedInfo>(); if (repairedComponent != null) { StationRepairScreen.OpenScreen(repairedComponent.GetRepairedComponent());; } else { Debug.LogError("Did not find Repairable Component on passed collision"); } } } }
public override void Perform(Sim sim, DiseaseVector vector) { int count = 0; List <GameObject> objs = sim.LotCurrent.GetObjectsInRoom <GameObject>(sim.RoomId); while ((count < mMaximum) && (objs.Count > 0)) { GameObject obj = RandomUtil.GetRandomObjectFromList(objs); count++; RepairableComponent repairable = obj.Repairable; if (repairable == null) { continue; } if (!repairable.CanBreak()) { continue; } repairable.BreakObject(sim, true); } }
protected override bool PrivateUpdate(ScenarioFrame frame) { Household house = Lot.Household; foreach (GameObject obj in Lot.GetObjects <GameObject>()) { if (!obj.Charred) { RepairableComponent repair = obj.Repairable; if (repair == null) { continue; } if (!repair.TestReplace()) { continue; } } else { if (obj is PlumbBob) { obj.Charred = false; continue; } } try { IncStat("Found: " + obj.CatalogName); } catch { } GameObject go = null; try { go = RepairableComponent.CreateReplaceObject(obj); } catch (Exception e) { Common.DebugException(obj.CatalogName, e); } if (go == null) { continue; } IncStat("Replaced"); if (house != null) { Money.AdjustFunds(house, "Replacement", -obj.Cost); } } return(true); }
protected static bool TestRepaired(IGameObject obj) { if (obj != null) { RepairableComponent repairable = obj.Repairable; if (repairable != null) { if (repairable.Broken) { return(false); } } } return(true); }
protected override OptionResult Run(Lot lot, Household me) { if (lot == null) { return(OptionResult.Failure); } foreach (GameObject obj in lot.GetObjects <GameObject>()) { if ((obj.InUse) || (!obj.InWorld)) { continue; } if (obj.Charred) { obj.Charred = false; if (obj is Windows) { RepairableComponent.CreateReplaceObject(obj); } } RepairableComponent repairable = obj.Repairable; if ((repairable != null) && (repairable.Broken)) { repairable.ForceRepaired(Sim.ActiveActor); } } LotLocation[] burntTiles = World.GetBurntTiles(lot.LotId, LotLocation.Invalid); if (burntTiles.Length > 0x0) { foreach (LotLocation burnt in burntTiles) { if ((lot.LotLocationIsPublicResidential(burnt)) && ((lot.TombRoomManager == null) || !lot.TombRoomManager.IsObjectInATombRoom(burnt))) { World.SetBurnt(lot.LotId, burnt, false); } } } return(OptionResult.SuccessClose); }
public static void OnMopped(Event e) { Sim actor = e.Actor as Sim; if (actor == null) { return; } if ((actor.Household == null) || (actor.Household.IsSpecialHousehold)) { return; } if (actor.LotCurrent == actor.LotHome) { return; } foreach (GameObject obj in actor.LotCurrent.GetObjects <GameObject>()) { if (obj.RoomId != actor.RoomId) { continue; } if ((obj.IsRepairable) && (obj is Sims3.Gameplay.Scenarios.IFloodWhenBroken)) { RepairableComponent repairable = obj.Repairable; if ((repairable != null) && repairable.Broken) { return; } } } GetPaid(actor, actor.LotCurrent, GetBasePay(actor.OccupationAsSkillBasedCareer) / 10, false); }
public void RegisterNewComponent(RepairableComponent newComp) { //Debug.LogWarning("Register Comp"); LinkedComponent = newComp; //Debug.Log(LinkedComponent); }
public override bool Run() { try { StandardEntry(); if (!Target.StartComputing(this, SurfaceHeight.Table, true)) { StandardExit(); return(false); } AnimateSim("GenericTyping"); List <GameObject> broken = new List <GameObject>(); List <GameObject> repairable = new List <GameObject>(); foreach (GameObject obj in Sims3.Gameplay.Queries.GetObjects <GameObject>()) { if (!obj.InWorld) { continue; } if (obj.InUse) { continue; } if (!obj.IsRepairable) { continue; } if (obj.InInventory) { continue; } if (obj.LotCurrent == Actor.LotHome) { continue; } if (obj.LotCurrent == null) { continue; } if (obj.LotCurrent.Household == null) { continue; } if (obj.IsInHiddenResidentialRoom) { continue; } RepairableComponent component = obj.Repairable; if (component == null || component is ScratchableRepairable) { continue; } bool found = false; foreach (Sim sim in obj.LotCurrent.Household.Sims) { if (!sim.SimDescription.TeenOrAbove) { continue; } if (sim.LotCurrent != obj.LotCurrent) { continue; } found = true; break; } if ((found) && (component.Broken)) { broken.Add(obj); } else { if (obj.LotCurrent == Actor.LotCurrent) { continue; } repairable.Add(obj); } } GameObject choice = null; if (broken.Count > 0) { choice = RandomUtil.GetRandomObjectFromList(broken); } else if (repairable.Count > 0) { if (NRaas.Careers.Settings.mRepairAllowToBreak) { choice = RandomUtil.GetRandomObjectFromList(repairable); if (!choice.Repairable.Broken) { choice.Repairable.BreakObject(); } } else { Common.Notify(Actor, Common.Localize("FindBroken:Failure", Actor.IsFemale)); } } if (choice != null) { Camera.FocusOnGivenPosition(choice.Position, Camera.kDefaultLerpDuration); } Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false); StandardExit(); } catch (Exception exception) { Common.Exception(Actor, Target, exception); } return(true); }
public static void GetRepairs(StoryProgressionObject manager, GameObject[] choices, Dictionary <Household, List <GameObject> > allRepairs) { foreach (GameObject obj in choices) { if (obj == null) { continue; } if (obj is Sim) { Sim sim = obj as Sim; if (!sim.SimDescription.IsFrankenstein) { continue; } if (!sim.BuffManager.HasElement(BuffNames.ShortOut)) { continue; } } else { if (obj.InUse) { continue; } if (!obj.InWorld) { continue; } if (!obj.IsRepairable) { continue; } RepairableComponent component = obj.Repairable; if (component == null) { continue; } if (!component.Broken) { continue; } } if (obj.LotCurrent == null) { continue; } Household household = obj.LotCurrent.Household; if (household == null) { continue; } if (household == Household.ActiveHousehold) { continue; } foreach (SimDescription member in HouseholdsEx.All(household)) { if (manager.GetValue <InStasisOption, bool>(member)) { continue; } } List <GameObject> repairs; if (!allRepairs.TryGetValue(household, out repairs)) { repairs = new List <GameObject>(); allRepairs.Add(household, repairs); } repairs.Add(obj); } }
public SkillAlteration(RepairableComponent.Tuning tuning, float factor) : base(tuning, factor, 0) { }
public MaxTimeAlteration(RepairableComponent.Tuning tuning, float factor) : base(tuning, factor, sDefaultMinimum) { }
public TuningAlteration(RepairableComponent.Tuning tuning, float factor, float minimum) : base(factor, minimum) { mTuning = tuning; }
public RepairAlteration(RepairableComponent.Tuning tuning, float factor) { Add(new MinTimeAlteration(tuning, factor)); Add(new MaxTimeAlteration(tuning, factor)); Add(new SkillAlteration(tuning, Relativity.Settings.GetSkillFactor(SkillNames.Handiness))); }
protected override bool PrivateUpdate(ScenarioFrame frame) { List <GameObject> breakables = new List <GameObject>(); foreach (Lot lot in ManagerLot.GetOwnedLots(Target)) { foreach (GameObject obj in lot.GetObjects <GameObject>()) { if (obj == null) { continue; } if (obj.InUse) { continue; } if (!obj.InWorld) { continue; } if (!obj.IsRepairable) { continue; } RepairableComponent component = obj.Repairable; if (component == null) { continue; } if (component.Broken) { continue; } if (!component.CanBreak()) { continue; } breakables.Add(obj); } } if (breakables.Count == 0) { return(false); } if (!base.PrivateUpdate(frame)) { return(false); } mVictim = RandomUtil.GetRandomObjectFromList(breakables); RepairableComponent repair = mVictim.Repairable; repair.BreakObject(Sim.CreatedSim, true); mFail = IsFail(Sim, Target); if (mFail) { int cost = (int)(mVictim.Value * 1.5); Money.AdjustFunds(Sim, "Damages", -cost); Money.AdjustFunds(Target, "Insurance", cost); } Add(frame, new ExistingEnemyManualScenario(Sim, Target, Delta, 0, GetTitlePrefix(PrefixType.Story)), ScenarioResult.Start); if (OnInvestigateScenario != null) { OnInvestigateScenario(this, frame); } return(true); }