Skip to content

Commit

Permalink
v4.4.1 fixes a bug from upgrading settings that prevented ZL from sta…
Browse files Browse the repository at this point in the history
…rting
  • Loading branch information
pardeike committed Nov 8, 2023
1 parent c2323ff commit 203012c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 26 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<li>Multiplayer</li>
</incompatibleWith>
<packageId>brrainz.zombieland</packageId>
<modVersion>4.4.0.0</modVersion>
<modVersion>4.4.1.0</modVersion>
<steamAppId>928376710</steamAppId>
<description>Do you like The Walking Dead? Are you afraid of The Undead? Good. Because this mod will give you the Heebie-jeebies!

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>4.4.0.0</version>
<version>4.4.1.0</version>
<targetVersions>
<li>1.4.0</li>
</targetVersions>
Expand Down
Binary file modified Assemblies/ZombieLand.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ModName>ZombieLand</ModName>
<ModFileName>ZombieLand</ModFileName>
<Repository>https://github.com/pardeike/Zombieland</Repository>
<ModVersion>4.4.0.0</ModVersion>
<ModVersion>4.4.1.0</ModVersion>
<ProjectGuid>{34AA2AF2-8E82-4C5B-8ABA-9AC53DA7C110}</ProjectGuid>
</PropertyGroup>

Expand Down
26 changes: 10 additions & 16 deletions Source/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ static Constants()
public static float ZOMBIE_HIT_CHANCE_TRACKING = 0.7f;
[Constant(1, "The number of cells out of the 8 surrounding cells of a zombie that get selected for moving")]
public static int NUMBER_OF_TOP_MOVEMENT_PICKS = 3;
[Constant(1, "The chance a zombie chooses a random movement when raging (multiplied by the number of zombies on the current and the destination positions together)")]
public static float CLUSTER_AVOIDANCE_CHANCE = 0.25f;
[Constant(1, "The chance a raging zombie does not go straight to their goal thus spreading them out a bit to keep it organic")]
public static float DIVERTING_FROM_RAGE = 0.1f;
[Constant(1, "Grouping of zombies, the higher the number the quicker will zombies loose interest in a trace if there are many zombies close to each other")]
public static int ZOMBIE_CLOGGING_FACTOR = 10000;
[Constant(1, "When zombies kill, this radius is applied to disburst them from the target in a random way")]
Expand All @@ -151,10 +147,6 @@ static Constants()
public static int ZOMBIE_COUNT_TO_TRIGGER_RAGE = 0;
[Constant(1, "When easy kill is turned on, what is the chance to skip \"missed a shot\" on long distance shots from a colonist")]
public static float COLONISTS_HIT_ZOMBIES_CHANCE = 0.9f;
[Constant(1, "With Combat Extended, sets the output of the method CombatExtended/ArmorUtilityCE.cs:GetPenetrationValue()")]
public static float COMBAT_EXTENDED_ARMOR_PENETRATION = 0.1f;
[Constant(1, "The time (in ticks) between healing a zombie wounds")]
public static int ZOMBIE_HEALING_TICKS = 3000;

// zombie incidents
//
Expand All @@ -176,14 +168,13 @@ static Constants()

// -- other constants --

public static readonly int MIN_DELTA_TICKS = 20;
public static readonly int MAX_DELTA_TICKS = 4;
public static readonly int RUBBLE_MIN_DELTA_TICKS = 20;
public static readonly int RUBBLE_MAX_DELTA_TICKS = 4;
public static readonly int RUBBLE_AMOUNT = 50;
public static readonly float MAX_HEIGHT = 0.6f;
public static readonly float MIN_SCALE = 0.05f;
public static readonly float MAX_SCALE = 0.3f;
public static readonly float ZOMBIE_LAYER = Altitudes.AltitudeFor(AltitudeLayer.Pawn) - 0.005f;
public static readonly float EMERGE_DELAY = 0.8f;
public static readonly float RUBBLE_MAX_HEIGHT = 0.6f;
public static readonly float RUBBLE_MIN_SCALE = 0.05f;
public static readonly float RUBBLE_MAX_SCALE = 0.3f;
public static readonly float RUBBLE_EMERGE_DELAY = 0.8f;

public static readonly Material RAGE_EYE = MaterialPool.MatFrom("RageEye", ShaderDatabase.Mote);
public static readonly Material BOMB_LIGHT = MaterialPool.MatFrom("BombLight", ShaderDatabase.MoteGlow);
Expand Down Expand Up @@ -447,7 +438,10 @@ public static bool Apply(Dictionary<string, VersionedValue> dict)
var value = info.value;

