Skip to content

Commit

Permalink
First iteration, playable but still problems, i.e. zombie melee
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Jun 16, 2018
1 parent 5a49e75 commit 4a3483b
Show file tree
Hide file tree
Showing 69 changed files with 302 additions and 277 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>Zombieland</name>
<author>Andreas Pardeike</author>
<url>https://ludeon.com/forums/index.php?topic=32601.0</url>
<targetVersion>0.18.0</targetVersion>
<targetVersion>1.0.0</targetVersion>
<description>Do you like The Walking Dead? Are you afraid of The Undead? Good. Because this mod will give you the Heebie-jeebies!

This is not your average Zombie mod. In Zombieland, Zombies are everywhere! They crawl out of the ground in masses, hunt you down, bash your doors and eat you alive! At night, their blood lust will steer them towards your base. So better be prepared!
Expand Down
11 changes: 5 additions & 6 deletions Defs/Zombie_Damages.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<DamageDef Name="ZombieBite" ParentName="LocalInjuryBase">
<DamageDef Name="ZombieBite">
<defName>ZombieBite</defName>
<label>zombie bite</label>
<workerClass>DamageWorker_Bite</workerClass>
Expand All @@ -15,7 +15,7 @@
<scratchSplitPercentage>0.67</scratchSplitPercentage>
</DamageDef>

<DamageDef Name="SuicideBomb" ParentName="LocalInjuryBase">
<DamageDef Name="SuicideBomb">
<defName>SuicideBomb</defName>
<label>suicide bomb</label>
<externalViolence>true</externalViolence>
Expand All @@ -26,25 +26,24 @@
<harmAllLayersUntilOutside>true</harmAllLayersUntilOutside>
<impactSoundType>Blunt</impactSoundType>
<armorCategory>Blunt</armorCategory>
<spreadOut>true</spreadOut>
<explosionAffectOutsidePartsOnly>false</explosionAffectOutsidePartsOnly>
<explosionCellMote>Mote_BlastDry</explosionCellMote>
<explosionColorCenter>(1, 0, 0)</explosionColorCenter>
<explosionColorEdge>(1, 0.5, 0)</explosionColorEdge>
<soundExplosion>Explosion_Bomb</soundExplosion>

<!-- will be overwritten dynamically from code -->
<explosionDamage>0</explosionDamage>
<defaultDamage>0</defaultDamage>
<explosionBuildingDamageFactor>0</explosionBuildingDamageFactor>
<explosionHeatEnergyPerCell>0</explosionHeatEnergyPerCell>
</DamageDef>

<DamageDef Name="ToxicSplatter">
<defName>ToxicSplatter</defName>
<label>smoke</label>
<label>splatter</label>
<canInterruptJobs>false</canInterruptJobs>
<makesBlood>false</makesBlood>
<explosionDamage>0</explosionDamage>
<defaultDamage>0</defaultDamage>
<explosionCellMote>Mote_BlastDry</explosionCellMote>
<explosionColorCenter>(0, 1, 0, 1)</explosionColorCenter>
<explosionColorEdge>(0, 1, 0, 0.1)</explosionColorEdge>
Expand Down
2 changes: 1 addition & 1 deletion Defs/Zombie_Hediffs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</comps>
<injuryProps>
<painPerSeverity>0.0125</painPerSeverity>
<averagePainPerSeverityOld>0.00625</averagePainPerSeverityOld>
<averagePainPerSeverityPermanent>0.00625</averagePainPerSeverityPermanent>
<bleedRate>0.05</bleedRate>
<canMerge>false</canMerge>
<destroyedLabel>Bitten off by a zombie</destroyedLabel>
Expand Down
2 changes: 1 addition & 1 deletion Defs/Zombie_Kind.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<max>250</max>
</apparelMoney>
<apparelIgnoreSeasons>true</apparelIgnoreSeasons>
<apparelAllowHeadwearChance>0.75</apparelAllowHeadwearChance>
<apparelAllowHeadgearChance>0.75</apparelAllowHeadgearChance>
<backstoryCryptosleepCommonality>0.0</backstoryCryptosleepCommonality>
<forceNormalGearQuality>false</forceNormalGearQuality>
</PawnKindDef>
Expand Down
10 changes: 7 additions & 3 deletions Defs/Zombie_Maneuvers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
<defName>ZombieBite</defName>
<requiredCapacity>ZombieBite</requiredCapacity>
<verb>
<verbClass>Verb_MeleeAttack</verbClass>
<verbClass>Verb_MeleeAttackDamage</verbClass>
<meleeDamageDef>ZombieBite</meleeDamageDef>
</verb>
<combatLogRules>Maneuver_Slash</combatLogRules>
<logEntryDef>MeleeAttack</logEntryDef>
<combatLogRulesHit>Maneuver_Bite_MeleeHit</combatLogRulesHit>
<combatLogRulesDeflect>Maneuver_Bite_MeleeDeflect</combatLogRulesDeflect>
<combatLogRulesMiss>Maneuver_Bite_MeleeMiss</combatLogRulesMiss>
<combatLogRulesDodge>Maneuver_Bite_MeleeDodge</combatLogRulesDodge>
</ManeuverDef>

