10 entity player = WaypointSprite_getviewentity(client);
17 if(myowner.alpha <= 0.5 &&
DIFF_TEAM(player, myowner) && myowner.alpha != 0)
32 this.
alpha = myowner.alpha;
41 if(player.alpha < 0 || player.buff_model !=
this)
44 player.buff_model =
NULL;
57 this.
color = heldbuff.m_color;
58 this.
glowmod = heldbuff.m_color;
59 this.
skin = heldbuff.m_skin;
65 this.
alpha = player.alpha;
71 delete(player.buff_model);
72 player.buff_model =
NULL;
78 setmodel(player.buff_model, MDL_BUFF);
79 setsize(player.buff_model,
'0 0 -40',
'0 0 40');
80 setattachment(player.buff_model, player,
"");
81 setorigin(player.buff_model,
'0 0 1' * (player.buff_model.maxs.z * 1));
82 player.buff_model.owner = player;
83 player.buff_model.exteriormodeltoclient = player;
84 player.buff_model.scale = 0.7;
86 player.buff_model.light_lev = 200;
88 player.buff_model.nextthink =
time;
105 if(
time >= player.buff_effect_delay)
107 Send_Effect_(eff, player.origin + ((player.mins + player.maxs) * 0.5),
'0 0 0', 1);
108 player.buff_effect_delay =
time + 0.05;
115 if(!this.
owner.buff_active && !
this.owner.buff_activetime || !
this.owner.buffdef)
121 return CS_CVAR(view).cvar_cl_buffs_autoreplace ==
false || heldbuff != this.
owner.buffdef;
124 return WaypointSprite_visible_for_player(
this, player, view);
132 entity wp = WaypointSprite_Spawn(WP_Buff, 0,
autocvar_g_buffs_waypoint_distance, e,
'0 0 1' * e.maxs.z,
NULL, e.team_forced, e,
buff_waypoint,
true, RADARICON_Buff);
133 wp.wp_extra = buff.m_id;
134 WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_Buff, e.glowmod);
154 if(game_stopped)
return;
165 this.
angles = spot.angles;
179 Send_Effect(EFFECT_ELECTRO_COMBO, oldbufforigin + ((this.
mins + this.
maxs) * 0.5),
'0 0 0', 1);
189 if(game_stopped)
return;
207 if((this.
team_forced && toucher.team !=
this.team_forced)
208 || (STAT(FROZEN, toucher))
211 || (
time < toucher.buff_shield)
219 entity thebuff = this.buffdef;
223 if (
CS_CVAR(toucher).cvar_cl_buffs_autoreplace && heldbuff != thebuff)
226 int buffid = heldbuff.m_id;
227 Send_Notification(NOTIF_ONE, toucher, MSG_INFO, INFO_ITEM_BUFF_LOST, toucher.netname, buffid);
229 Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_INFO, INFO_ITEM_BUFF_LOST, toucher.netname, buffid);
236 this.
owner = toucher;
239 Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_GOT, thebuff.m_id);
241 Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_INFO, INFO_ITEM_BUFF, toucher.netname, thebuff.m_id);
245 float oldtime = StatusEffects_gettime(thebuff, toucher);
246 float bufftime = ((this.buffs_finished) ? this.buffs_finished : thebuff.m_time(thebuff));
250 StatusEffects_apply(thebuff, toucher,
min(
time + bufftime,
max(oldtime,
time) + bufftime), 0);
252 StatusEffects_apply(thebuff, toucher,
time + 999, 0);
254 STAT(LAST_PICKUP, toucher) =
time;
261 if (buff == BUFF_AMMO && ((
start_items & IT_UNLIMITED_AMMO) ||
cvar(
"g_melee_only")))
263 if (buff == BUFF_VAMPIRE &&
cvar(
"g_vampire"))
265 return cvar(
strcat(
"g_buffs_", buff.netname));
276 float myseencount = (it.buff_seencount > 0) ? it.buff_seencount : 1;
282 newbuff.buff_seencount += 1;
283 ent.buffdef = newbuff;
288 if(!actor.statuseffects)
290 FOREACH(StatusEffect, it.instanceOfBuff,
292 it.m_remove(it, actor, removal_type);
298 if(!actor.statuseffects)
300 FOREACH(StatusEffect, it.instanceOfBuff && it.m_active(it, actor), {
return it; });
311 entity buff = this.buffdef;
312 this.
color = buff.m_color;
314 this.
skin = buff.m_skin;
401 entity player = WaypointSprite_getviewentity(client);
426 if(!
cvar(
"g_buffs")) {
delete(
this);
return; }
428 entity buff = this.buffdef;
449 this.
skin = buff.m_skin;
454 this.
color = buff.m_color;
461 if(!this.buffs_finished)
462 this.buffs_finished = this.
count;
478 if (ent.spawnflags & 2)
480 else if (ent.spawnflags & 4)
484 ent.buffdef = replacement;
492 ent.angles = old.angles;
509 return offset_y + (intersect_y - offset_y) *
logn(((damg - offset_x) * ((base - 1) / intersect_x)) + 1, base);
516 SUPER(
Buff).m_apply(
this, actor, eff_time, eff_flags);
523 int buffid = this.
m_id;
526 Send_Notification(NOTIF_ONE, actor, MSG_MULTI, ITEM_BUFF_DROP, buffid);
530 Send_Notification(NOTIF_ALL_EXCEPT, actor, MSG_INFO, INFO_ITEM_BUFF_LOST, actor.netname, buffid);
535 SUPER(
Buff).m_remove(
this, actor, removal_type);
540 if(
time >= actor.disabled_effect_time)
542 Send_Effect(EFFECT_SMOKING, actor.origin + ((actor.mins + actor.maxs) * 0.5),
'0 0 0', 1);
543 actor.disabled_effect_time =
time + 0.5;
549 actor.disabled_effect_time = 0;
558 actor.buff_ammo_prev_infitems = (actor.items & IT_UNLIMITED_AMMO);
559 actor.items |= IT_UNLIMITED_AMMO;
563 if(!actor.(weaponentity))
565 if(actor.(weaponentity).clip_load)
566 actor.(weaponentity).buff_ammo_prev_clipload = actor.(weaponentity).
clip_load;
567 if(actor.(weaponentity).clip_size)
568 actor.(weaponentity).clip_load = actor.(weaponentity).(
weapon_load[actor.(weaponentity).m_switchweapon.m_id]) = actor.(weaponentity).clip_size;
578 actor.items =
BITSET(actor.items, IT_UNLIMITED_AMMO, actor.buff_ammo_prev_infitems);
582 if(!actor.(weaponentity))
584 if(actor.(weaponentity).buff_ammo_prev_clipload)
586 actor.(weaponentity).
clip_load = actor.(weaponentity).buff_ammo_prev_clipload;
591 actor.buff_ammo_prev_infitems = 0;
601 if(actor.(weaponentity).clip_size)
602 actor.(weaponentity).clip_load = actor.(weaponentity).(
weapon_load[actor.(weaponentity).m_switchweapon.m_id]) = actor.(weaponentity).clip_size;
615 actor.buff_flight_oldgravity = actor.gravity;
626 actor.gravity = ((actor.trigger_gravity_check) ? actor.trigger_gravity_check.enemy.gravity : actor.buff_flight_oldgravity);
628 actor.buff_flight_oldgravity = 0;
640 pickup_size =
'1 1 1' * autocvar_g_buffs_magnet_range_buff;
642 pickup_size =
'1 1 1' * autocvar_g_buffs_magnet_range_item;
644 if(boxesoverlap(actor.absmin - pickup_size, actor.absmax + pickup_size, it.absmin, it.absmax))
647 gettouch(it)(it, actor);
660 float frag_deathtype =
M_ARGV(3,
float);
661 float frag_damage =
M_ARGV(4,
float);
664 if(frag_deathtype == DEATH_BUFF.m_id) {
return; }
666 if(StatusEffects_active(BUFF_RESISTANCE, frag_target))
669 frag_damage =
bound(0, frag_damage - reduced, frag_damage);
672 if(StatusEffects_active(BUFF_MEDIC, frag_target))
679 if(StatusEffects_active(BUFF_JUMP, frag_target))
680 if(frag_deathtype == DEATH_FALL.m_id)
683 if(StatusEffects_active(BUFF_VENGEANCE, frag_target))
685 if(frag_attacker != frag_target)
691 dmgent.enemy = frag_attacker;
692 dmgent.owner = frag_target;
694 dmgent.nextthink =
time + 0.1;
697 if(StatusEffects_active(BUFF_BASH, frag_target))
698 if(frag_attacker != frag_target)
699 frag_force =
'0 0 0';
701 if(StatusEffects_active(BUFF_BASH, frag_attacker))
704 if(frag_attacker == frag_target)
710 if(StatusEffects_active(BUFF_DISABILITY, frag_attacker))
711 if(frag_target != frag_attacker)
714 if(StatusEffects_active(BUFF_INFERNO, frag_target))
716 if(frag_deathtype == DEATH_FIRE.m_id)
718 if(frag_deathtype == DEATH_LAVA.m_id)
722 if(StatusEffects_active(BUFF_LUCK, frag_attacker))
723 if(frag_attacker != frag_target)
728 if(StatusEffects_active(BUFF_INFERNO, frag_attacker))
729 if(frag_target != frag_attacker) {
741 M_ARGV(4,
float) = frag_damage;
750 if(!StatusEffects_active(BUFF_VAMPIRE, frag_attacker))
754 if (!StatusEffects_active(STATUSEFFECT_SpawnShield, frag_target) && frag_target != frag_attacker
755 &&
IS_PLAYER(frag_attacker) && !
IS_DEAD(frag_target) && !STAT(FROZEN, frag_target))
766 if(StatusEffects_active(STATUSEFFECT_Disabled, player))
775 if(StatusEffects_active(BUFF_JUMP, player))
783 if(StatusEffects_active(STATUSEFFECT_Disabled, mon))
799 int buffid = heldbuff.m_id;
800 Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid);
802 Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
816 if(StatusEffects_active(BUFF_SWAPPER, player))
821 if(!
IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle)
824 float test =
vlen2(player.origin - it.origin);
825 if(test <= best_distance * best_distance)
827 best_distance =
sqrt(test);
835 vector my_org, my_vel, my_ang, their_org, their_vel, their_ang;
837 my_org = player.origin;
838 my_vel = player.velocity;
839 my_ang = player.angles;
840 their_org = closest.origin;
841 their_vel = closest.velocity;
842 their_ang = closest.angles;
851 closest.velocity = my_vel;
852 closest.angles = my_ang;
855 closest.v_angle = closest.angles;
858 closest.fixangle =
true;
859 closest.oldorigin = my_org;
860 closest.oldvelocity = my_vel;
861 player.velocity = their_vel;
862 player.angles = their_ang;
865 player.v_angle = player.angles;
868 player.fixangle =
true;
869 player.oldorigin = their_org;
870 player.oldvelocity = their_vel;
873 closest.pusher = player;
877 Send_Effect(EFFECT_ELECTRO_COMBO, their_org,
'0 0 0', 1);
878 Send_Effect(EFFECT_ELECTRO_COMBO, my_org,
'0 0 0', 1);
901 if(autocvar_g_buffs < 0)
920 if(StatusEffects_active(STATUSEFFECT_Disabled, player))
928 if(StatusEffects_active(STATUSEFFECT_Disabled, player))
945 if(StatusEffects_active(BUFF_FLIGHT, player))
948 player.buff_flight_crouchheld =
false;
949 else if(!player.buff_flight_crouchheld)
951 player.buff_flight_crouchheld =
true;
952 player.gravity *= -1;
964 if(StatusEffects_active(BUFF_MEDIC, player))
974 if(autocvar_g_buffs > 0)
980 if(autocvar_g_buffs > 0)
void buff_Init_Compat(entity ent, entity replacement)
void buff_RemoveAll(entity actor, int removal_type)
entity SelectSpawnPoint(entity this, bool anypoint)
#define round_handler_IsActive()
float autocvar_g_buffs_medic_survive_health
#define IL_EACH(this, cond, body)
float autocvar_g_buffs_inferno_burntime_factor
#define PHYS_INPUT_BUTTON_CHAT(s)
float autocvar_g_buffs_disability_slowtime
#define PHYS_INPUT_BUTTON_CROUCH(s)
float weapon_load[REGISTRY_MAX(Weapons)]
float autocvar_g_buffs_inferno_damagemultiplier
float autocvar_g_buffs_swapper_range
float autocvar_g_buffs_random_lifetime
float autocvar_g_buffs_medic_rot
float logn(float e, float base)
void bot_aim_reset(entity this)
#define IS_INDEPENDENT_PLAYER(e)
float autocvar_g_buffs_waypoint_distance
bool autocvar_g_buffs_replace_powerups
ERASEABLE void RandomSelection_Init()
bool buff_activetime_updated
bool autocvar_g_buffs_drop
int autocvar_g_buffs_spawn_count
float buff_Inferno_CalculateTime(float damg, float offset_x, float offset_y, float intersect_x, float intersect_y, float base)
void buffs_DelayedInit(entity this)
float autocvar_g_buffs_inferno_burntime_target_time
bool autocvar_g_buffs_random_location
void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint)
#define FOREACH_CLIENT(cond, body)
float autocvar_g_buffs_medic_regen
bool autocvar_g_buffs_effects
var void delete_fn(entity e)
Effect is being removed by a function, calls regular removal mechanics.
float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
float DPCONTENTS_PLAYERCLIP
float bot_pickupbasevalue
float generic_pickupevalfunc(entity player, entity item)
float autocvar_g_buffs_luck_damagemultiplier
float autocvar_g_buffs_bash_force
#define round_handler_IsRoundStarted()
#define METHOD(cname, name, prototype)
entity buff_FirstFromFlags(entity actor)
void buff_Init(entity this)
float autocvar_g_buffs_disability_weaponspeed
void PlayerPreThink(entity this)
float autocvar_g_buffs_medic_survive_chance
float autocvar_g_maxpushtime
bool buffs_RemovePlayer(entity player)
int autocvar_g_buffs_random_location_attempts
#define setmodel(this, m)
float autocvar_g_buffs_bash_force_self
bool buff_Customize(entity this, entity client)
void buff_Reset(entity this)
float autocvar_g_buffs_medic_max
#define RandomSelection_AddEnt(e, weight, priority)
const float EF_FULLBRIGHT
void buff_Touch(entity this, entity toucher)
void buff_Waypoint_Spawn(entity e)
void buff_SetCooldown(entity this, float cd)
float autocvar_g_buffs_vengeance_damage_multiplier
float autocvar_g_buffs_disability_rate
float autocvar_g_buffs_pickup_delay
MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
bool autocvar_g_buffs_randomize
const float MOVE_NOMONSTERS
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float autocvar_g_buffs_jump_height
void buff_SpawnReplacement(entity ent, entity old)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
const int MAX_WEAPONSLOTS
float autocvar_g_buffs_luck_chance
void PlayerUseKey(entity this)
entity RandomSelection_chosen_ent
void buffs_BuffModel_Remove(entity player)
const int CBC_ORDER_FIRST
void buff_Waypoint_Reset(entity this)
float autocvar_g_buffs_disability_speed
bool buff_Waypoint_visible_for_player(entity this, entity player, entity view)
float autocvar_g_buffs_cooldown_activate
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
#define MUTATOR_RETURNVALUE
bool autocvar_g_buffs_pickup_anyway
#define BITSET(var, mask, flag)
void buff_Think(entity this)
#define CENTER_OR_VIEWOFS(ent)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define ITEM_DAMAGE_NEEDKILL(dt)
int buff_ammo_prev_clipload
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
void buffs_BuffModel_Spawn(entity player)
const float PFLAGS_FULLDYNAMIC
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define ITEM_TOUCH_NEEDKILL()
float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
void InitializeEntity(entity e, void(entity this) func, int order)
bool Item_ShouldKeepPosition(entity item)
Returns whether item should keep its position or be dropped to the ground.
bool autocvar_g_buffs_randomize_teamplay
void buffs_BuffModel_Think(entity this)
const float SOLID_TRIGGER
float autocvar_g_buffs_inferno_burntime_min_time
float autocvar_g_buffs_resistance_blockpercent
#define MUTATOR_CALLHOOK(id,...)
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
void Drop_Special_Items(entity player)
entity weaponentities[MAX_WEAPONSLOTS]
void buff_Effect(entity player, string eff)
bool buffs_BuffModel_Customize(entity this, entity client)
float autocvar_g_buffs_cooldown_respawn
#define new_pure(class)
purely logical entities (.origin doesn't work)
#define sound(e, c, s, v, a)
void buff_Vengeance_DelayedDamage(entity this)
float buff_Available(entity buff)
float DPCONTENTS_DONOTENTER
void buff_Respawn(entity this)
void buff_Delete(entity this)
float autocvar_g_buffs_inferno_burntime_target_damage
#define FOREACH(list, cond, body)
void set_movetype(entity this, int mt)
float autocvar_g_buffs_vampire_damage_steal
void buffs_BuffModel_Update(entity this)
void buff_NewType(entity ent)