djcev.com

//

Git Repos / fte_dogmode / qc / items / powerups.qc

Last update to this file was on 2024-06-15 at 19:50.

Show powerups.qc

//==============================================================================
// items/powerups.qc -- POWERUPS
//==============================================================================

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

#ifdef SSQC
// base_item_powerup
void() base_item_powerup_touch;
entity(entity src, vector org, vector vel, void(entity) init_fn)
spawn_base_item_powerup;
void(entity e) base_item_powerup_init;
strip void() base_item_powerup;
#endif

#ifdef SSQC
// item_artifact_invulnerability
entity(entity src, vector org, vector vel) spawn_item_artifact_invulnerability;
void(entity e) item_artifact_invulnerability_init;
void() item_artifact_invulnerability;
#endif

#ifdef SSQC
// item_artifact_envirosuit
entity(entity src, vector org, vector vel) spawn_item_artifact_envirosuit;
void(entity e) item_artifact_envirosuit_init;
void() item_artifact_envirosuit;
#endif

#ifdef SSQC
// item_artifact_invisibility
entity(entity src, vector org, vector vel) spawn_item_artifact_invisibility;
void(entity e) item_artifact_invisibility_init;
void() item_artifact_invisibility;
#endif

#ifdef SSQC
// item_artifact_super_damage
entity(entity src, vector org, vector vel) spawn_item_artifact_super_damage;
void(entity e) item_artifact_super_damage_init;
void() item_artifact_super_damage;
#endif

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

