Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_instagib.qc File Reference
Include dependency graph for sv_instagib.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void instagib_ammocheck (entity this)
void instagib_countdown (entity this)
void instagib_replace_item_with (entity this, GameItem def)
void instagib_replace_item_with_random_powerup (entity item)
 Replaces item with a random powerup selected among the less spawned ones.
void instagib_stop_countdown (entity e)
 MUTATOR_HOOKFUNCTION (mutator_instagib, BuildMutatorsPrettyString)
 MUTATOR_HOOKFUNCTION (mutator_instagib, BuildMutatorsString)
 MUTATOR_HOOKFUNCTION (mutator_instagib, Damage_Calculate)
 MUTATOR_HOOKFUNCTION (mutator_instagib, FilterItem)
 MUTATOR_HOOKFUNCTION (mutator_instagib, ForbidRandomStartWeapons)
 MUTATOR_HOOKFUNCTION (mutator_instagib, ForbidThrowCurrentWeapon)
 MUTATOR_HOOKFUNCTION (mutator_instagib, GiveResourceWithLimit)
 MUTATOR_HOOKFUNCTION (mutator_instagib, ItemTouch)
 MUTATOR_HOOKFUNCTION (mutator_instagib, MakePlayerObserver)
 MUTATOR_HOOKFUNCTION (mutator_instagib, MatchEnd)
 MUTATOR_HOOKFUNCTION (mutator_instagib, MonsterDropItem)
 MUTATOR_HOOKFUNCTION (mutator_instagib, MonsterSpawn)
 MUTATOR_HOOKFUNCTION (mutator_instagib, PlayerDamage_SplitHealthArmor)
 MUTATOR_HOOKFUNCTION (mutator_instagib, PlayerDies)
 MUTATOR_HOOKFUNCTION (mutator_instagib, PlayerPreThink)
 MUTATOR_HOOKFUNCTION (mutator_instagib, PlayerRegen)
 MUTATOR_HOOKFUNCTION (mutator_instagib, PlayerSpawn)
 MUTATOR_HOOKFUNCTION (mutator_instagib, RandomItems_GetRandomItemClassName)
 MUTATOR_HOOKFUNCTION (mutator_instagib, SetModname)
 MUTATOR_HOOKFUNCTION (mutator_instagib, SetStartItems, CBC_ORDER_LAST)
 MUTATOR_HOOKFUNCTION (mutator_instagib, SetWeaponArena)
 MUTATOR_HOOKFUNCTION (mutator_instagib, SetWeaponStay)
 MUTATOR_HOOKFUNCTION (mutator_instagib, SuperweaponsImmutable)
 MUTATOR_HOOKFUNCTION (mutator_instagib, Turret_Plasma_Fire)
string RandomItems_GetRandomInstagibItemClassName (string prefix)
 Returns a random classname of the instagib item.

Variables

bool autocvar_g_instagib_allow_jetpacks
bool autocvar_g_instagib_ammo_convert_bullets
bool autocvar_g_instagib_ammo_convert_cells
bool autocvar_g_instagib_ammo_convert_rockets
bool autocvar_g_instagib_ammo_convert_shells
bool autocvar_g_instagib_blaster_keepdamage = false
bool autocvar_g_instagib_blaster_keepforce = false
bool autocvar_g_instagib_damagedbycontents = true
bool autocvar_g_instagib_friendlypush = true
bool autocvar_g_instagib_mirrordamage
bool instagib_needammo
float instagib_nextthink
const int INSTAGIB_POWERUP_COUNT = 3
GameItem instagib_remaining_powerups [INSTAGIB_POWERUP_COUNT]

Function Documentation

◆ instagib_ammocheck()

void instagib_ammocheck ( entity this)

Definition at line 70 of file sv_instagib.qc.

