Lex's Aircraft

by lexsus

Your attention is presented to the futuristic VTOL aircraft that are well suited to the style of the game. The mod includes aircraft: transport, light combat, heavy combat.

Content
8 months ago
1.1 - 2.0
65.0K
Transportation Combat

g Error with K2

6 months ago

Failed to load mods: lex-aircraft/prototypes/k2items.lua:19: attempt to index field 'kr-more-realistic-weapon' (a nil value)
stack traceback:
lex-aircraft/prototypes/k2items.lua:19: in main chunk
[C]: in function 'require'
lex-aircraft/data-updates.lua:3: in main chunk

3 months ago

same here

3 months ago

Same here

2 months ago

The integration with k2 is very outdated. I gave up on renaming the equipment categories, and before that, there were settings, weapon names, and fuel subgroups.

29 days ago

Managed to (sorta?) fix this error and get the mod working with K2 and SE. Hanuryk got the right idea about renaming the outdated parts of the code. Here is the changes I made in the lua files:

data-updates:

if mods["Krastorio2"] then
require("prototypes.k2items")
data.raw["spider-vehicle"]["lex-flying-cargo"].energy_source.fuel_categories = { "kr-vehicle-fuel" }
data.raw["spider-vehicle"]["lex-flying-gunship"].energy_source.fuel_categories = { "kr-vehicle-fuel" }
data.raw["spider-vehicle"]["lex-flying-heavyship"].energy_source.fuel_categories = { "kr-vehicle-fuel" }
data.raw["equipment-grid"]["lex-flying-cargo-grid"].equipment_categories = {
"kr-vehicle",
"kr-vehicle-motor",
"kr-vehicle-roboport",
}
data.raw["equipment-grid"]["lex-flying-gunship-grid"].equipment_categories = {
"kr-vehicle",
"kr-vehicle-motor",
"kr-vehicle-roboport",
}
data.raw["equipment-grid"]["lex-flying-heavyship-grid"].equipment_categories = {
"kr-vehicle",
"kr-vehicle-motor",
"kr-vehicle-roboport",
}
data.raw["equipment-grid"]["lex-flying-heavyship-grid"].equipment_categories = {
"kr-vehicle",
"kr-vehicle-motor",
"kr-vehicle-roboport",
}
table.insert(data.raw["spider-vehicle"]["lex-flying-heavyship"].guns, "rocket-launcher")
if settings.startup["kr-realistic-weapons"].value then
table.insert(data.raw["spider-vehicle"]["lex-flying-heavyship"].guns, "lex-advanced-machine-gun")

k2items.lua:

if mods["Krastorio2"] and settings.startup["kr-realistic-weapons"].value then
data:extend({
{
type = "gun",
name = "lex-advanced-machine-gun",
icon = "Krastorio2Assets/icons/guns/advanced-tank-machine-gun.png",
icon_size = 64,
hidden = true,
subgroup = "gun",
order = "z[tank]-a[advanced-tank-machine-gun]",
attack_parameters = {
type = "projectile",
ammo_category = "kr-anti-materiel-rifle-ammo",

12 days ago
(updated 12 days ago)

You have to update data-updates.lua entire first if statement to

if mods["Krastorio2"] then
require("prototypes.k2items")
data.raw["spider-vehicle"]["lex-flying-cargo"].energy_source.fuel_categories = { "kr-vehicle-fuel" }
data.raw["spider-vehicle"]["lex-flying-gunship"].energy_source.fuel_categories = { "kr-vehicle-fuel" }
data.raw["spider-vehicle"]["lex-flying-heavyship"].energy_source.fuel_categories = { "kr-vehicle-fuel" }
data.raw["equipment-grid"]["lex-flying-cargo-grid"].equipment_categories = {
"kr-vehicle",
"kr-vehicle-motor",
"kr-vehicle-roboport",
}
data.raw["equipment-grid"]["lex-flying-gunship-grid"].equipment_categories = {
"kr-vehicle",
"kr-vehicle-motor",
"kr-vehicle-roboport",
}
data.raw["equipment-grid"]["lex-flying-heavyship-grid"].equipment_categories = {
"kr-vehicle",
"kr-vehicle-motor",
"kr-vehicle-roboport",
}
data.raw["equipment-grid"]["lex-flying-heavyship-grid"].equipment_categories = {
"kr-vehicle",
"kr-vehicle-motor",
"kr-vehicle-roboport",
}
table.insert(data.raw["spider-vehicle"]["lex-flying-heavyship"].guns, "rocket-launcher")
if settings.startup["kr-realistic-weapons"].value then
table.insert(data.raw["spider-vehicle"]["lex-flying-heavyship"].guns, "lex-advanced-machine-gun")
end
else
data.raw["ammo"]["cannon-shell"].ammo_type.action.action_delivery.max_range = 50
data.raw["ammo"]["explosive-cannon-shell"].ammo_type.action.action_delivery.max_range = 50
data.raw["ammo"]["uranium-cannon-shell"].ammo_type.action.action_delivery.max_range = 50
data.raw["ammo"]["explosive-uranium-cannon-shell"].ammo_type.action.action_delivery.max_range = 50
end

and correct k2items.lua. The error with realistic weapons is referencing wrong setting name. It is not kr-more-realistic-weapons but kr-realistic-weapons. In this same file, you need to correct the filepath to the karastorio 2 asset advanced-tank-machine-gun.png. The filepath should look like Krastorio2Assets/icons/guns/advanced-tank-machine-gun.png

edit: since it is formatting the filepath instead of showing the string, the Krastorio2Assets should have a double _ both in front of and after it.

12 days ago

I uploaded it due to the convoluted info there. I do not claim it as my mod, just a fix until lex gets back at it.
https://mods.factorio.com/mod/lex-aircraft-fixed

New response