Skip to content

Commit

Permalink
adds roping confused (low consciousness) zombies
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Jan 19, 2022
1 parent beb4df5 commit 8315d81
Show file tree
Hide file tree
Showing 20 changed files with 254 additions and 42 deletions.
Binary file modified 1.3/Assemblies/ZombieLand.dll
Binary file not shown.
7 changes: 7 additions & 0 deletions About/Settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,10 @@ MAX_WEAPON_RANGE = 30.0
// Minimum distance between a zombie and a pawn for allowing the zombie to
// attack the pawn. This value is the squared distance! Default is 1.5
MIN_ATTACKDISTANCE_SQUARED = 2.25

// If consciousness falls below this value, zombies get confused and incapable
// of action or movement
MIN_CONSCIOUSNESS = 0.25

// The maximum distance between colonist and zombie while roping
MAX_ROPING_DISTANCE_SQUARED = 144
7 changes: 7 additions & 0 deletions Defs/Zombie_Jobs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@
<allowOpportunisticPrefix>true</allowOpportunisticPrefix>
</JobDef>

<JobDef>
<defName>RopeZombie</defName>
<driverClass>ZombieLand.JobDriver_RopeZombie</driverClass>
<reportString>roping TargetA.</reportString>
<allowOpportunisticPrefix>false</allowOpportunisticPrefix>
</JobDef>

</Defs>
1 change: 1 addition & 0 deletions Languages/ChineseSimplified/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<CopyButton>复制</CopyButton>
<PasteSettings>从剪贴板替换设置</PasteSettings>
<PasteButton>插入设置</PasteButton>
<RopeZombie>捕捉这个僵尸</RopeZombie>

<ColonistsBittenByZombie>殖民者被丧尸咬伤</ColonistsBittenByZombie>
<ColonistsBittenByZombieDesc>殖民者被丧尸咬伤了,目前尚不清楚他们是否被感染:\n\n{0}\n密切关注他们的伤口,因为感染需要一段时间后才能被发现。</ColonistsBittenByZombieDesc>
Expand Down
1 change: 1 addition & 0 deletions Languages/ChineseTraditional/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<CopyButton>複製</CopyButton>
<PasteSettings>從剪貼板替換設置</PasteSettings>
<PasteButton>插入設置</PasteButton>
<RopeZombie>捕捉這個殭屍</RopeZombie>

<ColonistsBittenByZombie>殖民者被殭屍咬傷</ColonistsBittenByZombie>
<ColonistsBittenByZombieDesc>殖民者被殭屍咬傷了,目前尚不清楚他們是否被感染:\n\n{0}\n密切關注他們的傷口,因為感染需要一段時間後才能被發現。</ColonistsBittenByZombieDesc>
Expand Down
1 change: 1 addition & 0 deletions Languages/English/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<CopyButton>Copy</CopyButton>
<PasteSettings>Replace settings from clipboard</PasteSettings>
<PasteButton>Paste</PasteButton>
<RopeZombie>Capture this zombie</RopeZombie>

<ColonistsBittenByZombie>Colonist bitten by zombie</ColonistsBittenByZombie>
<ColonistsBittenByZombieDesc>These colonists have been bitten by a zombie. At this point, it is unclear if they develop an infection:\n\n{0}\nMonitor their wounds closely because infections take some time to develop.</ColonistsBittenByZombieDesc>
Expand Down
1 change: 1 addition & 0 deletions Languages/French/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<CopyButton>Copie</CopyButton>
<PasteSettings>Remplacer les paramètres depuis le presse-papiers</PasteSettings>
<PasteButton>Coller</PasteButton>
<RopeZombie>Capturer ce zombie</RopeZombie>

<ColonistsBittenByZombie>Colon mordu par un zombie</ColonistsBittenByZombie>
<ColonistsBittenByZombieDesc>Ce colon a été mordu par un zombie. A ce stade, on ne sait pas s’il va développer l’infection. Surveillez les blessures car les infections prennent du temps à se développer</ColonistsBittenByZombieDesc>
Expand Down
1 change: 1 addition & 0 deletions Languages/German/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<CopyButton>Kopieren</CopyButton>
<PasteSettings>Erst die Einstellungen mit dem Inhalt der Zwischenablage</PasteSettings>
<PasteButton>Einsetzen</PasteButton>
<RopeZombie>Fang diesen Zombie</RopeZombie>

<ColonistsBittenByZombie>Kolonist wurde von einem Zombie gebissen</ColonistsBittenByZombie>
<ColonistsBittenByZombieDesc>Folgende Kolonisten wurden von einem Zombie gebissen. Noch ist unklar ob sich daraus eine Infektion entwickelt:\n\n{0}\nBeobachten Sie die Wunden um herauszufinden ob eine Infektion stattfinden wird.</ColonistsBittenByZombieDesc>
Expand Down
1 change: 1 addition & 0 deletions Languages/Russian/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<CopyButton>Копировать</CopyButton>
<PasteSettings>Заменить настройки из буфера обмена</PasteSettings>
<PasteButton>Вставить</PasteButton>
<RopeZombie>Захват зомби</RopeZombie>

