SERVER: Remove Bowie Knife on Re-Spawn

This commit is contained in:
MotoLegacy 2024-11-24 18:33:55 -08:00
parent 217e34b05e
commit 75152b9ad6
4 changed files with 10 additions and 9 deletions

View file

@ -225,7 +225,7 @@ var struct guninventory_struct
//Knife
.float knife_delay;
.float bowie;
.float has_bowie_knife;
//Grenades
.float grenades;

View file

@ -314,7 +314,7 @@ void () WallWeapon_TouchTrigger =
}
else if (self.weapon == W_BOWIE)
{
if (!other.bowie) {
if (!other.has_bowie_knife) {
useprint(other, 4, self.cost2, self.weapon);
if (other.button7)
{
@ -335,7 +335,7 @@ void () WallWeapon_TouchTrigger =
tempz = self;
self = other;
Set_W_Frame(15, 30, 2.75, 0, 0, W_PlayTakeOut, "models/weapons/knife/v_bowie.mdl", false, S_BOTH, true);
self.bowie = 1;
self.has_bowie_knife = true;
}
}
}

View file

@ -926,7 +926,8 @@ void() PlayerSpawn =
setsize(self, PLAYER_MINS_STANDING, PLAYER_MAXS_STANDING);
}
self.stance = 2;
self.has_bowie_knife = false;
self.stance = PLAYER_STANCE_STAND;
self.new_ofs_z = self.view_ofs_z;
self.oldz = self.origin_z;
self.grenades = self.grenades | 1; // add frag grenades to player inventory

View file

@ -1268,17 +1268,17 @@ void() WeaponCore_Melee =
// Apply damage to the entity.
if (trace_ent.takedamage) {
float melee_damage = WepDef_CalculateMeleeDamage(self.weapon, self.bowie);
float melee_damage = WepDef_CalculateMeleeDamage(self.weapon, self.has_bowie_knife);
DamageHandler (trace_ent, self, melee_damage, DMG_TYPE_MELEE);
}
}
}
// Grab animation stats for our melee weapon.
float start_frame = WepDef_GetMeleeFirstFrame(self.weapon, did_lunge, self.bowie);
float end_frame = WepDef_GetMeleeLastFrame(self.weapon, did_lunge, self.bowie);
float anim_duration = WepDef_GetMeleeAnimDuration(self.weapon, did_lunge, self.bowie);
string model_path = WepDef_GetMeleeModel(self.weapon, self.bowie);
float start_frame = WepDef_GetMeleeFirstFrame(self.weapon, did_lunge, self.has_bowie_knife);
float end_frame = WepDef_GetMeleeLastFrame(self.weapon, did_lunge, self.has_bowie_knife);
float anim_duration = WepDef_GetMeleeAnimDuration(self.weapon, did_lunge, self.has_bowie_knife);
string model_path = WepDef_GetMeleeModel(self.weapon, self.has_bowie_knife);
// Ensure we play the Take Out animation if the melee model is not our active weapon
void() end_func;