From 157ffeab7c258ef82cc9d76cbee23f2fb240f440 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Thu, 14 May 2026 20:26:44 +0300 Subject: [PATCH] bugfix for not garrisonning transport ships moved resource deposits on the river map bugfix for not rendering the minimap after opening the console --- Assets/Models/Maps/river/river.lua | 10 +++++----- Assets/Scripts/Core/main.lua | 2 -- Assets/Scripts/Core/player.lua | 7 +++++++ Assets/Scripts/Core/playerInit.lua | 19 +++++++++++++++++-- Assets/Scripts/Gui/_minimap.lua | 2 ++ gameManager.cpp | 2 ++ player.cpp | 2 +- vehicle.cpp | 2 +- 8 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 Assets/Scripts/Gui/_minimap.lua diff --git a/Assets/Models/Maps/river/river.lua b/Assets/Models/Maps/river/river.lua index 342e4a3..63d3e9a 100644 --- a/Assets/Models/Maps/river/river.lua +++ b/Assets/Models/Maps/river/river.lua @@ -6,7 +6,7 @@ metadata = { impassibleNodeValue = 65535, spawnPoints = { {x = -396.000000, y = 0.000000, z = -374.000000}, - {x = 300.000000, y = 0.000000, z = 400.000000}, + {x = 470.000000, y = 0.000000, z = 440.000000}, --{x = -326.000000, y = 0.000000, z = 374.000000}, }, choosablePlayers = { @@ -20,10 +20,10 @@ metadata = { }, civilianPlayer = { resourceDeposits = { - {id = 0, pos = {x = 450.000000, y = 0.000000, z = 450.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, - {id = 0, pos = {x = 450.000000, y = 0.000000, z = 430.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, - {id = 0, pos = {x = 450.000000, y = 0.000000, z = 410.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, - {id = 0, pos = {x = 450.000000, y = 0.000000, z = 390.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, + {id = 0, pos = {x = 220.000000, y = 0.000000, z = 450.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, + {id = 0, pos = {x = 220.000000, y = 0.000000, z = 430.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, + {id = 0, pos = {x = 220.000000, y = 0.000000, z = 410.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, + {id = 0, pos = {x = 220.000000, y = 0.000000, z = 390.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, {id = 0, pos = {x = -450.000000, y = 0.000000, z = -450.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, {id = 0, pos = {x = -450.000000, y = 0.000000, z = -430.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, {id = 0, pos = {x = -450.000000, y = 0.000000, z = -410.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000}, diff --git a/Assets/Scripts/Core/main.lua b/Assets/Scripts/Core/main.lua index 7192bf6..3c1fdea 100644 --- a/Assets/Scripts/Core/main.lua +++ b/Assets/Scripts/Core/main.lua @@ -1,6 +1,4 @@ game = {cpuPlayers = {}} -_minimapPos = {x = 0, y = 0} -_minimapSize = {x = 0, y = 0} GameObjectFrameStatus = { PLACEABLE = 0, BLOCKED_BY_FOG_OF_WAR = 1, diff --git a/Assets/Scripts/Core/player.lua b/Assets/Scripts/Core/player.lua index 2c6f1e5..ae5af93 100644 --- a/Assets/Scripts/Core/player.lua +++ b/Assets/Scripts/Core/player.lua @@ -395,6 +395,13 @@ end function Player:buildExtractors(arguments) extractors = self:getUnitsByClass(UnitClass.EXTRACTOR, -1) + + if arguments and arguments.numWaitExtractors and #extractors >= arguments.numWaitExtractors then + for i = 1, arguments.numWaitExtractors do + if not extractors[i]:toStructure():isComplete() then return BTNodeResult.RUNNING end + end + end + visibleDeposits = self:getVisibleDeposits() depId = nil diff --git a/Assets/Scripts/Core/playerInit.lua b/Assets/Scripts/Core/playerInit.lua index e43e9dd..5bc28b7 100644 --- a/Assets/Scripts/Core/playerInit.lua +++ b/Assets/Scripts/Core/playerInit.lua @@ -21,20 +21,35 @@ for i = 1, #game.cpuPlayers do { type = BTNodeType.SEQUENCE, children = { - {type = BTNodeType.FUNCTION, func = player.buildExtractors}, { type = BTNodeType.FUNCTION, func = player.buildTaskForces, args = { factoryClass = UnitClass.LAND_FACTORY, - taskForceData = {{class = UnitClass.RESOURCE_ROVER, numUnits = 4}} + taskForceData = {{class = UnitClass.RESOURCE_ROVER, numUnits = 1}} } }, + {type = BTNodeType.FUNCTION, func = player.buildExtractors, args = {numWaitExtractors = 1}}, } } } }, {type = BTNodeType.FUNCTION, func = player.startHarvesting}, + { + type = BTNodeType.PARALLEL, + children = { + {type = BTNodeType.FUNCTION, func = player.buildExtractors}, + { + type = BTNodeType.FUNCTION, + func = player.buildTaskForces, + args = { + factoryClass = UnitClass.LAND_FACTORY, + taskForceData = {{class = UnitClass.RESOURCE_ROVER, numUnits = 3}} + } + }, + } + }, + {type = BTNodeType.FUNCTION, func = player.startHarvesting}, { type = BTNodeType.SELECTOR, children = { diff --git a/Assets/Scripts/Gui/_minimap.lua b/Assets/Scripts/Gui/_minimap.lua new file mode 100644 index 0000000..893ae94 --- /dev/null +++ b/Assets/Scripts/Gui/_minimap.lua @@ -0,0 +1,2 @@ +_minimapPos = {x = 0, y = 0} +_minimapSize = {x = 0, y = 0} diff --git a/gameManager.cpp b/gameManager.cpp index 1193e23..297385e 100755 --- a/gameManager.cpp +++ b/gameManager.cpp @@ -260,6 +260,8 @@ namespace battleship{ for(string f : configData::scripts) SOL_LUA_STATE.script_file(path + f); + SOL_LUA_STATE.script_file(path + "Scripts/Gui/_minimap.lua"); + sol::table resTable = SOL_LUA_STATE["graphics"]["resolution"]; width = resTable["x"]; height = resTable["y"]; diff --git a/player.cpp b/player.cpp index 9419068..5f76d91 100755 --- a/player.cpp +++ b/player.cpp @@ -26,7 +26,7 @@ namespace battleship{ name("pl"), trader(new Trader()) { - resources[0] = 5000; + resources[0] = 10000; colorMaterial = new Material(Root::getSingleton()->getLibPath() + "texture"); colorMaterial->addBoolUniform("lightingEnabled", false); diff --git a/vehicle.cpp b/vehicle.cpp index d51aa77..9e163dd 100644 --- a/vehicle.cpp +++ b/vehicle.cpp @@ -345,7 +345,7 @@ namespace battleship{ bool buildOrder = (order.type == Order::TYPE::BUILD); bool resourceOrder = (order.type == Order::TYPE::LOAD || order.type == Order::TYPE::UNLOAD || order.type == Order::TYPE::SUPPLY); - if(blockingUnit && blockingUnit != this && !resourceOrder && !buildOrder && (!garrisonOrder || (garrisonOrder && blockingUnit != (Unit*)targObj))){ + if(blockingUnit && blockingUnit != this && !resourceOrder && !buildOrder && !garrisonOrder){ vector surrCellIds = map->getSurroundingCells(cells[dest].pos, 1); int altDest = -1;