/* * Copyright (c) 2023 Marco Cawthorne * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ class item_ammo:NSRenderableEntity { void(void) item_ammo; virtual void(void) Spawned; virtual void(void) Respawn; virtual void(entity) Touch; }; void item_ammo::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } player pl = (player)eToucher; Sound_Play(eToucher, CHAN_ITEM, "ammo.pickup"); Weapons_RefreshAmmo(pl); Logging_Pickup(eToucher, this, __NULL__); if (cvar("deathmatch") == 0 || cvar("deathmatch") == 4) { Destroy(); } else { Disappear(); if (cvar("deathmatch") == 3 || cvar("deathmatch") == 5) ScheduleThink(Respawn, 15.0f); else ScheduleThink(Respawn, 30.0f); } } void item_ammo::Respawn(void) { SetSolid(SOLID_TRIGGER); SetMovetype(MOVETYPE_TOSS); SetOrigin(GetSpawnOrigin()); if (HasSpawnFlags(1)) SetModel(noise); else SetModel(GetSpawnModel()); SetSize([-16,-16,0],[16,16,16]); ReleaseThink(); if (time > 30.0f) Sound_Play(this, CHAN_ITEM, "dmc_item.respawn"); DropToFloor(); } void item_ammo::Spawned(void) { super::Spawned(); Sound_Precache("ammo.pickup"); Sound_Precache("dmc_item.respawn"); precache_model(model); } void item_ammo::item_ammo(void) { m_oldModel = model; } /*QUAKED item_shells (0 0 0.8) (-16 -16 0) (16 16 32) DEATHMATCH CLASSIC (1999) ENTITY Shells for the shotguns. -------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- model="models/w_shotbox_big.mdl" */ class item_shells:item_ammo { void(void) item_shells; virtual void(entity) Touch; }; void item_shells::item_shells(void) { model = "models/w_shotbox.mdl"; noise = "models/w_shotbox_big.mdl"; } void item_shells::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } if (eToucher.classname == "player") { player pl = (player)eToucher; if (pl.ammo_shells < MAX_A_SHELLS) { if (HasSpawnFlags(1)) pl.ammo_shells = bound(0, pl.ammo_shells + 40, MAX_A_SHELLS); else pl.ammo_shells = bound(0, pl.ammo_shells + 20, MAX_A_SHELLS); item_ammo::Touch(eToucher); } } } /*QUAKED item_spikes (0 0 0.8) (-16 -16 0) (16 16 32) DEATHMATCH CLASSIC (1999) ENTITY Nails for the (Super) Nail Gun -------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- model="models/b_nail1.mdl" */ class item_spikes:item_ammo { void(void) item_spikes; virtual void(entity) Touch; }; void item_spikes::item_spikes(void) { model = "models/b_nail0.mdl"; noise = "models/b_nail1.mdl"; } void item_spikes::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } if (eToucher.classname == "player") { player pl = (player)eToucher; if (pl.ammo_nails < MAX_A_NAILS) { if (HasSpawnFlags(1)) pl.ammo_nails = bound(0, pl.ammo_nails + 50, MAX_A_NAILS); else pl.ammo_nails = bound(0, pl.ammo_nails + 25, MAX_A_NAILS); item_ammo::Touch(eToucher); } } } /*QUAKED item_rockets (0 0 0.8) (-16 -16 0) (16 16 32) DEATHMATCH CLASSIC (1999) ENTITY Rockets for the Grenade & Rocket Launcher -------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- model="models/w_rpgammo_big.mdl" */ class item_rockets:item_ammo { void(void) item_rockets; virtual void(entity) Touch; }; void item_rockets::item_rockets(void) { model = "models/w_rpgammo.mdl"; noise = "models/w_rpgammo_big.mdl"; } void item_rockets::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } if (eToucher.classname == "player") { player pl = (player)eToucher; if (pl.ammo_rockets < MAX_A_ROCKETS) { if (HasSpawnFlags(1)) pl.ammo_rockets = bound(0, pl.ammo_rockets + 10, MAX_A_ROCKETS); else pl.ammo_rockets = bound(0, pl.ammo_rockets + 5, MAX_A_ROCKETS); item_ammo::Touch(eToucher); } } } /*QUAKED item_cells (0 0 0.8) (-16 -16 0) (16 16 32) DEATHMATCH CLASSIC (1999) ENTITY Cells for the Lightning Gun -------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- model="models/w_batteryl.mdl" */ class item_cells:item_ammo { void(void) item_cells; virtual void(entity) Touch; }; void item_cells::item_cells(void) { model = "models/w_battery.mdl"; noise = "models/w_batteryl.mdl"; } void item_cells::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } if (eToucher.classname == "player") { player pl = (player)eToucher; if (pl.ammo_cells < MAX_A_CELLS) { if (HasSpawnFlags(1)) pl.ammo_cells = bound(0, pl.ammo_cells + 12, MAX_A_CELLS); else pl.ammo_cells = bound(0, pl.ammo_cells + 6, MAX_A_CELLS); item_ammo::Touch(eToucher); } } } /* extra items start here */ /*QUAKED item_lava_spikes (0 0 0.8) (-16 -16 0) (16 16 32) Lava Spikes from Mission Pack 2 by Rogue Entertainment -------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- model="models/b_lnail.mdl" */ class item_lava_spikes:item_ammo { void(void) item_lava_spikes; virtual void(entity) Touch; }; void item_lava_spikes::item_lava_spikes(void) { model = "models/b_lnail0.mdl"; noise = "models/b_lnail1.mdl"; } void item_lava_spikes::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } if (eToucher.classname == "player") { player pl = (player)eToucher; if (pl.ammo_lava_nails < 200) { if (HasSpawnFlags(1)) pl.ammo_lava_nails = bound(0, pl.ammo_lava_nails + 50, 200); else pl.ammo_lava_nails = bound(0, pl.ammo_lava_nails + 25, 200); item_ammo::Touch(eToucher); } } } /*QUAKED item_multi_rockets (0 0 0.8) (-16 -16 0) (16 16 32) Lava Spikes from Mission Pack 2 by Rogue Entertainment -------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- model="models/b_lnail.mdl" */ class item_multi_rockets:item_ammo { void(void) item_multi_rockets; virtual void(entity) Touch; }; void item_multi_rockets::item_multi_rockets(void) { model = "models/b_mrock0.mdl"; noise = "models/b_mrock1.mdl"; } void item_multi_rockets::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } if (eToucher.classname == "player") { player pl = (player)eToucher; if (pl.ammo_multi_rockets < 100) { if (HasSpawnFlags(1)) pl.ammo_multi_rockets = bound(0, pl.ammo_multi_rockets + 10, 100); else pl.ammo_multi_rockets = bound(0, pl.ammo_multi_rockets + 5, 100); item_ammo::Touch(eToucher); } } } /*QUAKED item_multi_rockets (0 0 0.8) (-16 -16 0) (16 16 32) Multi Rockets from Mission Pack 2 by Rogue Entertainment -------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- model="models/b_plas0.mdl" */ class item_plasma:item_ammo { void(void) item_plasma; virtual void(entity) Touch; }; void item_plasma::item_plasma(void) { model = "models/b_plas0.mdl"; noise = "models/b_plas1.mdl"; } void item_plasma::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } if (eToucher.classname == "player") { player pl = (player)eToucher; if (pl.ammo_plasma < 100) { if (HasSpawnFlags(1)) pl.ammo_plasma = bound(0, pl.ammo_plasma + 12, 100); else pl.ammo_plasma = bound(0, pl.ammo_plasma + 6, 100); item_ammo::Touch(eToucher); } } } /*QUAKED item_ice_shells (0 0 0.8) (-16 -16 0) (16 16 32) Ice Shells for FreeDMC -------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- model="models/w_icebox.mdl" */ class item_ice_shells:item_ammo { void(void) item_ice_shells; virtual void(entity) Touch; }; void item_ice_shells::item_ice_shells(void) { model = "models/w_icebox.mdl"; noise = "models/w_icebox_big.mdl"; } void item_ice_shells::Touch(entity eToucher) { if not (eToucher.flags & FL_CLIENT) { return; } if (eToucher.classname == "player") { player pl = (player)eToucher; if (pl.ammo_ice_shells < 200) { if (HasSpawnFlags(1)) pl.ammo_ice_shells = bound(0, pl.ammo_ice_shells + 40, 200); else pl.ammo_ice_shells = bound(0, pl.ammo_ice_shells + 20, 200); item_ammo::Touch(eToucher); } } }