MUTATOR_HOOKFUNCTION(breakablehook, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+
if(frag_target.classname == "grapplinghook")
{
if((!autocvar_g_breakablehook)
|| (!autocvar_g_breakablehook_owner && frag_attacker == frag_target.realowner)
- ) { frag_damage = 0; }
+ ) { M_ARGV(4, float) = 0; }
// hurt the owner of the hook
if(DIFF_TEAM(frag_attacker, frag_target.realowner))
MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_deathtype = M_ARGV(3, float);
+ float frag_damage = M_ARGV(4, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(frag_deathtype == DEATH_BUFF.m_id) { return false; }
if(frag_target.buffs & BUFF_SPEED.m_itemid)
frag_attacker.armorvalue = bound(0, frag_attacker.armorvalue + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.armorvalue), g_pickup_armorsmall_max);
}
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(6, vector) = frag_force;
+
return false;
}
MUTATOR_HOOKFUNCTION(campcheck, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+
if(IS_PLAYER(frag_target))
if(IS_PLAYER(frag_attacker))
if(frag_attacker != frag_target)
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_deathtype = M_ARGV(3, float);
+ float frag_damage = M_ARGV(4, float);
+ float frag_mirrordamage = M_ARGV(5, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(autocvar_g_friendlyfire == 0 && SAME_TEAM(frag_target, frag_attacker) && IS_PLAYER(frag_target) && IS_PLAYER(frag_attacker))
frag_damage = 0;
if(IS_PLAYER(frag_target))
yoda = 1;
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(5, float) = frag_mirrordamage;
+ M_ARGV(6, vector) = frag_force;
+
return false;
}
MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+
if(IS_PLAYER(frag_attacker))
if(IS_PLAYER(frag_target))
if(time < frag_target.midair_shieldtime)
MUTATOR_HOOKFUNCTION(nades, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_deathtype = M_ARGV(3, float);
+ float frag_damage = M_ARGV(4, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(STAT(FROZEN, frag_target))
if(autocvar_g_freezetag_revive_nade)
if(frag_attacker == frag_target)
frag_force = '0 0 0';
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);
Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
+
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(6, vector) = frag_force;
}
return false;
MUTATOR_HOOKFUNCTION(ok, PlayerDamage_Calculate, CBC_ORDER_LAST)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_deathtype = M_ARGV(3, float);
+ float frag_damage = M_ARGV(4, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target))
if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
{
Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE);
frag_force = '0 0 0';
}
+
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(6, vector) = frag_force;
}
return false;
// we do it this way, so rm can be toggled during the match
if(!autocvar_g_rm) { return false; }
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_deathtype = M_ARGV(3, float);
+ float frag_damage = M_ARGV(4, float);
+
if(DEATH_ISWEAPON(frag_deathtype, WEP_DEVASTATOR))
if(frag_attacker == frag_target || frag_target.classname == "nade")
frag_damage = 0;
if(frag_attacker == frag_target || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
frag_damage = 0;
+ M_ARGV(4, float) = frag_damage;
+
return false;
}
// used by MSG_CHOICE to build list of choices
#ifdef SVQC
-void Notification_GetCvars()
+void Notification_GetCvars(entity this)
{
FOREACH(Notifications, it.nent_type == MSG_CHOICE, {
GetCvars_handleFloat(
+ this,
get_cvars_s,
get_cvars_f,
msg_choice_choices[it.nent_choice_idx],
#ifdef SVQC
.float FRAG_VERBOSE;
-void Notification_GetCvars();
+void Notification_GetCvars(entity this);
float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes
#else
float autocvar_notification_item_centerprinttime = 1.5;
return substring(o, 1, -1);
}
-string W_FixWeaponOrder_AllowIncomplete(string order)
+string W_FixWeaponOrder_AllowIncomplete(entity this, string order)
{
return W_FixWeaponOrder(order, 0);
}
string W_NameWeaponOrder(string order);
string W_NumberWeaponOrder(string order);
string W_FixWeaponOrder_BuildImpulseList(string o);
-string W_FixWeaponOrder_AllowIncomplete(string order);
+string W_FixWeaponOrder_AllowIncomplete(entity this, string order);
string W_FixWeaponOrder_ForceComplete(string order);
void W_RandomWeapons(entity e, float n);
// should this be changed at all? If so, in what way?
MUTATOR_CALLHOOK(PlayerDamage_Calculate, inflictor, attacker, targ, deathtype, damage, mirrordamage, force);
- damage = frag_damage;
- mirrordamage = frag_mirrordamage;
- force = frag_force;
+ damage = M_ARGV(4, float);
+ mirrordamage = M_ARGV(5, float);
+ force = M_ARGV(6, vector);
if(STAT(FROZEN, targ))
if(deathtype != DEATH_HURTTRIGGER.m_id && deathtype != DEATH_TEAMCHANGE.m_id && deathtype != DEATH_AUTOTEAMCHANGE.m_id)
void play2team(float t, string filename);
-void GetCvars_handleFloat(string thisname, float f, .float field, string name);
+void GetCvars_handleFloat(entity this, string thisname, float f, .float field, string name);
float spamsound(entity e, float chan, string samp, float vol, float _atten);
-void GetCvars_handleString(string thisname, float f, .string field, string name);
+void GetCvars_handleString(entity this, string thisname, float f, .string field, string name);
void precache_all_playermodels(string pattern);
* i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
*/
#define EV_PlayerDamage_Calculate(i, o) \
- /**/ i(entity, frag_inflictor) \
- /**/ i(entity, frag_attacker) \
- /**/ i(entity, frag_target) \
- /**/ i(float, frag_deathtype) \
- /**/ i(float, frag_damage) \
- /**/ o(float, frag_damage) \
- /**/ i(float, frag_mirrordamage) \
- /**/ o(float, frag_mirrordamage) \
- /**/ i(vector, frag_force) \
- /**/ o(vector, frag_force) \
+ /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
+ /** target */ i(entity, MUTATOR_ARGV_2_entity) \
+ /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
+ /** damage */ i(float, MUTATOR_ARGV_4_float) \
+ /** damage */ o(float, MUTATOR_ARGV_4_float) \
+ /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
+ /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
+ /** force */ i(vector, MUTATOR_ARGV_6_vector) \
+ /** force */ o(vector, MUTATOR_ARGV_6_vector) \
/**/
-float frag_damage;
-float frag_mirrordamage;
-vector frag_force;
MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_PlayerDamage_Calculate);
/**
//vector bullet_hitloc; // the end pos matches the hit location, apparently
vector bullet_startpos;
vector bullet_endpos;
-//float frag_damage;
+float frag_damage;
MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
#define EV_FixPlayermodel(i, o) \
MUTATOR_HOOKFUNCTION(ca, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_deathtype = M_ARGV(3, float);
+ float frag_damage = M_ARGV(4, float);
+ float frag_mirrordamage = M_ARGV(5, float);
+
if (IS_PLAYER(frag_target))
if (!IS_DEAD(frag_target))
if (frag_target == frag_attacker || SAME_TEAM(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL.m_id)
frag_mirrordamage = 0;
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(5, float) = frag_mirrordamage;
+
return false;
}
MUTATOR_HOOKFUNCTION(ctf, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_damage = M_ARGV(4, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(frag_attacker.flagcarried) // if the attacker is a flagcarrier
{
if(frag_target == frag_attacker) // damage done to yourself
frag_damage *= autocvar_g_ctf_flagcarrier_damagefactor;
frag_force *= autocvar_g_ctf_flagcarrier_forcefactor;
}
+
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(6, vector) = frag_force;
}
else if(frag_target.flagcarried && !IS_DEAD(frag_target) && CTF_DIFFTEAM(frag_target, frag_attacker)) // if the target is a flagcarrier
{
MUTATOR_HOOKFUNCTION(cts, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_deathtype = M_ARGV(3, float);
+ float frag_damage = M_ARGV(4, float);
+
if(frag_target == frag_attacker || frag_deathtype == DEATH_FALL.m_id)
if(!autocvar_g_cts_selfdamage)
+ {
frag_damage = 0;
+ M_ARGV(4, float) = frag_damage;
+ }
return false;
}
MUTATOR_HOOKFUNCTION(inv, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_damage = M_ARGV(4, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target) && frag_attacker != frag_target)
{
frag_damage = 0;
frag_force = '0 0 0';
+
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(6, vector) = frag_force;
}
return false;
return -1;
}
- return 0;
+ return false;
}
}
if(frag_target.ballcarried) { ka_DropEvent(frag_target); } // a player with the ball has died, drop it
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, GiveFragsForKill)
if(self.ballcarried)
self.items |= IT_KEY1;
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, PlayerUseKey)
ka_DropEvent(self);
return 1;
}
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_damage = M_ARGV(4, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(frag_attacker.ballcarried) // if the attacker is a ballcarrier
{
if(frag_target == frag_attacker) // damage done to yourself
frag_force *= autocvar_g_keepaway_noncarrier_force;
}
}
- return 0;
+
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(6, vector) = frag_force;
+
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, ClientDisconnect)
{SELFPARAM();
if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, MakePlayerObserver)
{SELFPARAM();
if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, PlayerPowerups)
if(self.ballcarried)
self.effects |= autocvar_g_keepaway_ballcarrier_effects;
- return 0;
+ return false;
}
.float stat_sv_airspeedlimit_nonqw;