71{
72 if (time < this.instagib_nextthink || !IS_PLAYER(this))
73 return;
74
75 if (IS_DEAD(this) || game_stopped)
77 else if (GetResource(this, RES_CELLS) > 0 || (this.items & IT_UNLIMITED_AMMO) || (this.flags & FL_GODMODE))
80 {
81 if (!this.instagib_needammo)
82 {
83 Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE);
84 this.instagib_needammo = true;
85 }
86 }
87 else
88 {
89 this.instagib_needammo = true;
91 }
92 this.instagib_nextthink = time + 1;
93}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
const int IT_UNLIMITED_AMMO
Definition item.qh:23
int items
Definition player.qh:226
#define IS_DEAD(s)
Definition player.qh:244
#define IS_PLAYER(s)
Definition player.qh:242
float game_stopped
Definition stats.qh:81
const int FL_GODMODE
Definition constants.qh:67
float flags
float time
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1500
void instagib_countdown(entity this)
float instagib_nextthink
bool instagib_needammo
void instagib_stop_countdown(entity e)
bool autocvar_g_rm
Definition sv_instagib.qh:8
bool autocvar_g_rm_laser

References autocvar_g_rm, autocvar_g_rm_laser, entity(), FL_GODMODE, flags, game_stopped, GetResource(), instagib_countdown(), instagib_needammo, instagib_nextthink, instagib_stop_countdown(), IS_DEAD, IS_PLAYER, IT_UNLIMITED_AMMO, items, Send_Notification(), and time.

Referenced by MUTATOR_HOOKFUNCTION().

◆ instagib_countdown()

void instagib_countdown ( entity this)

Definition at line 51 of file sv_instagib.qc.

52{
53 float hp = GetResource(this, RES_HEALTH);
54
55 float dmg = (hp <= 10) ? 5 : 10;
56 Damage(this, this, this, dmg, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0');
57
58 entity annce = (hp <= 5) ? ANNCE_INSTAGIB_TERMINATED : Announcer_PickNumber(CNT_NORMAL, ceil(hp / 10));
59 Send_Notification(NOTIF_ONE, this, MSG_ANNCE, annce);
60
61 if (hp > 80)
62 {
63 if (hp <= 90)
64 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO);
65 else
66 Send_Notification(NOTIF_ONE_ONLY, this, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO);
67 }
68}
float dmg
Definition breakable.qc:12
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
Notification Announcer_PickNumber(int type, int num)
Definition util.qc:1926
const int CNT_NORMAL
Definition util.qh:258
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:484
#define DMG_NOWEP
Definition damage.qh:104
float ceil(float f)

References Announcer_PickNumber(), ceil(), CNT_NORMAL, Damage(), dmg, DMG_NOWEP, entity(), GetResource(), and Send_Notification().

Referenced by instagib_ammocheck().

◆ instagib_replace_item_with()

void instagib_replace_item_with ( entity this,
GameItem def )

Definition at line 272 of file sv_instagib.qc.

273{
274 entity new_item = spawn();
275 switch (def)
276 {
277 case ITEM_Invisibility:
278 new_item.invisibility_finished = autocvar_g_instagib_invisibility_time;
279 break;
280 case ITEM_Speed:
281 new_item.speed_finished = autocvar_g_instagib_speed_time;
282 break;
283 }
284 Item_CopyFields(this, new_item);
285 StartItem(new_item, def);
286}
#define spawn
void Item_CopyFields(entity this, entity to)
Definition items.qc:851
void StartItem(entity this, entity def)
Definition items.qc:1007
float autocvar_g_instagib_speed_time
float autocvar_g_instagib_invisibility_time

References autocvar_g_instagib_invisibility_time, autocvar_g_instagib_speed_time, entity(), Item_CopyFields(), spawn, and StartItem().

Referenced by instagib_replace_item_with_random_powerup(), and MUTATOR_HOOKFUNCTION().

◆ instagib_replace_item_with_random_powerup()

void instagib_replace_item_with_random_powerup ( entity item)

