djcev.com

//

Git Repos / fte_dogmode / qc / items / weapons.qc

Last update to this file was on 2025-03-30 at 19:29.

Show weapons.qc

//==============================================================================
// items/weapons.qc -- weapons
//==============================================================================

// TODO CEV .weapon is being used for default inventory slot AND
// the item_seq index. This is a conflict.

//======================================================================
// constants
//======================================================================

#ifdef SSQC
//----------------------------------------------------------------------
// default inventory slots for weapons
//----------------------------------------------------------------------
typedef enum
{
ITEM_WEAPON_AXE = 1, // id1 weapons first
ITEM_WEAPON_SHOTGUN = 2,
ITEM_WEAPON_SUPERSHOTGUN = 3,
ITEM_WEAPON_NAILGUN = 4,
ITEM_WEAPON_SUPERNAILGUN = 5,
ITEM_WEAPON_GRENADELAUNCHER = 6,
ITEM_WEAPON_ROCKETLAUNCHER = 7,
ITEM_WEAPON_LIGHTNINGGUN = 8
} item_info_weapon_defaultslots;

const float AMMO_SHELLS_WP = 5; // shells on weapon pickup; id1 5
const float AMMO_NAILS_WP = 30; // nails on weapon pickup; id1 30
const float AMMO_ROCKETS_WP = 5; // rockets on weapon pickup; id1 5
const float AMMO_CELLS_WP = 15; // cells on weapon pickup; id1 15

const float WEAPON_RESPAWN_TIME = 30; // as the name suggests; id1 30
#endif

//======================================================================
// forward declarations
//======================================================================

// base_item_weapon
#ifdef SSQC
// BASE_ITEM_WEAPON_HAVEWEAPON(p, w)
// BASE_ITEM_WEAPON_SLOTEMPTY(slot, p)
// BASE_ITEM_WEAPON_ADDAMMO(p, w, i)
// BASE_ITEM_WEAPON_ADDWEAPON(p, w, slot)
void(entity grabber, entity wep) base_item_weapon_grab;
void() base_item_weapon_touch;
entity(entity src, vector org, vector vel, float fl, void(entity) init_fn)
spawn_base_item_weapon;
void(string key, string value) base_item_weapon_init_field;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) base_item_weapon_init;
#endif
#ifdef SSQC
strip void() base_item_weapon;
#endif

// weapon_axe
#ifdef CSQC
void(float isnew) weapon_axe_netreceive;
#endif
#ifdef SSQC
entity(entity src, vector org, vector vel, float fl) spawn_weapon_axe;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_axe_init;
#endif
#ifdef SSQC
void() weapon_axe;
#endif

// weapon_shotgun
#ifdef CSQC
void(float isnew) weapon_shotgun_netreceive;
#endif
#ifdef SSQC
entity(entity src, vector org, vector vel, float fl) spawn_weapon_shotgun;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_shotgun_init;
#endif
#ifdef SSQC
void() weapon_shotgun;
#endif

// weapon_supershotgun
#ifdef CSQC
void(float isnew) weapon_supershotgun_netreceive;
#endif
#ifdef SSQC
entity(entity src, vector org, vector vel, float fl) spawn_weapon_supershotgun;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_supershotgun_init;
#endif
#ifdef SSQC
void() weapon_supershotgun;
#endif

// weapon_nailgun
#ifdef CSQC
void(float isnew) weapon_nailgun_netreceive;
#endif
#ifdef SSQC
entity(entity src, vector org, vector vel, float fl) spawn_weapon_nailgun;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_nailgun_init;
#endif
#ifdef SSQC
void() weapon_nailgun;
#endif

// weapon_supernailgun
#ifdef CSQC
void(float isnew) weapon_supernailgun_netreceive;
#endif
#ifdef SSQC
entity(entity src, vector org, vector vel, float fl) spawn_weapon_supernailgun;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_supernailgun_init;
#endif
#ifdef SSQC
void() weapon_supernailgun;
#endif

// weapon_grenadelauncher
#ifdef CSQC
void(float isnew) weapon_grenadelauncher_netreceive;
#endif
#ifdef SSQC
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_grenadelauncher;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_grenadelauncher_init;
#endif
#ifdef SSQC
void() weapon_grenadelauncher;
#endif

