I am still clumsy in lua so maybe I have made a noob mistake?
Code: Select all
local labLevel = _ + 1;
local labName = "lab-" .. tostring(_);
local newLabEntity = table.deepcopy(data.raw.lab.lab);
newLabEntity.name = labName;
local newLayers= {};
for _, animationLayer in pairs(newLabEntity.on_animation.layers) do
if animationLayer.draw_as_light then
animationLayer.filename = "__hard_science__/graphics/lab-storm.png" -- https://github.com/danielbrauer/DiscoScience/blob/master/src/graphics/hr-lab-storm.png
animationLayer.hr_version.filename = "__hard_science__/graphics/hr-lab-storm.png"
end
table.insert(newLayers, animationLayer)
end
newLabEntity.on_animation = {layers = newLayers};
log(serpent.block(newLabEntity.on_animation.layers))
data:extend({newLabEntity});
Code: Select all
1.830 Script @__hard_science__/data.lua:154: {
{
animation_speed = 0.3333333333333333,
filename = "__base__/graphics/entity/lab/lab.png",
frame_count = 33,
height = 87,
hr_version = {
animation_speed = 0.3333333333333333,
filename = "__base__/graphics/entity/lab/hr-lab.png",
frame_count = 33,
height = 174,
line_length = 11,
scale = 0.5,
shift = {
0,
0.046875
},
width = 194
},
line_length = 11,
shift = {
0,
0.046875
},
width = 98
},
{
animation_speed = 0.3333333333333333,
filename = "__base__/graphics/entity/lab/lab-integration.png",
frame_count = 1,
height = 81,
hr_version = {
animation_speed = 0.3333333333333333,
filename = "__base__/graphics/entity/lab/hr-lab-integration.png",
frame_count = 1,
height = 162,
line_length = 1,
repeat_count = 33,
scale = 0.5,
shift = {
0,
0.484375
},
width = 242
},
line_length = 1,
repeat_count = 33,
shift = {
0,
0.484375
},
width = 122
},
{
animation_speed = 0.3333333333333333,
blend_mode = "additive",
draw_as_light = true,
filename = "__hard_science__/graphics/lab-storm.png",
frame_count = 33,
height = 100,
hr_version = {
animation_speed = 0.3333333333333333,
blend_mode = "additive",
draw_as_light = true,
filename = "__hard_science__/graphics/hr-lab-storm.png",
frame_count = 33,
height = 194,
line_length = 11,
scale = 0.5,
shift = {
0,
0
},
width = 216
},
line_length = 11,
shift = {
-0.03125,
0.03125
},
width = 106
},
{
animation_speed = 0.3333333333333333,
draw_as_shadow = true,
filename = "__base__/graphics/entity/lab/lab-shadow.png",
frame_count = 1,
height = 68,
hr_version = {
animation_speed = 0.3333333333333333,
draw_as_shadow = true,
filename = "__base__/graphics/entity/lab/hr-lab-shadow.png",
frame_count = 1,
height = 136,
line_length = 1,
repeat_count = 33,
scale = 0.5,
shift = {
0.40625,
0.34375
},
width = 242
},
line_length = 1,
repeat_count = 33,
shift = {
0.40625,
0.34375
},
width = 122
}
}
1.832 Script @__hard_science__/data.lua:154: {
{
animation_speed = 0.3333333333333333,
filename = "__base__/graphics/entity/lab/lab.png",
frame_count = 33,
height = 87,
hr_version = {
animation_speed = 0.3333333333333333,
filename = "__base__/graphics/entity/lab/hr-lab.png",
frame_count = 33,
height = 174,
line_length = 11,
scale = 0.5,
shift = {
0,
0.046875
},
width = 194
},
line_length = 11,
shift = {
0,
0.046875
},
width = 98
},
{
animation_speed = 0.3333333333333333,
filename = "__base__/graphics/entity/lab/lab-integration.png",
frame_count = 1,
height = 81,
hr_version = {
animation_speed = 0.3333333333333333,
filename = "__base__/graphics/entity/lab/hr-lab-integration.png",
frame_count = 1,
height = 162,
line_length = 1,
repeat_count = 33,
scale = 0.5,
shift = {
0,
0.484375
},
width = 242
},
line_length = 1,
repeat_count = 33,
shift = {
0,
0.484375
},
width = 122
},
{
animation_speed = 0.3333333333333333,
blend_mode = "additive",
draw_as_light = true,
filename = "__hard_science__/graphics/lab-storm.png",
frame_count = 33,
height = 100,
hr_version = {
animation_speed = 0.3333333333333333,
blend_mode = "additive",
draw_as_light = true,
filename = "__hard_science__/graphics/hr-lab-storm.png",
frame_count = 33,
height = 194,
line_length = 11,
scale = 0.5,
shift = {
0,
0
},
width = 216
},
line_length = 11,
shift = {
-0.03125,
0.03125
},
width = 106
},
{
animation_speed = 0.3333333333333333,
draw_as_shadow = true,
filename = "__base__/graphics/entity/lab/lab-shadow.png",
frame_count = 1,
height = 68,
hr_version = {
animation_speed = 0.3333333333333333,
draw_as_shadow = true,
filename = "__base__/graphics/entity/lab/hr-lab-shadow.png",
frame_count = 1,
height = 136,
line_length = 1,
repeat_count = 33,
scale = 0.5,
shift = {
0.40625,
0.34375
},
width = 242
},
line_length = 1,
repeat_count = 33,
shift = {
0.40625,
0.34375
},
width = 122
}
}
Code: Select all
? tree ~/Code/FactorioModLab/mods/hard_science master -!+
.
├── README.md
├── data.lua
├── graphics
│ ├── hr-lab-storm.png
│ └── lab-storm.png
├── hard_science_0.0.1.zip
├── info.json
└── locale
└── en
└── locale.cfg
Code: Select all
{
"name": "hard_science",
"version": "0.0.1",
"title": "Hard Science",
"description": "Science is hard.",
"factorio_version": "1.1",
"dependencies": [
"base >= 1.1.21",
"recursive-science >= 2020.11.29"
],
"author": "adamwong246",
"contact": "adamwong246@gmail.com",
"homepage": "https://github.com/adamwong246"
}