Replaces item with a random powerup selected among the less spawned ones.

Definition at line 292 of file sv_instagib.qc.

293{
294 static int remaining_powerups_count = INSTAGIB_POWERUP_COUNT;
295 if (remaining_powerups_count == 0)
296 remaining_powerups_count = INSTAGIB_POWERUP_COUNT;
297 if (remaining_powerups_count == INSTAGIB_POWERUP_COUNT)
298 {
299 instagib_remaining_powerups[0] = ITEM_Invisibility;
300 instagib_remaining_powerups[1] = ITEM_ExtraLife;
301 instagib_remaining_powerups[2] = ITEM_Speed;
302 }
303
304 int r = floor(random() * remaining_powerups_count);
306 for (int i = r; i < INSTAGIB_POWERUP_COUNT - 1; ++i)
308 --remaining_powerups_count;
309}
float random(void)
float floor(float f)
GameItem instagib_remaining_powerups[INSTAGIB_POWERUP_COUNT]
const int INSTAGIB_POWERUP_COUNT
void instagib_replace_item_with(entity this, GameItem def)

References entity(), floor(), INSTAGIB_POWERUP_COUNT, instagib_remaining_powerups, instagib_replace_item_with(), and random().

Referenced by MUTATOR_HOOKFUNCTION().

◆ instagib_stop_countdown()

void instagib_stop_countdown ( entity e)

Definition at line 43 of file sv_instagib.qc.

44{
45 if (!e.instagib_needammo)
46 return;
47 Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_INSTAGIB_FINDAMMO);
48 e.instagib_needammo = false;
49}
void Kill_Notification(NOTIF broadcast, entity client, MSG net_type, CPID net_cpid)
Definition all.qc:1464

References entity(), and Kill_Notification().

Referenced by instagib_ammocheck(), MUTATOR_HOOKFUNCTION(), and MUTATOR_HOOKFUNCTION().

◆ MUTATOR_HOOKFUNCTION() [1/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
BuildMutatorsPrettyString  )

Definition at line 469 of file sv_instagib.qc.

470{
471 M_ARGV(0, string) = strcat(M_ARGV(0, string), ", InstaGib");
472}
#define M_ARGV(idx, type)
Definition base.qh:153
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References M_ARGV, and strcat().

◆ MUTATOR_HOOKFUNCTION() [2/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
BuildMutatorsString  )

Definition at line 464 of file sv_instagib.qc.

465{
466 M_ARGV(0, string) = strcat(M_ARGV(0, string), ":instagib");
467}

References M_ARGV, and strcat().

◆ MUTATOR_HOOKFUNCTION() [3/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
Damage_Calculate  )

Definition at line 162 of file sv_instagib.qc.