#ifdef SSQC
//----------------------------------------------------------------------
// class base_item_powerup: base_item
// {
//--------------------------------------------------------------
void() base_item_powerup_touch =
{
if (sub_checkvalidtouch(other) == FALSE)
return;

local float delay_sp = 0;
local float delay_dm = 0;

sprint (other, sprintf("You got the %s\n", self.netname));

if (!deathmatch)
{
if (self.classtype == CT_ITEM_INVULNERABILITY ||
self.classtype == CT_ITEM_INVISIBILITY)
{
delay_sp = 300;
}
else
{
delay_sp = 60;
}
}
else
{
if ((self.classtype == CT_ITEM_INVULNERABILITY) ||
(self.classtype == CT_ITEM_INVISIBILITY))
{
delay_dm = time + 60 * 5;
}
else
{
delay_dm = time + 60;
}
}

sound (other, CHAN_VOICE, self.noise, VOL_HIGH, ATTN_NORM);
stuffcmd (other, "bf\n");
other.items = other.items | self.items;

// do the apropriate action
if (self.classtype == CT_ITEM_ENVIROSUIT)
{
other.rad_time = 1;
other.radsuit_finished = time + 30;
}

if (self.classtype == CT_ITEM_INVULNERABILITY)
{
other.invincible_time = 1;
other.invincible_finished = time + 30;
}
else if (self.classtype == CT_ITEM_INVISIBILITY)
{
other.invisible_time = 1;
other.invisible_finished = time + 30;
}
else if (self.classtype == CT_ITEM_QUAD)
{
other.super_time = 1;
other.super_damage_finished = time + 30;
}

// remove it in single player, or setup for respawning in DM
// Supa, SP respawning items support
self.mdl = self.model;
self.solid = SOLID_NOT;
self.model = __NULL__;
base_item_check_respawn (self, delay_sp, delay_dm);

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

//--------------------------------------------------------------
entity(entity src, vector org, vector vel, void(entity) init_fn)
spawn_base_item_powerup =
{
local entity e = spawn ();
e.owner = src;
e.origin = org;
e.velocity = vel;
init_fn (e);
return e;
};

//--------------------------------------------------------------
void(entity e) base_item_powerup_init =
{
self.classgroup |= CG_ITEM_POWERUP;
self.touch = base_item_powerup_touch;
base_item_init (e);
};

//--------------------------------------------------------------
strip void() base_item_powerup =
{
base_item_powerup_init (self);
};
// };
#endif

#ifdef SSQC
/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (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/invulner.mdl"); }
Pentagram of Protection
Player is invulnerable for 30 seconds
*/
//----------------------------------------------------------------------
// class item_artifact_invulnerability: base_item_powerup
// {
//--------------------------------------------------------------
entity(entity src, vector org, vector vel)
spawn_item_artifact_invulnerability =
{
return spawn_base_item_powerup (src, org, vel,
item_artifact_invulnerability_init);
};

//--------------------------------------------------------------
void(entity e) item_artifact_invulnerability_init =
{
e.classname = "item_artifact_invulnerability";
e.classtype = CT_ITEM_INVULNERABILITY;

precache_body_model (e, "progs/invulner.mdl");
precache_sound ("items/protect.wav");
// called in client.qc -- dumptruck_ds
precache_sound ("items/protect2.wav");
// called in combat.qc -- dumptruck_ds
precache_sound ("items/protect3.wav");
e.noise = "items/protect.wav";
// setmodel (this, "progs/invulner.mdl");
body_model (e, "progs/invulner.mdl");
e.netname = "Pentagram of Protection";
e.items = IT_INVULNERABILITY;
e.pos1 = '-16 -16 -24';
e.pos2 = '16 16 32';

// t_fog fix for custom models dumptruck_ds
if !(e.particles_offset)
e.particles_offset = '0 0 16';

// StartItem
base_item_powerup_init (e);
};

//--------------------------------------------------------------
void() item_artifact_invulnerability =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

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

#ifdef SSQC
/*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (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/suit.mdl"); }
Biosuit
Player takes no damage from water or slime for 30 seconds
*/
//----------------------------------------------------------------------
// class item_artifact_envirosuit: base_item_powerup
// {
//--------------------------------------------------------------
entity(entity src, vector org, vector vel)
spawn_item_artifact_envirosuit =
{
return spawn_base_item_powerup (src, org, vel,
item_artifact_envirosuit_init);
};

//--------------------------------------------------------------
void(entity e) item_artifact_envirosuit_init =
{
e.classname = "item_artifact_envirosuit";
e.classtype = CT_ITEM_ENVIROSUIT;

precache_body_model (e, "progs/suit.mdl");
precache_sound ("items/suit.wav");
precache_sound ("items/suit2.wav");
e.noise = "items/suit.wav";
// setmodel (this, "progs/suit.mdl");
body_model (e, "progs/suit.mdl");
e.netname = "Biosuit";
e.items = IT_SUIT;
e.pos1 = '-16 -16 -24';
e.pos2 = '16 16 32';

// t_fog fix for custom models dumptruck_ds
if !(e.particles_offset)
e.particles_offset = '0 0 32';

// StartItem
base_item_powerup_init (e);
};

//--------------------------------------------------------------
void() item_artifact_envirosuit =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

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

#ifdef SSQC
/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (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/invisibl.mdl"); }
Ring of Shadows
Player is invisible for 30 seconds
*/
//----------------------------------------------------------------------
// class item_artifact_invisibility: base_item_powerup
// {
//--------------------------------------------------------------
entity(entity src, vector org, vector vel)
spawn_item_artifact_invisibility =
{
return spawn_base_item_powerup (src, org, vel,
item_artifact_invisibility_init);
};

//--------------------------------------------------------------
void(entity e) item_artifact_invisibility_init =
{
e.classname = "item_artifact_invisibility";
e.classtype = CT_ITEM_INVISIBILITY;

precache_body_model (e, "progs/invisibl.mdl");
precache_sound ("items/inv1.wav");
precache_sound ("items/inv2.wav");
precache_sound ("items/inv3.wav");
e.noise = "items/inv1.wav";
// setmodel (this, "progs/invisibl.mdl");
body_model (e, "progs/invisibl.mdl");
e.netname = "Ring of Shadows";
e.items = IT_INVISIBILITY;
e.pos1 = '-16 -16 -24';
e.pos2 = '16 16 32';

// t_fog fix for custom models dumptruck_ds
if !(e.particles_offset)
e.particles_offset = '0 0 0';

// StartItem
base_item_powerup_init (e);
};

//--------------------------------------------------------------
void() item_artifact_invisibility =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

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

#ifdef SSQC
/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (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/quaddama.mdl"); }
Quad Damage
Player does 4x damage for 30 seconds
*/
//----------------------------------------------------------------------
// class item_artifact_super_damage: base_item_powerup
// {
//--------------------------------------------------------------
entity(entity src, vector org, vector vel)
spawn_item_artifact_super_damage =
{
return spawn_base_item_powerup (src, org, vel,
item_artifact_super_damage_init);
};

//--------------------------------------------------------------
void(entity e) item_artifact_super_damage_init =
{
e.classname = "item_artifact_super_damage";
e.classtype = CT_ITEM_QUAD;

precache_body_model (e, "progs/quaddama.mdl");
precache_sound ("items/damage.wav");
precache_sound ("items/damage3.wav");
e.noise = "items/damage.wav";
// setmodel (this, "progs/quaddama.mdl");
body_model (e, "progs/quaddama.mdl");

// custom name -- dumptruck_ds
if !(e.netname)
e.netname = "Quad Damage";

e.items = IT_QUAD;
e.pos1 = '-16 -16 -24';
e.pos2 = '16 16 32';

// t_fog fix for custom models dumptruck_ds
if !(e.particles_offset)
e.particles_offset = '0 0 16';

// StartItem
base_item_powerup_init (e);
};

//--------------------------------------------------------------
void() item_artifact_super_damage =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

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

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

Log powerups.qc

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