// weapon_rocketlauncher
#ifdef CSQC
void(float isnew) weapon_rocketlauncher_netreceive;
#endif
#ifdef SSQC
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_rocketlauncher;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_rocketlauncher_init;
#endif
#ifdef SSQC
void() weapon_rocketlauncher;
#endif

// weapon_lightning
#ifdef CSQC
void(float isnew) weapon_lightning_netreceive;
#endif
#ifdef SSQC
void(vector p1, vector p2, entity from, float damage) fire_lightning;
entity(entity src, vector org, vector vel, float fl) spawn_weapon_lightning;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_lightning_init;
#endif
#ifdef SSQC
void() weapon_lightning;
#endif

//------------------------------------------------------------------------------

//----------------------------------------------------------------------
// class base_item_weapon: base_item
// {
#ifdef SSQC
//--------------------------------------------------------------
#define BASE_ITEM_WEAPON_HAVEWEAPON(p, w) \
{ \
local float haveweapon = FALSE; \
if (p.inventory1 == w.weapon) haveweapon = TRUE; \
else if (p.inventory2 == w.weapon) haveweapon = TRUE; \
else if (p.inventory3 == w.weapon) haveweapon = TRUE; \
else if (p.inventory4 == w.weapon) haveweapon = TRUE; \
else if (p.inventory5 == w.weapon) haveweapon = TRUE; \
else if (p.inventory6 == w.weapon) haveweapon = TRUE; \
else if (p.inventory7 == w.weapon) haveweapon = TRUE; \
else if (p.inventory8 == w.weapon) haveweapon = TRUE; \
local item_info_t item = item_info[w.weapon]; \
}

//--------------------------------------------------------------
#define BASE_ITEM_WEAPON_SLOTEMPTY(xin, p) \
{ \
local float slotempty = FALSE; \
switch (xin) \
{ \
case 1: \
if (p.inventory1 == ITEM_SEQ_HANDS) \
slotempty = TRUE; \
break; \
case 2: \
if (p.inventory2 == ITEM_SEQ_HANDS) \
slotempty = TRUE; \
break; \
case 3: \
if (p.inventory3 == ITEM_SEQ_HANDS) \
slotempty = TRUE; \
break; \
case 4: \
if (p.inventory4 == ITEM_SEQ_HANDS) \
slotempty = TRUE; \
break; \
case 5: \
if (p.inventory5 == ITEM_SEQ_HANDS) \
slotempty = TRUE; \
break; \
case 6: \
if (p.inventory6 == ITEM_SEQ_HANDS) \
slotempty = TRUE; \
break; \
case 7: \
if (p.inventory7 == ITEM_SEQ_HANDS) \
slotempty = TRUE; \
break; \
case 8: \
if (p.inventory8 == ITEM_SEQ_HANDS) \
slotempty = TRUE; \
break; \
} \
}

//--------------------------------------------------------------
#define BASE_ITEM_WEAPON_ADDAMMO(p, w, i) \
{ \
switch (i.option) \
{ \
case ITEM_AMMO_SHELLS: \
p.ammo_shells += w.ammo_shells; \
break; \
case ITEM_AMMO_NAILS: \
p.ammo_nails += w.ammo_nails; \
break; \
case ITEM_AMMO_ROCKETS: \
p.ammo_rockets += w.ammo_rockets; \
break; \
case ITEM_AMMO_CELLS: \
p.ammo_cells += w.ammo_cells; \
break; \
} \
}

//--------------------------------------------------------------
#define BASE_ITEM_WEAPON_ADDWEAPON(p, w, slot) \
{ \
if (haveweapon == FALSE) \
{ \
/* assign to the currently selected slot -- CEV */ \
switch (slot) \
{ \
case 1: p.inventory1 = w.weapon; break; \
case 2: p.inventory2 = w.weapon; break; \
case 3: p.inventory3 = w.weapon; break; \
case 4: p.inventory4 = w.weapon; break; \
case 5: p.inventory5 = w.weapon; break; \
case 6: p.inventory6 = w.weapon; break; \
case 7: p.inventory7 = w.weapon; break; \
case 8: p.inventory8 = w.weapon; break; \
} \
} \
}

