ons_Initialize();
ActivateTeamplay();
- SetLimits(autocvar_g_onslaught_point_limit, -1, -1, -1);
+ SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
have_team_spawns = -1; // request team spawns
}
onslaught_updatelinks();
// Use targets now (somebody make sure this is in the right place..)
- setself(this.owner);
- activator = this;
- WITHSELF(this, SUB_UseTargets());
- setself(this);
+ SUB_UseTargets(this.owner, this, NULL);
this.owner.waslinked = this.owner.islinked;
if(this.owner.model != "models/onslaught/controlpoint_pad.md3")
if(!self.owner.islinked)
self.owner.team = 0;
- setself(self.owner);
- activator = self;
- SUB_UseTargets ();
- setself(this);
+ SUB_UseTargets(self.owner, self, NULL);
self.owner.team = t;
onslaught_updatelinks();
// Use targets now (somebody make sure this is in the right place..)
- setself(self.owner);
- activator = self;
- SUB_UseTargets ();
- setself(this);
+ SUB_UseTargets(self.owner, self, NULL);
self.SendFlags |= CPSF_SETUP;
}
onslaught_updatelinks();
- activator = this;
- SUB_UseTargets(); // to reset the structures, playerspawns etc.
+ SUB_UseTargets(this, this, NULL); // to reset the structures, playerspawns etc.
CSQCMODEL_AUTOUPDATE(this);
}
void ons_MonsterSpawn_Delayed(entity this)
{
- entity e, own = self.owner;
+ entity own = self.owner;
- if(!own) { remove(self); return; }
+ if(!own) { remove(this); return; }
if(own.targetname)
{
- e = find(world, target, own.targetname);
+ entity e = find(world, target, own.targetname);
if(e != world)
{
own.team = e.team;
- activator = e;
- own.use();
+ own.use(own, e, NULL);
}
}
- remove(self);
+ remove(this);
}
MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
void ons_TurretSpawn_Delayed(entity this)
{
- entity e, own = self.owner;
+ entity own = self.owner;
if(!own) { remove(self); return; }
if(own.targetname)
{
- e = find(world, target, own.targetname);
+ entity e = find(world, target, own.targetname);
if(e != world)
{
own.team = e.team;
own.active = ACTIVE_NOT;
- activator = e;
- own.use();
+ own.use(own, e, NULL);
}
}
#ifdef SVQC
bool autocvar_g_nades_nade_small;
+ float autocvar_g_nades_spread = 0.04;
#endif
REGISTER_STAT(NADES_SMALL, int, autocvar_g_nades_nade_small)
this.realowner = attacker;
if(this.health <= 0)
- WITHSELF(this, W_PrepareExplosionByDamage(attacker, nade_boom));
+ W_PrepareExplosionByDamage(this, attacker, nade_boom);
else
nade_burn_spawn(this);
}
float _force = time - held_nade.nade_time_primed;
_force /= autocvar_g_nades_nade_lifetime;
_force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
- toss_nade(self, true, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0);
+ vector dir = (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05);
+ dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
+ toss_nade(self, true, dir * _force, 0);
}
}
}
float _force = time - held_nade.nade_time_primed;
_force /= autocvar_g_nades_nade_lifetime;
_force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
- toss_nade(player, false, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0);
+ vector dir = (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1);
+ dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
+ toss_nade(player, false, dir * _force, 0);
}
}
}
other.last_pickup = time;
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
- _sound (other, CH_TRIGGER, (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
+ _sound (other, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
if (this.classname == "droppedweapon")
remove (this);
// compatibility:
spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength(this);}
-void target_items_use()
-{SELFPARAM();
- if(activator.classname == "droppedweapon")
+void target_items_use(entity this, entity actor, entity trigger)
+{
+ other = trigger; // TODO
+
+ if(actor.classname == "droppedweapon")
{
EXACTTRIGGER_TOUCH;
- remove(activator);
+ remove(actor);
return;
}
- if (!IS_PLAYER(activator))
+ if (!IS_PLAYER(actor))
return;
- if(IS_DEAD(activator))
+ if(IS_DEAD(actor))
return;
EXACTTRIGGER_TOUCH;
- FOREACH_ENTITY_ENT(enemy, activator,
+ FOREACH_ENTITY_ENT(enemy, actor,
{
if(it.classname == "droppedweapon")
remove(it);
});
- if(GiveItems(activator, 0, tokenize_console(self.netname)))
- centerprint(activator, self.message);
+ if(GiveItems(actor, 0, tokenize_console(this.netname)))
+ centerprint(actor, this.message);
}
spawnfunc(target_items)
#include "jumppads.qh"
#include <common/physics/movetypes/movetypes.qh>
-void trigger_push_use()
-{SELFPARAM();
+void trigger_push_use(entity this, entity actor, entity trigger)
+{
if(teamplay)
{
- self.team = activator.team;
- self.SendFlags |= 2;
+ this.team = actor.team;
+ this.SendFlags |= 2;
}
}
#endif
}
if(this.enemy.target)
- {
- activator = other;
- WITHSELF(this.enemy, SUB_UseTargets());
- }
+ SUB_UseTargets(this.enemy, other, other); // TODO: do we need other as trigger too?
if (other.flags & FL_PROJECTILE)
{
NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
{
- make_pure(this);
-
this.classname = "jumppad";
int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
this.spawnflags = ReadInt24_t();
#define COMMON_UTIL_H
#ifndef MENUQC
+
vector real_origin(entity ent);
#endif
float median(float a, float b, float c);
// converts a number to a string with the indicated number of decimals
- // works for up to 10 decimals!
string ftos_decimals(float number, float decimals);
+ string ftos_mindecimals(float number);
bool fexists(string f);
vector animfixfps(entity e, vector a, vector b);
#endif
- #ifdef SVQC
- void dedicated_print(string input);
- #endif
-
#ifndef MENUQC
const float CNT_NORMAL = 1;
const float CNT_GAMESTART = 2;
remove(self);
}
+void W_Hagar_Explode_use(entity this, entity actor, entity trigger)
+{
+ WITHSELF(this, W_Hagar_Explode());
+}
+
void W_Hagar_Explode2()
{SELFPARAM();
self.event_damage = func_null;
remove(self);
}
+void W_Hagar_Explode2_use(entity this, entity actor, entity trigger)
+{
+ WITHSELF(this, W_Hagar_Explode2());
+}
+
void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(this.health <= 0)
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
+ W_PrepareExplosionByDamage(this, attacker, this.think);
}
void W_Hagar_Touch()
{SELFPARAM();
PROJECTILE_TOUCH;
- self.use();
+ this.use(this, NULL, NULL);
}
void W_Hagar_Touch2()
PROJECTILE_TOUCH;
if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
- self.use();
+ this.use(this, NULL, NULL);
} else {
self.cnt++;
Send_Effect(EFFECT_HAGAR_BOUNCE, self.origin, self.velocity, 1);
missile.damagedbycontents = true;
missile.touch = W_Hagar_Touch;
- missile.use = W_Hagar_Explode;
+ missile.use = W_Hagar_Explode_use;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
PROJECTILE_MAKETRIGGER(missile);
missile.touch = W_Hagar_Touch2;
missile.cnt = 0;
- missile.use = W_Hagar_Explode2;
+ missile.use = W_Hagar_Explode2_use;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
PROJECTILE_MAKETRIGGER(missile);
missile.damagedbycontents = true;
missile.touch = W_Hagar_Touch; // not bouncy
- missile.use = W_Hagar_Explode2;
+ missile.use = W_Hagar_Explode2_use;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
PROJECTILE_MAKETRIGGER(missile);
}
}
+ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
+ {
+ if(!(fire & 1) || actor.hagar_load || actor.hagar_loadblock)
+ {
+ w_ready(thiswep, actor, weaponentity, fire);
+ return;
+ }
+
+ if(!thiswep.wr_checkammo1(thiswep))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, weaponentity, fire);
+ return;
+ }
+
+ W_Hagar_Attack(thiswep);
+
+ int slot = weaponslot(weaponentity);
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor();
+ int theframe = WFRAME_FIRE1;
+ entity this = actor.(weaponentity);
+ if(this)
+ {
+ if(this.wframe == WFRAME_FIRE1)
+ theframe = WFRAME_DONTCHANGE;
+ }
+ weapon_thinkf(actor, weaponentity, theframe, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto);
+ }
+
METHOD(Hagar, wr_aim, void(entity thiswep))
{
SELFPARAM();
W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
thiswep.wr_reload(thiswep, actor, weaponentity);
- } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
- {
- W_Hagar_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
- }
}
+ else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+ W_Hagar_Attack_Auto(thiswep, actor, weaponentity, fire);
+ }
else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
{
if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
defaultmodel = substring(defaultmodel, 0, i);
}
}
+ if(autocvar_sv_defaultcharacterskin && !defaultskin)
+ {
+ if(teamplay)
+ {
+ string s = Static_Team_ColorName_Lower(player.team);
+ if (s != "neutral")
+ defaultskin = cvar(strcat("sv_defaultplayerskin_", s));
+ }
+
+ if(!defaultskin)
+ defaultskin = autocvar_sv_defaultplayerskin;
+ }
+
MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin);
defaultmodel = ret_string;
defaultskin = ret_int;
chmdl = true;
}
- oldskin = player.skin;
- player.skin = stof(player.playerskin);
+ if(!autocvar_sv_defaultcharacterskin)
+ {
+ oldskin = player.skin;
+ player.skin = stof(player.playerskin);
+ }
+ else
+ {
+ oldskin = player.skin;
+ player.skin = defaultskin;
+ }
}
if(chmdl || oldskin != player.skin) // model or skin has changed
this.oldorigin = this.origin;
this.prevorigin = this.origin;
this.lastteleporttime = time; // prevent insane speeds due to changing origin
- this.hud = HUD_NORMAL;
+ this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
+ this.hud = HUD_NORMAL;
this.event_damage = PlayerDamage;
{
string s = spot.target;
spot.target = string_null;
- WITH(entity, activator, this, LAMBDA(
- WITHSELF(spot, SUB_UseTargets())
- ));
+ SUB_UseTargets(spot, this, NULL);
spot.target = s;
}
void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+void adaptor_think2use();
+
#define IS_DEAD(s) ((s).deadflag != DEAD_NO)
warmup_stage = cvar("g_warmup");
warmup_limit = cvar("g_warmup_limit");
- if(warmup_limit == 0)
- warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
g_warmup_allguns = cvar("g_warmup_allguns");
g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
fraglimit_override = autocvar_g_domination_roundbased_point_limit;
ActivateTeamplay();
- SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, -1, -1);
+ SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, autocvar_timelimit_override, -1);
have_team_spawns = -1; // request team spawns
}
old_team = self.team;
self.team = real_team;
self.delay = 0;
- activator = self;
- SUB_UseTargets ();
+ SUB_UseTargets (self, self, NULL);
self.delay = old_delay;
self.team = old_team;