163{
164 entity frag_attacker = M_ARGV(1, entity);
166 float frag_deathtype = M_ARGV(3, float);
167 float frag_damage = M_ARGV(4, float);
168 float frag_mirrordamage = M_ARGV(5, float);
170
171 if (autocvar_g_friendlyfire == 0 && SAME_TEAM(frag_target, frag_attacker) && IS_PLAYER(frag_target) && IS_PLAYER(frag_attacker))
172 frag_damage = 0;
173
175 {
176 if (frag_deathtype == DEATH_FALL.m_id)
177 frag_damage = 0; // never count fall damage
178
180 switch (DEATH_ENT(frag_deathtype))
181 {
182 case DEATH_DROWN:
183 case DEATH_SLIME:
184 case DEATH_LAVA:
185 frag_damage = 0;
186 break;
187 }
188
189 if (IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
190 {
192 frag_force = '0 0 0';
193
194 float armor = GetResource(frag_target, RES_ARMOR);
195 if (armor)
196 {
197 --armor;
199 frag_damage = 0;
200 ++frag_target.hitsound_damage_dealt;
201 ++frag_attacker.hitsound_damage_dealt;
202 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, armor);
203 }
204 }
205
206 if (IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
207 {
209 {
210 frag_damage = 0;
212 frag_mirrordamage = 0; // never do mirror damage on enemies
213 }
214
215 if (frag_target != frag_attacker)
216 {
218 frag_force = '0 0 0';
219 }
220 }
221 }
222
223 if (!autocvar_g_instagib_mirrordamage // only apply the taking lives hack if we don't want to support real damage mirroring
224 && IS_PLAYER(frag_attacker)
225 && frag_mirrordamage > 0)
226 {
227 // just lose extra LIVES, don't kill the player for mirror damage
228 float armor = GetResource(frag_attacker, RES_ARMOR);
229 if (armor > 0)
230 {
231 --armor;
232 SetResource(frag_attacker, RES_ARMOR, armor);
233 Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, armor);
234 frag_attacker.hitsound_damage_dealt += frag_mirrordamage;
235 }
236 frag_mirrordamage = 0;
237 }
238
239 if (frag_target.alpha && frag_target.alpha < 1 && IS_PLAYER(frag_target))
240 yoda = 1;
241
242 M_ARGV(4, float) = frag_damage;
243 M_ARGV(5, float) = frag_mirrordamage;
245}
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
float yoda
Definition damage.qh:48
float autocvar_g_friendlyfire
Definition damage.qh:26
#define DEATH_ENT(t)
Definition all.qh:43
#define DEATH_ISWEAPON(t, w)
Definition all.qh:48
RES_ARMOR
Definition ent_cs.qc:155
vector
Definition self.qh:96
float frag_damage
Definition sv_ctf.qc:2316
vector frag_force
Definition sv_ctf.qc:2317
entity frag_target
Definition sv_ctf.qc:2315
bool autocvar_g_instagib_friendlypush
bool autocvar_g_instagib_damagedbycontents
Definition sv_instagib.qc:9
bool autocvar_g_instagib_mirrordamage
bool autocvar_g_instagib_blaster_keepdamage
bool autocvar_g_instagib_blaster_keepforce
#define SAME_TEAM(a, b)
Definition teams.qh:241

References autocvar_g_friendlyfire, autocvar_g_instagib_blaster_keepdamage, autocvar_g_instagib_blaster_keepforce, autocvar_g_instagib_damagedbycontents, autocvar_g_instagib_friendlypush, autocvar_g_instagib_mirrordamage, DEATH_ENT, DEATH_ISWEAPON, entity(), frag_damage, frag_force, frag_target, GetResource(), IS_PLAYER, M_ARGV, RES_ARMOR, SAME_TEAM, Send_Notification(), SetResource(), vector, and yoda.

◆ MUTATOR_HOOKFUNCTION() [4/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
FilterItem  )

Definition at line 311 of file sv_instagib.qc.