var valueVersion = info.version;
var fieldVersion = AccessTools.Field(typeof(Constants), key).GetCustomAttribute<ConstantAttribute>().Version;
var attributes = AccessTools.Field(typeof(Constants), key)?.GetCustomAttribute<ConstantAttribute>();
if (attributes == null)
continue;
var fieldVersion = attributes.Version;
if (valueVersion != fieldVersion)
{
needsSave = true;
Expand Down
14 changes: 7 additions & 7 deletions Source/Zombie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ void HandleRubble()
var idx = Rand.Range(rubbleCounter * 4 / 5, rubbleCounter);
rubbles.Insert(idx, Rubble.Create(rubbleCounter / (float)Constants.RUBBLE_AMOUNT));

var deltaTicks = Constants.MIN_DELTA_TICKS + (float)(Constants.MAX_DELTA_TICKS - Constants.MIN_DELTA_TICKS) / Math.Min(1, rubbleCounter * 2 - Constants.RUBBLE_AMOUNT);
var deltaTicks = Constants.RUBBLE_MIN_DELTA_TICKS + (float)(Constants.RUBBLE_MAX_DELTA_TICKS - Constants.RUBBLE_MIN_DELTA_TICKS) / Math.Min(1, rubbleCounter * 2 - Constants.RUBBLE_AMOUNT);
rubbleTicks = (int)deltaTicks;

rubbleCounter++;
Expand All @@ -539,10 +539,10 @@ void RenderRubble(Vector3 drawLoc)
{
foreach (var r in rubbles)
{
var scale = Constants.MIN_SCALE + (Constants.MAX_SCALE - Constants.MIN_SCALE) * r.scale;
var scale = Constants.RUBBLE_MIN_SCALE + (Constants.RUBBLE_MAX_SCALE - Constants.RUBBLE_MIN_SCALE) * r.scale;
var x = 0f + r.pX / 2f;
var bottomExtend = Mathf.Abs(r.pX) / 6f;
var y = -0.5f + Mathf.Max(bottomExtend, r.pY - r.drop) * (Constants.MAX_HEIGHT - scale / 2f) + (scale - Constants.MAX_SCALE) / 2f;
var y = -0.5f + Mathf.Max(bottomExtend, r.pY - r.drop) * (Constants.RUBBLE_MAX_HEIGHT - scale / 2f) + (scale - Constants.RUBBLE_MAX_SCALE) / 2f;
var pos = drawLoc + new Vector3(x, 0, y);
pos.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn + 1);
var rot = Quaternion.Euler(0f, r.rot * 360f, 0f);
Expand Down Expand Up @@ -699,9 +699,9 @@ public static Quaternion ZombieAngleAxis(float angle, Vector3 axis, Pawn pawn)
return result;

var progress = zombie.rubbleCounter / (float)Constants.RUBBLE_AMOUNT;
if (progress >= Constants.EMERGE_DELAY)
if (progress >= Constants.RUBBLE_EMERGE_DELAY)
{
var bodyRot = GenMath.LerpDouble(Constants.EMERGE_DELAY, 1, 90, 0, progress);
var bodyRot = GenMath.LerpDouble(Constants.RUBBLE_EMERGE_DELAY, 1, 90, 0, progress);
result *= Quaternion.Euler(Vector3.right * bodyRot);
}
return result;
Expand All @@ -712,9 +712,9 @@ public void Render(PawnRenderer renderer, Vector3 drawLoc)
drawLoc.x = (int)(drawLoc.x) + 0.5f;

var progress = rubbleCounter / (float)Constants.RUBBLE_AMOUNT;
if (progress >= Constants.EMERGE_DELAY)
if (progress >= Constants.RUBBLE_EMERGE_DELAY)
{
var bodyOffset = GenMath.LerpDouble(Constants.EMERGE_DELAY, 1, -0.45f, 0, progress);
var bodyOffset = GenMath.LerpDouble(Constants.RUBBLE_EMERGE_DELAY, 1, -0.45f, 0, progress);
renderer.RenderPawnInternal(drawLoc + new Vector3(0, 0, bodyOffset), 0f, true, Rot4.South, renderer.CurRotDrawMode, PawnRenderFlags.DrawNow);
}

Expand Down

0 comments on commit 203012c

Please sign in to comment.