2 #include "../common/weapons/all.qh"
4 spawnfunc(weapon_crylink);
5 spawnfunc(weapon_electro);
6 spawnfunc(weapon_hagar);
7 spawnfunc(weapon_machinegun);
8 spawnfunc(weapon_vortex);
10 spawnfunc(target_items);
12 spawnfunc(item_bullets);
13 spawnfunc(item_cells);
14 spawnfunc(item_rockets);
15 spawnfunc(item_shells);
17 spawnfunc(item_jetpack);
19 spawnfunc(item_armor_big);
20 spawnfunc(item_armor_large);
21 spawnfunc(item_armor_small);
23 spawnfunc(item_health_medium);
24 spawnfunc(item_health_mega);
26 //***********************
27 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
28 //***********************
30 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
33 spawnfunc(ammo_shells) { spawnfunc_item_shells(this); }
36 spawnfunc(ammo_bullets) { spawnfunc_item_bullets(this); }
39 spawnfunc(ammo_grenades) { spawnfunc_item_rockets(this); }
42 spawnfunc(weapon_lightning) { spawnfunc_weapon_electro(this); }
43 spawnfunc(ammo_lightning) { spawnfunc_item_cells(this); }
46 spawnfunc(weapon_plasmagun) { spawnfunc_weapon_hagar(this); }
47 spawnfunc(ammo_cells) { spawnfunc_item_rockets(this); }
50 spawnfunc(weapon_railgun) { spawnfunc_weapon_vortex(this); }
51 spawnfunc(ammo_slugs) { spawnfunc_item_cells(this); }
54 spawnfunc(weapon_bfg) { spawnfunc_weapon_crylink(this); }
55 spawnfunc(ammo_bfg) { spawnfunc_item_cells(this); }
58 spawnfunc(ammo_rockets) { spawnfunc_item_rockets(this); }
61 spawnfunc(item_armor_body) { spawnfunc_item_armor_large(this); }
62 spawnfunc(item_armor_combat) { spawnfunc_item_armor_big(this); }
63 spawnfunc(item_armor_shard) { spawnfunc_item_armor_small(this); }
64 spawnfunc(item_enviro) { spawnfunc_item_invincible(this); }
69 // weapon remove ent from df
70 void target_init_verify()
73 for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
74 for(targ = world; (targ = find(targ, targetname, trigger.target)); )
75 if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
82 //setsize(targ, trigger.mins, trigger.maxs);
83 //setorigin(targ, trigger.origin);
88 spawnfunc(target_init)
90 self.spawnflags = 0; // remove all weapons except the ones listed below
91 self.netname = "shotgun"; // keep these weapons through the remove trigger
92 spawnfunc_target_items(this);
93 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
96 // weapon give ent from defrag
97 void target_give_init()
100 for (targ = world; (targ = find(targ, targetname, self.target)); ) {
101 if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
102 self.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
103 self.netname = "devastator";
105 else if (targ.classname == "weapon_plasmagun") {
106 self.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
107 if(self.netname == "")
108 self.netname = "hagar";
110 self.netname = strcat(self.netname, " hagar");
112 else if (targ.classname == "weapon_bfg") {
113 self.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
114 if(self.netname == "")
115 self.netname = "crylink";
117 self.netname = strcat(self.netname, " crylink");
119 else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
120 self.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
121 if(self.netname == "")
122 self.netname = "mortar";
124 self.netname = strcat(self.netname, " mortar");
126 else if (targ.classname == "item_armor_body")
127 self.armorvalue = 100;
128 else if (targ.classname == "item_health_mega")
130 //remove(targ); // removing ents in init functions causes havoc, workaround:
131 targ.think = SUB_Remove_self;
132 targ.nextthink = time;
135 spawnfunc_target_items(this);
136 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
139 spawnfunc(target_give)
141 InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
144 //spawnfunc(item_flight) /* handled by jetpack */
145 //spawnfunc(item_haste) /* handled by buffs mutator */
146 //spawnfunc(item_health) /* handled in t_quake.qc */
147 //spawnfunc(item_health_large) /* handled in t_items.qc */
148 //spawnfunc(item_health_small) /* handled in t_items.qc */
149 //spawnfunc(item_health_mega) /* handled in t_items.qc */
150 //spawnfunc(item_invis) /* handled by buffs mutator */
151 //spawnfunc(item_regen) /* handled by buffs mutator */
153 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
155 spawnfunc(item_flight)
157 spawnfunc_item_jetpack(this);
166 float DoesQ3ARemoveThisEntity()
168 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
171 if(!teamplay || g_tdm || g_ctf)
175 if (!(!teamplay || g_tdm || g_ctf))
193 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
194 gametypename = "ffa";
196 gametypename = "team";
198 gametypename = "ctf";
200 gametypename = "single";
201 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
202 if(strstrofs(self.gametype, gametypename, 0) < 0)