312{
313 entity item = M_ARGV(0, entity);
314
315 switch (item.itemdef)
316 {
317 case ITEM_Strength: case ITEM_Shield:
318 case ITEM_HealthMega: case ITEM_ArmorMega:
321 return true;
322 case ITEM_Invisibility: case ITEM_ExtraLife: case ITEM_Speed:
323 return false;
324 case ITEM_Cells:
326 instagib_replace_item_with(item, ITEM_VaporizerCells);
327 return true;
328 case ITEM_Rockets:
330 instagib_replace_item_with(item, ITEM_VaporizerCells);
331 return true;
332 case ITEM_Shells:
334 instagib_replace_item_with(item, ITEM_VaporizerCells);
335 return true;
336 case ITEM_Bullets:
338 instagib_replace_item_with(item, ITEM_VaporizerCells);
339 return true;
340 case ITEM_Jetpack:
341 case ITEM_FuelRegen:
343 }
344
345 switch (item.weapon)
346 {
347 case WEP_VAPORIZER.m_id:
348 if (ITEM_IS_LOOT(item))
349 {
351 return false;
352 }
353 break;
354 case WEP_DEVASTATOR.m_id:
355 case WEP_VORTEX.m_id:
356 instagib_replace_item_with(item, ITEM_VaporizerCells);
357 return true;
358 }
359
360 float cells = GetResource(item, RES_CELLS);
361 if (cells > autocvar_g_instagib_ammo_drop && item.classname != "item_vaporizer_cells")
363
364 if (cells && !item.weapon)
365 return false;
366
367 return true;
368}
int autocvar_g_instagib_ammo_drop
Definition items.qh:13
#define ITEM_IS_LOOT(item)
Returns whether the item is loot.
Definition spawning.qh:39
bool autocvar_g_instagib_ammo_convert_cells
bool autocvar_g_instagib_ammo_convert_bullets
bool autocvar_g_instagib_ammo_convert_shells
bool autocvar_g_instagib_allow_jetpacks
void instagib_replace_item_with_random_powerup(entity item)
Replaces item with a random powerup selected among the less spawned ones.
bool autocvar_g_instagib_ammo_convert_rockets
int autocvar_g_powerups
Definition sv_powerups.qh:7

References autocvar_g_instagib_allow_jetpacks, autocvar_g_instagib_ammo_convert_bullets, autocvar_g_instagib_ammo_convert_cells, autocvar_g_instagib_ammo_convert_rockets, autocvar_g_instagib_ammo_convert_shells, autocvar_g_instagib_ammo_drop, autocvar_g_powerups, entity(), GetResource(), instagib_replace_item_with(), instagib_replace_item_with_random_powerup(), ITEM_IS_LOOT, M_ARGV, and SetResource().

◆ MUTATOR_HOOKFUNCTION() [5/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
ForbidRandomStartWeapons  )

Definition at line 124 of file sv_instagib.qc.

125{
126 return true;
127}

◆ MUTATOR_HOOKFUNCTION() [6/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
ForbidThrowCurrentWeapon  )

Definition at line 152 of file sv_instagib.qc.

153{
154 return true; // weapon dropping on death handled by FilterItem
155}

◆ MUTATOR_HOOKFUNCTION() [7/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
GiveResourceWithLimit  )

Definition at line 414 of file sv_instagib.qc.

415{
416 switch (M_ARGV(8, entity)) // resource type
417 {
418 case RES_ARMOR:
419 // Prevent Heal nade, Mage, Bumblebee, etc. from giving lots of Extra lives
421 break;
422 case RES_HEALTH:
423 M_ARGV(10, float) = 100; // don't heal above maximum health
424 break;
425 case RES_CELLS:
426 break;
427 case RES_FUEL:
429 M_ARGV(10, float) = 0;
430 break;
431 default:
432 M_ARGV(10, float) = 0;
433 break;
434 }
435}
int autocvar_g_instagib_extralives

References autocvar_g_instagib_allow_jetpacks, autocvar_g_instagib_extralives, entity(), GiveResourceWithLimit(), M_ARGV, and RES_ARMOR.

◆ MUTATOR_HOOKFUNCTION() [8/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
ItemTouch  )

Definition at line 377 of file sv_instagib.qc.

378{
380 return false;
381
382 entity item = M_ARGV(0, entity);
384
385 if (GetResource(item, RES_CELLS))
386 {
387 float hp = GetResource(toucher, RES_HEALTH);
388 if (IS_CLIENT(toucher))
389 {
390 // play some cool sounds ;)
391 if (hp <= 5)
392 Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_LASTSECOND);
393 else if (hp < 50)
394 Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_NARROWLY);
395 }
396
397 if (hp < 100)
398 SetResource(toucher, RES_HEALTH, 100);
399
401 }
402
403 if (item.itemdef == ITEM_ExtraLife)
404 {
406 Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES, autocvar_g_instagib_extralives);
407 Inventory_pickupitem(item.itemdef, toucher);
409 }
410
412}
#define MUTATOR_RETURNVALUE
Definition base.qh:384
#define IS_CLIENT(s)
Definition player.qh:241
void Inventory_pickupitem(Pickup this, entity player)
Definition inventory.qh:161
entity entity toucher
Definition self.qh:76
@ MUT_ITEMTOUCH_PICKUP
Definition events.qh:799
@ MUT_ITEMTOUCH_CONTINUE
Definition events.qh:797
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.

