player.zsc (3900B)
1 const CHAN_WINGS = 1215; //custom sound channel for the sounds your wings make. Arbitrary number. 2 3 //TODO: Make dashes uninterruptible 4 class DevilbunnyPlayer : PlayerPawn 5 { 6 //custom input stuff 7 bool inDonArmor; 8 9 actor parryShield; 10 actor thrownSword; //keep track of our sword projectile so we can make it disappear when we recall it 11 12 13 state flyState; 14 state glideState; 15 state furlState; 16 state dashState; 17 18 bool hasSword; //don't throw your sword, dummy 19 bool stunPunch; //if you've picked up the chainsaw replacement 20 21 //it's a lot easier to just bypass the inventory system for player resources 22 int spirit, maxspirit, targspirit; 23 Property StartSpirit : spirit; 24 Property MaxSpirit : maxspirit; 25 int hitpoints, maxhits; 26 Property HitPoints : hitpoints; 27 Property MaxHits : maxhits; 28 29 Default 30 { 31 Gravity 2.0; 32 Speed 1; 33 Health 1; 34 Radius 16; 35 Height 56; 36 Mass 150; 37 Painchance 255; 38 Player.DisplayName "Devilbunny"; 39 Player.StartItem "Pflug"; 40 Player.StartItem "CorpsACorps"; 41 Player.WeaponSlot 1, "CorpsACorps"; 42 Player.WeaponSlot 2, "Pflug"; 43 Player.WeaponSlot 3, "Fleche"; 44 Player.WeaponSlot 4, "ThrowTech"; 45 Player.WeaponSlot 5, "Zornhau"; 46 Player.WeaponSlot 6, "Passe"; 47 Player.SoundClass "devilbunny"; 48 Species "Player"; 49 +THRUSPECIES 50 51 //we don't actually use zdoom's health or armor values, though they do function in mostly the same way 52 DevilbunnyPlayer.StartSpirit 100; 53 DevilbunnyPlayer.MaxSpirit 400; 54 55 DevilbunnyPlayer.HitPoints 100; 56 DevilbunnyPlayer.MaxHits 100; 57 } 58 59 override void PostBeginPlay() 60 { 61 self.inDonArmor = FALSE; 62 63 self.hasSword = 1; 64 self.stunPunch = 0; 65 self.hasArmorType = 0; 66 self.flyState = self.ResolveState("Fly"); 67 self.glideState = self.ResolveState("Glide"); 68 self.furlState = self.ResolveState("Furl"); 69 self.dashState = self.ResolveState("Dash"); 70 71 self.parryShield = spawn("ParryAct", pos); 72 self.summonTarget = null; 73 self.targetRange = 4000; 74 self.targetPriority = 0; 75 76 //movement vars 77 self.flightRoll = 0; 78 self.flightYaw = 0; 79 Super.PostBeginPlay(); 80 } 81 //Don't want the FOV resetting until after we are done dashing 82 override void CheckFOV() 83 { 84 if (InStateSequence(CurState, dashState)) 85 { 86 return; 87 } 88 Super.CheckFOV(); 89 } 90 91 92 override void PlayerThink() 93 { 94 Super.PlayerThink(); 95 96 97 if (hitpoints <= 0) 98 { 99 targspirit = 0; 100 if (spirit <= 0) 101 { 102 A_Die(); 103 } 104 } 105 106 HandleSTarget(); 107 108 if (spirit > targspirit) 109 { 110 spirit -= 1; 111 } 112 113 updateParryShield(); 114 } 115 116 117 118 void TakeOffArmor() 119 { 120 if (!player.onground) { return; } 121 122 if (hasArmorType == 1) 123 { 124 spawn("Brigandine", pos, NO_REPLACE); 125 } 126 else if (hasArmorType == 2) 127 { 128 spawn("MariSkull", pos, NO_REPLACE); 129 } 130 131 A_StartSound("swordland", CHAN_BODY); 132 hasArmorType = 0; //unarmored 133 134 } 135 136 States 137 { 138 Spawn: 139 PLAY A 1 A_StopSound(CHAN_WINGS); 140 loop; 141 See: 142 PLAY ABCD 4; 143 loop; 144 Fly: 145 TNT1 A 0 A_StartSound("bun/wingflap", CHAN_WINGS, CHANF_DEFAULT, 1.0, ATTN_IDLE, 1.0); 146 PLAY ABCD 6; 147 goto Spawn; 148 Glide: 149 PLAY A 15; 150 TNT1 A 0 A_StartSound("bun/glide", CHAN_WINGS, CHANF_LOOP); 151 PLAY A 30; 152 goto Glide + 2; 153 Furl: 154 TNT1 A 0 A_StartSound("bun/wingfurl", CHAN_WINGS); 155 PLAY B 6; 156 goto Furl + 1; 157 Dash: 158 TNT1 A 0 A_StopSound(CHAN_WINGS); 159 PLAY EEEEEEEEEEEEEEEEEEEE 1 160 { 161 if (vel.Length() <= 10) 162 { 163 SetStateLabel("Spawn"); 164 } 165 } 166 goto Spawn; 167 Pain: 168 TNT1 A 0; 169 TNT1 A 0; 170 PLAY G 4 A_Pain; 171 Goto Spawn; 172 Death: 173 // PLAY H 0 A_SpawnProjectile("BigFeatherBurst", 32, 20, 180, CMF_AIMDIRECTION); 174 PLAY H 10; 175 PLAY I 10 A_StartSound("bun/death", CHAN_BODY, CHANF_DEFAULT); 176 PLAY J 10 A_NoBlocking; 177 PLAY KLM 10; 178 PLAY N -1; 179 Stop; 180 } 181 }