Skip to content

Commit

Permalink
v2.9.2 adds option to hide zombie health bar, balances dark slim
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Jan 31, 2022
1 parent 1ebfe2a commit 6550d9f
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 31 deletions.
4 changes: 2 additions & 2 deletions 1.2/Defs/Zombie_Things.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<altitudeLayer>FloorEmplacement</altitudeLayer>
<pathCost>8399</pathCost>
<pathCost>120</pathCost>
<pathCostIgnoreRepeat>false</pathCostIgnoreRepeat>
<size>(1,1)</size>
<filth>
<cleaningWorkToReduceThickness>4000</cleaningWorkToReduceThickness>
<cleaningWorkToReduceThickness>500</cleaningWorkToReduceThickness>
<rainWashes>true</rainWashes>
<canFilthAttach>false</canFilthAttach>
<allowsFire>false</allowsFire>
Expand Down
Binary file modified 1.3/Assemblies/ZombieLand.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions 1.3/Defs/Zombie_Things.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<altitudeLayer>FloorEmplacement</altitudeLayer>
<pathCost>8399</pathCost>
<pathCost>120</pathCost>
<pathCostIgnoreRepeat>false</pathCostIgnoreRepeat>
<size>(1,1)</size>
<filth>
<cleaningWorkToReduceThickness>4000</cleaningWorkToReduceThickness>
<cleaningWorkToReduceThickness>500</cleaningWorkToReduceThickness>
<rainWashes>true</rainWashes>
<canFilthAttach>false</canFilthAttach>
<allowsFire>false</allowsFire>
Expand Down
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>net.pardeike.rimworld.mod.zombieland</identifier>
<version>2.9.1.0</version>
<version>2.9.2.0</version>
<targetVersions>
<li>1.0.0</li>
<li>1.1.0</li>
Expand Down
4 changes: 2 additions & 2 deletions Defs/Zombie_Things.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<altitudeLayer>FloorEmplacement</altitudeLayer>
<pathCost>8399</pathCost>
<pathCost>120</pathCost>
<pathCostIgnoreRepeat>false</pathCostIgnoreRepeat>
<size>(1,1)</size>
<filth>
<cleaningWorkToReduceThickness>4000</cleaningWorkToReduceThickness>
<cleaningWorkToReduceThickness>500</cleaningWorkToReduceThickness>
<rainWashes>true</rainWashes>
<canFilthAttach>false</canFilthAttach>
<allowsFire>false</allowsFire>
Expand Down
2 changes: 2 additions & 0 deletions Languages/ChineseSimplified/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@
<ZombieShockerHasNoRoom>该设备没有附带有效的房间</ZombieShockerHasNoRoom>
<ZombieShockerLowBatteryState>该设备耗尽了附加的电池</ZombieShockerLowBatteryState>

<ShowHealthBar>僵尸健康酒吧</ShowHealthBar>

</LanguageData>
2 changes: 2 additions & 0 deletions Languages/ChineseTraditional/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@
<ZombieShockerHasNoRoom>該設備沒有附帶有效的房間</ZombieShockerHasNoRoom>
<ZombieShockerLowBatteryState>該設備耗盡了附加的電池</ZombieShockerLowBatteryState>

<ShowHealthBar>殭屍健康酒吧</ShowHealthBar>

</LanguageData>
2 changes: 2 additions & 0 deletions Languages/English/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@
<ZombieShockerHasNoRoom>The device has no valid room attached</ZombieShockerHasNoRoom>
<ZombieShockerLowBatteryState>The device has depleted the attached batteries</ZombieShockerLowBatteryState>

<ShowHealthBar>Zombies health bar</ShowHealthBar>

</LanguageData>
2 changes: 2 additions & 0 deletions Languages/French/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@
<ZombieShockerHasNoRoom>L'appareil n'a aucune pièce valide attachée</ZombieShockerHasNoRoom>
<ZombieShockerLowBatteryState>L'appareil a appauvri les piles attachées</ZombieShockerLowBatteryState>

