Vehicle Equipment Grids

by Kryzeth

Adds equipment grids to vehicles in a sensible manner (no more exoskeleton legs in cars or trains or boats or planes), and adds a replacement vehicle specific speed booster equipment. Compatible with SE Space Trains, Fusion Trains, Flamethrower Wagon, Aircraft, AAI Vehicles, Cargo Ships, GunEquipment, Radar Equipment (and more!)

Tweaks
15 days ago
1.1 - 2.0
2.79K
Transportation Trains

i [Fixed] Hovercrafts "now have an equipment grid by default"

a month ago
(updated a month ago)

Greetings my friend in the mod Hovercrafts have problems for the archive mod-compatibility.lua

(sorry a few part is spanish)

Error al cargar el mod: kry-vehicle-grids/prototypes/mod-compatability.lua:182: attempt to index field 'hovercraft-grid'
stack traceback:
kry-vehicle-grids/prototypes/mod-compatability.lua:182: in main chunk
[C]: in function 'require'
kry-vehicle-grids/data.lua:8: in main chunk

because in the changelog by mod Hovercrafts

Version: 2.0.3
Date: 2024-11-22
Features:
- Hovercrafts now have logistics requests
- Hovercrafts now allow remote driving
- Hovercrafts now have an equipment grid by default
Bugfixes:
- Fixed crash when moving over uncharted chunks in remote view

because in the equipment.lua in mod hovercrafts

local hgridw, hgridh = string.match(settings.startup["hovercraft-grid-size"].value, "(%d+)x(%d+)")
log("grid-hovercraft = " .. tostring(settings.startup["hovercraft-grid-size"].value) .. " " .. tostring(hgridw) .. ", " .. tostring(hgridh))

data:extend({
{
type = "equipment-grid",
name = "hovercraft-equipment",
width = tonumber(hgridw) or 2,
height = tonumber(hgridh) or 2,
equipment_categories = {"armor"}
}
})

my suggestions check the compatibility hovercrafts the code mod-compatability.lua (apply in the test by chat gpt)

-- if mods["Hovercrafts"] and settings.startup["hovercraft-grid"].value then
if mods["Hovercrafts"] and settings.startup["hovercraft-grid-size"] then
-- Extract the grid size from the Hovercrafts mod's settings
local hgridw, hgridh = string.match(settings.startup["hovercraft-grid-size"].value, "(%d+)x(%d+)")
if hgridw and hgridh then
-- Define categories to integrate hovercraft equipment into the game
local categories = {"vehicle", "vehicle-with-storage", "vehicle-with-speed"}
changeEquipmentCategories("hovercraft-equipment", categories)

    -- Compatibility with Hovercraft entities
    if data.raw["car"]["ecraft-entity"] then
        changeEquipmentCategories("ecraft-equipment", categories)
    end
    if data.raw["car"]["mcraft-entity"] then
        changeEquipmentCategories("mcraft-equipment", categories)
    end
    if data.raw["car"]["lcraft-entity"] then
        changeEquipmentCategories("lcraft-equipment", categories)
    end
end

end

I hope use the result of the mod hovercrafts for this mod Vehicle Equipment Grids, thanks, by alanovich (alanovich2010), see ya ;-)

a month ago
(updated a month ago)

Nice attempt with chatgpt, but I don't think it understood what my mod was trying to do in that code block. I don't need the grid size values at all, I just needed to verify whether or not the grid existed.

Since the grid is enabled by default now, just means I can remove "and settings.startup["hovercraft-grid"].value" from the if statement, and of course, change the "hcraft-equipment" line to "hovercraft-equipment", as the new name. Don't know why the hovercrafts mod author didn't also change the names of the other equipment grids at the same time though, since those are still ecraft, mcraft, and lcraft respectively.

Anyways, fixed as of v2.0.10

a month ago

Thanks, hommie, I´m not expert of programming in the lua for mod-compatability.lua in your mod, but I´m happy with the players of the community of the factorio (worldwire, latam factorio, anyways of another languaje or regions) in the fix the problem, greetings mi amigo (my friend) :-)

New response