This repository has been archived by the owner on Apr 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented smoke into CE shooting mechanics (#216)
Each tile of smoke on the LoS between shooter and target now contributes to visibility error. Smokepop belts now correctly activate when wearer is shot with CE weapon.
- Loading branch information
1 parent
11d0ebc
commit fe6c85d
Showing
10 changed files
with
82 additions
and
19 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using RimWorld; | ||
using Verse; | ||
using UnityEngine; | ||
using Harmony; | ||
|
||
namespace CombatExtended.Harmony | ||
{ | ||
// FIXME: Destructive detour | ||
[HarmonyPatch(typeof(SmokepopBelt), "CheckPreAbsorbDamage")] | ||
static class Harmony_SmokepopBelt | ||
{ | ||
public static bool Prefix(SmokepopBelt __instance, DamageInfo dinfo) | ||
{ | ||
if (!dinfo.Def.isExplosive | ||
&& dinfo.Def.harmsHealth | ||
&& dinfo.Def.externalViolence | ||
&& dinfo.WeaponGear != null | ||
&& (dinfo.WeaponGear.IsRangedWeapon || dinfo.WeaponGear.projectile is ProjectilePropertiesCE)) // Add a check for CE projectiles since we're using them as weaponGear to pass data to our ArmorUtility | ||
{ | ||
ThingDef gas_Smoke = ThingDefOf.Gas_Smoke; | ||
GenExplosion.DoExplosion(__instance.Wearer.Position, __instance.Wearer.Map, __instance.GetStatValue(StatDefOf.SmokepopBeltRadius, true), DamageDefOf.Smoke, null, null, null, null, gas_Smoke, 1f, 1, false, null, 0f, 1); | ||
__instance.Destroy(DestroyMode.Vanish); | ||
} | ||
return false; | ||
} | ||
} | ||
} |