+#include "../../common/triggers/target/music.qh"
#include "mutator_buffs.qh"
#include "../_all.qh"
#include "../../common/buffs.qh"
-.float lifetime;
-
float buffs_BuffModel_Customize()
{
entity player, myowner;
if(autocvar_g_buffs_randomize)
buff_NewType(self, self.buffs);
- if(autocvar_g_buffs_random_location || (self.spawnflags & 1))
+ if(autocvar_g_buffs_random_location || (self.spawnflags & 64))
buff_Respawn(self);
}
buff_Waypoint_Reset();
self.buff_activetime_updated = false;
- if(autocvar_g_buffs_random_location || (self.spawnflags & 1))
+ if(autocvar_g_buffs_random_location || (self.spawnflags & 64))
buff_Respawn(self);
}
void buff_Init(entity ent)
{
- if(!cvar("g_buffs")) { remove(self); return; }
+ if(!cvar("g_buffs")) { remove(ent); return; }
- if(!teamplay && self.team) { self.team = 0; }
+ if(!teamplay && ent.team) { ent.team = 0; }
entity oldself = self;
self = ent;
self.buff_active = !self.buff_activetime;
self.pflags = PFLAGS_FULLDYNAMIC;
+ if(self.spawnflags & 1)
+ self.noalign = true;
+
if(self.noalign)
self.movetype = MOVETYPE_NONE; // reset by random location
setmodel(self, BUFF_MODEL);
setsize(self, BUFF_MIN, BUFF_MAX);
- if(cvar("g_buffs_random_location") || (self.spawnflags & 1))
+ if(cvar("g_buffs_random_location") || (self.spawnflags & 64))
buff_Respawn(self);
self = oldself;
{
setorigin(ent, old.origin);
ent.angles = old.angles;
- ent.noalign = old.noalign;
+ ent.noalign = (old.noalign || (old.spawnflags & 1));
buff_Init(ent);
}
self.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_disability_speed;
}
+ if(self.buffs & BUFF_JUMP)
+ {
+ // automatically reset, no need to worry
+ self.stat_sv_jumpvelocity = autocvar_g_buffs_jump_height;
+ }
+
return false;
}
for(i = 0; i < autocvar_g_buffs_spawn_count; ++i)
{
entity e = spawn();
- e.spawnflags |= 1; // always randomize
+ e.spawnflags |= 64; // always randomize
e.velocity = randomvec() * 250; // this gets reset anyway if random location works
buff_Init(e);
}
MUTATOR_HOOK(ForbidThrowCurrentWeapon, buffs_PlayerThrowKey, CBC_ORDER_ANY);
MUTATOR_HOOK(MakePlayerObserver, buffs_RemovePlayer, CBC_ORDER_ANY);
MUTATOR_HOOK(ClientDisconnect, buffs_RemovePlayer, CBC_ORDER_ANY);
- MUTATOR_HOOK(OnEntityPreSpawn, buffs_OnEntityPreSpawn, CBC_ORDER_ANY);
+ MUTATOR_HOOK(OnEntityPreSpawn, buffs_OnEntityPreSpawn, CBC_ORDER_LAST);
MUTATOR_HOOK(CustomizeWaypoint, buffs_CustomizeWaypoint, CBC_ORDER_ANY);
MUTATOR_HOOK(WeaponRateFactor, buffs_WeaponRate, CBC_ORDER_ANY);
MUTATOR_HOOK(WeaponSpeedFactor, buffs_WeaponSpeed, CBC_ORDER_ANY);