item_armorX/item_health: respect 'deathmatch' cvar regarding respawn behaviour

This commit is contained in:
Marco Cawthorne 2023-04-15 14:47:51 -07:00
parent 0cdc3a1caa
commit d0e762788e
Signed by: eukara
GPG key ID: CE2032F0A2882A22
3 changed files with 17 additions and 12 deletions

View file

@ -35,11 +35,15 @@ item_ammo::Touch(entity eToucher)
Weapons_RefreshAmmo(pl);
Logging_Pickup(eToucher, this, __NULL__);
if (real_owner || cvar("sv_playerslots") == 1) {
if (cvar("deathmatch") == 0 || cvar("deathmatch") == 4) {
Destroy();
} else {
Disappear();
ScheduleThink(Respawn, 30.0f);
if (cvar("deathmatch") == 3 || cvar("deathmatch") == 5)
ScheduleThink(Respawn, 15.0f);
else
ScheduleThink(Respawn, 30.0f);
}
}
@ -59,10 +63,10 @@ item_ammo::Respawn(void)
ReleaseThink();
if (real_owner && time > 30.0f)
if (time > 30.0f)
Sound_Play(this, CHAN_ITEM, "dmc_item.respawn");
droptofloor();
DropToFloor();
}
void

View file

@ -32,14 +32,14 @@ item_armor::Touch(entity eToucher)
player pl = (player)eToucher;
Sound_Play(eToucher, CHAN_ITEM, strcat(noise, ".pickup"));
Weapons_RefreshAmmo(pl);
Logging_Pickup(eToucher, this, __NULL__);
if (real_owner || cvar("sv_playerslots") == 1) {
/* TODO: if deathmatch is 4 and player invincible, don't pick up */
if (cvar("deathmatch") == 0 || cvar("deathmatch") == 2) {
Destroy();
} else {
Disappear();
ScheduleThink(Respawn, 30.0f);
ScheduleThink(Respawn, 20.0f);
}
}
@ -54,10 +54,10 @@ item_armor::Respawn(void)
ReleaseThink();
if (real_owner && time > 30.0f)
if (time > 20.0f)
Sound_Play(this, CHAN_ITEM, "dmc_item.respawn");
droptofloor();
DropToFloor();
}
void

View file

@ -72,7 +72,8 @@ item_health::Touch(entity eToucher)
Logging_Pickup(eToucher, this, __NULL__);
if (real_owner || cvar("sv_playerslots") == 1) {
/* TODO: if deathmatch is 4 and player invincible, don't pick up */
if (cvar("deathmatch") == 0 || cvar("deathmatch") == 2) {
Destroy();
} else {
Disappear();
@ -91,10 +92,10 @@ item_health::Respawn(void)
ReleaseThink();
if (real_owner && time > 30.0f)
if (time > 30.0f)
Sound_Play(this, CHAN_ITEM, "dmc_item.respawn");
droptofloor();
DropToFloor();
}
void