Skip to content

Commit

Permalink
Release 2.0.3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jaihysc committed Jan 25, 2025
1 parent 9aac28b commit 8ef019d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
29 changes: 20 additions & 9 deletions logic/planeController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions logic/utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8ef019d

Please sign in to comment.