Baseless/data-final-fixes.lua

201 lines
6.2 KiB
Lua
Raw Normal View History

2024-09-15 07:45:35 +00:00
fmsl.log.color = true
2024-09-15 07:45:35 +00:00
baseless = require("baseless._baseless")
require("prototypes._prototype")(baseless)
-- Required by name
baseless.needs("map-settings", "map-settings")
baseless.needs("recipe-category", "crafting")
baseless.needs("resource-category", "basic-solid")
baseless.needs("item-subgroup", "other")
baseless.needs("item-subgroup", "fluid")
baseless.needs("trigger-target-type", "ground-unit")
baseless.needs("equipment-grid", "small-equipment-grid")
baseless.needs("item", "copper-cable")
baseless.needs("item", "red-wire")
baseless.needs("item", "green-wire")
baseless.needs("virtual-signal", "signal-everything")
baseless.needs("virtual-signal", "signal-anything")
baseless.needs("virtual-signal", "signal-each")
baseless.needs("damage-type", "physical")
baseless.needs("damage-type", "impact")
baseless.needs("trivial-smoke", "smoke-building")
-- Required by type
baseless.needs("ammo")
baseless.needs("armor")
baseless.needs("blueprint")
baseless.needs("blueprint-book")
baseless.needs("capsule")
baseless.needs("copy-paste-tool")
baseless.needs("deconstruction-item")
baseless.needs("item-with-entity-data")
baseless.needs("item-with-inventory")
baseless.needs("item-with-label")
baseless.needs("item-with-tags")
baseless.needs("module")
baseless.needs("rail-planner")
baseless.needs("repair-tool")
baseless.needs("selection-tool")
baseless.needs("spidertron-remote")
baseless.needs("tool")
baseless.needs("upgrade-item")
baseless.needs("accumulator")
baseless.needs("ammo-turret")
baseless.needs("arithmetic-combinator")
baseless.needs("arrow")
baseless.needs("artillery-flare")
baseless.needs("artillery-projectile")
baseless.needs("artillery-turret")
baseless.needs("artillery-wagon")
baseless.needs("assembling-machine")
baseless.needs("beacon")
baseless.needs("beam")
baseless.needs("boiler")
baseless.needs("burner-generator")
baseless.needs("car")
baseless.needs("cargo-wagon")
baseless.needs("character")
baseless.needs("character-corpse")
baseless.needs("cliff")
baseless.needs("combat-robot")
baseless.needs("constant-combinator")
baseless.needs("construction-robot")
baseless.needs("container")
baseless.needs("corpse")
baseless.needs("decider-combinator")
baseless.needs("deconstructible-tile-proxy")
baseless.needs("electric-energy-interface")
baseless.needs("electric-pole")
baseless.needs("electric-turret")
baseless.needs("entity-ghost")
baseless.needs("explosion")
baseless.needs("fire")
baseless.needs("fish")
baseless.needs("flame-thrower-explosion")
baseless.needs("fluid-turret")
baseless.needs("fluid-wagon")
baseless.needs("furnace")
baseless.needs("gate")
baseless.needs("generator")
baseless.needs("heat-interface")
baseless.needs("heat-pipe")
baseless.needs("highlight-box")
baseless.needs("infinity-container")
baseless.needs("infinity-pipe")
baseless.needs("inserter")
baseless.needs("item-entity")
baseless.needs("item-request-proxy")
baseless.needs("lab")
baseless.needs("lamp")
baseless.needs("land-mine")
baseless.needs("linked-belt")
baseless.needs("linked-container")
baseless.needs("loader")
baseless.needs("loader-1x1")
baseless.needs("locomotive")
baseless.needs("logistic-container")
baseless.needs("logistic-robot")
baseless.needs("market")
baseless.needs("mining-drill")
baseless.needs("offshore-pump")
baseless.needs("particle-source")
baseless.needs("pipe")
baseless.needs("pipe-to-ground")
baseless.needs("player-port")
baseless.needs("power-switch")
baseless.needs("programmable-speaker")
baseless.needs("projectile")
baseless.needs("pump")
baseless.needs("radar")
baseless.needs("rail-chain-signal")
baseless.needs("rail-remnants")
baseless.needs("rail-signal")
baseless.needs("reactor")
baseless.needs("resource")
baseless.needs("roboport")
baseless.needs("rocket-silo")
baseless.needs("rocket-silo-rocket-shadow")
baseless.needs("simple-entity")
baseless.needs("simple-entity-with-force")
baseless.needs("simple-entity-with-owner")
baseless.needs("smoke-with-trigger")
baseless.needs("solar-panel")
baseless.needs("speech-bubble")
baseless.needs("spider-vehicle")
baseless.needs("splitter")
baseless.needs("sticker")
baseless.needs("storage-tank")
baseless.needs("stream")
baseless.needs("tile-ghost")
baseless.needs("train-stop")
baseless.needs("transport-belt")
baseless.needs("tree")
baseless.needs("turret")
baseless.needs("underground-belt")
baseless.needs("unit-spawner")
baseless.needs("wall")
baseless.needs("active-defense-equipment")
baseless.needs("battery-equipment")
baseless.needs("belt-immunity-equipment")
baseless.needs("energy-shield-equipment")
baseless.needs("generator-equipment")
baseless.needs("movement-bonus-equipment")
baseless.needs("night-vision-equipment")
baseless.needs("roboport-equipment")
baseless.needs("solar-panel-equipment")
-- Deprecated prototypes
baseless.needs("mining-tool", "dummy-steel-axe")
baseless.needs("leaf-particle", "leaf-particle-for-migration")
baseless.needs("particle", "particle-for-migration")
baseless.needs("smoke", "smoke-for-migration")
local AddedCount = 0
local AttemptCount = 0
local BaselessHas = {}
-- Requires at least one tile that is walkable and not minable
for _, tile in pairs(data.raw["tile"] or {}) do
if tile.minable == nil then
for _, mask in pairs(tile.collision_mask or {}) do
if mask == "ground-tile" then
goto after_tile
end
end
end
end
if true then
local block = baseless.Make["tile"](nil, {collision_mask = {"ground-tile"}})
baseless.needs_dependencies(block.dependencies)
data:extend{block.prototype}
end
::after_tile::
local next = next
while next(baseless.Needs) ~= nil do
local requirement = table.remove(baseless.Needs)
local type = requirement.type
local name = requirement.name
AttemptCount = AttemptCount + 1
local HasID = type .. "-" .. baseless.name_of(type, name)
if (data.raw[type] == nil) or (name and data.raw[type][name] == nil) then
AddedCount = AddedCount + 1
local block = baseless.Make[type](name)
BaselessHas[HasID] = true
baseless.needs_dependencies(block.dependencies)
data:extend{block.prototype}
baseless.log(true, type, name)
else
if BaselessHas[HasID] == nil then
baseless.log(false, type, name)
else
AttemptCount = AttemptCount - 1
end
end
end
log("Added " .. AddedCount .. "/" .. AttemptCount .. " prototypes")