3 #include "../common/weapons/weapons.qc"
5 //***********************
6 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
7 //***********************
9 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
12 void spawnfunc_ammo_shells() { spawnfunc_item_shells(); }
15 void spawnfunc_ammo_bullets() { spawnfunc_item_bullets(); }
18 void spawnfunc_ammo_grenades() { spawnfunc_item_rockets(); }
21 void spawnfunc_weapon_lightning() { spawnfunc_weapon_electro(); }
22 void spawnfunc_ammo_lightning() { spawnfunc_item_cells(); }
25 void spawnfunc_weapon_plasmagun() { spawnfunc_weapon_hagar(); }
26 void spawnfunc_ammo_cells() { spawnfunc_item_rockets(); }
29 void spawnfunc_weapon_railgun() { spawnfunc_weapon_vortex(); }
30 void spawnfunc_ammo_slugs() { spawnfunc_item_cells(); }
33 void spawnfunc_weapon_bfg() { spawnfunc_weapon_crylink(); }
34 void spawnfunc_ammo_bfg() { spawnfunc_item_cells(); }
37 void spawnfunc_ammo_rockets() { spawnfunc_item_rockets(); }
40 void spawnfunc_item_armor_body() { spawnfunc_item_armor_large(); }
41 void spawnfunc_item_armor_combat() { spawnfunc_item_armor_big(); }
42 void spawnfunc_item_armor_shard() { spawnfunc_item_armor_small(); }
43 void spawnfunc_item_enviro() { spawnfunc_item_invincible(); }
45 // weapon remove ent from df
46 void target_init_verify()
49 for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
50 for(targ = world; (targ = find(targ, targetname, trigger.target)); )
51 if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
58 //setsize(targ, trigger.mins, trigger.maxs);
59 //setorigin(targ, trigger.origin);
64 void spawnfunc_target_init()
66 self.spawnflags = 0; // remove all weapons except the ones listed below
67 self.netname = "shotgun"; // keep these weapons through the remove trigger
68 spawnfunc_target_items();
69 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
72 // weapon give ent from defrag
73 void target_give_init()
76 for (targ = world; (targ = find(targ, targetname, self.target)); ) {
77 if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
78 self.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
79 self.netname = "devastator";
81 else if (targ.classname == "weapon_plasmagun") {
82 self.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
83 if(self.netname == "")
84 self.netname = "hagar";
86 self.netname = strcat(self.netname, " hagar");
88 else if (targ.classname == "weapon_bfg") {
89 self.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
90 if(self.netname == "")
91 self.netname = "crylink";
93 self.netname = strcat(self.netname, " crylink");
95 else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
96 self.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
97 if(self.netname == "")
98 self.netname = "mortar";
100 self.netname = strcat(self.netname, " mortar");
102 else if (targ.classname == "item_armor_body")
103 self.armorvalue = 100;
104 else if (targ.classname == "item_health_mega")
106 //remove(targ); // removing ents in init functions causes havoc, workaround:
107 targ.think = SUB_Remove;
108 targ.nextthink = time;
111 spawnfunc_target_items();
112 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
115 void spawnfunc_target_give()
117 InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
120 //void spawnfunc_item_flight() /* handled by buffs mutator or jetpack */
121 //void spawnfunc_item_haste() /* handled by buffs mutator */
122 //void spawnfunc_item_health() /* handled in t_quake.qc */
123 //void spawnfunc_item_health_large() /* handled in t_items.qc */
124 //void spawnfunc_item_health_small() /* handled in t_items.qc */
125 //void spawnfunc_item_health_mega() /* handled in t_items.qc */
126 //void spawnfunc_item_invis() /* handled by buffs mutator */
127 //void spawnfunc_item_regen() /* handled by buffs mutator */
129 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
131 void spawnfunc_item_flight()
133 if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
134 spawnfunc_item_jetpack();
136 buff_Init_Compat(self, BUFF_FLIGHT);
145 float DoesQ3ARemoveThisEntity()
147 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
150 if(!teamplay || g_tdm || g_ctf)
154 if (!(!teamplay || g_tdm || g_ctf))
172 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
173 gametypename = "ffa";
175 gametypename = "team";
177 gametypename = "ctf";
179 gametypename = "single";
180 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
181 if(strstrofs(self.gametype, gametypename, 0) < 0)