3 #include "../common/weapons/all.qh"
5 spawnfunc(weapon_crylink);
6 spawnfunc(weapon_electro);
7 spawnfunc(weapon_hagar);
8 spawnfunc(weapon_machinegun);
9 spawnfunc(weapon_vortex);
11 spawnfunc(target_items);
13 spawnfunc(item_bullets);
14 spawnfunc(item_cells);
15 spawnfunc(item_rockets);
16 spawnfunc(item_shells);
18 spawnfunc(item_jetpack);
20 spawnfunc(item_armor_big);
21 spawnfunc(item_armor_large);
22 spawnfunc(item_armor_small);
24 spawnfunc(item_health_medium);
25 spawnfunc(item_health_mega);
27 //***********************
28 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
29 //***********************
31 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
34 spawnfunc(ammo_shells) { spawnfunc_item_shells(this); }
37 spawnfunc(ammo_bullets) { spawnfunc_item_bullets(this); }
40 spawnfunc(ammo_grenades) { spawnfunc_item_rockets(this); }
43 spawnfunc(weapon_lightning) { spawnfunc_weapon_electro(this); }
44 spawnfunc(ammo_lightning) { spawnfunc_item_cells(this); }
47 spawnfunc(weapon_plasmagun) { spawnfunc_weapon_hagar(this); }
48 spawnfunc(ammo_cells) { spawnfunc_item_rockets(this); }
51 spawnfunc(weapon_railgun) { spawnfunc_weapon_vortex(this); }
52 spawnfunc(ammo_slugs) { spawnfunc_item_cells(this); }
55 spawnfunc(weapon_bfg) { spawnfunc_weapon_crylink(this); }
56 spawnfunc(ammo_bfg) { spawnfunc_item_cells(this); }
59 spawnfunc(ammo_rockets) { spawnfunc_item_rockets(this); }
62 spawnfunc(item_armor_body) { spawnfunc_item_armor_large(this); }
63 spawnfunc(item_armor_combat) { spawnfunc_item_armor_big(this); }
64 spawnfunc(item_armor_shard) { spawnfunc_item_armor_small(this); }
65 spawnfunc(item_enviro) { spawnfunc_item_invincible(this); }
70 // weapon remove ent from df
71 void target_init_verify(entity this)
74 for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
75 for(targ = world; (targ = find(targ, targetname, trigger.target)); )
76 if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
83 //setsize(targ, trigger.mins, trigger.maxs);
84 //setorigin(targ, trigger.origin);
89 spawnfunc(target_init)
91 this.spawnflags = 0; // remove all weapons except the ones listed below
92 this.netname = "shotgun"; // keep these weapons through the remove trigger
93 spawnfunc_target_items(this);
94 InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET);
97 // weapon give ent from defrag
98 void target_give_init(entity this)
101 for (targ = world; (targ = find(targ, targetname, this.target)); ) {
102 if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
103 this.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
104 this.netname = "devastator";
106 else if (targ.classname == "weapon_plasmagun") {
107 this.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
108 if(this.netname == "")
109 this.netname = "hagar";
111 this.netname = strcat(this.netname, " hagar");
113 else if (targ.classname == "weapon_bfg") {
114 this.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
115 if(this.netname == "")
116 this.netname = "crylink";
118 this.netname = strcat(this.netname, " crylink");
120 else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
121 this.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
122 if(this.netname == "")
123 this.netname = "mortar";
125 this.netname = strcat(this.netname, " mortar");
127 else if (targ.classname == "item_armor_body")
128 this.armorvalue = 100;
129 else if (targ.classname == "item_health_mega")
131 //remove(targ); // removing ents in init functions causes havoc, workaround:
132 setthink(targ, SUB_Remove);
133 targ.nextthink = time;
136 spawnfunc_target_items(this);
137 InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET);
140 spawnfunc(target_give)
142 InitializeEntity(this, target_give_init, INITPRIO_FINDTARGET);
145 //spawnfunc(item_flight) /* handled by jetpack */
146 //spawnfunc(item_haste) /* handled by buffs mutator */
147 //spawnfunc(item_health) /* handled in t_quake.qc */
148 //spawnfunc(item_health_large) /* handled in t_items.qc */
149 //spawnfunc(item_health_small) /* handled in t_items.qc */
150 //spawnfunc(item_health_mega) /* handled in t_items.qc */
151 //spawnfunc(item_invis) /* handled by buffs mutator */
152 //spawnfunc(item_regen) /* handled by buffs mutator */
154 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
156 spawnfunc(item_flight)
158 spawnfunc_item_jetpack(this);
167 bool DoesQ3ARemoveThisEntity(entity this)
169 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
172 if(!teamplay || g_tdm || g_ctf)
176 if (!(!teamplay || g_tdm || g_ctf))
194 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
195 gametypename = "ffa";
197 gametypename = "team";
199 gametypename = "ctf";
201 gametypename = "single";
202 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
203 if(strstrofs(this.gametype, gametypename, 0) < 0)