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

@ -1,3 +1,5 @@
--fix upgradeables bounding boxes
require('scripts/upgrades')
--insert tech
if data.raw.lab['lab'] then
table.insert(data.raw.lab['lab'].inputs, 'fi_ki_science')

View file

@ -63,7 +63,7 @@ data:extend({
usage_priority = 'solar',
input_flow_limit = '0W',
},
fast_replaceable_group = 'solar-panel',
--fast_replaceable_group = 'solar-panel',
production = solar_output(),
--picture
picture = {
@ -75,8 +75,3 @@ data:extend({
map_color = {r=1.7,g=1.7,b=1.7},
},
})
if data.raw["solar-panel"]["solar-panel"] then
data.raw["solar-panel"]["solar-panel"].next_upgrade = "el_solar_entity"
data.raw["solar-panel"]["solar-panel"].fast_replaceable_group = "solar-panel"
end

View file

@ -33,15 +33,15 @@ data:extend({
flags = {"player-creation","placeable-neutral"},
max_health = 300,
corpse = 'big-remnants',
collision_box = data.raw['assembling-machine']['assembling-machine-1'].collision_box,
selection_box = data.raw['assembling-machine']['assembling-machine-1'].selection_box,
collision_box = data.raw['assembling-machine']['assembling-machine-3'].collision_box,
selection_box = data.raw['assembling-machine']['assembling-machine-3'].selection_box,
squeak_behaviour = false,
map_color = {r=0, g=0, b=1, a=1},
minable = {
mining_time = 1,
result = 'fi_crafter_item',
},
fast_replaceable_group = "assembling-machine",
--fast_replaceable_group = "assembling-machine",
crafting_categories = {'advanced-crafting','crafting','smelting','fi_crafting_category'},
crafting_speed = 3.5,
energy_source = {
@ -108,5 +108,3 @@ data:extend({
},
},
})
data.raw['assembling-machine']['assembling-machine-3'].next_upgrade = 'fi_crafter_entity'

View file

@ -33,15 +33,15 @@ data:extend({
flags = {"player-creation","placeable-neutral"},
max_health = 300,
corpse = 'big-remnants',
collision_box = data.raw['assembling-machine']['assembling-machine-1'].collision_box,
selection_box = data.raw['assembling-machine']['assembling-machine-1'].selection_box,
collision_box = data.raw['assembling-machine']['assembling-machine-3'].collision_box,
selection_box = data.raw['assembling-machine']['assembling-machine-3'].selection_box,
squeak_behaviour = false,
map_color = {r=0, g=0, b=1, a=1},
minable = {
mining_time = 1,
result = 'gr_crafter_item',
},
fast_replaceable_group = "assembling-machine",
--fast_replaceable_group = "assembling-machine",
crafting_categories = {'advanced-crafting','crafting','smelting','fi_crafting_category'},
crafting_speed = 10,
energy_source = {
@ -103,5 +103,3 @@ data:extend({
},
},
})
data.raw['assembling-machine']['fi_crafter_entity'].next_upgrade = 'gr_crafter_entity'

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