//--------------------------------------------------------------
void(entity pl, entity wep) base_item_weapon_grab =
{
// don't let the owner re-grab within a set time -- CEV
if (wep.owner)
if (pl == wep.owner)
if (time < wep.attack_finished)
return;

// creates the variables haveweapon, item -- CEV
BASE_ITEM_WEAPON_HAVEWEAPON (pl, wep)

// add ammo first -- CEV
BASE_ITEM_WEAPON_ADDAMMO (pl, wep, item)

// now add the weapon -- CEV
BASE_ITEM_WEAPON_ADDWEAPON (pl, wep, pl.weapon)

// let the player know -- CEV
BASE_ITEM_PICKUPMESSAGE (pl, item, CHAN_ITEM_WEAPON)

// restrict ammo to game maximums -- CEV
base_entity_boundammo (pl);

// don't re-grab / immediately throw the item -- CEV
if (pl.button6)
pl.flags |= FL_THROW_HELD;

if (pl.classtype == CT_PLAYER && pl.SendEntity)
pl.SendFlags |= NETFLAG_PLAYER_AMMO |
NETFLAG_PLAYER_INVENTORY;

// fire all targets / killtargets
local entity stemp = self;
local entity otemp = other;
other = pl;
self = wep;
activator = other;
sub_usetargets ();
self = stemp;
other = otemp;

// remove the grabbed item or set up for respawning -- CEV
BASE_ITEM_CHECKREMOVE (wep,
WEAPON_RESPAWN_TIME, WEAPON_RESPAWN_TIME)
};

//--------------------------------------------------------------
// weapon_touch
//--------------------------------------------------------------
void() base_item_weapon_touch =
{
if (sub_checkvalidtouch(other) == FALSE)
return;

if (!(other.flags & FL_CLIENT))
return;

// this macro creates the float 'item_index' -- CEV
BASE_ENTITY_WEAPONLOOKUP (other)

// don't touch() if other is holding a non-weapon -- CEV
if (item_index > ITEM_SEQ_W_END)
return;

// creates the variables haveweapon, item -- CEV
BASE_ITEM_WEAPON_HAVEWEAPON (other, self)

// creates the variable slotempty -- CEV
BASE_ITEM_WEAPON_SLOTEMPTY (self.weapon, other)

// behavior is different if player is holding grab -- CEV
if (other.button6 && !(other.flags & FL_THROW_HELD))
{
// when player is holding grab, don't touch if
// A. they aren't already holding the same weapon or
// B. they don't have their hands out -- CEV
if (item_index != ITEM_SEQ_HANDS)
// if (item_index != self.weapon)
return;
}
else
{
// when player isn't holding grab, don't touch if
// A. their hands aren't out and
// B. they don't already have the weapon -- CEV
if (item_index == ITEM_SEQ_HANDS)
return;
if (slotempty == FALSE)
if (haveweapon == FALSE)
return;
}

// add ammo from the pickup -- CEV
BASE_ITEM_WEAPON_ADDAMMO (other, self, item)

// only add the weapon if the player's hands are empty -- CEV
local float destslot = 0;
if (item_index == ITEM_SEQ_HANDS)
destslot = other.weapon;
else if (slotempty)
destslot = self.weapon;

if (destslot)
{
BASE_ITEM_WEAPON_ADDWEAPON (other, self, destslot)
}

// let the player know -- CEV
BASE_ITEM_PICKUPMESSAGE (other, item, CHAN_ITEM_WEAPON)

// restrict ammo to game maximums -- CEV
base_entity_boundammo (other);

if (other.classtype == CT_PLAYER && other.SendEntity)
other.SendFlags |= NETFLAG_PLAYER_AMMO |
NETFLAG_PLAYER_INVENTORY;

// fire all targets / killtargets
activator = other;
sub_usetargets ();

// remove the touched item or set up for respawning -- CEV
BASE_ITEM_CHECKREMOVE (self,
WEAPON_RESPAWN_TIME, WEAPON_RESPAWN_TIME)
};

//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl,
void(entity) init_fn) spawn_base_item_weapon =
{
local entity e = spawn ();
e.owner = src;
e.spawnflags = fl;
e.origin = org;
e.velocity = vel;
init_fn (e);
e.attack_finished = time + 0.5;
return e;
};