</Defs>
</Defs>
8 changes: 3 additions & 5 deletions Defs/Zombie_Race.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<altitudeLayer>Pawn</altitudeLayer>
<useHitPoints>false</useHitPoints>
<hasTooltip>false</hasTooltip>
<soundImpactDefault>BulletImpactFlesh</soundImpactDefault>
<soundImpactDefault>BulletImpact_Flesh</soundImpactDefault>
<statBases>
<Mass>70</Mass>
<Flammability>1</Flammability>
Expand Down Expand Up @@ -47,7 +47,6 @@
<ArmorRating_Blunt>0</ArmorRating_Blunt>
<ArmorRating_Sharp>0</ArmorRating_Sharp>
<ArmorRating_Heat>0</ArmorRating_Heat>
<ArmorRating_Electric>0</ArmorRating_Electric>
<MeleeHitChance>0.5</MeleeHitChance>
<MeleeDodgeChance>0.05</MeleeDodgeChance>
</statBases>
Expand Down Expand Up @@ -105,8 +104,7 @@
<lifeExpectancy>9999</lifeExpectancy>
<baseBodySize>1</baseBodySize>
<baseHealthScale>1</baseHealthScale>
<leatherColor>(34,113,39)</leatherColor>
<leatherCommonalityFactor>0</leatherCommonalityFactor>
<leatherDef>Leather_Human</leatherDef>
<foodType>OmnivoreRoughAnimal</foodType>
<body>Human</body>
<nameCategory>HumanStandard</nameCategory>
Expand Down Expand Up @@ -141,4 +139,4 @@
</race>
</ThingDef>

</Defs>
</Defs>
12 changes: 9 additions & 3 deletions Defs/Zombie_Things.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
<thingClass>ZombieLand.BombVest</thingClass>
<label>bomb vest</label>
<description>A vest with explosives.</description>
<techLevel>Transcendent</techLevel>
<techLevel>Archotech</techLevel>
<tickerType>Never</tickerType>
<canBeSpawningInventory>false</canBeSpawningInventory>
<tradeability>Never</tradeability>
<tradeNeverStack>true</tradeNeverStack>
<tradeability>None</tradeability>
<generateCommonality>0</generateCommonality>
<generateAllowChance>0</generateAllowChance>
<scatterableOnMapGen>false</scatterableOnMapGen>
<forceDebugSpawnable>false</forceDebugSpawnable>
<destroyOnDrop>true</destroyOnDrop>
<menuHidden>true</menuHidden>
<selectable>false</selectable>
<smeltable>false</smeltable>
<useHitPoints>false</useHitPoints>
<drawGUIOverlay>false</drawGUIOverlay>
<alwaysHaulable>false</alwaysHaulable>
Expand All @@ -22,6 +27,7 @@
</graphicData>
<statBases>
<DeteriorationRate>0</DeteriorationRate>
<Flammability>0</Flammability>
</statBases>
<apparel>
<wornGraphicPath>BombVest/BombVest</wornGraphicPath>
Expand Down
4 changes: 2 additions & 2 deletions Source/Alerts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override string NameDecorator(Pawn pawn)
.FirstOrDefault();

var percent = string.Format("{0:P0}", tendDuration.InfectionProgress());
return pawn.NameStringShort + ", " + percent;
return pawn.Name.ToStringShort + ", " + percent;
}
}

Expand All @@ -81,7 +81,7 @@ public class Alert_ZombieInfectionProgress : Alert
public string label = "";

public virtual void Prepare() { }
public virtual string NameDecorator(Pawn pawn) { return pawn.NameStringShort; }
public virtual string NameDecorator(Pawn pawn) { return pawn.Name.ToStringShort; }
public virtual bool ColonistSelector(Pawn pawn) { return false; }

public virtual IEnumerable<Pawn> AffectedColonists
Expand Down
4 changes: 2 additions & 2 deletions Source/BombVest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void Explode()
{
var damageDef = new SuicideBombDamage();
var radius = 1f + Find.Storyteller.difficulty.difficulty;
GenExplosion.DoExplosion(pos, map, radius, damageDef, null, -1, null, null, null, null, 1f, 1, false, null, 0f, 1);
GenExplosion.DoExplosion(pos, map, radius, damageDef, null);
}
}