References autocvar_g_instagib_extralives, entity(), GetResource(), GiveResource(), Inventory_pickupitem(), IS_CLIENT, M_ARGV, MUT_ITEMTOUCH_CONTINUE, MUT_ITEMTOUCH_PICKUP, MUTATOR_RETURNVALUE, RES_ARMOR, Send_Notification(), SetResource(), and toucher.

◆ MUTATOR_HOOKFUNCTION() [9/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
MakePlayerObserver  )

Definition at line 118 of file sv_instagib.qc.

119{
120 entity player = M_ARGV(0, entity);
122}

References entity(), instagib_stop_countdown(), and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [10/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
MatchEnd  )

Definition at line 95 of file sv_instagib.qc.

96{
98}
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52

References FOREACH_CLIENT, instagib_stop_countdown(), and IS_PLAYER.

◆ MUTATOR_HOOKFUNCTION() [11/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
MonsterDropItem  )

Definition at line 106 of file sv_instagib.qc.

107{
108 M_ARGV(1, string) = "vaporizer_cells";
109}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [12/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
MonsterSpawn  )

Definition at line 111 of file sv_instagib.qc.

112{
113 entity mon = M_ARGV(0, entity);
114 if (mon.monsterdef == MON_MAGE)
115 mon.skin = 1; // always refill ammo
116}

References entity(), and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [13/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
PlayerDamage_SplitHealthArmor  )

Definition at line 146 of file sv_instagib.qc.

147{
148 M_ARGV(4, float) = M_ARGV(7, float); // take = damage
149 M_ARGV(5, float) = 0; // save
150}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [14/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
PlayerDies  )

Definition at line 370 of file sv_instagib.qc.

