diff --git a/[gameplay]/hedit/meta.xml b/[gameplay]/hedit/meta.xml
index b0ed6710d..22e78832f 100644
--- a/[gameplay]/hedit/meta.xml
+++ b/[gameplay]/hedit/meta.xml
@@ -1,7 +1,7 @@
-
+
true
-
+
diff --git a/[gameplay]/hedit/server/cfgloader.lua b/[gameplay]/hedit/server/cfgloader.lua
index 09cbefd17..d47e3b882 100644
--- a/[gameplay]/hedit/server/cfgloader.lua
+++ b/[gameplay]/hedit/server/cfgloader.lua
@@ -26,7 +26,7 @@ function loadCFGIntoMemory ( cfgstr )
waitForLine = false
if addingEntry then
- print ( "[HEDIT] Error while adding line #"..tostring(#lines)..", invalid character found: "..token )
+ outputDebugString ( "[HEDIT] Error while adding line #"..tostring(#lines)..", invalid character found: "..token, 1)
table.remove ( lines, #lines )
addingEntry = false
end
@@ -63,9 +63,9 @@ function loadCFGIntoMemory ( cfgstr )
if #lines > 0 then
- print ( "[HEDIT] Loaded "..tostring(#lines).." handling entries from "..tostring(string.len(cfgstr)).." bytes into the memory." )
- print ( "[HEDIT] Type 'exportcfg' to import the handling entries into defaults.xml." )
- print ( "[HEDIT] This may take some time." )
+ outputDebugString ( "[HEDIT] Loaded "..tostring(#lines).." handling entries from "..tostring(string.len(cfgstr)).." bytes into the memory." )
+ outputDebugString ( "[HEDIT] Type 'exportcfg' to import the handling entries into defaults.xml." )
+ outputDebugString ( "[HEDIT] This may take some time." )
addCommandHandler ( "exportcfg", function ( player )
@@ -73,8 +73,8 @@ function loadCFGIntoMemory ( cfgstr )
return false
end
- print ( "[HEDIT] Importing "..line.." handling entries into defaults.xml." )
- print ( "[HEDIT] This may take a while. Please wait." )
+ outputDebugString ( "[HEDIT] Importing "..line.." handling entries into defaults.xml." )
+ outputDebugString ( "[HEDIT] This may take a while. Please wait." )
setTimer ( function ( )
exportToDefaults ( lines )
@@ -85,8 +85,8 @@ function loadCFGIntoMemory ( cfgstr )
return true
end
- print ( "[HEDIT] No handling entries found in "..tostring(string.len(cfgstr)).." bytes!")
- print ( "[HEDIT] Make sure handling.cfg is correct and try again." )
+ outputDebugString ( "[HEDIT] No handling entries found in "..tostring(string.len(cfgstr)).." bytes!", 2)
+ outputDebugString ( "[HEDIT] Make sure handling.cfg is correct and try again.", 2 )
return true
end
@@ -113,7 +113,7 @@ function exportToDefaults ( linetabs )
if id == 1 then
if not tonumber ( value ) then
- print ( "[HEDIT] Handling line #"..tostring(num).." is invalid, can't import!" )
+ outputDebugString ( "[HEDIT] Handling line #"..tostring(num).." is invalid, can't import!", 1 )
break
end
@@ -156,8 +156,8 @@ addCommandHandler ( "loadcfg", function ( player )
fileClose ( cfgFile )
- print ( "[HEDIT] handling.cfg has been read." )
- print ( "[HEDIT] Please wait while loading the lines into the memory." )
+ outputDebugString ( "[HEDIT] handling.cfg has been read." )
+ outputDebugString ( "[HEDIT] Please wait while loading the lines into the memory." )
setTimer ( function ( )
loadCFGIntoMemory ( str )
@@ -166,6 +166,6 @@ addCommandHandler ( "loadcfg", function ( player )
return true
end
- print ( "[HEDIT] No handling.cfg found. Make sure it's in the root of this resource." )
+ outputDebugString ( "[HEDIT] No handling.cfg found. Make sure it's in the root of this resource.", 2 )
return false
end )
diff --git a/[gameplay]/hedit/server/core.lua b/[gameplay]/hedit/server/core.lua
index 06d3928d1..31628c6f8 100644
--- a/[gameplay]/hedit/server/core.lua
+++ b/[gameplay]/hedit/server/core.lua
@@ -7,26 +7,13 @@ addEventHandler ( "onResourceStart", resourceRoot, function ( )
local resName = getResourceName ( resource )
- setElementData(resourceRoot, "resourceVersion", getResourceInfo(resource, "version"))
-
if resName ~= "hedit" and not DEBUGMODE then
- outputChatBox ( "Handling Editor failed to start, see the logs for more information." )
- print ( "===============================================================================" )
- print ( "[HEDIT] Please rename resource '"..resName.."' to 'hedit' to use the handling editor." )
- print ( "[HEDIT] The handling editor will not work unless you rename the resource to 'hedit'." )
- print ( "===============================================================================" )
+ outputDebugString ( "[HEDIT] Please rename resource '"..resName.."' to 'hedit' to use the handling editor.", 1)
return cancelEvent ( true, "Rename the handling editor resource to 'hedit' in order to use the resource." )
end
-
- print ( "===============================================================================" )
- print ( " MTA:SA HANDLING EDITOR [hedit.github.io]" )
- print ( "===============================================================================" )
if fileExists ( "handling.cfg" ) then
- print ( " Handling.cfg found." )
- print ( " Type 'loadcfg' to load handling.cfg into the memory." )
- print ( " After this, you can import the handling into defaults.xml." )
- print ( "===============================================================================" )
+ outputDebugString ( "[HEDIT] Handling.cfg found; type 'loadcfg' to load handling.cfg into the memory.")
end
--Parse meta settings
@@ -34,7 +21,7 @@ addEventHandler ( "onResourceStart", resourceRoot, function ( )
addEventHandler("onSettingChange", root, parseMetaSettings)
for model=400,611 do
- setElementData ( root, "originalHandling."..tostring ( model ), getOriginalHandling ( model, true ) )
+ setElementData ( resourceRoot, "hedit:originalHandling."..tostring ( model ), getOriginalHandling ( model, true ), true, "deny" )
end
--initiateCFGLoader ( )
diff --git a/[gameplay]/hedit/server/logmanager.lua b/[gameplay]/hedit/server/logmanager.lua
index 43c3d1205..0dc6c988f 100644
--- a/[gameplay]/hedit/server/logmanager.lua
+++ b/[gameplay]/hedit/server/logmanager.lua
@@ -1,7 +1,7 @@
local vehicleLogs = {}
function loadHandlingLog ( )
- local data = getElementData ( root, "hedit:vehicleLogs" )
+ local data = getElementData ( root, "hedit:vehicleLogs" ) -- retrieve stashed vehicleLogs from root element data (if it exists)
if data then
vehicleLogs = data
@@ -12,7 +12,7 @@ end
function unloadHandlingLog ( )
- setElementData ( root, "hedit:vehicleLogs", vehicleLogs, false )
+ setElementData ( root, "hedit:vehicleLogs", vehicleLogs, false, "deny") -- stash vehicleLogs as root element data so it can be recovered on next start
return true
end
@@ -109,7 +109,7 @@ function uploadFullLog ( vehicle )
return false
end
- triggerClientEvent ( client, "receiveFullLog", client, getElementData(root,"hedit:vehicleLogs")[vehicle] )
+ triggerClientEvent ( client, "receiveFullLog", client, vehicleLogs[vehicle] )
return true
end
addEvent ( "requestFullLog", true )
diff --git a/[gameplay]/hedit/server/utils.lua b/[gameplay]/hedit/server/utils.lua
index 34ba5385e..64bd1cf92 100644
--- a/[gameplay]/hedit/server/utils.lua
+++ b/[gameplay]/hedit/server/utils.lua
@@ -123,9 +123,8 @@ function parseMetaSettings()
propertySettings[handlingProperty] = tobool(settingExists)
else
propertySettings[handlingProperty] = false
- print("Missing setting for "..handlingProperty..", defaulting to false.")
outputDebugString("Missing setting for "..handlingProperty..", defaulting to false.", 2)
end
end
- setElementData(resourceRoot, "propertySettings", propertySettings)
+ setElementData(resourceRoot, "hedit:propertySettings", propertySettings, true, "deny")
end
diff --git a/[gameplay]/hedit/shared/settings.lua b/[gameplay]/hedit/shared/settings.lua
index 20b5571d4..68b5ba975 100644
--- a/[gameplay]/hedit/shared/settings.lua
+++ b/[gameplay]/hedit/shared/settings.lua
@@ -1,4 +1,3 @@
DEBUGMODE = false
-MTAVER = 1.6
-HVER = "2.1.5"
+HVER = "2.1.6"
diff --git a/[gameplay]/hedit/shared/utils.lua b/[gameplay]/hedit/shared/utils.lua
index 0e3916933..4ef7516cf 100644
--- a/[gameplay]/hedit/shared/utils.lua
+++ b/[gameplay]/hedit/shared/utils.lua
@@ -136,7 +136,7 @@ end
--This function returns true if a setting is enabled in the meta, false otherwise.
function isHandlingPropertyEnabled(property)
if getLocalPlayer then
- return (getElementData(resourceRoot, "propertySettings", false)[property]) or true
+ return (getElementData(resourceRoot, "hedit:propertySettings", false)[property]) or true
else
return tobool(get("*enable_"..property))
end
@@ -330,7 +330,7 @@ function getHandlingPreviousValue ( vehicle, property )
return false
end
- return getElementData ( vehicle, "hedit:vehiclepreviousvalue."..property )
+ return getElementData ( vehicle, "hedit:vehiclepreviousvalue."..property, false )
end
@@ -344,7 +344,7 @@ function setVehicleSaved ( vehicle, saved )
return true
end
- setElementData ( vehicle, "hedit:saved", tostring ( saved ) )
+ setElementData ( vehicle, "hedit:saved", tostring ( saved ), true, "deny" )
local occupants = getVehicleOccupants ( vehicle )
local seats = getVehicleMaxPassengers ( vehicle )
@@ -370,8 +370,8 @@ function isVehicleSaved ( vehicle )
return false
end
- if not getElementData ( vehicle, "hedit:saved" ) then
- setElementData ( vehicle, "hedit:saved", "true" )
+ if not getElementData ( vehicle, "hedit:saved", false ) then
+ setElementData ( vehicle, "hedit:saved", "true", true, "deny" )
end
return tobool ( getElementData ( vehicle, "hedit:saved" ) )
diff --git a/[gameplay]/hedit/shared/wrappers/general.lua b/[gameplay]/hedit/shared/wrappers/general.lua
index d953bf89f..2fc657e31 100644
--- a/[gameplay]/hedit/shared/wrappers/general.lua
+++ b/[gameplay]/hedit/shared/wrappers/general.lua
@@ -11,10 +11,10 @@ end
_outputDebugString = outputDebugString
-function outputDebugString(...)
- if DEBUGMODE then
- return _outputDebugString(...)
- end
+function outputDebugString(string, level, r, g, b)
+ if not level then level = 3 end
+ if (not DEBUGMODE) and level >= 3 then return end
+ return _outputDebugString(string, level, r, g, b)
end
diff --git a/[gameplay]/hedit/shared/wrappers/handling.lua b/[gameplay]/hedit/shared/wrappers/handling.lua
index 6f5b57bec..ca0f82cdd 100644
--- a/[gameplay]/hedit/shared/wrappers/handling.lua
+++ b/[gameplay]/hedit/shared/wrappers/handling.lua
@@ -175,7 +175,7 @@ function setVehicleHandling ( vehicle, property, value, withLog )
end
- setElementData ( vehicle, "hedit:vehiclepreviousvalue."..property, oldValue )
+ setElementData ( vehicle, "hedit:vehiclepreviousvalue."..property, oldValue, true, "deny" )
triggerEvent ( "onVehicleHandlingChange", client, vehicle, property, oldValue, value )
@@ -197,7 +197,7 @@ function getOriginalHandling ( model, force )
return nil
end
- local data = getElementData ( root, "originalHandling."..tostring(model) )
+ local data = getElementData ( resourceRoot, "hedit:originalHandling."..tostring(model), false )
if not data or force then
data = conformHandlingTable ( _getOriginalHandling ( model ), model )
end