fix bug introduced in f5979ec

(modname was used out of scope)
This commit is contained in:
Treer 2018-09-12 22:03:33 +10:00
parent 679509077e
commit fdd47406b1
1 changed files with 25 additions and 16 deletions

View File

@ -173,42 +173,45 @@ else
end end
-- If the door uses textures from Darkage then use the default 16px res. function hidden_doors.get_painted_texture_suffix(use_default_16px_res)
-- Do the same for Moreblocks.
local use_default_16px_res = (modname == "darkage") or (modname == "moreblocks")
local texture_suffix = ""
local texture_suffix_inv = ""
local painted_texture_suffix = ""
local painted_texture_suffix_inv = ""
if doors_are_painted then if doors_are_painted then
local paint_opacity = 35 local paint_opacity = 35
local paint_opacity_inv = paint_opacity + 15 local paint_opacity_inv = paint_opacity + 15
if use_default_16px_res then if use_default_16px_res then
painted_texture_suffix = texture_suffix =
"^((hidden_doors_painted_overlay.png^[opacity:" .. paint_opacity .. "^((hidden_doors_painted_overlay.png^[opacity:" .. paint_opacity ..
"^hidden_doors_hinges_overlay.png)^[resize:38x32)" "^hidden_doors_hinges_overlay.png)^[resize:38x32)"
painted_texture_suffix_inv = texture_suffix_inv =
":8,0=hidden_doors_painted_overlay.png\\^[opacity\\:" .. ":8,0=hidden_doors_painted_overlay.png\\^[opacity\\:" ..
paint_opacity_inv .. "\\^[resize\\:38x32" paint_opacity_inv .. "\\^[resize\\:38x32"
else else
painted_texture_suffix = texture_suffix =
"^((hidden_doors_painted_overlay.png^[opacity:" .. paint_opacity .. "^((hidden_doors_painted_overlay.png^[opacity:" .. paint_opacity ..
"^hidden_doors_hinges_overlay.png)^[resize:" .. image_size .. ")" "^hidden_doors_hinges_overlay.png)^[resize:" .. image_size .. ")"
painted_texture_suffix_inv = texture_suffix_inv =
": " .. X1 .. ",0=hidden_doors_painted_overlay.png\\^[opacity\\:" .. ": " .. X1 .. ",0=hidden_doors_painted_overlay.png\\^[opacity\\:" ..
paint_opacity_inv .. "\\^[resize\\:" .. image_size paint_opacity_inv .. "\\^[resize\\:" .. image_size
end end
end end
return texture_suffix, texture_suffix_inv
end
function hidden_doors.register_hidden_doors(modname, subname, recipeItem1, function hidden_doors.register_hidden_doors(modname, subname, recipeItem1,
recipeItem2, recipeItem3, desc, sounds, sound_open, sound_close) recipeItem2, recipeItem3, desc, sounds, sound_open, sound_close)
local texture_name = modname .. "_" .. subname .. ".png" local texture_name = modname .. "_" .. subname .. ".png"
if (not use_default_16px_res) then -- If the door uses textures from Darkage then use the default 16px res.
-- Do the same for Moreblocks.
if (modname ~= "darkage") and (modname ~= "moreblocks") then
local new_texture = "[combine:" .. image_size .. ": 0," .. local new_texture = "[combine:" .. image_size .. ": 0," ..
"0=" .. texture_name .. ": 0," .. "0=" .. texture_name .. ": 0," ..
@ -218,6 +221,9 @@ function hidden_doors.register_hidden_doors(modname, subname, recipeItem1,
"0=" .. texture_name .. ":" .. X4 .. "," .. "0=" .. texture_name .. ":" .. X4 .. "," ..
Y3 .. "=" .. texture_name Y3 .. "=" .. texture_name
local painted_texture_suffix, painted_texture_suffix_inv =
hidden_doors.get_painted_texture_suffix(true)
doors.register("hidden_door_" .. subname, { doors.register("hidden_door_" .. subname, {
description = description_1 .. desc .. description_2, description = description_1 .. desc .. description_2,
@ -250,6 +256,9 @@ function hidden_doors.register_hidden_doors(modname, subname, recipeItem1,
"0=" .. texture_name .. ": 22," .. "0=" .. texture_name .. ": 22," ..
"16=" .. texture_name "16=" .. texture_name
local painted_texture_suffix, painted_texture_suffix_inv =
hidden_doors.get_painted_texture_suffix(false)
doors.register("hidden_door_" .. subname, { doors.register("hidden_door_" .. subname, {
description = description_1 .. desc .. description_2, description = description_1 .. desc .. description_2,