//--------------------------------------------------------------
void(string key, string value) base_item_weapon_init_field =
{
base_item_init_field (key, value);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) base_item_weapon_init =
{
e.classgroup |= CG_ITEM_WEAPON;

local item_info_t item = item_info[e.weapon];

#ifdef SSQC
e.touch = base_item_weapon_touch;
precache_model (item.world_model);
precache_sound (item.pickup_sound);
setmodel (e, item.world_model);
#endif

#ifdef CSQC
setmodelindex (e, e.modelindex);
e.modelflags |= MF_ROTATE;
#endif

e.noise = item.pickup_sound;
e.netname = item.name;

#ifdef SSQC
// if we have an owner pull from that entity's ammo pool -- CEV
if (e.spawnflags & SPAWNFLAG_ITEM_THROWN) {
if (e.owner)
{
local float ammo = 0;
switch (item.option)
{
case ITEM_AMMO_SHELLS:
ammo = AMMO_SHELLS_WP;
if (e.owner.ammo_shells >= ammo)
{
e.owner.ammo_shells -= ammo;
}
else
{
ammo = e.owner.ammo_shells;
e.ammo_shells = ammo;
e.owner.ammo_shells = 0;
}
break;
case ITEM_AMMO_NAILS:
ammo = AMMO_NAILS_WP;
if (e.owner.ammo_nails >= ammo)
{
e.owner.ammo_nails -= ammo;
}
else
{
ammo = e.owner.ammo_nails;
e.ammo_nails = ammo;
e.owner.ammo_nails = 0;
}
break;
case ITEM_AMMO_ROCKETS:
ammo = AMMO_ROCKETS_WP;
if (e.owner.ammo_rockets >= ammo)
{
e.owner.ammo_rockets -= ammo;
}
else
{
ammo = e.owner.ammo_rockets;
e.ammo_rockets = ammo;
e.owner.ammo_rockets = 0;
}
break;
case ITEM_AMMO_CELLS:
ammo = AMMO_CELLS_WP;
if (e.owner.ammo_cells >= ammo)
{
e.owner.ammo_cells -= ammo;
}
else
{
ammo = e.owner.ammo_cells;
e.ammo_cells = ammo;
e.owner.ammo_cells = 0;
}
break;
default:
dprint (sprintf("base_item_weapon_"
"init: unknown ammo type %g "
"for entity type %s!\n",
item.option, e.classname));
break;
}

// update any CSQC clients listening in -- CEV
if (e.owner.classtype == CT_PLAYER)
if (e.owner.SendEntity) {
{
e.owner.SendFlags |= NETFLAG_PLAYER_WEAPON |
NETFLAG_PLAYER_AMMO;
} }
} }
#endif

base_item_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
strip void() base_item_weapon =
{
base_item_weapon_init (self);
};
#endif
// };

//======================================================================
// Weapon 1: Ranger's Axe -- johnfitz -- dumptruck_ds from RRP and rubicon2
//======================================================================

/*QUAKED weapon_axe (0 .5 .8) (-16 -16 0) (16 16 32)
Axe
*/
//----------------------------------------------------------------------
// class weapon_axe: base_item_weapon
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) weapon_axe_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (weapon_axe_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl) spawn_weapon_axe =
{
return spawn_base_item_weapon (src, org, vel, fl,
weapon_axe_init);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_axe_init =
{
e.classname = "weapon_axe";
e.classtype = CT_ITEM_AXE;

#ifdef SSQC
e.weapon = ITEM_SEQ_AXE;
#endif

e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';

// StartItem
base_item_weapon_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() weapon_axe =
{
// remap spawnflags, inhibit spawn, remap fields -- CEV
BASE_ITEM_PREINIT (base_item_weapon_init_field)

weapon_axe_init (self);
};
#endif
// };

//======================================================================
// Weapon 2: Shotgun -- johnfitz -- dumptruck_ds from RRP and rubicon2
//======================================================================

/*QUAKED weapon_shotgun (0 .5 .8) (-16 -16 0) (16 16 32) X STYLE_1 STYLE_2 X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_shotgn.mdl"); }
This is a pickup model that should be used when you want a player to spawn with only an axe and then later get the shotgun: (trigger_take_weapon or reset_items 2 in worldspawn). There are two models to choose from. Spawnflag 2 (the default) selects an unused “classic look” model from Rubicon 2 by metlslime. Spawnflag 4 is an alternate from Slapmap and has been used in a few mods.
Single-barrelled Shotgun
Shotgun
*/
//----------------------------------------------------------------------
// class weapon_shotgun: base_item_weapon
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) weapon_shotgun_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (weapon_shotgun_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_shotgun =
{
return spawn_base_item_weapon (src, org, vel, fl,
weapon_shotgun_init);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_shotgun_init =
{
e.classname = "weapon_shotgun";
e.classtype = CT_ITEM_SHOTGUN;

#ifdef SSQC
// new shotgun model by Starshipwaters
// removed 2 older shotguns that used spawnflags -- dumptruck_ds
e.weapon = ITEM_SEQ_SHOTGUN;
if (!e.ammo_shells)
e.ammo_shells = AMMO_SHELLS_WP;
#endif

e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';

// StartItem
base_item_weapon_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() weapon_shotgun =
{
// remap spawnflags, inhibit spawn, remap fields -- CEV
BASE_ITEM_PREINIT (base_item_weapon_init_field)

weapon_shotgun_init (self);
};
#endif
// };

//======================================================================
// Weapon 3: Super Shotgun
//======================================================================

/*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_shot.mdl"); }
Double-barrelled Shotgun
*/
//----------------------------------------------------------------------
// class weapon_supershotgun: base_item_weapon
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) weapon_supershotgun_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (weapon_supershotgun_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_supershotgun =
{
return spawn_base_item_weapon (src, org, vel, fl,
weapon_supershotgun_init);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_supershotgun_init =
{
e.classname = "weapon_supershotgun";
e.classtype = CT_ITEM_SUPER_SHOTGUN;

#ifdef SSQC
e.weapon = ITEM_SEQ_SUPERSHOTGUN;
if (!e.ammo_shells)
e.ammo_shells = AMMO_SHELLS_WP;
e.particles_offset = '0 0 33';
#endif

e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';

// StartItem
base_item_weapon_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() weapon_supershotgun =
{
// remap spawnflags, inhibit spawn, remap fields -- CEV
BASE_ITEM_PREINIT (base_item_weapon_init_field)

weapon_supershotgun_init (self);
};
#endif
// };

//======================================================================
// Weapon 4: Nailgun
//======================================================================

/*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_nail.mdl"); }
Nailgun
*/
//----------------------------------------------------------------------
// class weapon_nailgun: base_item_weapon
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) weapon_nailgun_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (weapon_nailgun_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_nailgun =
{
return spawn_base_item_weapon (src, org, vel, fl,
weapon_nailgun_init);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_nailgun_init =
{
e.classname = "weapon_nailgun";
e.classtype = CT_ITEM_NAILGUN;

#ifdef SSQC
e.weapon = ITEM_SEQ_NAILGUN;
if (!e.ammo_shells)
e.ammo_nails = AMMO_NAILS_WP;
e.particles_offset = '0 0 31';
#endif

e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';

// StartItem
base_item_weapon_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() weapon_nailgun =
{
// remap spawnflags, inhibit spawn, remap fields -- CEV
BASE_ITEM_PREINIT (base_item_weapon_init_field)

weapon_nailgun_init (self);
};
#endif
// };

//======================================================================
// Weapon 5: Super Nailgun
//======================================================================

/*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_nail2.mdl"); }
Perforator
*/
//----------------------------------------------------------------------
// class weapon_supernailgun: base_item_weapon
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) weapon_supernailgun_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (weapon_supernailgun_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_supernailgun =
{
return spawn_base_item_weapon (src, org, vel, fl,
weapon_supernailgun_init);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_supernailgun_init =
{
e.classname = "weapon_supernailgun";
e.classtype = CT_ITEM_SUPER_NAILGUN;

#ifdef SSQC
e.weapon = ITEM_SEQ_SUPERNAILGUN;
if (!e.ammo_shells)
e.ammo_nails = AMMO_NAILS_WP;
e.particles_offset = '0 0 34';
#endif

e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';

// StartItem
base_item_weapon_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() weapon_supernailgun =
{
// remap spawnflags, inhibit spawn, remap fields -- CEV
BASE_ITEM_PREINIT (base_item_weapon_init_field)

weapon_supernailgun_init (self);
};
#endif
// };

//======================================================================
// Weapon 6: Grenade Launcher
//======================================================================

/*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_rock.mdl"); }
Grenade Launcher
*/
//----------------------------------------------------------------------
// class weapon_grenadelauncher: base_item_weapon
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) weapon_grenadelauncher_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (weapon_grenadelauncher_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_grenadelauncher =
{
return spawn_base_item_weapon (src, org, vel, fl,
weapon_grenadelauncher_init);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_grenadelauncher_init =
{
e.classname = "weapon_grenadelauncher";
e.classtype = CT_ITEM_GRENADE_LAUNCHER;

#ifdef SSQC
e.weapon = ITEM_SEQ_GRENADELAUNCHER;
if (!e.ammo_shells)
e.ammo_rockets = AMMO_ROCKETS_WP;
e.particles_offset = '0 0 28';
#endif

e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';

// StartItem
base_item_weapon_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() weapon_grenadelauncher =
{
// remap spawnflags, inhibit spawn, remap fields -- CEV
BASE_ITEM_PREINIT (base_item_weapon_init_field)

weapon_grenadelauncher_init (self);
};
#endif
// };

//======================================================================
// Weapon 7: Rocket Launcher
//======================================================================

/*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_rock2.mdl"); }
Rocket Launcher
*/
//----------------------------------------------------------------------
// class weapon_rocketlauncher: base_item_weapon
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) weapon_rocketlauncher_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (weapon_rocketlauncher_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_rocketlauncher =
{
return spawn_base_item_weapon (src, org, vel, fl,
weapon_rocketlauncher_init);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_rocketlauncher_init =
{
e.classname = "weapon_rocketlauncher";
e.classtype = CT_ITEM_ROCKET_LAUNCHER;

#ifdef SSQC
e.weapon = ITEM_SEQ_ROCKETLAUNCHER;
if (!e.ammo_shells)
e.ammo_rockets = AMMO_ROCKETS_WP;
e.particles_offset = '0 0 32';
#endif

e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';

// StartItem
base_item_weapon_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() weapon_rocketlauncher =
{
// remap spawnflags, inhibit spawn, remap fields -- CEV
BASE_ITEM_PREINIT (base_item_weapon_init_field)

weapon_rocketlauncher_init (self);
};
#endif
// };

//======================================================================
// Weapon 8: Lightning Gun
//======================================================================

/*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_light.mdl"); }
Thunderbolt
*/
//----------------------------------------------------------------------
// class weapon_lightning: base_item_weapon
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) weapon_lightning_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (weapon_lightning_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
// this is here 'cause LG doesn't create a projectile... -- CEV
//--------------------------------------------------------------
void(vector p1, vector p2, entity from, float damage) fire_lightning =
{
local entity e1, e2;
local vector f;

f = p2 - p1;
normalize (f);
f_x = 0 - f_y;
f_y = f_x;
f_z = 0;
f = f * 16;

e1 = e2 = world;

traceline (p1, p2, FALSE, from);
if (trace_ent.takedamage)
{
particle (trace_endpos, '0 0 100', 225, damage * 4);
t_damage2 (trace_ent, from, from, damage);
if (from.classtype == CT_PLAYER)
{
if (other.classtype == CT_PLAYER)
// fly me to the moon
trace_ent.velocity_z += 400;
}
}
e1 = trace_ent;

traceline (p1 + f, p2 + f, FALSE, from);
if (trace_ent != e1 && trace_ent.takedamage)
{
particle (trace_endpos, '0 0 100', 225, damage * 4);
t_damage2 (trace_ent, from, from, damage);
}
e2 = trace_ent;

traceline (p1 - f, p2 - f, FALSE, from);
if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage)
{
particle (trace_endpos, '0 0 100', 225, damage * 4);
t_damage2 (trace_ent, from, from, damage);
}
};

//--------------------------------------------------------------
entity(entity src, vector org, vector vel, float fl)
spawn_weapon_lightning =
{
return spawn_base_item_weapon (src, org, vel, fl,
weapon_lightning_init);
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_lightning_init =
{
e.classname = "weapon_lightning";
e.classtype = CT_ITEM_LIGHTNING_GUN;

#ifdef SSQC
e.weapon = ITEM_SEQ_LIGHTNINGGUN;
if (!e.ammo_shells)
e.ammo_cells = AMMO_CELLS_WP;
e.particles_offset = '0 0 31';
#endif

e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';

// StartItem
base_item_weapon_init (e);
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() weapon_lightning =
{
// remap spawnflags, inhibit spawn, remap fields -- CEV
BASE_ITEM_PREINIT (base_item_weapon_init_field)

weapon_lightning_init (self);
};
#endif
// };

Return to the top of this page or return to the overview of this repo.

Log weapons.qc

Return to the top of this page or return to the overview of this repo.