3 #include <server/defs.qh>
4 #include <server/miscfunctions.qh>
5 #include <server/items.qh>
6 #include <common/weapons/_all.qh>
8 spawnfunc(target_items);
10 //***********************
11 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
12 //***********************
14 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
17 SPAWNFUNC_ITEM(ammo_shells, ITEM_Shells)
20 SPAWNFUNC_ITEM(ammo_bullets, ITEM_Bullets)
23 SPAWNFUNC_ITEM(ammo_grenades, ITEM_Rockets)
26 SPAWNFUNC_WEAPON(weapon_prox_launcher, WEP_MINE_LAYER)
27 SPAWNFUNC_ITEM(ammo_mines, ITEM_Rockets)
30 SPAWNFUNC_WEAPON(weapon_lightning, WEP_ELECTRO)
31 SPAWNFUNC_ITEM(ammo_lightning, ITEM_Cells)
34 SPAWNFUNC_WEAPON(weapon_plasmagun, WEP_HAGAR)
35 SPAWNFUNC_ITEM(ammo_cells, ITEM_Rockets)
38 SPAWNFUNC_WEAPON(weapon_railgun, WEP_VORTEX)
39 SPAWNFUNC_ITEM(ammo_slugs, ITEM_Cells)
42 SPAWNFUNC_WEAPON(weapon_bfg, WEP_CRYLINK)
43 SPAWNFUNC_ITEM(ammo_bfg, ITEM_Cells)
45 // grappling hook -> hook
46 SPAWNFUNC_WEAPON(weapon_grapplinghook, WEP_HOOK)
49 SPAWNFUNC_ITEM(ammo_rockets, ITEM_Rockets)
52 SPAWNFUNC_ITEM(item_armor_body, ITEM_ArmorMega)
53 SPAWNFUNC_ITEM(item_armor_combat, ITEM_ArmorBig)
54 SPAWNFUNC_ITEM(item_armor_shard, ITEM_ArmorSmall)
55 SPAWNFUNC_ITEM(item_enviro, ITEM_Shield)
57 // medkit -> armor (we have no holdables)
58 SPAWNFUNC_ITEM(holdable_medkit, ITEM_ArmorMega)
60 // doubler -> strength
61 SPAWNFUNC_ITEM(item_doubler, ITEM_Strength)
66 // weapon remove ent from df
67 void target_init_verify(entity this)
70 for(trigger = NULL; (trigger = find(trigger, classname, "trigger_multiple")); )
71 for(targ = NULL; (targ = find(targ, targetname, trigger.target)); )
72 if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
79 //setsize(targ, trigger.mins, trigger.maxs);
80 //setorigin(targ, trigger.origin);
85 spawnfunc(target_init)
87 this.spawnflags = 0; // remove all weapons except the ones listed below
88 this.netname = "shotgun"; // keep these weapons through the remove trigger
89 spawnfunc_target_items(this);
90 InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET);
93 // weapon give ent from defrag
94 void target_give_init(entity this)
96 IL_EACH(g_items, it.targetname == this.target,
98 if (it.classname == "weapon_devastator") {
99 this.ammo_rockets += it.count * WEP_CVAR(devastator, ammo);
100 this.netname = cons(this.netname, "devastator");
102 else if (it.classname == "weapon_vortex") {
103 this.ammo_cells += it.count * WEP_CVAR_PRI(vortex, ammo); // WEAPONTODO
104 this.netname = cons(this.netname, "vortex");
106 else if (it.classname == "weapon_electro") {
107 this.ammo_cells += it.count * WEP_CVAR_PRI(electro, ammo); // WEAPONTODO
108 this.netname = cons(this.netname, "electro");
110 else if (it.classname == "weapon_hagar") {
111 this.ammo_rockets += it.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
112 this.netname = cons(this.netname, "hagar");
114 else if (it.classname == "weapon_crylink") {
115 this.ammo_cells += it.count * WEP_CVAR_PRI(crylink, ammo);
116 this.netname = cons(this.netname, "crylink");
118 else if (it.classname == "weapon_mortar") {
119 this.ammo_rockets += it.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
120 this.netname = cons(this.netname, "mortar");
122 else if (it.classname == "item_armor_mega")
123 this.armorvalue = 100;
124 else if (it.classname == "item_health_mega")
126 //remove(it); // removing ents in init functions causes havoc, workaround:
127 setthink(it, SUB_Remove);
131 this.spawnfunc_checked = true;
132 spawnfunc_target_items(this);
133 InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET);
136 spawnfunc(target_give)
138 InitializeEntity(this, target_give_init, INITPRIO_FINDTARGET);
141 //spawnfunc(item_flight) /* handled by buffs mutator */
142 //spawnfunc(item_haste) /* handled by buffs mutator */
143 //spawnfunc(item_health) /* handled in t_quake.qc */
144 //spawnfunc(item_health_large) /* handled in t_items.qc */
145 //spawnfunc(item_health_small) /* handled in t_items.qc */
146 //spawnfunc(item_health_mega) /* handled in t_items.qc */
147 //spawnfunc(item_invis) /* handled by buffs mutator */
148 //spawnfunc(item_regen) /* handled by buffs mutator */
150 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
158 bool DoesQ3ARemoveThisEntity(entity this)
160 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
163 if(!teamplay || g_tdm || g_ctf)
167 if (!(!teamplay || g_tdm || g_ctf))
185 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
186 gametypename = "ffa";
188 gametypename = "team";
190 gametypename = "ctf";
192 gametypename = "single";
193 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
194 if(strstrofs(this.gametype, gametypename, 0) < 0)