bounding box fix 2

This commit is contained in:
PreLeyZero 2022-06-08 00:55:23 +02:00
parent 42510376b3
commit 7e51d2cde1
6 changed files with 51 additions and 21 deletions

View file

@ -410,9 +410,7 @@ pre_tech_table = {
-- changes in entities and other protypes
--===================================================================================================================
data.raw["solar-panel"]["solar-panel"].next_upgrade = "el_solar_entity"
data.raw["solar-panel"]["el_solar_entity"].production = "220kW"
data.raw["solar-panel"]["el_solar_entity"].next_upgrade = "kr-advanced-solar-panel"
data.raw["solar-panel"]["kr-advanced-solar-panel"].production = "480kW"
data.raw.item["el_materials_ALK"].stack_size = 200
data.raw.recipe["dt-fuel"].ingredients = {

39
scripts/upgrades.lua Normal file
View file

@ -0,0 +1,39 @@
--table of entites that need to be fixed
--first arg = entity name, second arg = entity to copy bounfing box from, third arg = entity index in data raw
affected_entities = {
{"el_solar_entity", "solar-panel", "solar-panel"},
{"fi_crafter_entity", "assembling-machine-3", "assembling-machine"},
{"gr_crafter_entity", "assembling-machine-3", "assembling-machine"},
}
local function adjust_bounding_boxes(table_in)
--loop over all affected entities
for i,v in ipairs(table_in) do
--set bounding box to be same as entity to copy from
data.raw[v[3]][v[1]].collision_box = data.raw[v[3]][v[2]].collision_box
data.raw[v[3]][v[1]].selection_box = data.raw[v[3]][v[2]].selection_box
--set fast_replaceable_group
data.raw[v[3]][v[1]].fast_replaceable_group = v[3]
--collision mask
data.raw[v[3]][v[1]].collision_mask = data.raw[v[3]][v[2]].collision_mask
--bounding box
data.raw[v[3]][v[1]].bounding_box = data.raw[v[3]][v[2]].bounding_box
end
end
adjust_bounding_boxes(affected_entities)
--set next upgrades
data.raw['assembling-machine']['fi_crafter_entity'].next_upgrade = 'gr_crafter_entity'
data.raw['assembling-machine']['assembling-machine-3'].next_upgrade = 'fi_crafter_entity'
data.raw["solar-panel"]["solar-panel"].next_upgrade = "el_solar_entity"
data.raw["solar-panel"]["solar-panel"].fast_replaceable_group = "solar-panel"
if not mods["space-exploration"] then
if mods["Krastorio2"] then
data.raw["solar-panel"]["el_solar_entity"].next_upgrade = "kr-advanced-solar-panel"
end
end