AC Aircraft - PBY


Adds the PBY5 Catalina, a very famous aircraft to Factorio. This particular version has been made to more closely match the style of the game. Capable of landing on water (thanks to a fast update by haih_ys) 4/13/2026 Looking for assistance in updating to 2.0, if interested please leave a comment in the discussions! 6/12/23 *Its completely feature functional now, just dont land on the land or youl be beached! 6/11/23 *new graphics! 6/9/23 *release

Content
3 years ago
1.1
647
Transportation

g Changes for AircraftRealism 2.0.0

1 year, 7 months ago

The API for AircraftRealism has changed to work with the new Factorio 2.0. Mainly, AircraftRealism no longer modifies the plane, you only tell it the grounded/airborne plane prototypes. You have the flexibility to change all the prototype values yourself.

Shadows are done differently now that should (hopefully) be easier for you. You create the sprites, and pass an array of sprite names to the API.

The current AircraftRealism 2.0.0 release is incomplete, I will add back the rest of the features (runway, collisions) in a newer version
Let me know if you need any help.

https://github.com/jaihysc/Factorio-AircraftRealism/blob/2.0.0/Docs/AddingNewPlanes.md

1 year, 7 months ago

Excellent, and thanks for the heads up!

2 months ago

Heya, I gave it an honest attempt but trying to update for 2.0 has my head spinning, the documentation is plenty good for those who know a thing or two about factorio modding but its been two years and my head was spinning trying to figure out what to do, i check other mods to see how they did it, and while I could sort of see how it was done, I couldn't find any patterns that stood out to me. If your willing to still help im all ears! but until then the mod is firmly stuck as it is.

a month ago
(updated a month ago)

Hi yes I can help with that. Here are your mod's file updated to 2.0

info.json, change minimum AircraftRealism version and factorio_version

{
    "name": "AC-Aircraft",
    "version": "1.2.3",
    "title": "AC Aircraft - PBY",
    "author": "AngryCeltic/Turretproblems",
    "dependencies": ["base >= 1.1.0", "AircraftRealism >= 2.0.0"],
    "description": "Adds the PBY5 Catalina, a very famous aircraft to Factorio. This particular version has been made to more closely match the style of the game.",
    "factorio_version": "2.0"
}

recipe.lua, expensive mode is gone, an icon is required

data:extend({
  {
    type = "recipe",
    name = "PBY5",
    enabled = false,
    energy_required = 5,
    ingredients =
    {
      {type = "item", name = "engine-unit",     amount = 28},
      {type = "item", name = "iron-plate",      amount = 10},
      {type = "item", name = "iron-gear-wheel", amount = 40},
    },
    results = {{type = "item", name = "PBY5", amount = 1}},
    icon = "__AC-Aircraft__/graphics/PBY5_icon.png"
  },
})

technology.lua, no space allowed in name property

data:extend({
  {
    type = "technology",
    name = "EarlySeaplanes",
    icon_size = 128, icon_mipmaps = 4,
    icon = "__AC-Aircraft__/graphics/PBY5_icon.png",
    effects =
    {
      { type = "unlock-recipe", recipe = "PBY5" },
    },
    prerequisites = {"automobilism"},
    unit =
    {
      count = 250,
      ingredients =
      {
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
      },
      time = 30
    },
    order = "e-c-c"
  },
})

entity.lua, modify collision_mask, add energy source
You can play around with the collision masks and make it burn fuel

    -- item = true, meltable = true, object = true, player = true, is_object = true, is_lower_object = true
    collision_mask = { layers = {object = true}},
    energy_source = {type = "void"},

Now to make it fly

-- data.updates.lua
local api = require("__AircraftRealism__.api")

local flyingPlane = table.deepcopy(data.raw.car["PBY5"])
flyingPlane.name = "PBY5-flying"
flyingPlane.collision_mask = { layers = {} }
-- Remove the shadow layer
flyingPlane.animation = { layers = {flyingPlane.animation.layers[1], flyingPlane.animation.layers[2]}}
data:extend{flyingPlane}

-- Create the shadows
spriteNames = {}
for i=0,63 do
    local fileIdx = math.floor(i / 8) + 1
    local yOffset = i % 8
    spriteNames[i + 1] = "PBY5-shadow-" .. tostring(i)
    local sprite = {
        type = "sprite",
        name = "PBY5-shadow-" .. tostring(i),
        filename = "__AC-Aircraft__/graphics/PBY5-shadow-" .. tostring(fileIdx) .. ".png",

        width = 1024,
        height = 1024,
        x = 0,
        y = yOffset * 1024,

        shift = util.by_pixel(20, -10/3),
        scale = 0.75
    }
    data:extend{sprite}
end

api.register_plane({
    grounded_name = "PBY5",
    airborne_name = "PBY5-flying",
    transition_speed_setting = "aircraft-transition-speed-PBY5",
    shadow_sprite = spriteNames,
    shadow_end_speed = 50 / 216 -- Animation ends 50 km/h after takeoff
})

settings.lua

data:extend({
    {
        type = "double-setting",
        name = "aircraft-transition-speed-PBY5",
        setting_type = "runtime-global",
        minimum_value = 10,
        default_value = 139,
    },
})
a month ago
(updated a month ago)

I don't get messages for Factorio, so if you have any more questions you can message me on Discord (same name haih_ys) and I'll reply to you faster

New response