3 #include "../common/weapons/all.qh"
4 #include "../common/buffs/all.qh"
6 spawnfunc(weapon_crylink);
7 spawnfunc(weapon_electro);
8 spawnfunc(weapon_hagar);
9 spawnfunc(weapon_machinegun);
10 spawnfunc(weapon_vortex);
12 spawnfunc(target_items);
14 spawnfunc(item_bullets);
15 spawnfunc(item_cells);
16 spawnfunc(item_rockets);
17 spawnfunc(item_shells);
19 spawnfunc(item_jetpack);
21 spawnfunc(item_armor_big);
22 spawnfunc(item_armor_large);
23 spawnfunc(item_armor_small);
25 spawnfunc(item_health_medium);
26 spawnfunc(item_health_mega);
28 //***********************
29 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
30 //***********************
32 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
35 spawnfunc(ammo_shells) { spawnfunc_item_shells(this); }
38 spawnfunc(ammo_bullets) { spawnfunc_item_bullets(this); }
41 spawnfunc(ammo_grenades) { spawnfunc_item_rockets(this); }
44 spawnfunc(weapon_lightning) { spawnfunc_weapon_electro(this); }
45 spawnfunc(ammo_lightning) { spawnfunc_item_cells(this); }
48 spawnfunc(weapon_plasmagun) { spawnfunc_weapon_hagar(this); }
49 spawnfunc(ammo_cells) { spawnfunc_item_rockets(this); }
52 spawnfunc(weapon_railgun) { spawnfunc_weapon_vortex(this); }
53 spawnfunc(ammo_slugs) { spawnfunc_item_cells(this); }
56 spawnfunc(weapon_bfg) { spawnfunc_weapon_crylink(this); }
57 spawnfunc(ammo_bfg) { spawnfunc_item_cells(this); }
60 spawnfunc(ammo_rockets) { spawnfunc_item_rockets(this); }
63 spawnfunc(item_armor_body) { spawnfunc_item_armor_large(this); }
64 spawnfunc(item_armor_combat) { spawnfunc_item_armor_big(this); }
65 spawnfunc(item_armor_shard) { spawnfunc_item_armor_small(this); }
66 spawnfunc(item_enviro) { spawnfunc_item_invincible(this); }
68 // weapon remove ent from df
69 void target_init_verify()
72 for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
73 for(targ = world; (targ = find(targ, targetname, trigger.target)); )
74 if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
81 //setsize(targ, trigger.mins, trigger.maxs);
82 //setorigin(targ, trigger.origin);
87 spawnfunc(target_init)
89 self.spawnflags = 0; // remove all weapons except the ones listed below
90 self.netname = "shotgun"; // keep these weapons through the remove trigger
91 spawnfunc_target_items(this);
92 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
95 // weapon give ent from defrag
96 void target_give_init()
99 for (targ = world; (targ = find(targ, targetname, self.target)); ) {
100 if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
101 self.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
102 self.netname = "devastator";
104 else if (targ.classname == "weapon_plasmagun") {
105 self.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
106 if(self.netname == "")
107 self.netname = "hagar";
109 self.netname = strcat(self.netname, " hagar");
111 else if (targ.classname == "weapon_bfg") {
112 self.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
113 if(self.netname == "")
114 self.netname = "crylink";
116 self.netname = strcat(self.netname, " crylink");
118 else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
119 self.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
120 if(self.netname == "")
121 self.netname = "mortar";
123 self.netname = strcat(self.netname, " mortar");
125 else if (targ.classname == "item_armor_body")
126 self.armorvalue = 100;
127 else if (targ.classname == "item_health_mega")
129 //remove(targ); // removing ents in init functions causes havoc, workaround:
130 targ.think = SUB_Remove;
131 targ.nextthink = time;
134 spawnfunc_target_items(this);
135 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
138 spawnfunc(target_give)
140 InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
143 //spawnfunc(item_flight) /* handled by buffs mutator or jetpack */
144 //spawnfunc(item_haste) /* handled by buffs mutator */
145 //spawnfunc(item_health) /* handled in t_quake.qc */
146 //spawnfunc(item_health_large) /* handled in t_items.qc */
147 //spawnfunc(item_health_small) /* handled in t_items.qc */
148 //spawnfunc(item_health_mega) /* handled in t_items.qc */
149 //spawnfunc(item_invis) /* handled by buffs mutator */
150 //spawnfunc(item_regen) /* handled by buffs mutator */
152 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
154 spawnfunc(item_flight)
156 if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
157 spawnfunc_item_jetpack(this);
159 buff_Init_Compat(self, BUFF_FLIGHT);
168 float DoesQ3ARemoveThisEntity()
170 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
173 if(!teamplay || g_tdm || g_ctf)
177 if (!(!teamplay || g_tdm || g_ctf))
195 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
196 gametypename = "ffa";
198 gametypename = "team";
200 gametypename = "ctf";
202 gametypename = "single";
203 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
204 if(strstrofs(self.gametype, gametypename, 0) < 0)