originjitter 6 6 6
liquidfriction 5
velocitymultiplier 80
+
+
+// relic_resistance effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_resistance
+count 20
+type static
+color 0x00ff80 0x00ff80
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_regeneration effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_regeneration
+count 1
+type static
+color 0x00ffff 0x00ffff
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_vempire effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_vampire
+count 20
+type static
+color 0xff00ff 0xff00ff
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_ammo effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_ammo
+count 1
+type static
+color 0x80ff00 0x80ff00
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_damage effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_damage
+count 20
+type static
+color 0xff0000 0xff0000
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_splashdamage effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_ssplashdamage
+count 20
+type static
+color 0xff8000 0xff8000
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_firingspeed effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_firingspeed
+count 20
+type static
+color 0xffff00 0xffff00
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_disability effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_disability
+count 20
+type static
+color 0x0000ff 0x0000ff
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_disability_curse effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_disability_curse
+count 1
+type static
+color 0x000080 0x000080
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_teamboost effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_teamboost
+count 20
+type static
+color 0xffffff 0xffffff
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_teamboost_boost effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_teamboost_boost
+count 1
+type static
+color 0x808080 0x808080
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_speed effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_speed
+count 1
+type static
+color 0x80ffff 0x80ffff
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_jump effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_jump
+count 20
+type static
+color 0xffff80 0xffff80
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_flight effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_flight
+count 1
+type static
+color 0x8080ff 0x8080ff
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_radioactive effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_radioactive
+count 20
+type static
+color 0x00ff00 0x00ff00
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_resurrection effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_resurrection
+count 20
+type static
+color 0xff0080 0xff0080
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
+
+// relic_vengeance effect, used by the relics mutator
+// used in qcsrc/server/mutators/relics.qc: pointparticles(particleeffectnum(mdl), e.origin, '0 0 0', 1);
+effect relic_vengeance
+count 20
+type static
+color 0xff8080 0xff8080
+size 1.5 1.5
+alpha 128 256 256
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 8 8 32
+velocityjitter 64 64 32
// =======
set cl_buffs_autoreplace 1 "automatically drop current buff when picking up another"
set g_buffs 0 "enable buffs (requires buff items or powerups)"
+set g_buffs_effects 1 "show particle effects from carried buffs"
set g_buffs_waypoint_distance 1024 "maximum distance at which buff waypoint can be seen from item"
set g_buffs_randomize 1 "randomize buff type when player drops buff"
set g_buffs_random_lifetime 30 "re-spawn the buff again if it hasn't been touched after this time in seconds"
set g_buffs_disability_slowtime 3 "time in seconds for target disability"
set g_buffs_disability_speed 0.5 "player speed multiplier while disabled"
set g_buffs_disability_rate 1.7 "player weapon rate multiplier while disabled"
+set g_buffs_disability_weaponspeed 0.6 "weapon speed multiplier while disabled"
set g_buffs_speed 1 "speed buff: increased movement/attack/health regeneration speed, carrier takes slightly more damage"
set g_buffs_speed_time 60 "speed buff carry time"
set g_buffs_speed_speed 1.7 "player speed multiplier while holding speed buff"
set g_buffs_speed_rate 0.8 "player weapon rate multiplier while holding speed buff"
+set g_buffs_speed_weaponspeed 1.6 "weapon speed multiplier while holding speed buff"
set g_buffs_speed_damage_take 1.2 "damage taken multiplier while holding speed buff"
set g_buffs_speed_regen 1.2 "regeneration speed multiplier while holding speed buff"
set g_buffs_vampire 1 "vampire buff: attacks to players and monsters heal the carrier"
// accelerate
makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0');
- velspeed = WEP_CVAR(devastator, speed) * g_weaponspeedfactor - (self.velocity * v_forward);
+ velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor() - (self.velocity * v_forward);
if(velspeed > 0)
- self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * g_weaponspeedfactor * frametime, velspeed);
+ self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor() * frametime, velspeed);
// laser guided, or remote detonation
if(self.realowner.weapon == WEP_DEVASTATOR)
float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
float autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health;
float autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath;
+bool autocvar_g_buffs_effects;
float autocvar_g_buffs_waypoint_distance;
float autocvar_g_buffs_randomize;
float autocvar_g_buffs_random_lifetime;
float autocvar_g_buffs_disability_slowtime;
float autocvar_g_buffs_disability_speed;
float autocvar_g_buffs_disability_rate;
+float autocvar_g_buffs_disability_weaponspeed;
float autocvar_g_buffs_speed_speed;
float autocvar_g_buffs_speed_rate;
+float autocvar_g_buffs_speed_weaponspeed;
float autocvar_g_buffs_speed_damage_take;
float autocvar_g_buffs_speed_regen;
float autocvar_g_buffs_vampire_damage_steal;
hf = self.dphitcontentsmask;
self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
- shotspeed *= g_weaponspeedfactor;
- shotspeedupward *= g_weaponspeedfactor;
+ shotspeed *= W_WeaponSpeedFactor();
+ shotspeedupward *= W_WeaponSpeedFactor();
if (!shotspeed)
{
dprint("bot_aim: WARNING: weapon ", WEP_NAME(self.weapon), " shotspeed is zero!\n");
// INPUT, OUTPUT:
float weapon_rate;
+MUTATOR_HOOKABLE(WeaponSpeedFactor);
+ // allows changing weapon speed (projectiles mostly)
+ // INPUT, OUTPUT:
+ //float ret_float;
+
MUTATOR_HOOKABLE(SetStartItems);
// adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}}
return true;
}
+void buffs_BuffModel_Spawn(entity player)
+{
+ player.buff_model = spawn();
+ setmodel(player.buff_model, BUFF_MODEL);
+ setsize(player.buff_model, '0 0 -40', '0 0 40');
+ setattachment(player.buff_model, player, "");
+ setorigin(player.buff_model, '0 0 1' * (player.buff_model.maxs.z * 1));
+ player.buff_model.owner = player;
+ player.buff_model.scale = 0.7;
+ player.buff_model.pflags = PFLAGS_FULLDYNAMIC;
+ player.buff_model.light_lev = 200;
+ player.buff_model.customizeentityforclient = buffs_BuffModel_Customize;
+}
+
vector buff_GlowColor(entity buff)
{
//if(buff.team) { return Team_ColorRGB(buff.team); }
return buff.color;
}
+void buff_Effect(entity player, string eff)
+{
+ if(!autocvar_g_buffs_effects) { return; }
+
+ if(time >= self.buff_effect_delay)
+ {
+ pointparticles(particleeffectnum(eff), player.origin + ((player.mins + player.maxs) * 0.5), '0 0 0', 1);
+ self.buff_effect_delay = time + 0.05; // prevent spam
+ }
+}
+
// buff item
float buff_Waypoint_visible_for_player(entity plr)
{
self.glowmod = buff_GlowColor(self);
self.skin = Buff_Skin(self.buffs);
- setmodel(self, "models/relics/relic.md3");
+ setmodel(self, BUFF_MODEL);
if(self.buff_waypoint)
{
if(self.noalign)
self.movetype = MOVETYPE_NONE; // reset by random location
- setmodel(self, "models/relics/relic.md3");
+ setmodel(self, BUFF_MODEL);
setsize(self, BUFF_MIN, BUFF_MAX);
if(cvar("g_buffs_random_location") || (self.spawnflags & 1))
buff_Init(ent);
}
+void buff_Vengeance_DelayedDamage()
+{
+ if(self.enemy)
+ Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF, self.enemy.origin, '0 0 0');
+
+ remove(self);
+ return;
+}
+
+float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float intersect_x, float intersect_y, float base)
+{
+ return offset_y + (intersect_y - offset_y) * logn(((x - offset_x) * ((base - 1) / intersect_x)) + 1, base);
+}
+
// mutator hooks
MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_SplitHealthArmor)
{
return false;
}
-void buff_Vengeance_DelayedDamage()
-{
- if(self.enemy)
- Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF, self.enemy.origin, '0 0 0');
-
- remove(self);
- return;
-}
-
-float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float intersect_x, float intersect_y, float base)
-{
- return offset_y + (intersect_y - offset_y) * logn(((x - offset_x) * ((base - 1) / intersect_x)) + 1, base);
-}
-
MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate)
{
if(frag_deathtype == DEATH_BUFF) { return false; }
if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
if(frag_attacker)
if(random() <= autocvar_g_buffs_medic_survive_chance)
- if(frag_target.health - autocvar_g_buffs_medic_survive_health > 0) // not if the final result would be less than 0, medic must get health
- frag_damage = frag_target.health - autocvar_g_buffs_medic_survive_health;
+ frag_damage = max(5, frag_target.health - autocvar_g_buffs_medic_survive_health);
if(frag_target.buffs & BUFF_VENGEANCE)
if(frag_attacker)
return false;
}
+MUTATOR_HOOKFUNCTION(buffs_WeaponSpeed)
+{
+ if(self.buffs & BUFF_SPEED)
+ ret_float *= autocvar_g_buffs_speed_weaponspeed;
+
+ if(time < self.buff_disability_time)
+ ret_float *= autocvar_g_buffs_disability_weaponspeed;
+
+ return false;
+}
+
+string autocvar_blah;
MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
{
if(gameover || self.deadflag != DEAD_NO) { return false; }
self.alpha = self.buff_invisible_prev_alpha;
BUFF_ONADD(BUFF_FLIGHT)
- self.gravity = self.buff_flight_prev_gravity;
-
- BUFF_ONREM(BUFF_FLIGHT)
{
self.buff_flight_prev_gravity = self.gravity;
self.gravity = autocvar_g_buffs_flight_gravity;
}
+ BUFF_ONREM(BUFF_FLIGHT)
+ self.gravity = self.buff_flight_prev_gravity;
+
self.oldbuffs = self.buffs;
if(self.buffs)
{
if(!self.buff_model)
- {
- self.buff_model = spawn();
- setmodel(self.buff_model, "models/relics/relic.md3");
- setsize(self.buff_model, '0 0 -40', '0 0 40');
- setattachment(self.buff_model, self, "");
- setorigin(self.buff_model, '0 0 1' * (self.buff_model.maxs.z * 1));
- self.buff_model.owner = self;
- self.buff_model.scale = 0.7;
- self.buff_model.pflags = PFLAGS_FULLDYNAMIC;
- self.buff_model.light_lev = 200;
- self.buff_model.customizeentityforclient = buffs_BuffModel_Customize;
- }
+ buffs_BuffModel_Spawn(self);
+
self.buff_model.color = Buff_Color(self.buffs);
self.buff_model.glowmod = buff_GlowColor(self.buff_model);
self.buff_model.skin = Buff_Skin(self.buffs);
void buffs_Initialize()
{
- precache_model("models/relics/relic.md3");
+ precache_model(BUFF_MODEL);
precache_sound("misc/strength_respawn.wav");
precache_sound("misc/shield_respawn.wav");
precache_sound("relics/relic_effect.wav");
MUTATOR_HOOK(OnEntityPreSpawn, buffs_OnEntityPreSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(CustomizeWaypoint, buffs_CustomizeWaypoint, CBC_ORDER_ANY);
MUTATOR_HOOK(WeaponRateFactor, buffs_WeaponRate, CBC_ORDER_ANY);
+ MUTATOR_HOOK(WeaponSpeedFactor, buffs_WeaponSpeed, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerPreThink, buffs_PlayerThink, CBC_ORDER_ANY);
MUTATOR_HOOK(GetCvars, buffs_GetCvars, CBC_ORDER_ANY);
MUTATOR_HOOK(BuildMutatorsString, buffs_BuildMutatorsString, CBC_ORDER_ANY);
// disability
.float buff_disability_time;
.float buff_disability_effect_time;
+// common buff variables
+.float buff_effect_delay;
// buff definitions
.float buff_active;
.int oldbuffs; // for updating effects
.entity buff_model; // controls effects (TODO: make csqc)
+const string BUFF_MODEL = "models/relics/relic.md3";
+
const vector BUFF_MIN = ('-16 -16 -20');
const vector BUFF_MAX = ('16 16 20');
float mspeed;
vector outvelocity;
- mvelocity = mvelocity * g_weaponspeedfactor;
+ mvelocity = mvelocity * W_WeaponSpeedFactor();
mdirection = normalize(mvelocity);
mspeed = vlen(mvelocity);
return t;
}
+float W_WeaponSpeedFactor()
+{
+ float t;
+ t = 1.0 * g_weaponspeedfactor;
+
+ ret_float = t;
+ MUTATOR_CALLHOOK(WeaponSpeedFactor);
+ t = ret_float;
+
+ return t;
+}
+
void(float fr, float t, void() func) weapon_thinkf;
float W_WeaponRateFactor();
+float W_WeaponSpeedFactor();
+
float weapon_prepareattack(float secondary, float attacktime);
float weapon_prepareattack_check(float secondary, float attacktime);