371{
372 float frag_deathtype = M_ARGV(3, float);
373 if (DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
374 M_ARGV(4, float) = 1000; // always gib if it was a vaporizer death
375}

References DEATH_ISWEAPON, and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [15/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
PlayerPreThink  )

Definition at line 135 of file sv_instagib.qc.

136{
137 entity player = M_ARGV(0, entity);
138 instagib_ammocheck(player);
139}
void instagib_ammocheck(entity this)

References entity(), instagib_ammocheck(), M_ARGV, and PlayerPreThink.

◆ MUTATOR_HOOKFUNCTION() [16/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
PlayerRegen  )

Definition at line 141 of file sv_instagib.qc.

142{
143 return true; // no regeneration in InstaGib
144}

◆ MUTATOR_HOOKFUNCTION() [17/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
PlayerSpawn  )

Definition at line 129 of file sv_instagib.qc.

130{
131 entity player = M_ARGV(0, entity);
132 player.effects |= EF_FULLBRIGHT;
133}
const float EF_FULLBRIGHT

References EF_FULLBRIGHT, entity(), and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [18/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
RandomItems_GetRandomItemClassName  )

Definition at line 100 of file sv_instagib.qc.

101{
103 return true;
104}
string RandomItems_GetRandomInstagibItemClassName(string prefix)
Returns a random classname of the instagib item.

References M_ARGV, RandomItems_GetRandomInstagibItemClassName(), and RandomItems_GetRandomItemClassName().

◆ MUTATOR_HOOKFUNCTION() [19/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
SetModname  )

Definition at line 474 of file sv_instagib.qc.

475{
476 M_ARGV(0, string) = "InstaGib";
477 return true;
478}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [20/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
SetStartItems ,
CBC_ORDER_LAST  )

Definition at line 247 of file sv_instagib.qc.

248{
251
256 //start_ammo_fuel = warmup_start_ammo_fuel = 0;
257
260}
const int IT_UNLIMITED_SUPERWEAPONS
Definition item.qh:24
int autocvar_g_instagib_ammo_start
#define WEPSET(id)
Definition all.qh:47
WepSet start_weapons
Definition world.qh:79
float warmup_start_ammo_cells
Definition world.qh:104
float start_ammo_shells
Definition world.qh:83
float warmup_start_ammo_rockets
Definition world.qh:103
float warmup_start_ammo_shells
Definition world.qh:101
int start_items
Definition world.qh:82
float warmup_start_ammo_nails
Definition world.qh:102
float start_ammo_cells
Definition world.qh:86
float warmup_start_health
Definition world.qh:106
float start_ammo_rockets
Definition world.qh:85
float start_armorvalue
Definition world.qh:96
WepSet warmup_start_weapons
Definition world.qh:97
float start_health
Definition world.qh:95
float warmup_start_armorvalue
Definition world.qh:107
float start_ammo_nails
Definition world.qh:84

References autocvar_g_instagib_ammo_start, CBC_ORDER_LAST, IT_UNLIMITED_SUPERWEAPONS, start_ammo_cells, start_ammo_nails, start_ammo_rockets, start_ammo_shells, start_armorvalue, start_health, start_items, start_weapons, warmup_start_ammo_cells, warmup_start_ammo_nails, warmup_start_ammo_rockets, warmup_start_ammo_shells, warmup_start_armorvalue, warmup_start_health, warmup_start_weapons, and WEPSET.

◆ MUTATOR_HOOKFUNCTION() [21/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
SetWeaponArena  )

Definition at line 262 of file sv_instagib.qc.

263{
264 M_ARGV(0, string) = "off"; // turn weapon arena off
265}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [22/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
SetWeaponStay  )

Definition at line 267 of file sv_instagib.qc.

268{
269 M_ARGV(0, int) = 0; // turn weapon stay off
270}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [23/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
SuperweaponsImmutable  )

Definition at line 157 of file sv_instagib.qc.

158{
159 return true;
160}

◆ MUTATOR_HOOKFUNCTION() [24/24]

MUTATOR_HOOKFUNCTION ( mutator_instagib ,
Turret_Plasma_Fire  )

Definition at line 437 of file sv_instagib.qc.

438{
439 entity it = M_ARGV(0, entity);
440 //bool dual = M_ARGV(1, bool);
441
442 .entity weaponentity = weaponentities[0]; // TODO: unhardcode
443 FireRailgunBullet(it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance,
444 10000000000,
445 false,
446 800,
447 0,
448 0,
449 0,
450 0,
451 DEATH_TURRET_PLASMA.m_id
452 );
453
454 Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, it.tur_shotorg, it.tur_shotdir_updated * 1000, 1);
455
456 // teamcolor / hit beam effect
458 vector rgb = Team_ColorRGB(it.team);
459 Send_Effect_Core(EFFECT_VAPORIZER_BEAM, it.tur_shotorg, v, 1, rgb, rgb, -1, -1, -1, NULL);
460
461 return true;
462}
vector trace_endpos
void Send_Effect_Core(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, float eff_alpha_min, float eff_alpha_max, float eff_alpha_fade, entity ignore)
Definition all.qc:74
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:155
vector WarpZone_UnTransformOrigin(entity wz, vector org)
Transforms origin org backwards through warpzone wz, as the inverse of WarpZone_TransformOrigin.
Definition common.qc:530
entity WarpZone_trace_transform
Transform accumulator during a trace.
Definition common.qh:40
#define NULL
Definition post.qh:14
vector Team_ColorRGB(int teamid)
Definition teams.qh:76
void FireRailgunBullet(entity this,.entity weaponentity, vector start, vector end, float bdamage, bool headshot_notify, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, int deathtype)
Definition tracing.qc:261
int max_shot_distance
Definition weapon.qh:240
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17

