summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/ChunkWorx/chunkworx_main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer/Plugins/ChunkWorx/chunkworx_main.lua')
-rw-r--r--MCServer/Plugins/ChunkWorx/chunkworx_main.lua53
1 files changed, 23 insertions, 30 deletions
diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua
index ab9962387..f74c4ea2d 100644
--- a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua
+++ b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua
@@ -6,20 +6,27 @@ CX = 0
CZ = 0
CURRENT = 0
TOTAL = 0
+
-- AREA Variables
AreaStartX = -10
AreaStartZ = -10
AreaEndX = 10
AreaEndZ = 10
+
-- RADIAL Variables
RadialX = 0
RadialZ = 0
-Radius = 1
+Radius = 10
+
-- WORLD
WORK_WORLD = cRoot:Get():GetDefaultWorld():GetName()
WW_instance = cRoot:Get():GetDefaultWorld()
WORLDS = {}
+
+
+
+
function Initialize(Plugin)
PLUGIN = Plugin
@@ -36,39 +43,25 @@ function Initialize(Plugin)
LOG("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": NO WORLD found :(")
end
- PLUGIN.IniFile = cIniFile("ChunkWorx.ini")
- if (PLUGIN.IniFile:ReadFile() == false) then
- PLUGIN.IniFile:HeaderComment("ChunkWorx Save")
- PLUGIN.IniFile:AddKeyName("Area data")
- PLUGIN.IniFile:SetValueI("Area data", "StartX", AreaStartX)
- PLUGIN.IniFile:SetValueI("Area data", "StartZ", AreaStartZ)
- PLUGIN.IniFile:SetValueI("Area data", "EndX", AreaEndX)
- PLUGIN.IniFile:SetValueI("Area data", "EndZ", AreaEndZ)
- PLUGIN.IniFile:AddKeyName("Radial data")
- PLUGIN.IniFile:SetValueI("Radial data", "RadialX", RadialX)
- PLUGIN.IniFile:SetValueI("Radial data", "RadialZ", RadialZ)
- PLUGIN.IniFile:SetValueI("Radial data", "Radius", Radius)
- PLUGIN.IniFile:WriteFile()
- end
-
- AreaStartX = PLUGIN.IniFile:GetValueI("Area data", "StartX")
- AreaStartZ = PLUGIN.IniFile:GetValueI("Area data", "StartZ")
- AreaEndX = PLUGIN.IniFile:GetValueI("Area data", "EndX")
- AreaEndZ = PLUGIN.IniFile:GetValueI("Area data", "EndZ")
-
- RadialX = PLUGIN.IniFile:GetValueI("Radial data", "RadialX")
- RadialZ = PLUGIN.IniFile:GetValueI("Radial data", "RadialZ")
- Radius = PLUGIN.IniFile:GetValueI("Radial data", "Radius")
+ -- Read the stored values:
+ local SettingsIni = cIniFile();
+ SettingsIni:ReadFile("ChunkWorx.ini"); -- ignore any read errors
+ AreaStartX = SettingsIni:GetValueSetI("Area data", "StartX", AreaStartX)
+ AreaStartZ = SettingsIni:GetValueSetI("Area data", "StartZ", AreaStartZ)
+ AreaEndX = SettingsIni:GetValueSetI("Area data", "EndX", AreaEndX)
+ AreaEndZ = SettingsIni:GetValueSetI("Area data", "EndZ", AreaEndZ)
+ RadialX = SettingsIni:GetValueSetI("Radial data", "RadialX", RadialX)
+ RadialZ = SettingsIni:GetValueSetI("Radial data", "RadialZ", RadialZ)
+ Radius = SettingsIni:GetValueSetI("Radial data", "Radius", Radius)
+ SettingsIni:WriteFile("ChunkWorx.ini");
LOG("Initialized " .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion())
- --LOG("Test1: " .. math.fmod(1.5, 1)) - return fractional part!
return true
end
-function OnDisable()
- PLUGIN.IniFile:WriteFile()
- LOG(PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " is shutting down...")
-end
+
+
+
function OnTick( DeltaTime )
if (GENERATION_STATE == 1 or GENERATION_STATE == 3) then
@@ -128,7 +121,7 @@ function OnTick( DeltaTime )
end
end
end
- WW_instance:SaveAllChunks()
+ WW_instance:QueueSaveAllChunks()
WW_instance:UnloadUnusedChunks()
end
end