return 0;
}
-
-int Buff_Skin(float buff_id)
+int Buff_Skin(int buff_id)
{
entity e;
for(e = Buff_Type_first; e; e = e.enemy)
#ifndef BUFFS_H
#define BUFFS_H
+// Welcome to the stuff behind the scenes
+// Below, you will find the list of buffs
+// Add new buffs here!
+// Note: Buffs also need spawnfuncs, which are set below
entity Buff_Type_first;
entity Buff_Type_last;
.entity enemy; // internal next pointer
int BUFF_LAST = 1;
+int BUFF_ALL;
.int items; // buff ID
.string netname; // buff name
{ \
BUFF_##NAME = BUFF_LAST * 2; \
BUFF_LAST = BUFF_##NAME; \
+ BUFF_ALL |= BUFF_##NAME; \
Buff_Type##sname = spawn(); \
Buff_Type##sname.items = BUFF_##NAME; \
Buff_Type##sname.netname = #sname; \
BUFF_SPAWNFUNCS(random, 0)
BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_MEDIC)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_SPEED)
BUFF_SPAWNFUNC_Q3TA_COMPAT(ammoregen, BUFF_AMMO)
BUFF_SPAWNFUNC_Q3TA_COMPAT(haste, BUFF_SPEED)
BUFF_SPAWNFUNC_Q3TA_COMPAT(invis, BUFF_INVISIBLE)
BUFF_SPAWNFUNC_Q3TA_COMPAT(medic, BUFF_MEDIC)
+
+#undef BUFF_SPAWNFUNC
+#undef BUFF_SPAWNFUNC_Q3TA_COMPAT
+#undef BUFF_SPAWNFUNCS
#endif
vector Buff_Color(int buff_id);
#define DEATHTYPES \
DEATHTYPE(DEATH_AUTOTEAMCHANGE, DEATH_SELF_AUTOTEAMCHANGE, NO_MSG, DEATH_SPECIAL_START) \
- DEATHTYPE(DEATH_BUFF_VENGEANCE, NO_MSG, DEATH_MURDER_VENGEANCE, NORMAL_POS) \
+ DEATHTYPE(DEATH_BUFF, NO_MSG, DEATH_MURDER_BUFF, NORMAL_POS) \
DEATHTYPE(DEATH_CAMP, DEATH_SELF_CAMP, NO_MSG, NORMAL_POS) \
DEATHTYPE(DEATH_CHEAT, DEATH_SELF_CHEAT, DEATH_MURDER_CHEAT, NORMAL_POS) \
DEATHTYPE(DEATH_CUSTOM, DEATH_SELF_CUSTOM, NO_MSG, NORMAL_POS) \
MULTITEAM_INFO(1, INFO_CTF_PICKUP_, 2, 1, 0, "s1", "s1", "notify_%s_taken", _("^BG%s^BG got the ^TC^TT^BG flag"), "") \
MULTITEAM_INFO(1, INFO_CTF_RETURN_, 2, 1, 0, "s1", "s1", "notify_%s_returned", _("^BG%s^BG returned the ^TC^TT^BG flag"), "") \
MULTITEAM_INFO(1, INFO_CTF_RETURN_MONSTER_, 2, 1, 0, "s1", "s1", "notify_%s_returned", _("^BG%s^BG returned the ^TC^TT^BG flag"), "") \
+ MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_BUFF, 3, 3, "spree_inf s1 s2 f3buffname s3loc spree_end", "s2 s1", "notify_death", _("^BG%s%s^K1 was killed by ^BG%s^K1's ^BG%s^K1 buff ^K1%s%s"), _("^BG%s%s^K1 was scored against by ^BG%s^K1's ^BG%s^K1 buff ^K1%s%s")) \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_CHEAT, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_death", _("^BG%s%s^K1 was unfairly eliminated by ^BG%s^K1%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_DROWN, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_water", _("^BG%s%s^K1 was drowned by ^BG%s^K1%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_FALL, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_fall", _("^BG%s%s^K1 was grounded by ^BG%s^K1%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_VH_WAKI_DEATH, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_death", _("^BG%s%s^K1 got caught in the blast when ^BG%s^K1's Racer exploded%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_VH_WAKI_GUN, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_death", _("^BG%s%s^K1 was bolted down by ^BG%s^K1's Racer%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_VH_WAKI_ROCKET, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_death", _("^BG%s%s^K1 couldn't find shelter from ^BG%s^K1's Racer%s%s"), "") \
- MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_VENGEANCE, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_death", _("^BG%s%s^K1 was destroyed by the vengeful ^BG%s^K1%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_VOID, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_void", _("^BG%s%s^K1 was thrown into a world of hurt by ^BG%s^K1%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_SELF_AUTOTEAMCHANGE, 2, 1, "s1 s2loc death_team", "", "", _("^BG%s^K1 was moved into the %s%s"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_SELF_BETRAYAL, 2, 1, "s1 s2loc spree_lost", "s1", "notify_teamkill_red", _("^BG%s^K1 became enemies with the Lord of Teamplay%s%s"), "") \
MULTITEAM_MULTI##teams(default,prefix,anncepre,infopre,centerpre)
#define MSG_MULTI_NOTIFICATIONS \
+ MSG_MULTI_NOTIF(1, DEATH_MURDER_BUFF, NO_MSG, INFO_DEATH_MURDER_BUFF, NO_MSG) \
MSG_MULTI_NOTIF(1, DEATH_MURDER_CHEAT, NO_MSG, INFO_DEATH_MURDER_CHEAT, NO_MSG) \
MSG_MULTI_NOTIF(1, DEATH_MURDER_DROWN, NO_MSG, INFO_DEATH_MURDER_DROWN, NO_MSG) \
MSG_MULTI_NOTIF(1, DEATH_MURDER_FALL, NO_MSG, INFO_DEATH_MURDER_FALL, NO_MSG) \
MSG_MULTI_NOTIF(1, DEATH_MURDER_VH_WAKI_DEATH, NO_MSG, INFO_DEATH_MURDER_VH_WAKI_DEATH, NO_MSG) \
MSG_MULTI_NOTIF(1, DEATH_MURDER_VH_WAKI_GUN, NO_MSG, INFO_DEATH_MURDER_VH_WAKI_GUN, NO_MSG) \
MSG_MULTI_NOTIF(1, DEATH_MURDER_VH_WAKI_ROCKET, NO_MSG, INFO_DEATH_MURDER_VH_WAKI_ROCKET, NO_MSG) \
- MSG_MULTI_NOTIF(1, DEATH_MURDER_VENGEANCE, NO_MSG, INFO_DEATH_MURDER_VENGEANCE, NO_MSG) \
MSG_MULTI_NOTIF(1, DEATH_MURDER_VOID, NO_MSG, INFO_DEATH_MURDER_VOID, NO_MSG) \
MSG_MULTI_NOTIF(1, DEATH_SELF_AUTOTEAMCHANGE, NO_MSG, INFO_DEATH_SELF_AUTOTEAMCHANGE, CENTER_DEATH_SELF_AUTOTEAMCHANGE) \
MSG_MULTI_NOTIF(1, DEATH_SELF_BETRAYAL, NO_MSG, INFO_DEATH_SELF_BETRAYAL, CENTER_DEATH_SELF_BETRAYAL) \
#elif defined(SVQC)
#include "../warpzonelib/common.qh"
#include "../common/constants.qh"
+ #include "../common/buffs.qh"
#include "../common/teams.qh"
#include "../common/util.qh"
#include "../common/weapons/weapons.qh"
);
}
+ float f3 = 0;
+ if(deathtype == DEATH_BUFF)
+ f3 = attacker.buffs;
+
if (!Obituary_WeaponDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker))
- Obituary_SpecialDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker, 0);
+ Obituary_SpecialDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker, f3);
}
}
// count the damage
if(attacker)
if(!targ.deadflag)
- if(deathtype != DEATH_BUFF_VENGEANCE)
+ if(deathtype != DEATH_BUFF)
if(targ.takedamage == DAMAGE_AIM)
if(targ != attacker)
{
return true;
}
+vector buff_GlowColor(entity buff)
+{
+ //if(buff.team) { return Team_ColorRGB(buff.team); }
+ return buff.color;
+}
+
// buff item
float buff_Waypoint_visible_for_player(entity plr)
{
if(self.buffs != self.oldbuffs)
{
self.color = Buff_Color(self.buffs);
- self.glowmod = ((self.team) ? Team_ColorRGB(self.team) + '0.1 0.1 0.1' : self.color);
+ self.glowmod = buff_GlowColor(self);
self.skin = Buff_Skin(self.buffs);
setmodel(self, "models/relics/relic.md3");
}
}
- if(!self.buff_active)
+ if(self.buff_active)
{
- self.alpha = 0.3;
- self.effects &= ~(EF_FULLBRIGHT);
- self.pflags = 0;
- }
- else
- {
- self.alpha = 1;
- self.effects |= EF_FULLBRIGHT;
- self.light_lev = 220 + 36 * sin(time);
- self.pflags = PFLAGS_FULLDYNAMIC;
-
if(self.team && !self.buff_waypoint)
buff_Waypoint_Spawn(self);
buff_Respawn(self);
}
+float buff_Customize()
+{
+ entity player = WaypointSprite_getviewentity(other);
+ if(!self.buff_active || (self.team && DIFF_TEAM(player, self)))
+ {
+ self.alpha = 0.3;
+ if(self.effects & EF_FULLBRIGHT) { self.effects &= ~(EF_FULLBRIGHT); }
+ self.pflags = 0;
+ }
+ else
+ {
+ self.alpha = 1;
+ if(!(self.effects & EF_FULLBRIGHT)) { self.effects |= EF_FULLBRIGHT; }
+ self.light_lev = 220 + 36 * sin(time);
+ self.pflags = PFLAGS_FULLDYNAMIC;
+ }
+ return true;
+}
+
void buff_Init(entity ent)
{
if(!cvar("g_buffs")) { remove(self); return; }
self.skin = Buff_Skin(self.buffs);
self.effects = EF_FULLBRIGHT | EF_STARDUST | EF_NOSHADOW;
self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
+ self.customizeentityforclient = buff_Customize;
//self.gravity = 100;
self.color = Buff_Color(self.buffs);
- self.glowmod = ((self.team) ? Team_ColorRGB(self.team) + '0.1 0.1 0.1' : self.color);
+ self.glowmod = buff_GlowColor(self);
buff_SetCooldown(autocvar_g_buffs_cooldown_activate + game_starttime);
self.buff_active = !self.buff_activetime;
self.pflags = PFLAGS_FULLDYNAMIC;
// mutator hooks
MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_SplitHealthArmor)
{
- if(frag_deathtype == DEATH_BUFF_VENGEANCE) { return false; } // oh no you don't
+ if(frag_deathtype == DEATH_BUFF) { return false; }
if(frag_target.buffs & BUFF_RESISTANCE)
{
void buff_Vengeance_DelayedDamage()
{
if(self.enemy)
- Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF_VENGEANCE, self.enemy.origin, '0 0 0');
+ Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF, self.enemy.origin, '0 0 0');
remove(self);
return;
MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate)
{
- if(frag_deathtype == DEATH_BUFF_VENGEANCE) { return false; } // oh no you don't
+ if(frag_deathtype == DEATH_BUFF) { return false; }
if(frag_target.buffs & BUFF_SPEED)
if(frag_target != frag_attacker)
frag_target.buff_disability_time = time + autocvar_g_buffs_disability_time;
if(frag_attacker.buffs & BUFF_MEDIC)
+ if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC)
if(SAME_TEAM(frag_attacker, frag_target))
if(frag_attacker != frag_target)
{
// this... is ridiculous (TODO: fix!)
if(frag_attacker.buffs & BUFF_VAMPIRE)
if(!frag_target.vehicle)
+ if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC)
if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
if(frag_target.deadflag == DEAD_NO)
if(IS_PLAYER(frag_target) || (frag_target.flags & FL_MONSTER))
self.buff_model.customizeentityforclient = buffs_BuffModel_Customize;
}
self.buff_model.color = Buff_Color(self.buffs);
- self.buff_model.glowmod = ((self.buff_model.team) ? Team_ColorRGB(self.buff_model.team) + '0.1 0.1 0.1' : self.buff_model.color);
+ self.buff_model.glowmod = buff_GlowColor(self.buff_model);
self.buff_model.skin = Buff_Skin(self.buffs);
self.effects |= EF_NOSHADOW;
MUTATOR_HOOK(VehicleExit, buffs_VehicleExit, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerRegen, buffs_PlayerRegen, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerDies, buffs_PlayerDies, CBC_ORDER_ANY);
- MUTATOR_HOOK(PlayerUseKey, buffs_PlayerUseKey, CBC_ORDER_ANY);
+ MUTATOR_HOOK(PlayerUseKey, buffs_PlayerUseKey, CBC_ORDER_FIRST);
MUTATOR_HOOK(MakePlayerObserver, buffs_RemovePlayer, CBC_ORDER_ANY);
MUTATOR_HOOK(ClientDisconnect, buffs_RemovePlayer, CBC_ORDER_ANY);
MUTATOR_HOOK(OnEntityPreSpawn, buffs_OnEntityPreSpawn, CBC_ORDER_ANY);