<ShowHealthBar>Barre de santé de zombies</ShowHealthBar>

</LanguageData>
2 changes: 2 additions & 0 deletions Languages/German/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@
<ZombieShockerHasNoRoom>Das Gerät verfügt über keinen gültigen Raum</ZombieShockerHasNoRoom>
<ZombieShockerLowBatteryState>Das Gerät hat die angeschlossenen Batterien erschöpft</ZombieShockerLowBatteryState>

<ShowHealthBar>Zeige Zombiegesundheit an</ShowHealthBar>

</LanguageData>
2 changes: 2 additions & 0 deletions Languages/Russian/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@
<ZombieShockerHasNoRoom>Устройство не имеет действительной комнаты</ZombieShockerHasNoRoom>
<ZombieShockerLowBatteryState>Устройство истощало прикрепленные батареи</ZombieShockerLowBatteryState>

<ShowHealthBar>Зомби Бар здоровья</ShowHealthBar>

</LanguageData>
2 changes: 2 additions & 0 deletions Languages/Turkish/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@
<ZombieShockerHasNoRoom>Cihazın geçerli bir oda ekli yok</ZombieShockerHasNoRoom>
<ZombieShockerLowBatteryState>Cihaz ekli pilleri tüketti</ZombieShockerLowBatteryState>

<ShowHealthBar>Zombiler sağlık çubuğu</ShowHealthBar>

</LanguageData>
1 change: 1 addition & 0 deletions Source/Dialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ public static void DoWindowContentsInternal(ref SettingsGroup settings, Rect inR
list.Dialog_Checkbox("BetterZombieAvoidance", ref settings.betterZombieAvoidance);
list.Dialog_Checkbox("ZombiesDropBlood", ref settings.zombiesDropBlood);
list.Dialog_Checkbox("ZombiesBurnLonger", ref settings.zombiesBurnLonger);
list.Dialog_Checkbox("ShowHealthBar", ref settings.showHealthBar);
list.Gap(30f);

// Actions
Expand Down
6 changes: 2 additions & 4 deletions Source/JobDriver_ExtractZombieSerum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ public class JobDriver_ExtractZombieSerum : JobDriver
private const float extractWork = 100;
private float extractProcess = 0;

private readonly ThingDef extractDef = ThingDef.Named("ZombieExtract");

public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look<float>(ref extractProcess, "extractProcess", 0f, false);
Scribe_Values.Look(ref extractProcess, "extractProcess", 0f, false);
}

