public static List <JoyKindDef> JoyKindsOnMapTempList(Map map) { for (int i = 0; i < DefDatabase <JoyKindDef> .AllDefsListForReading.Count; i++) { JoyKindDef joyKindDef = DefDatabase <JoyKindDef> .AllDefsListForReading[i]; if (!joyKindDef.needsThing) { JoyUtility.tempKindList.Add(joyKindDef); } } foreach (Thing current in JoyUtility.JoySourceBuildings(map)) { if (!JoyUtility.tempKindList.Contains(current.def.building.joyKind)) { JoyUtility.tempKindList.Add(current.def.building.joyKind); } } foreach (Thing current2 in map.listerThings.ThingsInGroup(ThingRequestGroup.Drug)) { if (current2.def.IsIngestible && current2.def.ingestible.joyKind != null && !JoyUtility.tempKindList.Contains(current2.def.ingestible.joyKind) && !current2.Position.Fogged(map)) { JoyUtility.tempKindList.Add(current2.def.ingestible.joyKind); } } foreach (Thing current3 in map.listerThings.ThingsInGroup(ThingRequestGroup.FoodSourceNotPlantOrTree)) { if (current3.def.IsIngestible && current3.def.ingestible.joyKind != null && !JoyUtility.tempKindList.Contains(current3.def.ingestible.joyKind) && !current3.Position.Fogged(map)) { JoyUtility.tempKindList.Add(current3.def.ingestible.joyKind); } } return(JoyUtility.tempKindList); }
public string TolerancesString() { StringBuilder stringBuilder = new StringBuilder(); List <JoyKindDef> allDefsListForReading = DefDatabase <JoyKindDef> .AllDefsListForReading; for (int i = 0; i < allDefsListForReading.Count; i++) { JoyKindDef joyKindDef = allDefsListForReading[i]; float num = tolerances[joyKindDef]; if (num > 0.01f) { if (stringBuilder.Length == 0) { stringBuilder.AppendLine("JoyTolerances".Translate() + ":"); } string text = " " + joyKindDef.LabelCap + ": " + num.ToStringPercent(); if (bored[joyKindDef]) { text = text + " (" + "bored".Translate() + ")"; } stringBuilder.AppendLine(text); } } return(stringBuilder.ToString().TrimEndNewlines()); }
public static string JoyKindsOnMapString(Map map) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < DefDatabase <JoyKindDef> .AllDefsListForReading.Count; i++) { JoyKindDef joyKindDef = DefDatabase <JoyKindDef> .AllDefsListForReading[i]; if (!joyKindDef.needsThing) { JoyUtility.CheckAppendJoyKind(stringBuilder, null, joyKindDef, map); } } foreach (Thing current in JoyUtility.JoySourceBuildings(map)) { JoyUtility.CheckAppendJoyKind(stringBuilder, current, current.def.building.joyKind, map); } foreach (Thing current2 in map.listerThings.ThingsInGroup(ThingRequestGroup.Drug)) { if (current2.def.IsIngestible && current2.def.ingestible.joyKind != null) { JoyUtility.CheckAppendJoyKind(stringBuilder, current2, current2.def.ingestible.joyKind, map); } } foreach (Thing current3 in map.listerThings.ThingsInGroup(ThingRequestGroup.FoodSourceNotPlantOrTree)) { if (current3.def.IsIngestible && current3.def.ingestible.joyKind != null) { JoyUtility.CheckAppendJoyKind(stringBuilder, current3, current3.def.ingestible.joyKind, map); } } JoyUtility.listedJoyKinds.Clear(); return(stringBuilder.ToString().TrimEndNewlines()); }
private static void CheckAppendJoyKind(StringBuilder sb, Thing t, JoyKindDef kind, Map map) { if (JoyUtility.listedJoyKinds.Contains(kind)) { return; } if (t == null) { sb.AppendLine(" " + kind.LabelCap); } else { if (t.def.category == ThingCategory.Item && t.Position.Fogged(map)) { return; } sb.AppendLine(string.Concat(new string[] { " ", kind.LabelCap, " (", t.def.label, ")" })); } JoyUtility.listedJoyKinds.Add(kind); }
public static List <JoyKindDef> JoyKindsOnMapTempList(Map map) { for (int i = 0; i < DefDatabase <JoyKindDef> .AllDefsListForReading.Count; i++) { JoyKindDef joyKindDef = DefDatabase <JoyKindDef> .AllDefsListForReading[i]; if (!joyKindDef.needsThing) { tempKindList.Add(joyKindDef); } } foreach (Building item in map.listerBuildings.allBuildingsColonist) { if (item.def.building.joyKind != null && !tempKindList.Contains(item.def.building.joyKind)) { tempKindList.Add(item.def.building.joyKind); } } foreach (Thing item2 in map.listerThings.ThingsInGroup(ThingRequestGroup.Drug)) { if (item2.def.IsIngestible && item2.def.ingestible.joyKind != null && !tempKindList.Contains(item2.def.ingestible.joyKind) && !item2.Position.Fogged(map)) { tempKindList.Add(item2.def.ingestible.joyKind); } } foreach (Thing item3 in map.listerThings.ThingsInGroup(ThingRequestGroup.FoodSourceNotPlantOrTree)) { if (item3.def.IsIngestible && item3.def.ingestible.joyKind != null && !tempKindList.Contains(item3.def.ingestible.joyKind) && !item3.Position.Fogged(map)) { tempKindList.Add(item3.def.ingestible.joyKind); } } return(tempKindList); }
public static string JoyKindsNotOnMapString(Map map) { List <JoyKindDef> allDefsListForReading = DefDatabase <JoyKindDef> .AllDefsListForReading; List <JoyKindDef> list = JoyUtility.JoyKindsOnMapTempList(map); string result; if (allDefsListForReading.Count == list.Count) { result = "(" + "None".Translate() + ")"; } else { string text = ""; for (int i = 0; i < allDefsListForReading.Count; i++) { JoyKindDef joyKindDef = allDefsListForReading[i]; if (!list.Contains(joyKindDef)) { text = text + " " + joyKindDef.LabelCap + "\n"; } } list.Clear(); result = text.TrimEndNewlines(); } return(result); }
public float this[JoyKindDef d] { get { return(tolerances[d]); } }
public bool JoyKindDisabled(JoyKindDef joyKind) { if (disabledJoyKinds == null) { return(false); } return(disabledJoyKinds.Contains(joyKind)); }
public void Notify_JoyGained(float amount, JoyKindDef joyKind) { float num = Mathf.Min(tolerances[joyKind] + amount * 0.65f, 1f); tolerances[joyKind] = num; if (num > 0.5f) { bored[joyKind] = true; } }
public void GainJoy(float amount, JoyKindDef joyKind) { if (!(amount <= 0f)) { amount *= tolerances.JoyFactorFromTolerance(joyKind); amount = Mathf.Min(amount, 1f - CurLevel); curLevelInt += amount; if (joyKind != null) { tolerances.Notify_JoyGained(amount, joyKind); } lastGainTick = Find.TickManager.TicksGame; } }
public void GainJoy(float amount, JoyKindDef joyKind) { if (amount <= 0f) { return; } amount *= this.tolerances.JoyFactorFromTolerance(joyKind); amount = Mathf.Min(amount, 1f - this.CurLevel); this.curLevelInt += amount; if (joyKind != null) { this.tolerances.Notify_JoyGained(amount, joyKind); } this.lastGainTick = Find.TickManager.TicksGame; }
public string TolerancesString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("\n" + "JoyTolerances".Translate() + ":"); List <JoyKindDef> allDefsListForReading = DefDatabase <JoyKindDef> .AllDefsListForReading; for (int i = 0; i < allDefsListForReading.Count; i++) { JoyKindDef joyKindDef = allDefsListForReading[i]; float num = this.tolerances[joyKindDef]; if (num > 0.0099999997764825821) { stringBuilder.AppendLine(" -" + joyKindDef.label + ": " + num.ToStringPercent()); } } return(stringBuilder.ToString()); }
public void GainJoy(float amount, JoyKindDef joyKind) { if (joyKind == null) { Log.Error("No joyKind!"); } else { amount *= this.tolerances.JoyFactorFromTolerance(joyKind); } amount = Mathf.Min(amount, (float)(1.0 - this.CurLevel)); base.curLevelInt += amount; if (joyKind != null) { this.tolerances.Notify_JoyGained(amount, joyKind); } this.lastGainTick = Find.TickManager.TicksGame; }
private static void CheckAppendJoyKind(StringBuilder sb, Thing t, JoyKindDef kind, Map map) { if (!listedJoyKinds.Contains(kind)) { if (t == null) { sb.AppendLine(" " + kind.LabelCap); } else { if (t.def.category == ThingCategory.Item && t.Position.Fogged(map)) { return; } sb.AppendLine(" " + kind.LabelCap + " (" + t.def.label + ")"); } listedJoyKinds.Add(kind); } }
public static string JoyKindsOnMapString(Map map) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < DefDatabase <JoyKindDef> .AllDefsListForReading.Count; i++) { JoyKindDef joyKindDef = DefDatabase <JoyKindDef> .AllDefsListForReading[i]; if (!joyKindDef.needsThing) { CheckAppendJoyKind(stringBuilder, null, joyKindDef, map); } } foreach (Building item in map.listerBuildings.allBuildingsColonist) { if (item.def.building.joyKind != null) { CheckAppendJoyKind(stringBuilder, item, item.def.building.joyKind, map); } } foreach (Thing item2 in map.listerThings.ThingsInGroup(ThingRequestGroup.Drug)) { if (item2.def.IsIngestible && item2.def.ingestible.joyKind != null) { CheckAppendJoyKind(stringBuilder, item2, item2.def.ingestible.joyKind, map); } } foreach (Thing item3 in map.listerThings.ThingsInGroup(ThingRequestGroup.FoodSourceNotPlantOrTree)) { if (item3.def.IsIngestible && item3.def.ingestible.joyKind != null) { CheckAppendJoyKind(stringBuilder, item3, item3.def.ingestible.joyKind, map); } } listedJoyKinds.Clear(); return(stringBuilder.ToString().TrimEndNewlines()); }
public void Notify_JoyGained(float amount, JoyKindDef joyKind) { this.tolerances[joyKind] = Mathf.Min(this.tolerances[joyKind] + amount * 0.4f, 1f); }
public float JoyFactorFromTolerance(JoyKindDef joyKind) { return((float)(1.0 - this.tolerances[joyKind])); }
public float this[JoyKindDef d] => tolerances[d];
public float JoyFactorFromTolerance(JoyKindDef joyKind) { return(1f - tolerances[joyKind]); }
public bool BoredOf(JoyKindDef def) { return(bored[def]); }
public void Notify_JoyGained(float amount, JoyKindDef joyKind) { this.tolerances[joyKind] = Mathf.Min((float)(this.tolerances[joyKind] + amount * 0.40000000596046448), 1f); }