public override bool FireEvent(Event E) { if (E.ID == "EndTurnEngulfing") { if (descriptionSet == false) { IPart.ThePlayer.GetPart <Description>().Short = "I'm not a bad slime"; descriptionSet = true; } GameObject parameter = E.GetParameter <GameObject>("Object"); if (parameter != null) { Damage damage = new Damage(Stat.Random(IPart.ThePlayer.Statistics["Toughness"].BaseValue / 2, IPart.ThePlayer.Statistics["Toughness"].BaseValue)); Event E1 = Event.New("TakeDamage", 0, 0, 0); E1.AddParameter("Damage", (object)damage); E1.AddParameter("Owner", (object)this.ParentObject); E1.AddParameter("Attacker", (object)this.ParentObject); E1.AddParameter("Message", this.DamageMessage); parameter.FireEvent(E1); if (parameter.hitpoints <= 0) { if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&wAverage") { this.statGains(1); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&WTough") { this.statGains(2); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&rVery Tough") { this.statGains(4); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&RImpossible") { this.statGains(8); } Mutations targetMutations = parameter.GetPart <Mutations>(); Mutations playerMutations = IPart.ThePlayer.GetPart <Mutations>(); if (targetMutations != null) { foreach (BaseMutation mutation in targetMutations.MutationList) { if (!playerMutations.HasMutation(mutation) && !excludedMutations.Contains(mutation.Name) && mutation.CompatibleWith(IPart.ThePlayer)) { playerMutations.AddMutation(mutation, 1); } } } Stomach part = IPart.ThePlayer.GetPart <Stomach>(); IPart.ThePlayer.RemoveEffect("Famished", false); part.HungerLevel = 0; part.CookCount = 0; part.CookingCounter = 0; part.Water = 30000; } } } return(true); }
private void button2_Click(object sender, EventArgs e) { var Stomach = new Stomach { Name = TName.Text, Age = TAge.Text, Gender = CGender.Text, FileNo = TFileNo.Text, Date = dateTimePicker1.Value, Premedication = TPremedication.Text, Scope = CScope.Text, ReferredDoctor = TReferredDoctor.Text, ClinicalData = TClinicalData.Text, GEJ = TGEJ.Text, Esophagus = TEsophagus.Text, StomachDetails = TStomach.Text, D1 = TD1.Text, D2 = TD2.Text, Conclusion = TConclusion.Text, Assistant = TAssistant.Text, Endoscopist = TEndoscopist.Text, }; _context.Stomaches.Add(Stomach); _context.SaveChanges(); CrystalReport2 cr = new CrystalReport2(); cr.SetParameterValue("@Id", Stomach.Id); var ForCr = new ReportViewerForm(); ForCr.crystalReportViewer1.ReportSource = cr; ForCr.crystalReportViewer1.Refresh(); ForCr.Show(); }
public Student(string name) { this.name = name; stomach = new Stomach(); soul = new Soul(); brain = new Brain(); }
private bool isVomiting; // 呕吐ing private void Start() { animator = GetComponent <Animator>(); Stomach = GetComponent <Stomach>(); CombosManager = GetComponent <CombosManager>(); PlayerMove = GetComponent <PlayerTouchMove>(); }
public override bool Drank(LiquidVolume Liquid, int Volume, GameObject Target, StringBuilder Message, ref bool ExitInterface) { long turns = XRLCore.Core.Game.Turns; if (Target.HasPart("Stomach")) { Stomach part = Target.GetPart <Stomach>(); Target.FireEvent(Event.New("AddWater", "Amount", 2 * Volume, "Forced", 1)); Target.FireEvent(Event.New("AddFood", "Satiation", "Snack")); Message.Append("It is bitter and delicious.\n"); Message.Append("You are now " + part.FoodStatus() + "."); } if (!Target.Property.ContainsKey("ConfuseOnEatTurnWine")) { Target.Property.Add("ConfuseOnEatTurnWine", XRLCore.Core.Game.Turns.ToString()); } if (!Target.Property.ContainsKey("ConfuseOnEatAmountWine")) { Target.Property.Add("ConfuseOnEatAmountWine", "0"); } long longProperty = Target.GetLongProperty("ConfuseOnEatTurnWine"); int num = (int)Target.GetLongProperty("ConfuseOnEatAmountWine"); if (turns - longProperty > 80) { num = 0; } if (num > Math.Max(1, Target.Statistics["Toughness"].Modifier * 2) && Target.ApplyEffect(new Confused(Stat.Roll("5d5"), 1, 3))) { ExitInterface = true; } Target.SetLongProperty("ConfuseOnEatTurnWine", turns); Target.Property["ConfuseOnEatAmountWine"] = (num + 1).ToString(); return(true); }
// Use this for initialization void Start() { timeRenderer = GetComponent <SpriteRenderer> (); initTime = Time.timeSinceLevelLoad; stomach = FindObjectOfType <Stomach> (); //print (stomach.getstomachRate()); }
public int TranslateFromHunger() { Stomach Stomach = this.ParentObject.GetPart("Stomach") as Stomach; int StomachCapacity = Stomach.CalculateCookingIncrement() * 2; // accounts for Fasting Way and Mind Over Body -- * 2 gets you total hunger until famished double PercentageFull = (double)(StomachCapacity - Stomach.CookingCounter) / (double)StomachCapacity; return(Math.Max(0, (int)(PercentageFull * GetCapacity(this.Level)))); }
private void UpdateHunger() { Stomach stomach = FindObjectOfType <Stomach>(); if (stomach != null) { mainSlider.value = stomach.Hunger; } }
void Start() { stomach = playerData.getStomach(); stomach.registerSubscriber(this); if (score == null) { score = GameObject.FindObjectOfType <Score>(); } }
public static bool Prefix(ref FoodItem food, ref Stomach __instance) { PlayerEatEvent cEvent = new PlayerEatEvent(ref __instance.Owner, ref food, ref __instance); IEvent iEvent = cEvent; EventManager.CallEvent(ref iEvent); return(!cEvent.IsCancelled()); }
public Instance(IStateMachineTarget master, Def def) : base(master, def) { calories = Db.Get().Amounts.Calories.Lookup(base.gameObject); calories.value = calories.GetMax() * 0.9f; stomach = new Stomach(def.diet, master.gameObject, def.minPoopSizeInCalories); metabolism = base.gameObject.GetAttributes().Add(Db.Get().CritterAttributes.Metabolism); deltaCalorieMetabolismModifier = new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, 1f, DUPLICANTS.MODIFIERS.METABOLISM_CALORIE_MODIFIER.NAME, true, false, false); calories.deltaAttribute.Add(deltaCalorieMetabolismModifier); }
public void CmdInteractionFinished(GameObject other) { Stomach belly = other.GetComponent <Stomach>(); if (belly != null) { belly.Feed(size); } Destroy(this.gameObject); }
public void Digest() { Balls.Digest(p => BallsDigested(p)); Boobs.Digest(p => BoobsDigested(p)); Stomach.Digest(p => StomachDigested(p)); Anal.Digest(p => AnalDigested(p)); if (V****a.ChildTf) { v****a.TransformToChild(p => TfToChild(p)); } else { V****a.Digest(p => VaginaDigested(p)); } void TfToChild(ThePrey thePrey) { PlayerPredEventLog($"{FullName(thePrey)} has shrunk"); pred.VoreChar.V****a.PreyIsRebithed(thePrey); } void VaginaDigested(ThePrey thePrey) { PlayerPredEventLog($"{FullName(thePrey)}"); pred.VoreChar.V****a.PreyIsdigested(thePrey); } void BallsDigested(ThePrey thePrey) { PlayerPredEventLog($"{FullName(thePrey)} has been fully transfomed into cum."); pred.VoreChar.Balls.PreyIsdigested(thePrey); } void BoobsDigested(ThePrey thePrey) { PlayerPredEventLog($"{FullName(thePrey)} is now nothing but milk."); pred.VoreChar.Boobs.PreyIsdigested(thePrey); } void StomachDigested(ThePrey thePrey) { PlayerPredEventLog($"{FullName(thePrey)} has been digested."); pred.VoreChar.Stomach.PreyIsdigested(thePrey); } void AnalDigested(ThePrey thePrey) { PlayerPredEventLog($"{FullName(thePrey)} has been reduced to nothing in your bowels."); pred.VoreChar.Anal.PreyIsdigested(thePrey); } }
public override bool FireEvent(Event E) { if (E.ID == "EndTurnEngulfing") { if (descriptionSet == false) { this.ParentObject.GetPart <Description>().Short = "I'm not a bad slime"; descriptionSet = true; } GameObject parameter = E.GetParameter <GameObject>("Object"); if (parameter != null) { Damage damage = new Damage(Stat.Random(this.ParentObject.Statistics["Toughness"].BaseValue / 4, this.ParentObject.Statistics["Toughness"].BaseValue)); Event E1 = Event.New("TakeDamage", 0, 0, 0); E1.AddParameter("Damage", (object)damage); E1.AddParameter("Owner", (object)this.ParentObject); E1.AddParameter("Attacker", (object)this.ParentObject); E1.AddParameter("Message", this.DamageMessage); parameter.FireEvent(E1); if (parameter.hitpoints <= 0) { if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&wAverage") { this.statGains(1); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&WTough") { this.statGains(2); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&rVery Tough") { this.statGains(4); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&RImpossible") { this.statGains(8); } Stomach part = this.ParentObject.GetPart <Stomach>(); this.ParentObject.RemoveEffect("Famished", false); part.HungerLevel = 0; part.CookCount = 0; part.CookingCounter = 0; part.Water = 30000; } } } return(true); }
// return actual charge used public int ConsumeCharge(int Charge) { int ChargeAvailable = TranslateFromHunger(); if (Charge > ChargeAvailable) { return(0); } Stomach Stomach = this.ParentObject.GetPart("Stomach") as Stomach; int StomachCapacity = Stomach.CalculateCookingIncrement() * 2; // accounts for Fasting Way and Mind Over Body -- * 2 gets you total hunger until famished Stomach.CookingCounter = (int)(((ChargeAvailable - Charge) / (double)GetCapacity(this.Level)) * StomachCapacity); return(Charge); }
private void Start() { stomach = player.GetComponent <PlayerData>().getStomach(); }
public Biped(World w, Vec2 position) { _world = w; BipedDef def = new BipedDef(); BodyDef bd = new BodyDef(); // create body parts bd = def.LFootDef; bd.Position += position; LFoot = w.CreateBody(bd); LFoot.CreateShape(def.LFootPoly); LFoot.SetMassFromShapes(); bd = def.RFootDef; bd.Position += position; RFoot = w.CreateBody(bd); RFoot.CreateShape(def.RFootPoly); RFoot.SetMassFromShapes(); bd = def.LCalfDef; bd.Position += position; LCalf = w.CreateBody(bd); LCalf.CreateShape(def.LCalfPoly); LCalf.SetMassFromShapes(); bd = def.RCalfDef; bd.Position += position; RCalf = w.CreateBody(bd); RCalf.CreateShape(def.RCalfPoly); RCalf.SetMassFromShapes(); bd = def.LThighDef; bd.Position += position; LThigh = w.CreateBody(bd); LThigh.CreateShape(def.LThighPoly); LThigh.SetMassFromShapes(); bd = def.RThighDef; bd.Position += position; RThigh = w.CreateBody(bd); RThigh.CreateShape(def.RThighPoly); RThigh.SetMassFromShapes(); bd = def.PelvisDef0; bd.Position += position; Pelvis = w.CreateBody(bd); Pelvis.CreateShape(def.PelvisPoly); Pelvis.SetMassFromShapes(); bd = def.PelvisDef; bd.Position += position; Stomach = w.CreateBody(bd); Stomach.CreateShape(def.StomachPoly); Stomach.SetMassFromShapes(); bd = def.ChestDef; bd.Position += position; Chest = w.CreateBody(bd); Chest.CreateShape(def.ChestPoly); Chest.SetMassFromShapes(); bd = def.NeckDef; bd.Position += position; Neck = w.CreateBody(bd); Neck.CreateShape(def.NeckPoly); Neck.SetMassFromShapes(); bd = def.HeadDef; bd.Position += position; Head = w.CreateBody(bd); Head.CreateShape(def.HeadCirc); Head.SetMassFromShapes(); bd = def.LUpperArmDef; bd.Position += position; LUpperArm = w.CreateBody(bd); LUpperArm.CreateShape(def.LUpperArmPoly); LUpperArm.SetMassFromShapes(); bd = def.RUpperArmDef; bd.Position += position; RUpperArm = w.CreateBody(bd); RUpperArm.CreateShape(def.RUpperArmPoly); RUpperArm.SetMassFromShapes(); bd = def.LForearmDef; bd.Position += position; LForearm = w.CreateBody(bd); LForearm.CreateShape(def.LForearmPoly); LForearm.SetMassFromShapes(); bd = def.RForearmDef; bd.Position += position; RForearm = w.CreateBody(bd); RForearm.CreateShape(def.RForearmPoly); RForearm.SetMassFromShapes(); bd = def.LHandDef; bd.Position += position; LHand = w.CreateBody(bd); LHand.CreateShape(def.LHandPoly); LHand.SetMassFromShapes(); bd = def.RHandDef; bd.Position += position; RHand = w.CreateBody(bd); RHand.CreateShape(def.RHandPoly); RHand.SetMassFromShapes(); // link body parts def.LAnkleDef.Body1 = LFoot; def.LAnkleDef.Body2 = LCalf; def.RAnkleDef.Body1 = RFoot; def.RAnkleDef.Body2 = RCalf; def.LKneeDef.Body1 = LCalf; def.LKneeDef.Body2 = LThigh; def.RKneeDef.Body1 = RCalf; def.RKneeDef.Body2 = RThigh; def.LHipDef.Body1 = LThigh; def.LHipDef.Body2 = Pelvis; def.RHipDef.Body1 = RThigh; def.RHipDef.Body2 = Pelvis; def.LowerAbsDef.Body1 = Pelvis; def.LowerAbsDef.Body2 = Stomach; def.UpperAbsDef.Body1 = Stomach; def.UpperAbsDef.Body2 = Chest; def.LowerNeckDef.Body1 = Chest; def.LowerNeckDef.Body2 = Neck; def.UpperNeckDef.Body1 = Chest; def.UpperNeckDef.Body2 = Head; def.LShoulderDef.Body1 = Chest; def.LShoulderDef.Body2 = LUpperArm; def.RShoulderDef.Body1 = Chest; def.RShoulderDef.Body2 = RUpperArm; def.LElbowDef.Body1 = LForearm; def.LElbowDef.Body2 = LUpperArm; def.RElbowDef.Body1 = RForearm; def.RElbowDef.Body2 = RUpperArm; def.LWristDef.Body1 = LHand; def.LWristDef.Body2 = LForearm; def.RWristDef.Body1 = RHand; def.RWristDef.Body2 = RForearm; // create joints LAnkle = (RevoluteJoint)w.CreateJoint(def.LAnkleDef); RAnkle = (RevoluteJoint)w.CreateJoint(def.RAnkleDef); LKnee = (RevoluteJoint)w.CreateJoint(def.LKneeDef); RKnee = (RevoluteJoint)w.CreateJoint(def.RKneeDef); LHip = (RevoluteJoint)w.CreateJoint(def.LHipDef); RHip = (RevoluteJoint)w.CreateJoint(def.RHipDef); LowerAbs = (RevoluteJoint)w.CreateJoint(def.LowerAbsDef); UpperAbs = (RevoluteJoint)w.CreateJoint(def.UpperAbsDef); LowerNeck = (RevoluteJoint)w.CreateJoint(def.LowerNeckDef); UpperNeck = (RevoluteJoint)w.CreateJoint(def.UpperNeckDef); LShoulder = (RevoluteJoint)w.CreateJoint(def.LShoulderDef); RShoulder = (RevoluteJoint)w.CreateJoint(def.RShoulderDef); LElbow = (RevoluteJoint)w.CreateJoint(def.LElbowDef); RElbow = (RevoluteJoint)w.CreateJoint(def.RElbowDef); LWrist = (RevoluteJoint)w.CreateJoint(def.LWristDef); RWrist = (RevoluteJoint)w.CreateJoint(def.RWristDef); }
public override bool FireEvent(Event E) { if (E.ID == "EndTurnEngulfing") { if (descriptionSet == false) { IPart.ThePlayer.GetPart <Description>().Short = "I'm not a bad slime"; descriptionSet = true; } GameObject parameter = E.GetParameter <GameObject>("Object"); if (parameter != null) { Damage damage = new Damage(Stat.Random(IPart.ThePlayer.Statistics["Toughness"].BaseValue / 2, IPart.ThePlayer.Statistics["Toughness"].BaseValue)); Event E1 = Event.New("TakeDamage", 0, 0, 0); E1.AddParameter("Damage", (object)damage); E1.AddParameter("Owner", (object)this.ParentObject); E1.AddParameter("Attacker", (object)this.ParentObject); E1.AddParameter("Message", this.DamageMessage); parameter.FireEvent(E1); if (parameter.hitpoints <= 0) { if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&wAverage") { this.statGains(1); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&WTough") { this.statGains(2); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&rVery Tough") { this.statGains(4); } else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&RImpossible") { this.statGains(8); } Mutations targetMutations = parameter.GetPart <Mutations>(); Mutations playerMutations = IPart.ThePlayer.GetPart <Mutations>(); if (targetMutations != null) { bool CasterIsPlayer = XRLCore.Core.Game.Player.Body == this.ParentObject ? true : false; string PopupText; foreach (BaseMutation mutation in targetMutations.MutationList) { //mutation.GetStat() == "Ego" if (!playerMutations.HasMutation(mutation) && mutation.CompatibleWith(this.ParentObject)) { if (mutation.GetMutationEntry().Category.Name == "Mental") { PopupText = "Integrate Mental mutation with name of " + mutation.Name; if (CasterIsPlayer || UI.Popup.ShowYesNoCancel(PopupText) == DialogResult.Yes) { playerMutations.AddMutation(mutation, 1); } } else if (CasterIsPlayer && ForbiddenMutations.Contains(mutation.Name))//Forbidden Mutations { if (mutation.AffectsBodyParts()) { PopupText = "Integrate Forbidden-" + mutation.GetMutationEntry().Category.Name + " BodyBased mutation with name of " + mutation.Name; } else { PopupText = "Integrate Forbidden-" + mutation.GetMutationEntry().Category.Name + " mutation with name of " + mutation.Name; } if (UI.Popup.ShowYesNoCancel(PopupText) == DialogResult.Yes) { playerMutations.AddMutation(mutation, 1); } } } } } Stomach part = IPart.ThePlayer.GetPart <Stomach>(); IPart.ThePlayer.RemoveEffect("Famished", false); part.HungerLevel = 0; part.CookCount = 0; part.CookingCounter = 0; part.Water = 30000; } } } return(true); }
} //protected because we can't change it public PlayerEatEvent(ref User pUser, ref FoodItem pFoodIten, ref Stomach pStomach) : base() { this.User = pUser; this.FoodItem = pFoodIten; this.Stomach = pStomach; }
public static bool Prefix(Stomach __instance, ref GameObject ___owner, ref List <CreatureCalorieMonitor.Stomach.CaloriesConsumedEntry> ___caloriesConsumed) { if (___owner.PrefabID() == FloralHatchConfig.Id || ___owner.PrefabID() == FloralHatchConfig.BabyId || ___owner.PrefabID() == WoodenHatchConfig.Id || ___owner.PrefabID() == WoodenHatchConfig.BabyId) { float num = 0f;//consumed calories acumulated Tag tag = Tag.Invalid; byte disease_idx = byte.MaxValue; int num2 = 0;//total germs bool flag = false; for (int i = 0; i < ___caloriesConsumed.Count; i++) { CreatureCalorieMonitor.Stomach.CaloriesConsumedEntry value = ___caloriesConsumed[i]; if (value.calories > 0f) { Diet.Info dietInfo = __instance.diet.GetDietInfo(value.tag); if (dietInfo != null) { if (!(tag != Tag.Invalid) || !(tag != dietInfo.producedElement)) { num += dietInfo.ConvertConsumptionMassToProducedMass(dietInfo.ConvertCaloriesToConsumptionMass(value.calories)); tag = dietInfo.producedElement; disease_idx = dietInfo.diseaseIdx; num2 = (int)(dietInfo.diseasePerKgProduced * num); value.calories = 0f; ___caloriesConsumed[i] = value; flag = (flag || dietInfo.produceSolidTile); } } } } if (num <= 0f || tag == Tag.Invalid) { Debug.Log("tag invalid"); return(false); } Element element = ElementLoader.GetElement(tag); if (element == null) { //for food and others GameObject prefab = Assets.GetPrefab(tag); GameObject gameObject2 = GameUtil.KInstantiate(prefab, Grid.SceneLayer.Ore, null, 0); int units_c = 0; PrimaryElement component2 = null; if (___owner.PrefabID() == WoodenHatchConfig.Id || ___owner.PrefabID() == WoodenHatchConfig.BabyId) { // EdiblesManager.FoodInfo food_info = EdiblesManager.GetFoodInfo(tag.ToString()); var out_put = prefab.GetComponent <PrimaryElement>(); units_c = (int)(num / out_put.Mass); Facing component = ___owner.GetComponent <Facing>(); int num3 = Grid.PosToCell(___owner.transform.GetPosition()); var pos = Grid.CellToPosCCC(num3, Grid.SceneLayer.Ore); gameObject2.transform.SetPosition(pos); component2 = gameObject2.GetComponent <PrimaryElement>(); component2.Units = units_c; } else { var out_put_edible = prefab.GetComponent <Edible>(); var out_put_food_info = out_put_edible.FoodInfo; units_c = (int)(num / out_put_food_info.CaloriesPerUnit); Facing component = ___owner.GetComponent <Facing>(); int num3 = Grid.PosToCell(___owner.transform.GetPosition()); var pos = Grid.CellToPosCCC(num3, Grid.SceneLayer.Ore); gameObject2.transform.SetPosition(pos); component2 = gameObject2.GetComponent <PrimaryElement>(); component2.Mass = num; } float temperature = ___owner.GetComponent <PrimaryElement>().Temperature; component2.Temperature = temperature; gameObject2.SetActive(true); component2.AddDisease(disease_idx, num2, "ComplexFabricator.CompleteOrder"); KPrefabID component3 = ___owner.GetComponent <KPrefabID>(); if (!Game.Instance.savedInfo.creaturePoopAmount.ContainsKey(component3.PrefabTag)) { Game.Instance.savedInfo.creaturePoopAmount.Add(component3.PrefabTag, 0f); } Dictionary <Tag, float> creaturePoopAmount; Tag prefabTag; (creaturePoopAmount = Game.Instance.savedInfo.creaturePoopAmount)[prefabTag = component3.PrefabTag] = creaturePoopAmount[prefabTag] + num; PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, prefab.name, ___owner.transform, 1.5f, false); } else { ///default option global::Debug.Assert(element != null, "Fail at default option"); int num3 = Grid.PosToCell(___owner.transform.GetPosition()); float temperature = ___owner.GetComponent <PrimaryElement>().Temperature; if (element.IsLiquid) { FallingWater.instance.AddParticle(num3, element.idx, num, temperature, disease_idx, num2, true, false, false, false); } else if (element.IsGas) { SimMessages.AddRemoveSubstance(num3, (int)element.idx, CellEventLogger.Instance.ElementConsumerSimUpdate, num, temperature, disease_idx, num2, true, -1); } else if (flag) { Facing component = ___owner.GetComponent <Facing>(); int num4 = component.GetFrontCell(); if (!Grid.IsValidCell(num4)) { global::Debug.LogWarningFormat("{0} attemping to Poop {1} on invalid cell {2} from cell {3}", new object[] { ___owner, element.name, num4, num3 }); num4 = num3; } SimMessages.AddRemoveSubstance(num4, (int)element.idx, CellEventLogger.Instance.ElementConsumerSimUpdate, num, temperature, disease_idx, num2, true, -1); } else { element.substance.SpawnResource(Grid.CellToPosCCC(num3, Grid.SceneLayer.Ore), num, temperature, disease_idx, num2, false, false, false); } KPrefabID component2 = ___owner.GetComponent <KPrefabID>(); if (!Game.Instance.savedInfo.creaturePoopAmount.ContainsKey(component2.PrefabTag)) { Game.Instance.savedInfo.creaturePoopAmount.Add(component2.PrefabTag, 0f); } Dictionary <Tag, float> creaturePoopAmount; Tag prefabTag; (creaturePoopAmount = Game.Instance.savedInfo.creaturePoopAmount)[prefabTag = component2.PrefabTag] = creaturePoopAmount[prefabTag] + num; PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, element.name, ___owner.transform, 1.5f, false); } return(false); } else { return(true); } }
private void Awake() { stomach = new Stomach(startStomachValue); }
public static bool Prefix(Stomach __instance, ref GameObject ___owner, ref List <CreatureCalorieMonitor.Stomach.CaloriesConsumedEntry> ___caloriesConsumed) { if (___owner.PrefabID() == CloudyPuftConfig.ID || ___owner.PrefabID() == CloudyPuftConfig.BABY_ID || ___owner.PrefabID() == SmoggyPuftConfig.ID || ___owner.PrefabID() == SmoggyPuftConfig.BABY_ID) { float deltaEmitTemperature = 0; if (___owner.PrefabID() == CloudyPuftConfig.ID || ___owner.PrefabID() == CloudyPuftConfig.BABY_ID) { deltaEmitTemperature = -5f * 2; } if (___owner.PrefabID() == SmoggyPuftConfig.ID || ___owner.PrefabID() == SmoggyPuftConfig.BABY_ID) { deltaEmitTemperature = 5f * 8; } float num1 = 0.0f; Tag tag = Tag.Invalid; byte disease_idx = byte.MaxValue; int num2 = 0; bool flag = false; for (int index = 0; index < ___caloriesConsumed.Count; ++index) { CreatureCalorieMonitor.Stomach.CaloriesConsumedEntry caloriesConsumedEntry = ___caloriesConsumed[index]; if ((double)caloriesConsumedEntry.calories > 0.0) { Diet.Info dietInfo = __instance.diet.GetDietInfo(caloriesConsumedEntry.tag); if (dietInfo != null && (!(tag != Tag.Invalid) || !(tag != dietInfo.producedElement))) { num1 += dietInfo.ConvertConsumptionMassToProducedMass(dietInfo.ConvertCaloriesToConsumptionMass(caloriesConsumedEntry.calories)); tag = dietInfo.producedElement; disease_idx = dietInfo.diseaseIdx; num2 = (int)((double)dietInfo.diseasePerKgProduced * (double)num1); caloriesConsumedEntry.calories = 0.0f; ___caloriesConsumed[index] = caloriesConsumedEntry; flag = flag || dietInfo.produceSolidTile; } } } if ((double)num1 <= 0.0 || tag == Tag.Invalid) { return(false); } Element element = ElementLoader.GetElement(tag); Debug.Assert(element != null, (object)"TODO: implement non-element tag spawning"); int cell = Grid.PosToCell(___owner.transform.GetPosition()); float temperature = ___owner.GetComponent <PrimaryElement>().Temperature; temperature = Mathf.Max(element.lowTemp + 5f, temperature + deltaEmitTemperature); if (element.IsLiquid) { FallingWater.instance.AddParticle(cell, element.idx, num1, temperature, disease_idx, num2, true, false, false, false); } else if (element.IsGas) { SimMessages.AddRemoveSubstance(cell, (int)element.idx, CellEventLogger.Instance.ElementConsumerSimUpdate, num1, temperature, disease_idx, num2, true, -1); } else if (flag) { int num3 = ___owner.GetComponent <Facing>().GetFrontCell(); if (!Grid.IsValidCell(num3)) { Debug.LogWarningFormat("{0} attemping to Poop {1} on invalid cell {2} from cell {3}", (object)___owner, (object)element.name, (object)num3, (object)cell); num3 = cell; } SimMessages.AddRemoveSubstance(num3, (int)element.idx, CellEventLogger.Instance.ElementConsumerSimUpdate, num1, temperature, disease_idx, num2, true, -1); } else { element.substance.SpawnResource(Grid.CellToPosCCC(cell, Grid.SceneLayer.Ore), num1, temperature, disease_idx, num2, false, false, false); } KPrefabID component = ___owner.GetComponent <KPrefabID>(); if (!Game.Instance.savedInfo.creaturePoopAmount.ContainsKey(component.PrefabTag)) { Game.Instance.savedInfo.creaturePoopAmount.Add(component.PrefabTag, 0.0f); } Dictionary <Tag, float> creaturePoopAmount; Tag prefabTag; (creaturePoopAmount = Game.Instance.savedInfo.creaturePoopAmount)[prefabTag = component.PrefabTag] = creaturePoopAmount[prefabTag] + num1; PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, element.name, ___owner.transform, 1.5f, false); return(false); } else { return(true); } }