References entity(), FireRailgunBullet(), M_ARGV, max_shot_distance, NULL, Send_Effect(), Send_Effect_Core(), Team_ColorRGB(), trace_endpos, vector, WarpZone_trace_transform, WarpZone_UnTransformOrigin(), and weaponentities.

◆ RandomItems_GetRandomInstagibItemClassName()

string RandomItems_GetRandomInstagibItemClassName ( string prefix)

Returns a random classname of the instagib item.

Parameters
[in]prefixPrefix of the cvars that hold probabilities.
Returns
Random classname of the instagib item.

Definition at line 24 of file sv_instagib.qc.

25{
28 {
29 string cvar_name = sprintf("g_%s_%s_probability", prefix,
30 it.m_canonical_spawnfunc);
31 if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
32 {
33 LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
34 continue;
35 }
36 RandomSelection_AddString(it.m_canonical_spawnfunc, cvar(cvar_name), 1);
37 });
39}
float CVAR_TYPEFLAG_EXISTS
#define IL_EACH(this, cond, body)
bool Item_IsDefinitionAllowed(entity definition)
Checks whether the items with the specified definition are allowed to spawn.
Definition spawning.qc:17
#define LOG_WARNF(...)
Definition log.qh:59
float cvar(string name)
ERASEABLE void RandomSelection_Init()
Definition random.qc:4
string RandomSelection_chosen_string
Definition random.qh:7
#define RandomSelection_AddString(s, weight, priority)
Definition random.qh:16
IntrusiveList g_instagib_items

References cvar(), CVAR_TYPEFLAG_EXISTS, g_instagib_items, IL_EACH, Item_IsDefinitionAllowed(), LOG_WARNF, RandomSelection_AddString, RandomSelection_chosen_string, and RandomSelection_Init().

Referenced by MUTATOR_HOOKFUNCTION().

Variable Documentation

◆ autocvar_g_instagib_allow_jetpacks

bool autocvar_g_instagib_allow_jetpacks

Definition at line 19 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION(), and MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_ammo_convert_bullets

bool autocvar_g_instagib_ammo_convert_bullets

Definition at line 18 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_ammo_convert_cells

bool autocvar_g_instagib_ammo_convert_cells

Definition at line 15 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_ammo_convert_rockets

bool autocvar_g_instagib_ammo_convert_rockets

Definition at line 16 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_ammo_convert_shells

bool autocvar_g_instagib_ammo_convert_shells

Definition at line 17 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_blaster_keepdamage

bool autocvar_g_instagib_blaster_keepdamage = false

Definition at line 10 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_blaster_keepforce

bool autocvar_g_instagib_blaster_keepforce = false

Definition at line 11 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_damagedbycontents

bool autocvar_g_instagib_damagedbycontents = true

Definition at line 9 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_friendlypush

bool autocvar_g_instagib_friendlypush = true

Definition at line 13 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_instagib_mirrordamage

bool autocvar_g_instagib_mirrordamage

Definition at line 12 of file sv_instagib.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ instagib_needammo

bool instagib_needammo

Definition at line 42 of file sv_instagib.qc.

Referenced by instagib_ammocheck().

◆ instagib_nextthink

float instagib_nextthink

Definition at line 41 of file sv_instagib.qc.

Referenced by instagib_ammocheck().

◆ INSTAGIB_POWERUP_COUNT

const int INSTAGIB_POWERUP_COUNT = 3

Definition at line 288 of file sv_instagib.qc.

Referenced by instagib_replace_item_with_random_powerup().

◆ instagib_remaining_powerups

GameItem instagib_remaining_powerups[INSTAGIB_POWERUP_COUNT]

Definition at line 289 of file sv_instagib.qc.

Referenced by instagib_replace_item_with_random_powerup().