7 #include "../random_items/sv_random_items.qh" 45 string cvar_name = sprintf(
"g_%s_%s_probability", prefix,
46 it.m_canonical_spawnfunc);
49 LOG_WARNF(
"Random items: cvar %s doesn't exist.", cvar_name);
61 if (!e.instagib_needammo)
63 Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_INSTAGIB_FINDAMMO);
64 e.instagib_needammo =
false;
71 float dmg = (hp <= 10) ? 5 : 10;
72 Damage(
this,
this,
this, dmg, DEATH_NOAMMO.m_id,
DMG_NOWEP,
this.origin,
'0 0 0');
74 entity annce = (hp <= 5) ? ANNCE_INSTAGIB_TERMINATED : Announcer_PickNumber(CNT_NORMAL,
ceil(hp / 10));
75 Send_Notification(NOTIF_ONE,
this, MSG_ANNCE, annce);
80 Send_Notification(NOTIF_ONE_ONLY,
this, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO);
82 Send_Notification(NOTIF_ONE_ONLY,
this, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO);
93 if(
IS_DEAD(
this) || game_stopped)
101 Send_Notification(NOTIF_ONE,
this, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE);
129 item.monster_loot = ITEM_VaporizerCells;
137 if(mon.monsterdef == MON_MAGE)
189 float frag_deathtype =
M_ARGV(3,
float);
190 float frag_damage =
M_ARGV(4,
float);
191 float frag_mirrordamage =
M_ARGV(5,
float);
199 if(frag_deathtype == DEATH_FALL.m_id)
216 frag_force =
'0 0 0';
224 frag_target.hitsound_damage_dealt += 1;
225 frag_attacker.hitsound_damage_dealt += 1;
226 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, armor);
238 frag_mirrordamage = 0;
241 if(frag_target != frag_attacker)
244 frag_force =
'0 0 0';
252 if(frag_mirrordamage > 0)
255 float armor =
GetResource(frag_attacker, RES_ARMOR);
260 Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, armor);
261 frag_attacker.hitsound_damage_dealt += frag_mirrordamage;
263 frag_mirrordamage = 0;
266 if(frag_target.alpha && frag_target.alpha < 1)
270 M_ARGV(4,
float) = frag_damage;
271 M_ARGV(5,
float) = frag_mirrordamage;
294 M_ARGV(0,
string) =
"off";
299 entity e =
new(item_vaporizer_cells);
304 e.spawnfunc_checked =
true;
305 spawnfunc_item_vaporizer_cells(e);
312 if(item.classname ==
"item_cells")
320 else if(item.classname ==
"item_rockets")
328 else if(item.classname ==
"item_shells")
336 else if(item.classname ==
"item_bullets")
345 if(item.weapon == WEP_VAPORIZER.m_id &&
Item_IsLoot(item))
347 SetResource(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
351 if(item.weapon == WEP_DEVASTATOR.m_id || item.weapon == WEP_VORTEX.m_id)
357 if(item.itemdef.instanceOfPowerup)
361 if(cells > autocvar_g_instagib_ammo_drop && item.classname !=
"item_vaporizer_cells")
362 SetResource(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
364 if(cells && !item.weapon)
372 float frag_deathtype =
M_ARGV(3,
float);
392 Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_LASTSECOND);
394 Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_NARROWLY);
403 if(item.itemdef == ITEM_ExtraLife)
419 if (!(ent.classname ==
"item_strength" || ent.classname ==
"item_shield" || ent.classname ==
"item_invincible" || ent.classname ==
"item_health_mega"))
427 e.classname =
"item_invisibility";
432 e.classname =
"item_extralife";
437 e.classname =
"item_speed";
441 e.nextthink =
time + 0.1;
442 e.spawnflags = ent.spawnflags;
443 e.noalign = ent.noalign;
461 M_ARGV(0,
string) =
"InstaGib";
#define IL_EACH(this, cond, body)
string RandomSelection_chosen_string
void instagib_speed(entity this)
bool Item_IsDefinitionAllowed(entity definition)
Checks whether the items with the specified definition are allowed to spawn.
float warmup_start_ammo_shells
WepSet warmup_start_weapons
bool autocvar_g_instagib_ammo_convert_bullets
ERASEABLE void RandomSelection_Init()
float CVAR_TYPEFLAG_EXISTS
bool autocvar_g_instagib_friendlypush
#define FOREACH_CLIENT(cond, body)
void instagib_invisibility(entity this)
void instagib_stop_countdown(entity e)
bool autocvar_g_instagib_ammo_convert_shells
#define RandomSelection_AddString(s, weight, priority)
bool autocvar_g_instagib_ammo_convert_cells
void PlayerPreThink(entity this)
float warmup_start_ammo_plasma
MUTATOR_HOOKFUNCTION(mutator_instagib, MatchEnd)
const float EF_FULLBRIGHT
string RandomItems_GetRandomInstagibItemClassName(string prefix)
Returns a random classname of the instagib item.
void replace_with_insta_cells(entity item)
bool autocvar_g_instagib_blaster_keepdamage
float autocvar_g_instagib_speed_time
Time of speed powerup in seconds.
float warmup_start_ammo_cells
bool autocvar_g_instagib_damagedbycontents
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
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"))
string RandomItems_GetRandomItemClassName(string prefix)
Returns a random classname of the item.
void StartItem(entity this, GameItem def)
float autocvar_g_friendlyfire
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
#define MUTATOR_RETURNVALUE
const int HITTYPE_SECONDARY
IntrusiveList g_instagib_items
float warmup_start_armorvalue
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
bool autocvar_g_instagib_mirrordamage
float warmup_start_ammo_rockets
bool Item_ShouldKeepPosition(entity item)
Returns whether item should keep its position or be dropped to the ground.
int autocvar_g_instagib_extralives
bool autocvar_g_instagib_blaster_keepforce
float warmup_start_health
float autocvar_g_instagib_invisibility_time
Time of invisibility powerup in seconds.
bool Item_IsLoot(entity item)
Returns whether the item is loot.
bool autocvar_g_instagib_ammo_convert_rockets
#define DEATH_ISWEAPON(t, w)
void instagib_extralife(entity this)
void instagib_ammocheck(entity this)
float autocvar_g_rm_laser
void instagib_countdown(entity this)
float warmup_start_ammo_nails