public override string GetReport()
Expand Down Expand Up @@ -58,7 +56,7 @@ public override IEnumerable<Toil> MakeNewToils()
extractProcess += pawn.GetStatValue(StatDefOf.MedicalTendSpeed, true) / 2;
if (extractProcess >= extractWork)
{
var extractResult = ThingMaker.MakeThing(extractDef, null);
var extractResult = ThingMaker.MakeThing(CustomDefs.ZombieExtract, null);
extractResult.stackCount = Tools.ExtractPerZombie();
_ = GenPlace.TryPlaceThing(extractResult, pawn.Position, pawn.Map, ThingPlaceMode.Near, null, null);

Expand Down
3 changes: 3 additions & 0 deletions Source/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ public static class CustomDefs
public static JobDef ZapZombies;
public static RecipeDef CureZombieInfection;
public static ThingDef Zombie;
public static ThingDef ZombieExtract;
public static ThingDef Corpse_Zombie;
public static ThingDef TarSlime;
public static ThingDef TarSmoke;
public static ThingDef StickyGoo;
public static ThingDef ZombieShocker;
public static ThingDef ZombieZapA;
public static ThingDef ZombieZapB;
public static ThingDef ZombieZapC;
public static ThingDef ZombieZapD;
public static ThingDef Apparel_BombVest;
public static HediffDef ZombieInfection;
public static LetterDef ColonistTurnedZombie;
public static LetterDef OtherTurnedZombie;
Expand Down
39 changes: 30 additions & 9 deletions Source/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,20 @@ static class Thing_Position_Patch
{
static readonly MentalStateDef def1 = MentalStateDefOf.Manhunter;
static readonly MentalStateDef def2 = MentalStateDefOf.ManhunterPermanent;
static readonly ThingDef stickyGooDef = ThingDef.Named("StickyGoo");

// top level idx = sign(new.x-old.x) + 1 + 3 * (sign(new.z-old.z) + 1)
static readonly IntVec3[][] orthogonalIndices = new[]
{ // (T)op (B)ottom (L)eft (R)right (0)zero
new [] { new IntVec3(00, 0, -1), new IntVec3(-1, 0, 00) }, // LB -> 0B + L0
new [] { new IntVec3(01, 0, 00), new IntVec3(-1, 0, 00) }, // 0B -> R0 + L0
new [] { new IntVec3(01, 0, 00), new IntVec3(00, 0, -1) }, // RB -> R0 + 0B
new [] { new IntVec3(00, 0, -1), new IntVec3(00, 0, 01) }, // L0 -> 0B + 0T
new [] { new IntVec3(00, 0, 00), new IntVec3(00, 0, 00) }, // center unused
new [] { new IntVec3(00, 0, 01), new IntVec3(00, 0, -1) }, // R0 -> 0T + 0B
new [] { new IntVec3(-1, 0, 00), new IntVec3(00, 0, 01) }, // LT -> L0 + 0T
new [] { new IntVec3(-1, 0, 00), new IntVec3(01, 0, 00) }, // 0T -> L0 + R0
new [] { new IntVec3(00, 0, 01), new IntVec3(01, 0, 00) }, // RT -> 0T + R0
};

static void Prefix(Thing __instance, IntVec3 value)
{
Expand Down Expand Up @@ -1961,7 +1974,19 @@ static void Prefix(Thing __instance, IntVec3 value)
// dark slimers leave dark slime behind them
//
if (zombie.isDarkSlimer)
_ = FilthMaker.TryMakeFilth(value, map, ThingDef.Named("TarSlime"), zombie.Name.ToStringShort, 1);
{
_ = FilthMaker.TryMakeFilth(value, map, CustomDefs.TarSlime, null, true);
if (Tools.Difficulty() > 1)
{
var x = Math.Sign(value.x - pos.x) + 1;
var z = Math.Sign(value.z - pos.z) + 1;
var orthIdx = x + 3 * z;
var pair = orthogonalIndices[orthIdx];
Log.Warning($"{pos}->{value} [{x}] [{z}] => {orthIdx} dx[{pair[0]}] dz[{pair[1]}]");
_ = FilthMaker.TryMakeFilth(pos + pair[0], map, CustomDefs.TarSlime, null, true);
_ = FilthMaker.TryMakeFilth(pos + pair[1], map, CustomDefs.TarSlime, null, true);
}
}

return;
}
Expand All @@ -1981,7 +2006,7 @@ static void Prefix(Thing __instance, IntVec3 value)
var toxity = 0.05f * pawn.GetStatValue(StatDefOf.ToxicSensitivity, true);
if (toxity > 0f)
{
pawn.Position.GetThingList(pawn.Map).Where(thing => thing.def == stickyGooDef).Do(thing =>
pawn.Position.GetThingList(pawn.Map).Where(thing => thing.def == CustomDefs.StickyGoo).Do(thing =>
{
HealthUtility.AdjustSeverity(pawn, HediffDefOf.ToxicBuildup, toxity);
});
Expand Down Expand Up @@ -3052,19 +3077,15 @@ static bool Prefix(ThingStuffPair pair, ref bool __result)
[HarmonyPatch(nameof(PawnGraphicSet.ResolveApparelGraphics))]
static class PawnGraphicSet_ResolveApparelGraphics_Patch
{
static ThingDef bombVestApparelDef;

[HarmonyPriority(Priority.Last)]
static void Postfix(PawnGraphicSet __instance)
{
if (!(__instance.pawn is Zombie zombie)) return;

if (zombie.IsSuicideBomber)
{
if (bombVestApparelDef == null)
bombVestApparelDef = ThingDef.Named("Apparel_BombVest");
var apparel = new Apparel() { def = bombVestApparelDef };
if (__instance.apparelGraphics.Any(a => a.sourceApparel.def == bombVestApparelDef) == false)
var apparel = new Apparel() { def = CustomDefs.Apparel_BombVest };
if (__instance.apparelGraphics.Any(a => a.sourceApparel.def == CustomDefs.Apparel_BombVest) == false)
if (ApparelGraphicRecordGetter.TryGetGraphicApparel(apparel, BodyTypeDefOf.Hulk, out var record))
__instance.apparelGraphics.Add(record);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/TarSlime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
if (map.thingGrid.ThingAt<TarSlime>(Position) != null)
return;
if (Position.Walkable(map) == false)
if (Position.Standable(map) == false)
return;
if (respawningAfterLoad == false)
thickness = 4;
Expand Down
13 changes: 7 additions & 6 deletions Source/Zombie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,7 @@ public override void Kill(DamageInfo? dinfo, Hediff exactCulprit = null)
bombTickingInterval = -1f;
bombWillGoOff = false;
hasTankyShield = -1f;

var def = ThingDef.Named("Apparel_BombVest");
_ = Drawer.renderer.graphics.apparelGraphics.RemoveAll(record => record.sourceApparel?.def == def);

_ = Drawer.renderer.graphics.apparelGraphics.RemoveAll(record => record.sourceApparel?.def == CustomDefs.Apparel_BombVest);
Map.GetComponent<TickManager>()?.AddExplosion(Position);
}

Expand Down Expand Up @@ -357,7 +354,7 @@ void DropStickyGoo()
if (r > maxRadius) maxRadius = r;
var cell = pos + vec;
if (GenSight.LineOfSight(pos, cell, map, true, null, 0, 0) && cell.Walkable(map))
if (FilthMaker.TryMakeFilth(cell, map, ThingDef.Named("StickyGoo"), Name.ToStringShort, 1))
if (FilthMaker.TryMakeFilth(cell, map, CustomDefs.StickyGoo, Name.ToStringShort, 1))
hasFilth++;
}
if (hasFilth >= 6)
Expand Down Expand Up @@ -442,10 +439,14 @@ void RenderRubble(Vector3 drawLoc)
new Color(1f, 0.5f, 0),
new Color(1f, 1f, 0),
};

public override void DrawGUIOverlay()
{
const float width = 60;

base.DrawGUIOverlay();
var width = 60;
if (ZombieSettings.Values.showHealthBar == false)
return;

if (UI.MapToUIPosition(Vector3.one).x - UI.MapToUIPosition(Vector3.zero).x < width / 2)
return;
Expand Down
2 changes: 1 addition & 1 deletion Source/ZombieLand.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<OutputPath>..\1.3\Assemblies\</OutputPath>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.9.1.0</Version>
<Version>2.9.2.0</Version>
<Copyright>Copyright © 2017</Copyright>
</PropertyGroup>

Expand Down
4 changes: 1 addition & 3 deletions Source/ZombieSerumFilterWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ namespace ZombieLand
{
public class ZombieSerumFilterWorker : SpecialThingFilterWorker
{
private readonly ThingDef extractDef = ThingDef.Named("ZombieExtract");

public override bool Matches(Thing t) // true = exclude
{
if (t.def == extractDef) return false; // ok
if (t.def == CustomDefs.ZombieExtract) return false; // ok
if (t is Medicine) return false; // ok
if (!(t is Corpse corpse)) return true; // exclude, need to be corpse
var pawn = corpse.InnerPawn;
Expand Down
1 change: 1 addition & 0 deletions Source/ZombieSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class SettingsGroup : IExposable, ICloneable
public float reducedTurretConsumption = 0f;
public bool zombiesCauseManhuntingResponse = true;
public WanderingStyle wanderingStyle = WanderingStyle.Smart;
public bool showHealthBar = true;

// unused
public int suicideBomberIntChance = 1;
Expand Down

0 comments on commit 6550d9f

Please sign in to comment.