Skip to content

Commit

Permalink
v3.8 adds burning tar slime and fixes NREs in two places
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Apr 3, 2023
1 parent 9efb00e commit 6e04c72
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 31 deletions.
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>3.6.0.0</version>
<version>3.8.0.0</version>
<targetVersions>
<li>1.4.0</li>
</targetVersions>
Expand Down
Binary file modified Assemblies/ZombieLand.dll
Binary file not shown.
52 changes: 27 additions & 25 deletions Defs/Zombie_Things.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,33 @@
</apparel>
</ThingDef>

<ThingDef ParentName="BaseFilth">
<defName>TarSlime</defName>
<thingClass>ZombieLand.TarSlime</thingClass>
<label>super sticky slime</label>
<description>A very sticky slime that makes you move much slower</description>
<statBases>
<Beauty>-10</Beauty>
<Cleanliness>-10</Cleanliness>
</statBases>
<graphicData>
<texPath>Dummy</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<altitudeLayer>FloorEmplacement</altitudeLayer>
<pathCost>120</pathCost>
<pathCostIgnoreRepeat>false</pathCostIgnoreRepeat>
<size>(1,1)</size>
<filth>
<cleaningWorkToReduceThickness>500</cleaningWorkToReduceThickness>
<rainWashes>true</rainWashes>
<canFilthAttach>false</canFilthAttach>
<allowsFire>false</allowsFire>
<maxThickness>4</maxThickness>
</filth>
</ThingDef>
<ThingDef ParentName="BaseFilth">
<defName>TarSlime</defName>
<thingClass>ZombieLand.TarSlime</thingClass>
<label>super sticky slime</label>
<description>A very sticky slime that makes you move much slower</description>
<statBases>
<Beauty>-10</Beauty>
<Flammability>1.0</Flammability>
<Cleanliness>-10</Cleanliness>
<MaxHitPoints>300</MaxHitPoints>
</statBases>
<graphicData>
<texPath>Dummy</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<altitudeLayer>FloorEmplacement</altitudeLayer>
<pathCost>120</pathCost>
<pathCostIgnoreRepeat>false</pathCostIgnoreRepeat>
<useHitPoints>True</useHitPoints>
<size>(1,1)</size>
<filth>
<cleaningWorkToReduceThickness>500</cleaningWorkToReduceThickness>
<rainWashes>true</rainWashes>
<canFilthAttach>false</canFilthAttach>
<maxThickness>4</maxThickness>
</filth>
</ThingDef>

<ThingDef>
<defName>TarSmoke</defName>
Expand Down
19 changes: 19 additions & 0 deletions Source/Dialog_ZombieDebugActionMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using Verse;
using static Verse.PawnCapacityUtility;

namespace ZombieLand
{
Expand Down Expand Up @@ -214,5 +215,23 @@ private static void ApplyZombieRaging()
ZombieStateHandler.StartRage(zombie);
}
}

[DebugAction("Zombieland", "Apply: Zombie add bloodloss", false, false, false, 0, false, actionType = DebugActionType.ToolMap, allowedGameStates = AllowedGameStates.PlayingOnMap)]
private static void ApplyHalfConsciousness()
{
foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()))
{
if (thing is not Zombie zombie)
continue;

var cap = new CapacityImpactorCapacity()
{
capacity = PawnCapacityDefOf.Consciousness
};
var hediff = HediffMaker.MakeHediff(HediffDefOf.BloodLoss, zombie);
hediff.Severity = 0.24f;
zombie.health.hediffSet.AddDirect(hediff);
}
}
}
}
22 changes: 22 additions & 0 deletions Source/TarSlime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class TarSlime : Filth
static readonly Vector2 size2 = new(1.5f, 1.5f);
static readonly Vector2 size3 = new(2f, 2f);

private int fireCounter = 0;

public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
if (map.thingGrid.ThingAt<TarSlime>(Position) != null)
Expand All @@ -32,6 +34,26 @@ public override void Destroy(DestroyMode mode)
base.Destroy(mode);
}

public override void PostApplyDamage(DamageInfo dinfo, float totalDamageDealt)
{
if (dinfo.Def == DamageDefOf.Flame)
{
var n = Mathf.FloorToInt(1 + 2 * Tools.Difficulty());
if (++fireCounter >= n)
{
fireCounter = 0;
if (thickness > 0)
thickness--;
if (thickness == 0)
{
Destroy(DestroyMode.Vanish);
return;
}
}
}
base.PostApplyDamage(dinfo, totalDamageDealt);
}

public override void Print(SectionLayer layer)
{
if (thickness <= 0 || thickness > 4) return;
Expand Down
2 changes: 1 addition & 1 deletion Source/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public static bool ShouldAvoidZombies(Pawn pawn = null)

if (ZombieSettings.Values.betterZombieAvoidance == false)
return false;
return ColonistSettings.Values.ConfigFor(pawn).autoAvoidZombies;
return ColonistSettings.Values.ConfigFor(pawn)?.autoAvoidZombies ?? false;
}

public static bool CanHarmElectricZombies(this Verb verb)
Expand Down
4 changes: 2 additions & 2 deletions Source/WorkGivers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
if (pawn.IsColonist == false || t is not ZombieCorpse corpse)
return false;

if (forced == false && ColonistSettings.Values.ConfigFor(pawn).autoExtractZombieSerum == false)
if (forced == false && (ColonistSettings.Values.ConfigFor(pawn)?.autoExtractZombieSerum ?? false) == false)
return false;

var map = pawn.Map;
Expand Down Expand Up @@ -124,7 +124,7 @@ public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
if (ZombieSettings.Values.hoursAfterDeathToBecomeZombie == -1)
return false;

if (forced == false && ColonistSettings.Values.ConfigFor(pawn).autoDoubleTap == false)
if (forced == false && (ColonistSettings.Values.ConfigFor(pawn)?.autoDoubleTap ?? false) == false)
return false;

if (corpse.InnerPawn.health.hediffSet.GetBrain() == null)
Expand Down
4 changes: 2 additions & 2 deletions Source/ZombieLand.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<OutputPath>..\1.4\Assemblies\</OutputPath>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>3.7.0.0</Version>
<Version>3.8.0.0</Version>
<Copyright>Copyright © 2017</Copyright>
<Configurations>Release;Debug</Configurations>
</PropertyGroup>
Expand Down Expand Up @@ -93,7 +93,7 @@
echo Postprocessing
where ModBuilder 2&gt; nul | find /i "ModBuilder.exe"
if not errorlevel 1 (
ModBuilder AssemblyVersion -file "$(MSBuildProjectDirectory)\$(OutputPath)$(AssemblyName).dll" -save "$(MSBuildProjectName)-version"
ModBuilder AssemblyVersion -file "$(MSBuildProjectDirectory)\$(OutputPath)\$(AssemblyName).dll" -save "$(MSBuildProjectName)-version"
ModBuilder XMLPut -file "$(MSBuildProjectDirectory)\..\About\Manifest.xml" -xpath /Manifest/version -value "{{$(MSBuildProjectName)-version}}"
)
if defined INSTALL_MOD (
Expand Down

0 comments on commit 6e04c72

Please sign in to comment.