mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-01-17 00:05:07 -05:00
Added potential memory saver.
This commit is contained in:
@@ -63,13 +63,15 @@ public class spawning extends script.base_script
|
||||
}
|
||||
public static void addToSpawnDebugList(obj_id self, obj_id spawned) throws InterruptedException
|
||||
{
|
||||
Vector debugSpawnList = new Vector();
|
||||
debugSpawnList.setSize(0);
|
||||
if(!utils.inDebugMode()) return;
|
||||
Vector debugSpawnList;
|
||||
if (utils.hasScriptVar(self, "debugSpawnList"))
|
||||
{
|
||||
debugSpawnList = utils.getResizeableObjIdArrayScriptVar(self, "debugSpawnList");
|
||||
debugSpawnList = utils.addElement(debugSpawnList, spawned);
|
||||
} else {
|
||||
debugSpawnList = utils.addElement(new Vector(), spawned);
|
||||
}
|
||||
debugSpawnList = utils.addElement(debugSpawnList, spawned);
|
||||
utils.setScriptVar(self, "debugSpawnList", debugSpawnList);
|
||||
}
|
||||
public static Vector getAllObjectsWithObjVar(location locTest, String strObjVarName) throws InterruptedException
|
||||
|
||||
@@ -78,7 +78,7 @@ public class utils extends script.base_script
|
||||
public static final String BAZAAR_SCRIPT = "terminal.bazaar";
|
||||
public static int clipRange(int iValue, int iClipMin, int iClipMax) throws InterruptedException
|
||||
{
|
||||
return (iValue < iClipMin) ? iClipMin : (iValue > iClipMax) ? iClipMax : iValue;
|
||||
return (iValue < iClipMin) ? iClipMin : Math.min(iValue, iClipMax);
|
||||
}
|
||||
public static location getRandomAwayLocation(location pos, float fMinRadius, float fMaxRadius) throws InterruptedException
|
||||
{
|
||||
@@ -143,10 +143,7 @@ public class utils extends script.base_script
|
||||
if (isIdValid(armor))
|
||||
{
|
||||
String template = getTemplateName(armor);
|
||||
if (template.endsWith("armor_mandalorian_belt.iff") || template.endsWith("armor_mandalorian_bicep_l.iff") || template.endsWith("armor_mandalorian_bicep_r.iff") || template.endsWith("armor_mandalorian_bracer_l.iff") || template.endsWith("armor_mandalorian_bracer_r.iff") || template.endsWith("armor_mandalorian_chest_plate.iff") || template.endsWith("armor_mandalorian_helmet.iff") || template.endsWith("armor_mandalorian_leggings.iff") || template.endsWith("armor_mandalorian_shoes.iff") || template.endsWith("armor_mandalorian_gloves.iff"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return template.endsWith("armor_mandalorian_belt.iff") || template.endsWith("armor_mandalorian_bicep_l.iff") || template.endsWith("armor_mandalorian_bicep_r.iff") || template.endsWith("armor_mandalorian_bracer_l.iff") || template.endsWith("armor_mandalorian_bracer_r.iff") || template.endsWith("armor_mandalorian_chest_plate.iff") || template.endsWith("armor_mandalorian_helmet.iff") || template.endsWith("armor_mandalorian_leggings.iff") || template.endsWith("armor_mandalorian_shoes.iff") || template.endsWith("armor_mandalorian_gloves.iff");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -4791,30 +4788,20 @@ public class utils extends script.base_script
|
||||
|
||||
if (intServerSpawnLimit > 0)
|
||||
{
|
||||
if (intNumCreatures > intServerSpawnLimit)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return intNumCreatures <= intServerSpawnLimit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (intNumPlayers < 200000)
|
||||
{
|
||||
if (intNumCreatures > 5000)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return intNumCreatures <= 5000;
|
||||
}
|
||||
else
|
||||
{
|
||||
float fltRatio = (intNumCreatures / intNumPlayers);
|
||||
if (fltRatio > 10)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return !(fltRatio > 10.0f);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static String formatTimeVerbose(int seconds) throws InterruptedException
|
||||
{
|
||||
@@ -7220,4 +7207,7 @@ public class utils extends script.base_script
|
||||
}
|
||||
return intNumCreatures;
|
||||
}
|
||||
public static boolean inDebugMode() throws InterruptedException {
|
||||
return (utils.getIntConfigSetting("GameServer", "debugMode") == 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user