I was hoping someone could spot why my below code is not working as intended.
I'm creating tables from 1 to 100.
The Scale works, but not the selection, collision or tint. Those do not work...
Code: Select all
require("prototypes.New_Units.ne-biter-animations")
--- Tint
local ne_tank_tint = {}
local tint_r = 0
for i = 1, 100 do
tint_r = tint_r + 1
table.insert(ne_tank_tint, {{r=(tint_r/255), g=(tint_r/255), b=(tint_r/255), a=0.65}})
end
--- Collision Box
local ne_collision_box = {}
local c1 = 0
for i = 1, 100 do
c1 = c1 + 0.0057
table.insert(ne_collision_box, {{-(0.0943 + c1), -(0.0943 + c1)}, {(0.0943 + c1), (0.0943 + c1)}})
end
--- Selection Box
local ne_selection_box = {}
local s1 = 0
local s2 = 0
for i = 1, 100 do
s1 = s1 + 0.0097
s2 = s2 + 0.00234
table.insert(ne_selection_box, {{-(0.1903 + s1), -(0.34766 + s2)}, {(0.34766 + s2), (0.19032 + s1)}})
end
--- Scale
local ne_scale = {}
local scale = 0
for i = 1, 100 do
scale = scale + 0.0175
table.insert(ne_scale, 0.2325 + scale)
end
for i = 1, 100 do
NE_Tank_Unit = table.deepcopy(data.raw.unit["small-biter"])
NE_Tank_Unit.name = "ne-biter-tank-" .. i
NE_Tank_Unit.collision_box = ne_collision_box[i]
NE_Tank_Unit.selection_box = ne_selection_box[i]
NE_Tank_Unit.max_health = i
NE_Tank_Unit.attack_parameters.animation = ne_biter_attack_animation(ne_scale[i], ne_tank_tint[i], ne_tank_tint[i])
NE_Tank_Unit.run_animation = ne_biter_run_animation(ne_scale[i], ne_tank_tint[i], ne_tank_tint[i])
data:extend{NE_Tank_Unit}
end