Xonotic
shield.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <common/items/all.qh>
5 #ifdef SVQC
6  // For FL_POWERUP
7  #include <common/constants.qh>
8  #include <server/items/items.qh>
9 #endif
10 
11 #ifdef GAMEQC
12 MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
13 SOUND(Shield, Item_Sound("powerup_shield"));
14 #endif
15 
16 #ifdef SVQC
17 bool autocvar_g_powerups_shield = 1;
18 float autocvar_g_balance_powerup_invincible_takedamage;
19 float autocvar_g_balance_powerup_invincible_takeforce = 0.33;
20 float autocvar_g_balance_powerup_invincible_time;
21 void powerup_shield_init(Pickup this, entity item)
22 {
23  if(!item.invincible_finished)
24  item.invincible_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invincible_time;
25 }
26 #endif
28  this.m_canonical_spawnfunc = "item_shield";
29 #ifdef SVQC
30  if(autocvar_g_powerups_shield)
32  else
34 
35  this.m_iteminit = powerup_shield_init;
36 #endif
37 #ifdef GAMEQC
38  this.m_itemid = IT_INVINCIBLE;
39  this.m_model = MDL_Shield_ITEM;
40  this.m_sound = SND_Shield;
41  this.m_glow = true;
42  this.m_respawnsound = SND_SHIELD_RESPAWN;
43 #endif
44  this.netname = "invincible";
45  this.m_name = _("Shield");
46  this.m_icon = "shield";
47  this.m_color = '1 0 1';
48  this.m_waypoint = _("Shield");
49  this.m_waypointblink = 2;
50 }
51 
52 SPAWNFUNC_ITEM(item_shield, ITEM_Shield)
53 SPAWNFUNC_ITEM(item_invincible, ITEM_Shield)
54 
56  ATTRIB(Shield, netname, string, "invincible"); // NOTE: referring to as invincible so that it matches the powerup item
57  ATTRIB(Shield, m_name, string, _("Shield"));
58  ATTRIB(Shield, m_icon, string, "shield");
59 ENDCLASS(Shield)
60 REGISTER_STATUSEFFECT(Shield, NEW(Shield));
Item is usable during normal gameplay.
Definition: item.qh:98
#define NEW(cname,...)
Definition: oo.qh:105
CLASS(Object) Object
Definition: oo.qh:318
SPAWNFUNC_ITEM(item_armor_green, ITEM_ArmorMedium) .float wait
Definition: shield.qh:55
REGISTER_STATUSEFFECT(Shield, NEW(Shield))
entity() spawn
string netname
Definition: powerups.qc:20
int m_itemid
Definition: jetpack.qh:11
Definition: pickup.qh:22
float spawnflags
Definition: progsdefs.qc:191
string Item_Sound(string it_snd)
Definition: all.qc:18
#define ATTRIB(...)
Definition: oo.qh:136
REGISTER_ITEM(Shield, Powerup)
Definition: shield.qh:27
#define MODEL(name, path)
Definition: all.qh:8
#define ENDCLASS(cname)
Definition: oo.qh:269
string Item_Model(string item_mdl)
Definition: all.qc:8
#define SOUND(name, path)
Definition: all.qh:30
string m_name
Definition: scores.qh:135