]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/t_quake3.qc
Merge branch 'master' into terencehill/menu_gametype_tooltips_2
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_quake3.qc
1
2 #include "../common/weapons/all.qh"
3 #include "../common/buffs/all.qh"
4
5 spawnfunc(weapon_crylink);
6 spawnfunc(weapon_electro);
7 spawnfunc(weapon_hagar);
8 spawnfunc(weapon_machinegun);
9 spawnfunc(weapon_vortex);
10
11 spawnfunc(target_items);
12
13 spawnfunc(item_bullets);
14 spawnfunc(item_cells);
15 spawnfunc(item_rockets);
16 spawnfunc(item_shells);
17
18 spawnfunc(item_jetpack);
19
20 spawnfunc(item_armor_big);
21 spawnfunc(item_armor_large);
22 spawnfunc(item_armor_small);
23
24 spawnfunc(item_health_medium);
25 spawnfunc(item_health_mega);
26
27 //***********************
28 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
29 //***********************
30
31 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
32
33 // SG -> SG
34 spawnfunc(ammo_shells)         { spawnfunc_item_shells(this);         }
35
36 // MG -> MG
37 spawnfunc(ammo_bullets)        { spawnfunc_item_bullets(this);        }
38
39 // GL -> Mortar
40 spawnfunc(ammo_grenades)       { spawnfunc_item_rockets(this);        }
41
42 // LG -> Lightning
43 spawnfunc(weapon_lightning)    { spawnfunc_weapon_electro(this);      }
44 spawnfunc(ammo_lightning)      { spawnfunc_item_cells(this);          }
45
46 // Plasma -> Hagar
47 spawnfunc(weapon_plasmagun)    { spawnfunc_weapon_hagar(this);        }
48 spawnfunc(ammo_cells)          { spawnfunc_item_rockets(this);        }
49
50 // Rail -> Vortex
51 spawnfunc(weapon_railgun)      { spawnfunc_weapon_vortex(this);          }
52 spawnfunc(ammo_slugs)          { spawnfunc_item_cells(this);          }
53
54 // BFG -> Crylink
55 spawnfunc(weapon_bfg)          { spawnfunc_weapon_crylink(this);      }
56 spawnfunc(ammo_bfg)            { spawnfunc_item_cells(this);          }
57
58 // RL -> RL
59 spawnfunc(ammo_rockets)        { spawnfunc_item_rockets(this);        }
60
61 // Armor
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);     }
66
67 .float wait;
68 .float delay;
69
70 // weapon remove ent from df
71 void target_init_verify()
72 {
73         entity trigger, targ;
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")
77                         {
78                                 trigger.wait = 0;
79                                 trigger.delay = 0;
80                                 targ.wait = 0;
81                                 targ.delay = 0;
82
83                                 //setsize(targ, trigger.mins, trigger.maxs);
84                                 //setorigin(targ, trigger.origin);
85                                 //remove(trigger);
86                         }
87 }
88
89 spawnfunc(target_init)
90 {
91         self.spawnflags = 0; // remove all weapons except the ones listed below
92         self.netname = "shotgun"; // keep these weapons through the remove trigger
93         spawnfunc_target_items(this);
94         InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
95 }
96
97 // weapon give ent from defrag
98 void target_give_init()
99 {SELFPARAM();
100         entity targ;
101         for (targ = world; (targ = find(targ, targetname, self.target)); ) {
102                 if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
103                         self.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
104                         self.netname = "devastator";
105                 }
106                 else if (targ.classname == "weapon_plasmagun") {
107                         self.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
108                         if(self.netname == "")
109                                 self.netname = "hagar";
110                         else
111                                 self.netname = strcat(self.netname, " hagar");
112                 }
113                 else if (targ.classname == "weapon_bfg") {
114                         self.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
115                         if(self.netname == "")
116                                 self.netname = "crylink";
117                         else
118                                 self.netname = strcat(self.netname, " crylink");
119                 }
120                 else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
121                         self.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
122                         if(self.netname == "")
123                                 self.netname = "mortar";
124                         else
125                                 self.netname = strcat(self.netname, " mortar");
126                 }
127                 else if (targ.classname == "item_armor_body")
128                         self.armorvalue = 100;
129                 else if (targ.classname == "item_health_mega")
130                         self.health = 200;
131                 //remove(targ); // removing ents in init functions causes havoc, workaround:
132         targ.think = SUB_Remove;
133         targ.nextthink = time;
134         }
135         self.spawnflags = 2;
136         spawnfunc_target_items(this);
137         InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
138 }
139
140 spawnfunc(target_give)
141 {
142         InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
143 }
144
145 //spawnfunc(item_flight)       /* handled by buffs mutator or 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 */
153
154 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
155
156 spawnfunc(item_flight)
157 {
158         if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
159                 spawnfunc_item_jetpack(this);
160         else
161                 buff_Init_Compat(self, BUFF_FLIGHT);
162 }
163
164 .float notteam;
165 .float notsingle;
166 .float notfree;
167 .float notq3a;
168 .float notta;
169 .string gametype;
170 float DoesQ3ARemoveThisEntity()
171 {SELFPARAM();
172         // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
173
174         if(self.notq3a)
175                 if(!teamplay || g_tdm || g_ctf)
176                         return 1;
177
178         if(self.notta)
179                 if (!(!teamplay || g_tdm || g_ctf))
180                         return 1;
181
182         if(self.notsingle)
183                 if(maxclients == 1)
184                         return 1;
185
186         if(self.notteam)
187                 if(teamplay)
188                         return 1;
189
190         if(self.notfree)
191                 if(!teamplay)
192                         return 1;
193
194         if(self.gametype)
195         {
196                 string gametypename;
197                 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
198                 gametypename = "ffa";
199                 if(teamplay)
200                         gametypename = "team";
201                 if(g_ctf)
202                         gametypename = "ctf";
203                 if(maxclients == 1)
204                         gametypename = "single";
205                 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
206                 if(strstrofs(self.gametype, gametypename, 0) < 0)
207                         return 1;
208         }
209
210         return 0;
211 }