<ColonistsBittenByZombie>Колонист, укушенный зомби</ColonistsBittenByZombie>
<ColonistsBittenByZombieDesc>Эти колонисты были укушены зомби. На данный момент неясно, разовьется ли у них инфекция:\n\n{0}\nВнимательно следите за их ранами, потому что инфекциям нужно время, чтобы проявиться.</ColonistsBittenByZombieDesc>
Expand Down
1 change: 1 addition & 0 deletions Languages/Turkish/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<CopyButton>Kopyala</CopyButton>
<PasteSettings>Panodan ayarları ayarla</PasteSettings>
<PasteButton>Yapıştırmak</PasteButton>
<RopeZombie>Bu zombiyi yakala</RopeZombie>

<ColonistsBittenByZombie>Kolonist zombi tarafından ısırıldı</ColonistsBittenByZombie>
<ColonistsBittenByZombieDesc>Bu kolonistler bir zombi tarafından ısırıldı. Bu noktada, bir enfeksiyon geliştirmeleri net değil:\n\n{0}\nYaralarını yakından izleyin çünkü enfeksiyonların gelişmesi biraz zaman alır.</ColonistsBittenByZombieDesc>
Expand Down
1 change: 1 addition & 0 deletions Source/ColonistSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public override void ExposeData()
{
base.ExposeData();
colonists ??= new Dictionary<Pawn, ColonistConfig>();
_ = colonists.RemoveAll(pair => pair.Key == null || pair.Key.Destroyed == false && pair.Key.Spawned == false);
Scribe_Collections.Look(ref colonists, "colonists", LookMode.Reference, LookMode.Deep, ref colonistsKeysWorkingList, ref colonistsValuesWorkingList);
}
}
Expand Down
7 changes: 7 additions & 0 deletions Source/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ static Constants()
public static readonly float MAX_WEAPON_RANGE = 30f;
public static readonly float MIN_ATTACKDISTANCE_SQUARED = 2.25f;
public static readonly float MIN_CONSCIOUSNESS = 0.25f;
public static readonly float MAX_ROPING_DISTANCE_SQUARED = 144;

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 @@ -299,6 +300,12 @@ static Constants()
MaterialPool.MatFrom("BeingHealed", ShaderDatabase.Mote, new Color(1f, 1f, 1f, 0.9f)),
MaterialPool.MatFrom("BeingHealed", ShaderDatabase.Mote, new Color(1f, 1f, 1f, 1.0f))
};
public static readonly Material[] RopeLineMat = new[]
{
MaterialPool.MatFrom(Pawn_RopeTracker.RopeTexPath, ShaderDatabase.Transparent, GenColor.FromBytes(255, 0, 0, 255)),
MaterialPool.MatFrom(Pawn_RopeTracker.RopeTexPath, ShaderDatabase.Transparent, GenColor.FromBytes(209, 135, 62, 255)),
MaterialPool.MatFrom(Pawn_RopeTracker.RopeTexPath, ShaderDatabase.Transparent, GenColor.FromBytes(99, 70, 41, 255)),
};

public static readonly System.Random random = new System.Random();

Expand Down
39 changes: 39 additions & 0 deletions Source/JobDriver_RopeZombie.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Collections.Generic;
using Verse;
using Verse.AI;

namespace ZombieLand
{
public class JobDriver_RopeZombie : JobDriver
{
bool ZombieIsRopable()
{
var thing = job.GetTarget(TargetIndex.A).Thing;
if (!(thing is Zombie zombie) || zombie.Destroyed || zombie.Spawned == false)
return false;
return zombie.ropedBy == null;
}

public override bool TryMakePreToilReservations(bool errorOnFailed)
{
var thing = job.GetTarget(TargetIndex.A).Thing;
if (pawn.CanReach(job.GetTarget(TargetIndex.A), PathEndMode.Touch, Danger.Deadly) == false)
return false;
return ZombieIsRopable();
}

public override IEnumerable<Toil> MakeNewToils()
{
_ = this.FailOnDespawnedOrNull(TargetIndex.A);
yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch);
yield return new Toil
{
initAction = delegate ()
{
var zombie = job.GetTarget(TargetIndex.A).Thing as Zombie;
zombie.ropedBy = pawn;
}
};
}
}
}
6 changes: 6 additions & 0 deletions Source/JobDriver_Stumble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ void TickAction()
if (this.ShouldDie(zombie))
return;

if (this.Roping(zombie))
{
this.ExecuteMove(zombie, zombie.Map.GetGrid());
return;
}

if (ZombieStateHandler.DownedOrUnconsciousness(zombie))
return;

Expand Down
1 change: 1 addition & 0 deletions Source/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static class CustomDefs
public static JobDef Sabotage;
public static JobDef ExtractZombieSerum;
public static JobDef DoubleTap;
public static JobDef RopeZombie;
public static RecipeDef CureZombieInfection;
public static ThingDef Zombie;
public static ThingDef Corpse_Zombie;
Expand Down
Loading

0 comments on commit 8315d81

Please sign in to comment.