X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmiscfunctions.qc;h=a770ec55eb5c0bbd1be910cddf08844b3203e179;hb=ff2155c8fbc6602d7001cd6180eac2465cf4bdc6;hp=11c97cc110e0975c33a25b70a6743316f6082a85;hpb=0a5f730751cf4a7f6ce555ef920fe9fdcd8e59ac;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 11c97cc11..a770ec55e 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -880,8 +880,8 @@ float want_weapon(string cvarprefix, entity weaponinfo, float allguns) t = (weaponinfo.spawnflags & WEP_FLAG_NORMAL); else if(t < -1) t = 0; - else if (g_race || g_cts) - t = (i == WEP_LASER); + else if (g_cts) + t = (i == WEP_SHOTGUN); else if (g_nexball) t = 0; // weapon is set a few lines later else @@ -915,8 +915,15 @@ void readplayerstartcvars() g_weaponarena = 0; s = cvar_string("g_weaponarena"); - if (s == "0") + if (s == "0" || s == "") { + if(g_lms || g_ca) + s = "most"; + } + + if (s == "off") + { + // forcibly turn off weaponarena } else if (s == "all") { @@ -981,6 +988,40 @@ void readplayerstartcvars() if (g_weaponarena) { start_weapons = g_weaponarena; + if(!(g_lms || g_ca)) + start_items |= IT_UNLIMITED_AMMO; + } + else if (g_minstagib) + { + start_health = 100; + start_armorvalue = 0; + start_weapons = WEPBIT_MINSTANEX; + weapon_action(WEP_MINSTANEX, WR_PRECACHE); + g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha"); + + if (g_minstagib_invis_alpha <= 0) + g_minstagib_invis_alpha = -1; + } + else + { + for (i = WEP_FIRST; i <= WEP_LAST; ++i) + { + e = get_weaponinfo(i); + if(want_weapon("g_start_weapon_", e, FALSE)) + start_weapons |= e.weapons; + } + } + + if(!cvar("g_use_ammunition")) + start_items |= IT_UNLIMITED_AMMO; + + if(g_minstagib) + { + start_ammo_cells = cvar("g_minstagib_ammo_start"); + start_ammo_fuel = cvar("g_start_ammo_fuel"); + } + else if(start_items & IT_UNLIMITED_WEAPON_AMMO) + { for (j = WEP_FIRST; j <= WEP_LAST; ++j) { e = get_weaponinfo(j); @@ -998,32 +1039,16 @@ void readplayerstartcvars() start_ammo_fuel = 999; } } - start_items |= IT_UNLIMITED_AMMO; - } - else if (g_minstagib) - { - start_health = 100; - start_armorvalue = 0; - start_weapons = WEPBIT_MINSTANEX; - weapon_action(WEP_MINSTANEX, WR_PRECACHE); - start_ammo_cells = cvar("g_minstagib_ammo_start"); - g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha"); - start_ammo_fuel = cvar("g_start_ammo_fuel"); - - if (g_minstagib_invis_alpha <= 0) - g_minstagib_invis_alpha = -1; } else { - if (g_lms || g_ca) + if(g_lms || g_ca) { start_ammo_shells = cvar("g_lms_start_ammo_shells"); start_ammo_nails = cvar("g_lms_start_ammo_nails"); start_ammo_rockets = cvar("g_lms_start_ammo_rockets"); start_ammo_cells = cvar("g_lms_start_ammo_cells"); start_ammo_fuel = cvar("g_lms_start_ammo_fuel"); - start_health = cvar("g_lms_start_health"); - start_armorvalue = cvar("g_lms_start_armor"); } else { @@ -1033,13 +1058,12 @@ void readplayerstartcvars() start_ammo_cells = cvar("g_start_ammo_cells"); start_ammo_fuel = cvar("g_start_ammo_fuel"); } + } - for (i = WEP_FIRST; i <= WEP_LAST; ++i) - { - e = get_weaponinfo(i); - if(want_weapon("g_start_weapon_", e, FALSE)) - start_weapons |= e.weapons; - } + if (g_lms || g_ca) + { + start_health = cvar("g_lms_start_health"); + start_armorvalue = cvar("g_lms_start_armor"); } if (inWarmupStage) @@ -1080,22 +1104,6 @@ void readplayerstartcvars() warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable")); } - if(!cvar("g_use_ammunition")) - { - start_ammo_shells = cvar("g_pickup_shells_max"); - start_ammo_nails = cvar("g_pickup_nails_max"); - start_ammo_rockets = cvar("g_pickup_rockets_max"); - start_ammo_cells = cvar("g_pickup_cells_max"); - start_ammo_fuel = cvar("g_pickup_fuel_max"); - start_items |= IT_UNLIMITED_AMMO; - warmup_start_ammo_shells = cvar("g_pickup_shells_max"); - warmup_start_ammo_nails = cvar("g_pickup_nails_max"); - warmup_start_ammo_rockets = cvar("g_pickup_rockets_max"); - warmup_start_ammo_cells = cvar("g_pickup_cells_max"); - warmup_start_ammo_fuel = cvar("g_pickup_fuel_max"); - //warmup_start_items |= IT_UNLIMITED_AMMO; - } - if (g_jetpack) start_items |= IT_JETPACK; @@ -1164,6 +1172,7 @@ float sv_pitch_min; float sv_pitch_max; float sv_pitch_fixyaw; +string GetGametype(); // g_world.qc void readlevelcvars(void) { // first load all the mutators @@ -1214,6 +1223,8 @@ void readlevelcvars(void) sv_gentle = cvar("sv_gentle"); sv_foginterval = cvar("sv_foginterval"); g_cloaked = cvar("g_cloaked"); + if(g_cts) + g_cloaked = 1; // always enable cloak in CTS g_jump_grunt = cvar("g_jump_grunt"); g_footsteps = cvar("g_footsteps"); g_grappling_hook = cvar("g_grappling_hook"); @@ -1297,7 +1308,9 @@ void readlevelcvars(void) g_pinata = cvar("g_pinata"); - g_weapon_stay = cvar("g_weapon_stay"); + g_weapon_stay = cvar(strcat("g_", GetGametype(), "_weapon_stay")); + if(!g_weapon_stay) + g_weapon_stay = cvar("g_weapon_stay"); if (!g_weapon_stay && (cvar("deathmatch") == 2)) g_weapon_stay = 1; @@ -1523,8 +1536,12 @@ void precache_playermodel(string m) precache_model(m); if(sv_loddistance1) { - precache_model(strcat(substring(m, 0, -5), "_lod1", substring(m, -4, -1))); - precache_model(strcat(substring(m, 0, -5), "_lod2", substring(m, -4, -1))); + f = strcat(substring(m, 0, -5), "_lod1", substring(m, -4, -1)); + if(fexists(f)) + precache_model(f); + f = strcat(substring(m, 0, -5), "_lod2", substring(m, -4, -1)); + if(fexists(f)) + precache_model(f); } globhandle = search_begin(strcat(m, "_*.sounds"), TRUE, FALSE); @@ -1750,6 +1767,14 @@ void objerror(string s) objerror_builtin(s); } +.float remove_except_protected_forbidden; +void remove_except_protected(entity e) +{ + if(e.remove_except_protected_forbidden) + error("not allowed to remove this at this point"); + remove_builtin(e); +} + void remove_unsafely(entity e) { remove_builtin(e); @@ -1800,6 +1825,11 @@ void InitializeEntitiesRun() entity startoflist; startoflist = initialize_entity_first; initialize_entity_first = world; + remove = remove_except_protected; + for (self = startoflist; self; self = self.initialize_entity_next) + { + self.remove_except_protected_forbidden = 1; + } for (self = startoflist; self; ) { entity e; @@ -1809,6 +1839,7 @@ void InitializeEntitiesRun() self.initialize_entity_order = 0; self.initialize_entity = func_null; self.initialize_entity_next = world; + self.remove_except_protected_forbidden = 0; if (self.classname == "initialize_entity") { entity e_old; @@ -1817,9 +1848,16 @@ void InitializeEntitiesRun() self = e_old; } //dprint("Delayed initialization: ", self.classname, "\n"); - func(); + if(func != func_null) + func(); + else + { + eprint(self); + backtrace(strcat("Null function in: ", self.classname, "\n")); + } self = e; } + remove = remove_unsafely; } .float uncustomizeentityforclient_set; @@ -2595,7 +2633,6 @@ void zcurveparticles_from_tracetoss(float effectno, vector start, vector end, ve zcurveparticles(effectno, start, end, end_dz, vlen(vel)); } -string GetGametype(); // g_world.qc void write_recordmarker(entity pl, float tstart, float dt) { GameLogEcho(strcat(":recordset:", ftos(pl.playerid), ":", ftos(dt)));