A few people have reported that
one of my add-ons causes other client-side add-ons to not load.
The add-on is not causing any problems for me, so I am unable to investigate the issue and possible solutions. I've looked through the code, and nothing pops out to me as potentially problem causing
client.cs
exec("./guiMods.cs");
package Env_LoadSave
{
//Called when starting load
function LoadBricks_ClickLoadButton()
{
$LoadBricksName = filterOutString(getField(LoadBricks_FileList.getValue(),0),"/");
Parent::LoadBricks_ClickLoadButton();
}
//Called when loading is finished
function handleProcessComplete(%type,%msg)
{
Parent::handleProcessComplete(%type,%msg);
if(LoadBricks_Environment.getValue()) //Load the environment after brick loading is complete
LoadBricks_LoadEnvironment();
}
//Called when the save button is clicked
function SaveBricks_Save()
{
EnvGui.onWake(); //Appears to be the easiest way to update the client with environment settings from the server. Doing it now so it has some time to update before saving.
$SaveBricksName = SaveBricks_FileName.getValue();
Parent::SaveBricks_Save();
}
//Returns when saving is finished
function SavingGui::Save()
{
Parent::Save();
if(SaveBricks_Environment.getValue()) //Save the environment after we save bricks
SaveBricks_SaveEnvironment();
}
//Support for Siba's Delete extension
function DeleteSave_Confirm()
{
%fileName=getField($DelGui.getValue(),0);
%file = "saves/" @ %fileName @ ".ble";
Parent::DeleteSave_Confirm();
if(isFile(%file))
fileDelete(%file);
}
};
ActivatePackage(Env_LoadSave);
function LoadBricks_LoadEnvironment()
{
%fileName = "saves/" @ $LoadBricksName @ ".ble";
if(!isFile(%fileName))
return;
%file = new FileObject();
%file.openForRead(%fileName);
%file.readLine(); %file.readLine(); %file.readLine(); //Read a few lines to skip paste what we don't want
while(!%file.isEof())
{
%line = %file.readLine();
%var = getField(%line,0);
%val = getField(%line,1);
commandtoserver('envGui_SetVar',%var,%val);
}
%file.close();
%file.delete();
}
function SaveBricks_SaveEnvironment()
{
//Write the .ble environment file
if($EnvGui::SkyIdx $= "") //Not having the environment settings could be caused by a few things, such as not being an admin on the server.
{
echo("Could not save environment.");
return;
}
%file = new FileObject();
%file.openForWrite("saves/" @ $SaveBricksName @ ".ble");
%file.writeLine("This is a Blockland Environment file generated by Adam487's Save/Load Bricks Extension: Environment");
%file.writeLine("You probably shouldn't modify it cause you'll screw it up.");
%file.writeLine("");
%file.writeLine("WaterIdx" TAB $EnvGui::WaterIdx);
%file.writeLine("SkyIdx" TAB $EnvGui::SkyIdx);
%file.writeLine("GroundIdx" TAB $EnvGui::GroundIdx);
%file.writeLine("DayOffset" TAB $EnvGui::DayOffset);
%file.writeLine("DayLength" TAB $EnvGui::DayLength);
%file.writeLine("DayCycleEnabled" TAB $EnvGui::DayCycleEnabled);
%file.writeLine("DayCycleIdx" TAB $EnvGui::DayCycleIdx);
%file.writeLine("Sunational socialistmuth" TAB $EnvGui::Sunational socialistmuth);
%file.writeLine("SunElevation" TAB $EnvGui::SunElevation);
%file.writeLine("DirectLightColor" TAB $EnvGui::DirectLightColor);
%file.writeLine("AmbientLightColor" TAB $EnvGui::AmbientLightColor);
%file.writeLine("ShadowColor" TAB $EnvGui::ShadowColor);
%file.writeLine("SunFlareColor" TAB $EnvGui::SunFlareColor);
%file.writeLine("SunFlareSize" TAB $EnvGui::SunFlareSize);
%file.writeLine("SunFlareTopIdx" TAB $EnvGui::SunFlareTopIdx);
%file.writeLine("SunFlareBottomIdx" TAB $EnvGui::SunFlareBottomIdx);
%file.writeLine("VisibleDistance" TAB $EnvGui::VisibleDistance);
%file.writeLine("FogDistance" TAB $EnvGui::FogDistance);
%file.writeLine("FogHeight" TAB $EnvGui::FogHeight);
%file.writeLine("FogColor" TAB $EnvGui::FogColor);
%file.writeLine("WaterColor" TAB $EnvGui::WaterColor);
%file.writeLine("WaterHeight" TAB $EnvGui::WaterHeight);
%file.writeLine("UnderWaterColor" TAB $EnvGui::UnderWaterColor);
%file.writeLine("SkyColor" TAB $EnvGui::SkyColor);
%file.writeLine("WaterScrollX" TAB $EnvGui::WaterScrollX);
%file.writeLine("WaterScrollY" TAB $EnvGui::WaterScrollY);
%file.writeLine("GroundColor" TAB $EnvGui::GroundColor);
%file.writeLine("GroundScrollX" TAB $EnvGui::GroundScrollX);
%file.writeLine("GroundScrollY" TAB $EnvGui::GroundScrollY);
%file.writeLine("VignetteMultiply" TAB $EnvGui::VignetteMultiply);
%file.writeLine("VignetteColor" TAB $EnvGui::VignetteColor);
%file.writeLine("SimpleMode" TAB $EnvGui::SimpleMode);
%file.close();
%file.delete();
}
guiMods.cs
//Modifies the load and save bricks guis to make room for and add checkboxes for loading environment
//Modify Load Bricks gui
if(!isObject(LoadBricks_Environment))
{
//Get all the objects we need to modify
%loadButton = LoadBricks_LoadButton;
%description = LoadBricks_Description;
//Some objects we need to move don't have a name, so we have to find them
%count = LoadBricks_Window.getCount();
for(%i=0;%i<%count;%i++)
{
%obj = LoadBricks_Window.getObject(%i);
if(%obj.text $= "Cancel") //Cancel Button
%cancelButton = %obj;
if(%obj.getClassName() $= "GuiSwatchCtrl" && %obj.color $= "255 255 255 192") //Description Swatch
%descriptionSwatch = %obj;
}
//Modify some elements
%loadButton.shift("0 10");
%cancelButton.shift("0 10");
%descriptionSwatch.shift("0 15");
%description.shift("0 15");
//Create a new checkbox
new GuiCheckBoxCtrl(LoadBricks_Environment)
{
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "429 276";
extent = "150 30";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
text = "Load Environment Settings";
groupNum = "-1";
buttonType = "ToggleButton";
};
LoadBricks_Window.add(LoadBricks_Environment);
}
//Modify Save Bricks gui
if(!isObject(SaveBricks_Environment))
{
//Get all the objects we need to modify
%description = SaveBricks_Description;
//Some objects we need to move don't have a name, so we have to find them
%count = SaveBricks_Window.getCount();
for(%i=0;%i<%count;%i++)
{
%obj = SaveBricks_Window.getObject(%i);
if(%obj.text $= "Cancel") //Cancel Button
%cancelButton = %obj;
if(%obj.getClassName() $= "GuiSwatchCtrl" && %obj.color $= "255 255 255 192") //Description Swatch
%descriptionSwatch = %obj;
if(%obj.text $= "Save") //Save button
%saveButton = %obj;
if(%obj.text $= "Description : ") //Description Header
%descriptionHeader = %obj;
if(%obj.text $= "Clear") //Clear Button
%clearButton = %obj;
}
//Modify some elements
%saveButton.shift("0 7");
%cancelButton.shift("0 7");
%descriptionSwatch.shift("0 15");
%descriptionHeader.shift("0 15");
%clearButton.shift("0 15");
//Create a new checkbox
new GuiCheckBoxCtrl(SaveBricks_Environment)
{
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "14 298";
extent = "140 30";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
text = "Save Environment";
groupNum = "-1";
buttonType = "ToggleButton";
};
SaveBricks_Window.add(SaveBricks_Environment);
}
//Support for Siba's Save Delete Extension
package Env_LoadSaveGuiMod
{
function LoadBricks_Window::onWake(%this)
{
Parent::onWake(%this);
if($Env_LoadSave_SibaButtonsMoved || !isFile("Add-Ons/Client_SaveDelete/client.cs"))
return;
$Env_LoadSave_SibaButtonsMoved = 1;
LoadBricks_CancelButton.shift("0 10");
LoadBricks_DeleteButton.shift("0 10");
LoadBricks_LoadButton.shift("0 10");
}
function SaveBricks_Window::onWake(%this)
{
Parent::onWake(%this);
if($Env_LoadSave_SibaSaveButtonsMoved || !isFile("Add-Ons/Client_SaveDelete/client.cs"))
return;
$Env_LoadSave_SibaSaveButtonsMoved = 1;
SaveBricks_DeleteButton.shift("0 7");
}
};
ActivatePackage(Env_LoadSaveGuiMod);