From c46fb6c33d243b2195fa51962abb50923ad5fea2 Mon Sep 17 00:00:00 2001 From: Starystars67 Date: Tue, 21 Sep 2021 18:07:13 +0100 Subject: [PATCH] Fix mapping coords + minor edit for when reloading lua + adjust wording for power type. --- levels/west_coast_usa/fuelstations.json | 66 ++++++++++++------------- lua/ge/extensions/fuelStations.lua | 17 +++++-- 2 files changed, 47 insertions(+), 36 deletions(-) diff --git a/levels/west_coast_usa/fuelstations.json b/levels/west_coast_usa/fuelstations.json index cd8e69d..ad1af03 100644 --- a/levels/west_coast_usa/fuelstations.json +++ b/levels/west_coast_usa/fuelstations.json @@ -1,35 +1,35 @@ [ - { "location": [ -480.495, 134.616, 102.21 ], "type":"any"}, - { "location": [ -476.888, 133.500, 102.21 ], "type":"any"}, - { "location": [ -478.933, 126.744, 102.21 ], "type":"any"}, - { "location": [ -482.540, 127.860, 102.21 ], "type":"any"}, - { "location": [ -490.042, 130.875, 102.21 ], "type":"any"}, - { "location": [ -487.997, 137.631, 102.21 ], "type":"any"}, - { "location": [ -484.390, 136.515, 102.21 ], "type":"any"}, - { "location": [ -486.435, 129.759, 102.21 ], "type":"any"}, - { "location": [ -492.171, 138.235, 102.21 ], "type":"any"}, - { "location": [ -495.778, 139.350, 102.21 ], "type":"any"}, - { "location": [ -497.824, 132.595, 102.21 ], "type":"any"}, - { "location": [ -494.217, 131.479, 102.21 ], "type":"any"}, - { "location": [ -800.910, 861.350, 76.800 ], "type":"any"}, - { "location": [ -794.050, 852.340, 76.800 ], "type":"any"}, - { "location": [ -800.636, 852.330, 76.800 ], "type":"any"}, - { "location": [ -794.050, 848.565, 76.800 ], "type":"any"}, - { "location": [ -800.582, 848.555, 76.800 ], "type":"any"}, - { "location": [ -800.856, 857.575, 76.800 ], "type":"any"}, - { "location": [ -793.745, 861.358, 76.800 ], "type":"any"}, - { "location": [ -793.691, 857.583, 76.800 ], "type":"any"}, - { "location": [ -193.984, 522.874, 76.830 ], "type":"any"}, - { "location": [ -183.978, 516.118, 76.830 ], "type":"any"}, - { "location": [ -180.021, 522.874, 76.830 ], "type":"any"}, - { "location": [ -180.021, 516.118, 76.830 ], "type":"any"}, - { "location": [ -200.020, 516.517, 76.830 ], "type":"any"}, - { "location": [ -183.978, 522.874, 76.830 ], "type":"any"}, - { "location": [ -203.978, 516.517, 76.830 ], "type":"any"}, - { "location": [ -200.020, 522.781, 76.830 ], "type":"any"}, - { "location": [ -203.978, 522.781, 76.830 ], "type":"any"}, - { "location": [ -190.027, 522.874, 76.830 ], "type":"any"}, - { "location": [ -190.019, 515.983, 76.830 ], "type":"any"}, - { "location": [ -193.976, 515.983, 76.830 ], "type":"any"}, - { "location": [ 417.285, -229.916, 147.06 ], "type":"any"} + { "location": [ -480.495, 134.616, 100.21 ], "type":"any"}, + { "location": [ -476.888, 133.500, 100.21 ], "type":"any"}, + { "location": [ -478.933, 126.744, 100.21 ], "type":"any"}, + { "location": [ -482.540, 127.860, 100.21 ], "type":"any"}, + { "location": [ -490.042, 130.875, 100.21 ], "type":"any"}, + { "location": [ -487.997, 137.631, 100.21 ], "type":"any"}, + { "location": [ -484.390, 136.515, 100.21 ], "type":"any"}, + { "location": [ -486.435, 129.759, 100.21 ], "type":"any"}, + { "location": [ -492.171, 138.235, 100.21 ], "type":"any"}, + { "location": [ -495.778, 139.350, 100.21 ], "type":"any"}, + { "location": [ -497.824, 132.595, 100.21 ], "type":"any"}, + { "location": [ -494.217, 131.479, 100.21 ], "type":"any"}, + { "location": [ -800.910, 861.350, 74.800 ], "type":"any"}, + { "location": [ -794.050, 852.340, 74.800 ], "type":"any"}, + { "location": [ -800.636, 852.330, 74.800 ], "type":"any"}, + { "location": [ -794.050, 848.565, 74.800 ], "type":"any"}, + { "location": [ -800.582, 848.555, 74.800 ], "type":"any"}, + { "location": [ -800.856, 857.575, 74.800 ], "type":"any"}, + { "location": [ -793.745, 861.358, 74.800 ], "type":"any"}, + { "location": [ -793.691, 857.583, 74.800 ], "type":"any"}, + { "location": [ -193.984, 522.874, 74.800 ], "type":"any"}, + { "location": [ -183.978, 516.118, 74.800 ], "type":"any"}, + { "location": [ -180.021, 522.874, 74.800 ], "type":"any"}, + { "location": [ -180.021, 516.118, 74.800 ], "type":"any"}, + { "location": [ -200.020, 516.517, 74.800 ], "type":"any"}, + { "location": [ -183.978, 522.874, 74.800 ], "type":"any"}, + { "location": [ -203.978, 516.517, 74.800 ], "type":"any"}, + { "location": [ -200.020, 522.781, 74.800 ], "type":"any"}, + { "location": [ -203.978, 522.781, 74.800 ], "type":"any"}, + { "location": [ -190.027, 522.874, 74.800 ], "type":"any"}, + { "location": [ -190.019, 515.983, 74.800 ], "type":"any"}, + { "location": [ -193.976, 515.983, 74.800 ], "type":"any"}, + { "location": [ 417.285, -229.916, 145.06 ], "type":"any"} ] diff --git a/lua/ge/extensions/fuelStations.lua b/lua/ge/extensions/fuelStations.lua index 775f9eb..3818ad0 100644 --- a/lua/ge/extensions/fuelStations.lua +++ b/lua/ge/extensions/fuelStations.lua @@ -19,12 +19,14 @@ local function loadMapStations(infopath) stations = jsonReadFile(maproot .. "fuelstations.json") + log('I','[FuelStations]', "Refuel Points Loaded") + return stations ~= nil end local function onClientPostStartMission(infopath) if loadMapStations(infopath) then - log('I','[FuelStations]', "Loaded stations") + log('I','[FuelStations]', "Stations loaded.") else log('I','[FuelStations]', "Could not load stations for map "..infopath) end @@ -54,7 +56,10 @@ local function onUpdate() debugDrawer:drawCylinder(pos, topPos:toPoint3F(), 0.05, ColorF(1,0.2,0.2,0.7)) --bottom, top, radius, color end - if not stations then return end + if not stations then + loadMapStations() + return + end local activeVeh = be:getPlayerVehicle(0) local activeFuelType = "any" @@ -101,7 +106,13 @@ local function onUpdate() end if canRefill then - ui_message("Hold E To Refuel", 1, "fuelStations") + if activeFuelType == "gas" then + ui_message("Hold E To Refuel", 1, "fuelStations") + elseif activeFuelType == "ev" then + ui_message("Hold E To Recharge", 1, "fuelStations") + else + ui_message("Hold E To Refuel/Recharge", 1, "fuelStations") + end if ePressed then addFuel() end