Updated weapon pickup logic to respect startammo (required by OP4CTF)

This commit is contained in:
Marco Cawthorne 2023-06-28 08:53:25 -07:00
parent 930a034a01
commit d4e6604d7a
Signed by: eukara
GPG key ID: CE2032F0A2882A22
9 changed files with 24 additions and 48 deletions

View file

@ -18,4 +18,3 @@
#include "gamerules_ctf.h"
#include "../../../valve/src/server/items.h"
#include "../../../valve/src/server/flashlight.h"
#include "../../../valve/src/server/HLXenMonster.h"

View file

@ -20,41 +20,7 @@ defs.h
../shared/include.src
../../../valve/src/server/HLXenMonster.qc
../../../valve/src/server/monster_apache.qc
../../../valve/src/server/monster_alien_controller.qc
../../../valve/src/server/monster_alien_grunt.qc
../../../valve/src/server/monster_alien_slave.qc
../../../valve/src/server/monster_barnacle.qc
../../../valve/src/server/monster_barney.qc
../../../valve/src/server/monster_barney_dead.qc
../../../valve/src/server/monster_bigmomma.qc
../../../valve/src/server/monster_bloater.qc
../../../valve/src/server/monster_bullchicken.qc
../../../valve/src/server/monster_cockroach.qc
../../../valve/src/server/monster_flyer_flock.qc
../../../valve/src/server/monster_gargantua.qc
../../../valve/src/server/monster_gman.qc
../../../valve/src/server/monster_headcrab.qc
../../../valve/src/server/monster_babycrab.qc
../../../valve/src/server/monster_hevsuit_dead.qc
../../../valve/src/server/monster_houndeye.qc
../../../valve/src/server/monster_human_grunt.qc
../../../valve/src/server/monster_hgrunt_dead.qc
../../../valve/src/server/monster_human_assassin.qc
../../../valve/src/server/monster_ichthyosaur.qc
../../../valve/src/server/monster_leech.qc
../../../valve/src/server/monster_miniturret.qc
../../../valve/src/server/monster_nihilanth.qc
../../../valve/src/server/monster_osprey.qc
../../../valve/src/server/monster_rat.qc
../../../valve/src/server/monster_scientist_dead.qc
../../../valve/src/server/monster_sitting_scientist.qc
../../../valve/src/server/monster_scientist.qc
../../../valve/src/server/monster_sentry.qc
../../../valve/src/server/monster_tentacle.qc
../../../valve/src/server/monster_turret.qc
../../../valve/src/server/monster_zombie.qc
monster_drillsergeant.qc
monster_recruit.qc

View file

@ -28,8 +28,13 @@ player::PowerupThink(void)
health += 1;
m_flPickUpTime = time + 0.5f;
} else if (g_items & ITEM_CTF_BACKPACK) {
print("add ammo!\n");
m_flPickUpTime = time + 0.5f;
m_flPickUpTime = time + 1.0;
if (activeweapon) {
if (Weapons_AddItem(this, activeweapon, 1)) {
print("added ammo\n");
}
}
}
}
#endif

View file

@ -77,9 +77,10 @@ int
w_displacer_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
int addAmmo = (startammo == -1) ? 40 : startammo;
if (pl.ammo_uranium < MAX_A_URANIUM) {
pl.ammo_uranium = bound(0, pl.ammo_uranium + 40, MAX_A_URANIUM);
pl.ammo_uranium = bound(0, pl.ammo_uranium + addAmmo, MAX_A_URANIUM);
} else {
return (0);
}

View file

@ -47,12 +47,13 @@ int
w_eagle_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
int addAmmo = (startammo == -1) ? 7 : startammo;
if (new) {
pl.eagle_mag = 7;
pl.eagle_mag = addAmmo;
} else {
if (pl.ammo_357 < MAX_A_357) {
pl.ammo_357 = bound(0, pl.ammo_357 + 7, MAX_A_357);
pl.ammo_357 = bound(0, pl.ammo_357 + addAmmo, MAX_A_357);
} else {
return (0);
}

View file

@ -45,12 +45,13 @@ int
w_m249_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
int addAmmo = (startammo == -1) ? 50 : startammo;
if (new) {
pl.m249_mag = 50;
pl.m249_mag = addAmmo;
} else {
if (pl.ammo_556 < MAX_A_556) {
pl.ammo_556 = bound(0, pl.ammo_556 + 50, MAX_A_556);
pl.ammo_556 = bound(0, pl.ammo_556 + addAmmo, MAX_A_556);
} else {
return (0);
}

View file

@ -28,9 +28,10 @@ int
w_penguin_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
int addAmmo = (startammo == -1) ? 3 : startammo;
if (pl.ammo_penguin < MAX_A_PENGUIN) {
pl.ammo_penguin = bound(0, pl.ammo_penguin + 3, MAX_A_PENGUIN);
pl.ammo_penguin = bound(0, pl.ammo_penguin + addAmmo, MAX_A_PENGUIN);
} else {
return (0);
}

View file

@ -44,12 +44,13 @@ int
w_sniperrifle_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
int addAmmo = (startammo == -1) ? 5 : startammo;
if (new) {
pl.sniper_mag = 5;
pl.sniper_mag = addAmmo;
} else {
if (pl.ammo_762 < MAX_A_762) {
pl.ammo_762 = bound(0, pl.ammo_762 + 5, MAX_A_762);
pl.ammo_762 = bound(0, pl.ammo_762 + addAmmo, MAX_A_762);
} else {
return (0);
}

View file

@ -180,12 +180,13 @@ int
w_sporelauncher_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
int addAmmo = (startammo == -1) ? 5 : startammo;
if (new) {
pl.sporelauncher_mag = 5;
pl.sporelauncher_mag = addAmmo;
} else {
if (pl.ammo_spore < MAX_A_SPORE) {
pl.ammo_spore = bound(0, pl.ammo_spore + 5, MAX_A_SPORE);
pl.ammo_spore = bound(0, pl.ammo_spore + addAmmo, MAX_A_SPORE);
} else {
return (0);
}