Skip to content

Instantly share code, notes, and snippets.

@tony0x59
Last active December 31, 2022 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tony0x59/cb32df6a91477f5f19e0253af16287f5 to your computer and use it in GitHub Desktop.
Save tony0x59/cb32df6a91477f5f19e0253af16287f5 to your computer and use it in GitHub Desktop.
No More Zone Checks mod add Agrotsar support
function doAgroMapZones()
--do nothing, remove this
end
function doAgrotsarMapZones()
-- print("doAgroMapZones")
local file = 'media/mapszones/Muldraugh, KY/agrozones.lua'
if fileExists(file) then
-- print("doAgroMapZones fileExists")
agrozones = {}
reloadLuaFile(file)
for k,v in ipairs(agrozones) do
if v.type == "Mannequin" then
handleMannequinZone(file, v)
elseif v.type == "SpawnOrigin" then
handleSpawnOrigin(file, v)
elseif v.type == "WaterFlow" then
handleWaterFlow(file, v)
elseif v.type == "WaterZone" then
handleWaterZone(file, v)
elseif v.geometry ~= nil then
if tonumber(v.lineWidth) then
v.properties = v.properties or {}
v.properties.LineWidth = v.lineWidth
end
getWorld():getMetaGrid():registerGeometryZone(v.name, v.type, v.z, v.geometry, v.points, v.properties)
else
local vzone = getWorld():registerVehiclesZone(v.name, v.type, v.x, v.y, v.z, v.width, v.height, v.properties)
-- print("doAgroMapZones vzone")
-- print(vzone)
if vzone == nil then
getWorld():registerZone(v.name, v.type, v.x, v.y, v.z, v.width, v.height)
end
end
table.wipe(v)
end
table.wipe(agrozones)
else
print('can\'t find map agrozones file: '..file)
end
getWorld():checkVehiclesZones();
end
Events.OnLoadMapZones.Remove(doAgroMapZones);
Events.OnLoadMapZones.Add(doAgrotsarMapZones);
@tony0x59
Copy link
Author

tony0x59 commented Dec 11, 2022

  1. origin mod link, subscribe it:
    https://steamcommunity.com/sharedfiles/filedetails/?id=2847449198

  2. add this file to workshop mod path: E:\SteamLibrary\steamapps\workshop\content\108600\2847449198\mods\NoMoreZoneChecks\media\lua\server\metazones\AGROZones.lua

  3. mod load order:
    ...
    Tsarzones(Tsar's Common Library),
    Aquazones(Aquatsar Yacht Club),
    Agrozones(Argotsar Farming Company),
    No More Zone Checks,
    ...

@TLengert
Copy link

TLengert commented Dec 29, 2022

Correct me if I'm wrong but I believe it should be:

function doAgroMapZones()
	--do nothing, remove this
end

function doAgrotsarMapZones()
-- print("doAgroMapZones")
        local file = 'media/mapszones/Muldraugh, KY/agrozones.lua'
        if fileExists(file) then
		-- print("doAgroMapZones fileExists")
		agrozones = {}
		reloadLuaFile(file)
		for k,v in ipairs(agrozones) do
			if v.type == "Mannequin" then
				handleMannequinZone(file, v)
			elseif v.type == "SpawnOrigin" then
				handleSpawnOrigin(file, v)
			elseif v.type == "WaterFlow" then
				handleWaterFlow(file, v)
			elseif v.type == "WaterZone" then
				handleWaterZone(file, v)
			elseif v.geometry ~= nil then
				if tonumber(v.lineWidth) then
					v.properties = v.properties or {}
					v.properties.LineWidth = v.lineWidth
				end
				getWorld():getMetaGrid():registerGeometryZone(v.name, v.type, v.z, v.geometry, v.points, v.properties)
			else
				local vzone = getWorld():registerVehiclesZone(v.name, v.type, v.x, v.y, v.z, v.width, v.height, v.properties)
				-- print("doAgroMapZones vzone")
				-- print(vzone)
				if vzone == nil then
					getWorld():registerZone(v.name, v.type, v.x, v.y, v.z, v.width, v.height)
				end
			end
			table.wipe(v)
		end
		table.wipe(agrozones)
	else
		print('can\'t find map agrozones file: '..file)
	end
	getWorld():checkVehiclesZones();
end
Events.OnLoadMapZones.Remove(doAgroMapZones);
Events.OnLoadMapZones.Add(doAgrotsarMapZones);

@tony0x59
Copy link
Author

Correct me if I'm wrong but I believe it should be:

function doAgroMapZones()
	--do nothing, remove this
end

function doAgrotsarMapZones()
-- print("doAgroMapZones")
        local file = 'media/mapszones/Muldraugh, KY/agrozones.lua'
        if fileExists(file) then
		-- print("doAgroMapZones fileExists")
		agrozones = {}
		reloadLuaFile(file)
		for k,v in ipairs(agrozones) do
			if v.type == "Mannequin" then
				handleMannequinZone(file, v)
			elseif v.type == "SpawnOrigin" then
				handleSpawnOrigin(file, v)
			elseif v.type == "WaterFlow" then
				handleWaterFlow(file, v)
			elseif v.type == "WaterZone" then
				handleWaterZone(file, v)
			elseif v.geometry ~= nil then
				if tonumber(v.lineWidth) then
					v.properties = v.properties or {}
					v.properties.LineWidth = v.lineWidth
				end
				getWorld():getMetaGrid():registerGeometryZone(v.name, v.type, v.z, v.geometry, v.points, v.properties)
			else
				local vzone = getWorld():registerVehiclesZone(v.name, v.type, v.x, v.y, v.z, v.width, v.height, v.properties)
				-- print("doAgroMapZones vzone")
				-- print(vzone)
				if vzone == nil then
					getWorld():registerZone(v.name, v.type, v.x, v.y, v.z, v.width, v.height)
				end
			end
			table.wipe(v)
		end
		table.wipe(agrozones)
	else
		print('can\'t find map agrozones file: '..file)
	end
	getWorld():checkVehiclesZones();
end
Events.OnLoadMapZones.Remove(doAgroMapZones);
Events.OnLoadMapZones.Add(doAgrotsarMapZones);

yes, you are right, thank you fix it!
code updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment