]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into martin-t/available
authorMartin Taibr <taibr.martin@gmail.com>
Sun, 25 Aug 2019 23:00:59 +0000 (01:00 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Sun, 25 Aug 2019 23:00:59 +0000 (01:00 +0200)
1  2 
gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh
qcsrc/common/stats.qh
qcsrc/server/miscfunctions.qc

diff --combined gamemodes-server.cfg
index b5e46ac6205565399f1ba6ce5ee5b1844077cf00,7dd231fe6046b6902105aa4e2079cca389f922e4..d38cee893adbe0931b23bc73aa063440fb5655c8
@@@ -226,7 -226,6 +226,7 @@@ set g_ca_round_timelimit 180 "round tim
  seta g_ca_teams_override 0
  set g_ca_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
  set g_ca_teams 0
 +set g_ca_weaponarena "most" "starting weapons - takes the same options as g_weaponarena"
  
  
  // ==================
@@@ -254,7 -253,7 +254,7 @@@ set g_ctf_stalemate 1 "show the enemy f
  set g_ctf_stalemate_endcondition 1 "condition for stalemate mode to be finished: 1 = If ONE flag is no longer stale, 2 = If BOTH flags are no longer stale"
  set g_ctf_stalemate_time 60 "time for each flag until stalemate mode is activated"
  set g_ctf_flagcarrier_waypointforenemy_spotting 1 "show the enemy flagcarrier location if a team mate presses +use to spot them"
- set g_ctf_dropped_capture_delay 1 "dropped capture delay"
+ set g_ctf_dropped_capture_delay 1.5 "autocapture delay when flag is thrown onto the base - counted from throw, not landing"
  set g_ctf_dropped_capture_radius 100 "allow dropped flags to be automatically captured by base flags if the dropped flag is within this radius of it"
  set g_ctf_flag_damageforcescale 2
  set g_ctf_portalteleport 0 "allow flag carriers to go through portals made in portal gun without dropping the flag"
@@@ -371,7 -370,6 +371,7 @@@ set g_freezetag_frozen_maxtime 60 "froz
  seta g_freezetag_teams_override 0
  set g_freezetag_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
  set g_freezetag_teams 0
 +set g_freezetag_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena"
  
  
  // ==========
@@@ -435,7 -433,6 +435,7 @@@ set g_lms_extra_lives 
  set g_lms_regenerate 0
  set g_lms_last_join 3 "if g_lms_join_anytime is false, new players can only join if the worst active player has more than (fraglimit - g_lms_last_join) lives"
  set g_lms_join_anytime 1      "if true, new players can join, but get same amount of lives as the worst player"
 +set g_lms_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena"
  
  
  // =========
index 95f760c47c53a8316293ef35cf7ef9e50393286e,cf2821844aa01666e3b3fb2a62df7b0d900cefc5..4721cb38015ea7cb4ea306accd3f3389eaa14d14
@@@ -483,6 -483,11 +483,6 @@@ MUTATOR_HOOKFUNCTION(ca, ClientCommand_
        return MUT_SPECCMD_CONTINUE;
  }
  
 -MUTATOR_HOOKFUNCTION(ca, WantWeapon)
 -{
 -      M_ARGV(2, bool) = true; // all weapons
 -}
 -
  MUTATOR_HOOKFUNCTION(ca, HideTeamNagger)
  {
        return true; // doesn't work well with the whole spectator as player thing
@@@ -497,6 -502,14 +497,14 @@@ MUTATOR_HOOKFUNCTION(ca, GetPlayerStatu
  
  MUTATOR_HOOKFUNCTION(ca, SetWeaponArena)
  {
 -      // most weapons arena
 -      if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") M_ARGV(0, string) = "most";
 +      if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "")
 +              M_ARGV(0, string) = autocvar_g_ca_weaponarena;
  }
+ MUTATOR_HOOKFUNCTION(ca, SV_ParseServerCommand)
+ {
+       string cmd_name = M_ARGV(0, string);
+       if (cmd_name == "shuffleteams")
+               shuffleteams_on_reset_map = !allowed_to_spawn;
+       return false;
+ }
index 27953bd3b607f033b1daa8b2f34a2028d41dd714,e383687fcf44dd2ed3a69efa5b4c357e1e91e746..f1fc645094c7c7de36b29a9d9e21a92c08a69d0b
@@@ -3,6 -3,7 +3,7 @@@
  #include <common/mutators/base.qh>
  #include <server/round_handler.qh>
  #include <server/miscfunctions.qh>
+ #include <server/command/sv_cmd.qh>
  
  int autocvar_g_ca_point_limit;
  int autocvar_g_ca_point_leadlimit;
@@@ -11,7 -12,6 +12,7 @@@ bool autocvar_g_ca_team_spawns
  //int autocvar_g_ca_teams;
  int autocvar_g_ca_teams_override;
  float autocvar_g_ca_warmup;
 +string autocvar_g_ca_weaponarena;
  
  
  int ca_teams;
index 5d94da9d9a41990093089895a7e62d8ece85026e,0f37cf1e8fa4673c4c77e3553d6b55d84fd08557..b1feaa9917c2cb913ce91f9465f795d6f40305ab
@@@ -361,7 -361,9 +361,9 @@@ MUTATOR_HOOKFUNCTION(ft, PlayerDies
                if (STAT(FROZEN, frag_target) == FROZEN_NORMAL)
                        Unfreeze(frag_target, true);
                freezetag_count_alive_players();
-               return true; // let the player die so that he can respawn whenever he wants
+               frag_target.respawn_time = time;
+               frag_target.respawn_flags |= RESPAWN_FORCE;
+               return true;
        }
  
        // Cases DEATH_TEAMCHANGE and DEATH_AUTOTEAMCHANGE are needed to fix a bug whe
@@@ -585,8 -587,9 +587,8 @@@ MUTATOR_HOOKFUNCTION(ft, TeamBalance_Ch
  
  MUTATOR_HOOKFUNCTION(ft, SetWeaponArena)
  {
 -      // most weapons arena
        if(M_ARGV(0, string) == "0" || M_ARGV(0, string) == "")
 -              M_ARGV(0, string) = "most";
 +              M_ARGV(0, string) = autocvar_g_freezetag_weaponarena;
  }
  
  MUTATOR_HOOKFUNCTION(ft, FragCenterMessage)
        return true;
  }
  
+ MUTATOR_HOOKFUNCTION(ft, SV_ParseServerCommand)
+ {
+       string cmd_name = M_ARGV(0, string);
+       if (cmd_name == "shuffleteams")
+               shuffleteams_on_reset_map = !(round_handler_IsActive() && !round_handler_IsRoundStarted());
+       return false;
+ }
  void freezetag_Initialize()
  {
        freezetag_teams = autocvar_g_freezetag_teams_override;
index 7cb66bc6fee47f451eee62152201041f66fc312b,df138a93d84f011bf29a51f2cf6135872773e0bb..6992db7b47996be07d0c46a1f1c776fd910821c4
@@@ -1,12 -1,11 +1,13 @@@
  #pragma once
  
  #include <common/mutators/base.qh>
+ #include <server/command/sv_cmd.qh>
  
  int autocvar_g_freezetag_point_limit;
  int autocvar_g_freezetag_point_leadlimit;
  bool autocvar_g_freezetag_team_spawns;
 +string autocvar_g_freezetag_weaponarena;
 +
  void freezetag_Initialize();
  
  REGISTER_MUTATOR(ft, false)
diff --combined qcsrc/common/stats.qh
index 697403cbeb4a0687af1dc2c1db69556a04122a32,e35115d3e54a51d8d81fc9e2c7cafd0e89f39f4b..9fc79cdc98852451623dacbc67a5d72cbe57c49e
@@@ -43,12 -43,8 +43,12 @@@ const int MAX_CL_STATS = 256
  #endif
  
  #ifdef SVQC
 +/// all the weapons actually spawned in the map, does not include filtered items
  vector weaponsInMap;
 +/// all the weapons placed by the mapper (weaponreplace applied), ignores most filters
 +vector weaponsInMapAll;
  #endif
 +
  REGISTER_STAT(WEAPONS, vectori)
  REGISTER_STAT(WEAPONSINMAP, vectori, weaponsInMap)
  
@@@ -380,8 -376,8 +380,8 @@@ noref int autocvar_cl_gunalign
  #endif
  #ifdef SVQC
  .int cvar_cl_gunalign;
- REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
  #endif
  REGISTER_STAT(GUNALIGN, int)
  #ifdef SVQC
  SPECTATE_COPYFIELD(_STAT(GUNALIGN))
index 23b2d669365785bb5cf0af7866bde8a2a5ed3d8d,854e39781f11794e7c3aca8c3065f8761d8630b5..a59f4afa231380a58cc9f5e24fd6b7e76dd6e0b5
@@@ -429,6 -429,9 +429,9 @@@ void GetCvars(entity this, entity store
  {
        string s = string_null;
  
+       if (f == 0)
+               LOG_INFO("Warning: requesting cvar values is deprecated. Client should send them automatically using REPLICATE.\n");
        if (f > 0)
                s = strcat1(argv(f));
  
@@@ -484,12 -487,13 +487,12 @@@ string playername(entity p, bool team_c
          return p.netname;
  }
  
 -float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done?
 +float want_weapon(entity weaponinfo, float allguns)
  {
 -      int i = weaponinfo.m_id;
        int d = 0;
        bool allow_mutatorblocked = false;
  
 -      if(!i)
 +      if(!weaponinfo.m_id)
                return 0;
  
        bool mutator_returnvalue = MUTATOR_CALLHOOK(WantWeapon, weaponinfo, d, allguns, allow_mutatorblocked);
        allow_mutatorblocked = M_ARGV(3, bool);
  
        if(allguns)
-               d = boolean((weaponinfo.spawnflags & WEP_FLAG_NORMAL) && !(weaponinfo.spawnflags & WEP_FLAG_HIDDEN));
+               d = boolean((weaponinfo.spawnflags & WEP_FLAG_NORMAL) && !(weaponinfo.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK)));
        else if(!mutator_returnvalue)
                d = !(!weaponinfo.weaponstart);
  
  
        float t = weaponinfo.weaponstartoverride;
  
 -      //print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n"));
 +      //LOG_INFOF("want_weapon: %s - d: %d t: %d\n", weaponinfo.netname, d, t);
  
        // bit order in t:
        // 1: want or not
        return t;
  }
  
-               if(w & 1)
 +/// Weapons the player normally starts with outside weapon arena.
 +WepSet weapons_start()
 +{
 +      WepSet ret = '0 0 0';
 +      FOREACH(Weapons, it != WEP_Null, {
 +              int w = want_weapon(it, false);
-               if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
++              if (w & 1)
 +                      ret |= it.m_wepset;
 +      });
 +      return ret;
 +}
 +
 +WepSet weapons_all()
 +{
 +      WepSet ret = '0 0 0';
 +      FOREACH(Weapons, it != WEP_Null, {
-               if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && (it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & WEP_FLAG_HIDDEN))
++              if (!(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK)))
 +                      ret |= it.m_wepset;
 +      });
 +      return ret;
 +}
 +
 +WepSet weapons_devall()
 +{
 +      WepSet ret = '0 0 0';
 +      FOREACH(Weapons, it != WEP_Null,
 +      {
 +              ret |= it.m_wepset;
 +      });
 +      return ret;
 +}
 +
 +WepSet weapons_most()
 +{
 +      WepSet ret = '0 0 0';
 +      FOREACH(Weapons, it != WEP_Null, {
++              if ((it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK)))
 +                      ret |= it.m_wepset;
 +      });
 +      return ret;
 +}
 +
 +void weaponarena_available_all_update(entity this)
 +{
 +      if (weaponsInMapAll)
 +      {
 +              start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | (weaponsInMapAll & weapons_all());
 +      }
 +      else
 +      {
 +              // if no weapons are available on the map, just fall back to all weapons arena
 +              start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_all();
 +      }
 +}
 +
 +void weaponarena_available_devall_update(entity this)
 +{
 +      if (weaponsInMapAll)
 +      {
 +              start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | weaponsInMapAll;
 +      }
 +      else
 +      {
 +              // if no weapons are available on the map, just fall back to devall weapons arena
 +              start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_devall();
 +      }
 +}
 +
 +void weaponarena_available_most_update(entity this)
 +{
 +      if (weaponsInMapAll)
 +      {
 +              start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | (weaponsInMapAll & weapons_most());
 +      }
 +      else
 +      {
 +              // if no weapons are available on the map, just fall back to most weapons arena
 +              start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_most();
 +      }
 +}
 +
  void readplayerstartcvars()
  {
        float i, t;
 -      string s;
  
        // initialize starting values for players
        start_weapons = '0 0 0';
        g_weaponarena = 0;
        g_weaponarena_weapons = '0 0 0';
  
 -      s = cvar_string("g_weaponarena");
 +      string s = cvar_string("g_weaponarena");
  
        MUTATOR_CALLHOOK(SetWeaponArena, s);
        s = M_ARGV(0, string);
        {
                g_weaponarena = 1;
                g_weaponarena_list = "All Weapons";
 -              FOREACH(Weapons, it != WEP_Null, {
 -                      if(!(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK)))
 -                              g_weaponarena_weapons |= (it.m_wepset);
 -              });
 +              g_weaponarena_weapons = weapons_all();
        }
        else if (s == "devall")
        {
                g_weaponarena = 1;
 -              g_weaponarena_list = "All Weapons"; // TODO: report as more than just all weapons?
 -              FOREACH(Weapons, it != WEP_Null,
 -              {
 -                      g_weaponarena_weapons |= (it.m_wepset);
 -              });
 +              g_weaponarena_list = "Dev All Weapons";
 +              g_weaponarena_weapons = weapons_devall();
        }
        else if (s == "most")
        {
                g_weaponarena = 1;
                g_weaponarena_list = "Most Weapons";
 -              FOREACH(Weapons, it != WEP_Null, {
 -                      if ((it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK)))
 -                              g_weaponarena_weapons |= (it.m_wepset);
 -              });
 +              g_weaponarena_weapons = weapons_most();
 +      }
 +      else if (s == "all_available")
 +      {
 +              g_weaponarena = 1;
 +              g_weaponarena_list = "All Available Weapons";
 +
 +              // this needs to run after weaponsInMapAll is initialized
 +              InitializeEntity(NULL, weaponarena_available_all_update, INITPRIO_FINDTARGET);
 +      }
 +      else if (s == "devall_available")
 +      {
 +              g_weaponarena = 1;
 +              g_weaponarena_list = "Dev All Available Weapons";
 +
 +              // this needs to run after weaponsInMapAll is initialized
 +              InitializeEntity(NULL, weaponarena_available_devall_update, INITPRIO_FINDTARGET);
 +      }
 +      else if (s == "most_available")
 +      {
 +              g_weaponarena = 1;
 +              g_weaponarena_list = "Most Available Weapons";
 +
 +              // this needs to run after weaponsInMapAll is initialized
 +              InitializeEntity(NULL, weaponarena_available_most_update, INITPRIO_FINDTARGET);
        }
        else if (s == "none")
        {
                start_ammo_plasma = cvar("g_start_ammo_plasma");
                start_ammo_fuel = cvar("g_start_ammo_fuel");
                random_start_weapons_count = cvar("g_random_start_weapons_count");
 -              SetResource(random_start_ammo, RES_SHELLS, cvar(
 -                      "g_random_start_shells"));
 -              SetResource(random_start_ammo, RES_BULLETS, cvar(
 -                      "g_random_start_bullets"));
 -              SetResource(random_start_ammo, RES_ROCKETS,
 -                      cvar("g_random_start_rockets"));
 -              SetResource(random_start_ammo, RES_CELLS, cvar(
 -                      "g_random_start_cells"));
 -              SetResource(random_start_ammo, RES_PLASMA, cvar(
 -                      "g_random_start_plasma"));
 -      }
 -
 -      if (warmup_stage)
 -      {
 -              warmup_start_ammo_shells = start_ammo_shells;
 -              warmup_start_ammo_nails = start_ammo_nails;
 -              warmup_start_ammo_rockets = start_ammo_rockets;
 -              warmup_start_ammo_cells = start_ammo_cells;
 -              warmup_start_ammo_plasma = start_ammo_plasma;
 -              warmup_start_ammo_fuel = start_ammo_fuel;
 -              warmup_start_health = start_health;
 -              warmup_start_armorvalue = start_armorvalue;
 -              warmup_start_weapons = start_weapons;
 -              warmup_start_weapons_default = start_weapons_default;
 -              warmup_start_weapons_defaultmask = start_weapons_defaultmask;
 -
 -              if (!g_weaponarena && !g_ca && !g_freezetag)
 -              {
 -                      warmup_start_ammo_shells = cvar("g_warmup_start_ammo_shells");
 -                      warmup_start_ammo_nails = cvar("g_warmup_start_ammo_nails");
 -                      warmup_start_ammo_rockets = cvar("g_warmup_start_ammo_rockets");
 -                      warmup_start_ammo_cells = cvar("g_warmup_start_ammo_cells");
 -                      warmup_start_ammo_plasma = cvar("g_warmup_start_ammo_plasma");
 -                      warmup_start_ammo_fuel = cvar("g_warmup_start_ammo_fuel");
 -                      warmup_start_health = cvar("g_warmup_start_health");
 -                      warmup_start_armorvalue = cvar("g_warmup_start_armor");
 -                      warmup_start_weapons = '0 0 0';
 -                      warmup_start_weapons_default = '0 0 0';
 -                      warmup_start_weapons_defaultmask = '0 0 0';
 -                      FOREACH(Weapons, it != WEP_Null, {
 -                              int w = want_weapon(it, g_warmup_allguns);
 -                              WepSet s = (it.m_wepset);
 -                              if(w & 1)
 -                                      warmup_start_weapons |= s;
 -                              if(w & 2)
 -                                      warmup_start_weapons_default |= s;
 -                              if(w & 4)
 -                                      warmup_start_weapons_defaultmask |= s;
 -                      });
 -              }
 +              SetResource(random_start_ammo, RES_SHELLS, cvar("g_random_start_shells"));
 +              SetResource(random_start_ammo, RES_BULLETS, cvar("g_random_start_bullets"));
 +              SetResource(random_start_ammo, RES_ROCKETS,cvar("g_random_start_rockets"));
 +              SetResource(random_start_ammo, RES_CELLS, cvar("g_random_start_cells"));
 +              SetResource(random_start_ammo, RES_PLASMA, cvar("g_random_start_plasma"));
 +      }
 +
 +      warmup_start_ammo_shells = start_ammo_shells;
 +      warmup_start_ammo_nails = start_ammo_nails;
 +      warmup_start_ammo_rockets = start_ammo_rockets;
 +      warmup_start_ammo_cells = start_ammo_cells;
 +      warmup_start_ammo_plasma = start_ammo_plasma;
 +      warmup_start_ammo_fuel = start_ammo_fuel;
 +      warmup_start_health = start_health;
 +      warmup_start_armorvalue = start_armorvalue;
 +      warmup_start_weapons = start_weapons;
 +      warmup_start_weapons_default = start_weapons_default;
 +      warmup_start_weapons_defaultmask = start_weapons_defaultmask;
 +
 +      if (!g_weaponarena)
 +      {
 +              warmup_start_ammo_shells = cvar("g_warmup_start_ammo_shells");
 +              warmup_start_ammo_nails = cvar("g_warmup_start_ammo_nails");
 +              warmup_start_ammo_rockets = cvar("g_warmup_start_ammo_rockets");
 +              warmup_start_ammo_cells = cvar("g_warmup_start_ammo_cells");
 +              warmup_start_ammo_plasma = cvar("g_warmup_start_ammo_plasma");
 +              warmup_start_ammo_fuel = cvar("g_warmup_start_ammo_fuel");
 +              warmup_start_health = cvar("g_warmup_start_health");
 +              warmup_start_armorvalue = cvar("g_warmup_start_armor");
 +              warmup_start_weapons = '0 0 0';
 +              warmup_start_weapons_default = '0 0 0';
 +              warmup_start_weapons_defaultmask = '0 0 0';
 +              FOREACH(Weapons, it != WEP_Null, {
 +                      int w = want_weapon(it, g_warmup_allguns);
 +                      WepSet s = it.m_wepset;
 +                      if(w & 1)
 +                              warmup_start_weapons |= s;
 +                      if(w & 2)
 +                              warmup_start_weapons_default |= s;
 +                      if(w & 4)
 +                              warmup_start_weapons_defaultmask |= s;
 +              });
        }
  
        if (g_jetpack)
        start_ammo_cells = max(0, start_ammo_cells);
        start_ammo_plasma = max(0, start_ammo_plasma);
        start_ammo_fuel = max(0, start_ammo_fuel);
 -      SetResource(random_start_ammo, RES_SHELLS, max(0,
 -              GetResource(random_start_ammo, RES_SHELLS)));
 -      SetResource(random_start_ammo, RES_BULLETS, max(0,
 -              GetResource(random_start_ammo, RES_BULLETS)));
 -      SetResource(random_start_ammo, RES_ROCKETS, max(0,
 -              GetResource(random_start_ammo, RES_ROCKETS)));
 -      SetResource(random_start_ammo, RES_CELLS, max(0,
 -              GetResource(random_start_ammo, RES_CELLS)));
 -      SetResource(random_start_ammo, RES_PLASMA, max(0,
 -              GetResource(random_start_ammo, RES_PLASMA)));
 +      SetResource(random_start_ammo, RES_SHELLS,
 +              max(0, GetResource(random_start_ammo, RES_SHELLS)));
 +      SetResource(random_start_ammo, RES_BULLETS,
 +              max(0, GetResource(random_start_ammo, RES_BULLETS)));
 +      SetResource(random_start_ammo, RES_ROCKETS,
 +              max(0, GetResource(random_start_ammo, RES_ROCKETS)));
 +      SetResource(random_start_ammo, RES_CELLS,
 +              max(0, GetResource(random_start_ammo, RES_CELLS)));
 +      SetResource(random_start_ammo, RES_PLASMA,
 +              max(0, GetResource(random_start_ammo, RES_PLASMA)));
  
        warmup_start_ammo_shells = max(0, warmup_start_ammo_shells);
        warmup_start_ammo_nails = max(0, warmup_start_ammo_nails);
@@@ -834,9 -751,9 +837,9 @@@ void precache_playermodel(string m
        float globhandle, i, n;
        string f;
  
 -      if(substring(m, -9,5) == "_lod1")
 +      if(substring(m, -9, 5) == "_lod1")
                return;
 -      if(substring(m, -9,5) == "_lod2")
 +      if(substring(m, -9, 5) == "_lod2")
                return;
        precache_model(m);
        f = strcat(substring(m, 0, -5), "_lod1", substring(m, -4, -1));