Guest User

Hollow Knight but with fall damage

a guest
Sep 3rd, 2021
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using GlobalEnums;
  2. using Modding;
  3. using Vasi;
  4.  
  5. namespace FallDamageMod {
  6.     public class FallDamageMod : Mod {
  7.  
  8.         public override void Initialize() {
  9.             On.HeroController.DoHardLanding += HardLand;
  10.             On.PlayMakerFSM.OnEnable += ModifyFSM;
  11.         }
  12.  
  13.         private void ModifyFSM(On.PlayMakerFSM.orig_OnEnable orig, PlayMakerFSM self) {
  14.             if (self.FsmName == "Control" && self.name == "Initial Fall Impact") {
  15.                 self.GetState("Land").AddMethod(() => Die(HeroController.instance));
  16.             }
  17.  
  18.             orig(self);
  19.         }
  20.  
  21.         private void HardLand(On.HeroController.orig_DoHardLanding orig, HeroController self) {
  22.             Die(self);
  23.         }
  24.  
  25.         private void Die(HeroController hc) {
  26.             hc.TakeDamage(hc.gameObject, CollisionSide.bottom, 9999, 0);
  27.         }
  28.  
  29.         public override string GetVersion() {
  30.             return "1.0";
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment