public override void AddInteractions(InteractionObjectPair iop, Sim actor, GameObject target, List <InteractionObjectPair> results) { string[] menuPath = new string[] { GameObject.DEBUG_Sculpturify.LocalizeString("Sculpturify", new object[0x0]) + Localization.Ellipsis }; foreach (SculptureComponent.SculptureMaterial material in Enum.GetValues(typeof(SculptureComponent.SculptureMaterial))) { if (((material != SculptureComponent.SculptureMaterial.None) && (material != SculptureComponent.SculptureMaterial.Metal)) && (material != SculptureComponent.SculptureMaterial.Topiary)) { InteractionObjectPair item = new InteractionObjectPair(new Definition(SculptingSkill.GetLocalizedMaterialName(material), material, menuPath), target); results.Add(item); } } }
public Definition(string menuText, SculptingSkill.SkillSculptureData sculpture, SculptureComponent.SculptureMaterial material, string[] path) : base(menuText, sculpture, material, path) { }
protected override bool PrivateUpdate(ScenarioFrame frame) { base.PrivateUpdate(frame); List <SculptingStation> stations = new List <SculptingStation>(); List <SculptingStation> empties = new List <SculptingStation>(); foreach (Lot lot in ManagerLot.GetOwnedLots(Sim)) { foreach (SculptingStation station in lot.GetObjects <SculptingStation>()) { if (station.HasFinishedSculpture()) { GameObject sculpture = station.GetCurrentSculpture(); station.OnHandToolChildUnslottedBase(sculpture, Slot.ContainmentSlot_0); sculpture.UnParent(); if (!Sim.Household.SharedFamilyInventory.Inventory.TryToMove(sculpture)) { int value = Money.Sell(Sim, sculpture); AddStat("Sculpture Sold", value); } else { IncStat("Sculpture Stored"); } } if (station.HasUnfinishedSculpture()) { GameObject currentSculpture = station.GetCurrentSculpture(); if ((currentSculpture != null) && (currentSculpture.SculptureComponent != null)) { if (currentSculpture.SculptureComponent.Artist == Sim) { stations.Add(station); } } } else { empties.Add(station); } } } if (stations.Count == 0) { stations.AddRange(empties); } if (stations.Count == 0) { IncStat("No Station"); return(false); } SculptingStation choice = RandomUtil.GetRandomObjectFromList(stations); if (choice.HasUnfinishedSculpture()) { IncStat("Sculpture Continued"); return(Situations.PushInteraction(this, Sim, choice, ContinueSculptureEx.Singleton)); } else { List <SculptureComponent.SculptureMaterial> materials = new List <SculptureComponent.SculptureMaterial>(); int skillLevel = Sim.SkillManager.GetSkillLevel(SkillNames.Sculpting); skillLevel = Math.Max(0, skillLevel); foreach (SculptureComponent.SculptureMaterial material in Enum.GetValues(typeof(SculptureComponent.SculptureMaterial))) { if (material == SculptureComponent.SculptureMaterial.None) { continue; } if (material == SculptureComponent.SculptureMaterial.Metal) { continue; } if (!SculptingSkill.HasLevelForMaterial(skillLevel, material)) { continue; } if (!SculptingSkill.CanAfford(Sim.CreatedSim, material)) { continue; } materials.Add(material); } if (materials.Count == 0) { IncStat("No Material"); return(false); } SculptureComponent.SculptureMaterial materialChoice = RandomUtil.GetRandomObjectFromList(materials); List <SculptingSkill.SkillSculptureData> sculptures = SculptingSkill.ValidRandomSculpturesForLevelAndMaterial(skillLevel, materialChoice, Sim.CreatedSim); if (sculptures.Count == 0) { IncStat("No Sculptures"); return(false); } SculptingSkill.SkillSculptureData sculptureChoice = RandomUtil.GetWeightedRandomObjectFromList(sculptures.ToArray()) as SculptingSkill.SkillSculptureData; IncStat("Sculpture Started"); return(Situations.PushInteraction(this, Sim, choice, new CreateSculptureEx.Definition(null, sculptureChoice, materialChoice, new string[0]))); } }