1 #include "../common/weapons/weapons.qc"
3 //***********************
4 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
5 //***********************
7 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
10 void spawnfunc_ammo_shells() { spawnfunc_item_shells(); }
13 void spawnfunc_ammo_bullets() { spawnfunc_item_bullets(); }
16 void spawnfunc_ammo_grenades() { spawnfunc_item_rockets(); }
19 void spawnfunc_weapon_lightning() { spawnfunc_weapon_electro(); }
20 void spawnfunc_ammo_lightning() { spawnfunc_item_cells(); }
23 void spawnfunc_weapon_plasmagun() { spawnfunc_weapon_hagar(); }
24 void spawnfunc_ammo_cells() { spawnfunc_item_rockets(); }
27 void spawnfunc_weapon_railgun() { spawnfunc_weapon_vortex(); }
28 void spawnfunc_ammo_slugs() { spawnfunc_item_cells(); }
31 void spawnfunc_weapon_bfg() { spawnfunc_weapon_crylink(); }
32 void spawnfunc_ammo_bfg() { spawnfunc_item_cells(); }
35 void spawnfunc_ammo_rockets() { spawnfunc_item_rockets(); }
38 void spawnfunc_item_armor_body() { spawnfunc_item_armor_large(); }
39 void spawnfunc_item_armor_combat() { spawnfunc_item_armor_big(); }
40 void spawnfunc_item_armor_shard() { spawnfunc_item_armor_small(); }
41 void spawnfunc_item_enviro() { spawnfunc_item_invincible(); }
43 // weapon remove ent from df
44 void target_init_verify()
47 for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
48 for(targ = world; (targ = find(targ, targetname, trigger.target)); )
49 if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
56 //setsize(targ, trigger.mins, trigger.maxs);
57 //setorigin(targ, trigger.origin);
62 void spawnfunc_target_init()
64 self.spawnflags = 0; // remove all weapons except the ones listed below
65 self.netname = "shotgun"; // keep these weapons through the remove trigger
66 spawnfunc_target_items();
67 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
70 // weapon give ent from defrag
71 void target_give_init()
74 for (targ = world; (targ = find(targ, targetname, self.target)); ) {
75 if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
76 self.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
77 self.netname = "devastator";
79 else if (targ.classname == "weapon_plasmagun") {
80 self.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
81 if(self.netname == "")
82 self.netname = "hagar";
84 self.netname = strcat(self.netname, " hagar");
86 else if (targ.classname == "weapon_bfg") {
87 self.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
88 if(self.netname == "")
89 self.netname = "crylink";
91 self.netname = strcat(self.netname, " crylink");
93 else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
94 self.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
95 if(self.netname == "")
96 self.netname = "mortar";
98 self.netname = strcat(self.netname, " mortar");
100 else if (targ.classname == "item_armor_body")
101 self.armorvalue = 100;
102 else if (targ.classname == "item_health_mega")
104 //remove(targ); // removing ents in init functions causes havoc, workaround:
105 targ.think = SUB_Remove;
106 targ.nextthink = time;
109 spawnfunc_target_items();
110 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
113 void spawnfunc_target_give()
115 InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
118 //void spawnfunc_item_flight() /* handled by buffs mutator or jetpack */
119 //void spawnfunc_item_haste() /* handled by buffs mutator */
120 //void spawnfunc_item_health() /* handled in t_quake.qc */
121 //void spawnfunc_item_health_large() /* handled in t_items.qc */
122 //void spawnfunc_item_health_small() /* handled in t_items.qc */
123 //void spawnfunc_item_health_mega() /* handled in t_items.qc */
124 //void spawnfunc_item_invis() /* handled by buffs mutator */
125 //void spawnfunc_item_regen() /* handled by buffs mutator */
127 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
129 void spawnfunc_item_flight()
131 if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
132 spawnfunc_item_jetpack();
134 buff_Init_Compat(self, BUFF_FLIGHT);
143 float DoesQ3ARemoveThisEntity()
145 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
148 if(!teamplay || g_tdm || g_ctf)
152 if (!(!teamplay || g_tdm || g_ctf))
170 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
171 gametypename = "ffa";
173 gametypename = "team";
175 gametypename = "ctf";
177 gametypename = "single";
178 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
179 if(strstrofs(self.gametype, gametypename, 0) < 0)