From 8ef019d9660d30f1f9efaccfe21964e192996c7c Mon Sep 17 00:00:00 2001 From: Johnny Cai Date: Sat, 25 Jan 2025 12:20:34 -0500 Subject: [PATCH] Release 2.0.3 Hide plane data fish from factoripedia Fix crash on takeoff/landing if there is ghost in equipment grid Fix equipment grid gui not remaining open between takeoff/landing --- changelog.txt | 7 +++++++ info.json | 2 +- logic/planeController.lua | 29 ++++++++++++++++++++--------- logic/utility.lua | 1 + 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/changelog.txt b/changelog.txt index d6736b5..7736839 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,11 @@ --------------------------------------------------------------------------------------------------- +Version: 2.0.3 +Date: 2025-01-25 + Changes: + - Hide internal data in factoriopedia + - Fix crash if plane equipment grid has ghost equipment + - Fix equipment grid GUI not remaining opened between takeoff/landing +--------------------------------------------------------------------------------------------------- Version: 2.0.2 Date: 2024-12-10 Changes: diff --git a/info.json b/info.json index 8a6b91b..d7099f9 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "AircraftRealism", - "version": "2.0.2", + "version": "2.0.3", "title": "Aircraft Realism", "author": "haih_ys", "homepage": "https://github.com/jaihysc/Factorio-AircraftRealism", diff --git a/logic/planeController.lua b/logic/planeController.lua index 23bdad5..51708b3 100644 --- a/logic/planeController.lua +++ b/logic/planeController.lua @@ -85,11 +85,10 @@ local function copyOpened(oldPlane, newPlane, occupant) assert(oldPlane) assert(newPlane) if occupant and occupant.opened then - -- It appears .opened is bugged in Factorio 2.0.15, only works for the plane GUI, not equipment guid - if occupant.opened == oldPlane then - occupant.opened = newPlane - elseif occupant.opened == oldPlane.grid then + if occupant.opened_gui_type == defines.gui_type.opened_entity_grid then occupant.opened = newPlane.grid + else + occupant.opened = newPlane end end end @@ -173,11 +172,23 @@ local function transitionPlane(oldPlane, newPlane) newPlane.grid.inhibit_movement_bonus = oldPlane.grid.inhibit_movement_bonus for index,item in pairs(oldPlane.grid.equipment) do - local addedEquipment = newPlane.grid.put{ - name = item.name, - quality = item.quality, - position = item.position - } + local isGhost = item.name == "equipment-ghost" + local addedEquipment = nil + if isGhost then + addedEquipment = newPlane.grid.put{ + name = item.ghost_name, + quality = item.quality, + position = item.position, + ghost = true + } + else + addedEquipment = newPlane.grid.put{ + name = item.name, + quality = item.quality, + position = item.position, + ghost = false + } + end assert(addedEquipment, "Could not insert old plane equipment into new plane. Check plane prototypes") -- We must check for non zero, otherwise attempting to set for item which diff --git a/logic/utility.lua b/logic/utility.lua index 52986da..28b05e0 100644 --- a/logic/utility.lua +++ b/logic/utility.lua @@ -202,6 +202,7 @@ local function savePlaneData(planeData) name=PDH_NAME_PREFIX .. tostring(prototypeIdx), type=PDH_PROTOTYPE, order="", + hidden=true }} planeDataHolder = data.raw[PDH_PROTOTYPE][PDH_NAME_PREFIX .. tostring(prototypeIdx)] assert(planeDataHolder)