Expand All @@ -36,7 +36,7 @@ public SuicideBombDamage()
var baseDef = CustomDefs.SuicideBomb;
Traverse.IterateFields(baseDef, this, (from, to) => { to.SetValue(from.GetValue()); });

explosionDamage = ScaledValueBetween(8, 120);
defaultDamage = ScaledValueBetween(8, 120);
explosionBuildingDamageFactor = ScaledValueBetween(10, 320);
explosionHeatEnergyPerCell = ScaledValueBetween(8, 128);
}
Expand Down
12 changes: 6 additions & 6 deletions Source/Dialog_ZombieDebugActionMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private void SpawnZombie(ZombieGenerator.ZombieType type, bool appearDirectly)
zombie.rubbleCounter = Constants.RUBBLE_AMOUNT;
zombie.state = ZombieState.Wandering;
}
GenPlace.TryPlaceThing(zombie, UI.MouseCell(), Find.VisibleMap, ThingPlaceMode.Direct, null);
GenPlace.TryPlaceThing(zombie, UI.MouseCell(), Find.CurrentMap, ThingPlaceMode.Direct, null);
zombie.Rotation = Rot4.South;
TickManager.ForceRecalculate();
}
Expand All @@ -28,7 +28,7 @@ protected override void DoListingItems()
if (Current.ProgramState != ProgramState.Playing)
return;

var map = Find.VisibleMap;
var map = Find.CurrentMap;
if (map == null)
return;

Expand Down Expand Up @@ -77,7 +77,7 @@ protected override void DoListingItems()
});
DebugToolMap("Convert: Make Zombie", delegate
{
foreach (var thing in Find.VisibleMap.thingGrid.ThingsAt(UI.MouseCell()))
foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()))
{
var pawn = thing as Pawn;
if (pawn == null || pawn is Zombie)
Expand All @@ -87,7 +87,7 @@ protected override void DoListingItems()
});
DebugToolMap("Apply: Trigger rotting", delegate
{
foreach (var thing in Find.VisibleMap.thingGrid.ThingsAt(UI.MouseCell()))
foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()))
{
var compRottable = thing.TryGetComp<CompRottable>();
if (compRottable != null)
Expand All @@ -96,7 +96,7 @@ protected override void DoListingItems()
});
DebugToolMap("Apply: Add infection", delegate
{
foreach (var thing in Find.VisibleMap.thingGrid.ThingsAt(UI.MouseCell()))
foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()))
{
var pawn = thing as Pawn;
if (pawn == null || pawn is Zombie)
Expand All @@ -120,7 +120,7 @@ protected override void DoListingItems()
});
DebugToolMap("Apply: Remove infection", delegate
{
foreach (var thing in Find.VisibleMap.thingGrid.ThingsAt(UI.MouseCell()))
foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()))
{
var pawn = thing as Pawn;
if (pawn == null || pawn is Zombie)
Expand Down
3 changes: 2 additions & 1 deletion Source/GraphicsDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using UnityEngine;
using Verse;
using System;
using RimWorld;

namespace ZombieLand
{
Expand Down Expand Up @@ -77,7 +78,7 @@ static GraphicsDatabase()

var graphicData = new GraphicData()
{
shaderType = ShaderType.Cutout,
shaderType = ShaderTypeDefOf.Cutout,
texPath = "Twinkie",
graphicClass = typeof(Graphic_Single)
};
Expand Down
24 changes: 0 additions & 24 deletions Source/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,6 @@ public ZombielandMod(ModContentPack content) : base(content)
{
Identifier = content.Identifier;
GetSettings<ZombieSettingsDefaults>();

// HarmonyInstance.DEBUG = true;
var harmony = HarmonyInstance.Create("net.pardeike.zombieland");
harmony.PatchAll(Assembly.GetExecutingAssembly());

// prepare Twinkie
LongEventHandler.QueueLongEvent(() => { Tools.EnableTwinkie(false); }, "", true, null);

// patches for Combat Extended (need to run late or else statics in those classes are not set yet)
LongEventHandler.ExecuteWhenFinished(() =>
{
Patches.Projectile_Launch_Patch.PatchCombatExtended(harmony);
Patches.ArmorUtility_GetPostArmorDamage_Patch.PatchCombatExtended(harmony);
});

// for debugging
/*
DebugRimworldMethodCalls((Type type) =>
{
if (type.Name.Contains("AttackTarget")) return true;
if (type.Name.Contains("_AI")) return true;
if (type.Name.Contains("Reachability")) return true;
return false;
}); */
}

public override void DoSettingsWindowContents(Rect inRect)
Expand Down
Loading

0 comments on commit 4a3483b

Please sign in to comment.