Skip to content

Instantly share code, notes, and snippets.

@tony0x59
Last active December 31, 2022 10:10
Show Gist options
  • Select an option

  • Save tony0x59/cb32df6a91477f5f19e0253af16287f5 to your computer and use it in GitHub Desktop.

Select an option

Save tony0x59/cb32df6a91477f5f19e0253af16287f5 to your computer and use it in GitHub Desktop.

Revisions

  1. tony0x59 revised this gist Dec 31, 2022. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions AGROZones.lua
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,10 @@ function doAgroMapZones()
    --do nothing, remove this
    end

    function doAquaMapZones()
    function doAgrotsarMapZones()
    -- print("doAgroMapZones")
    local file = 'media/mapszones/Muldraugh, KY/aquazones.lua'
    if fileExists(file) then
    local file = 'media/mapszones/Muldraugh, KY/agrozones.lua'
    if fileExists(file) then
    -- print("doAgroMapZones fileExists")
    agrozones = {}
    reloadLuaFile(file)
    @@ -40,6 +40,5 @@ function doAquaMapZones()
    end
    getWorld():checkVehiclesZones();
    end

    Events.OnLoadMapZones.Remove(doAgroMapZones);
    Events.OnLoadMapZones.Add(doAquaMapZones);
    Events.OnLoadMapZones.Add(doAgrotsarMapZones);
  2. tony0x59 revised this gist Dec 11, 2022. No changes.
  3. tony0x59 revised this gist Dec 11, 2022. No changes.
  4. tony0x59 created this gist Dec 11, 2022.
    45 changes: 45 additions & 0 deletions AGROZones.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    function doAgroMapZones()
    --do nothing, remove this
    end

    function doAquaMapZones()
    -- print("doAgroMapZones")
    local file = 'media/mapszones/Muldraugh, KY/aquazones.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(doAquaMapZones);