Skip to content

Commit

Permalink
More biofluid fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Nov 9, 2024
1 parent 48ecfec commit 57bec87
Showing 1 changed file with 130 additions and 14 deletions.
144 changes: 130 additions & 14 deletions prototypes/biofluid/vessel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,140 @@ ITEM {
}

local variants = {
"straight-base-vertical",
"straight-base-horizontal",
"alone",
"straight-horizontal",
"curved-right-up",
"curved-right-down",
"curved-left-down",
"curved-left-up",
"junction-down",
"junction-left",
"junction-up",
"junction-right",
"full-junction",
["straight_vertical"] = "straight-base-vertical",
["straight_vertical_window"] = "straight-base-vertical",
["straight_horizontal"] = "straight-base-horizontal",
["straight_horizontal_window"] = "straight-horizontal",
["straight_vertical_single"] = "alone",
["corner_up_right"] = "curved-right-up",
["corner_down_right"] = "curved-right-down",
["corner_down_left"] = "curved-left-down",
["corner_up_left"] = "curved-left-up",
["t_up"] = "junction-down",
["t_right"] = "junction-left",
["t_down"] = "junction-up",
["t_left"] = "junction-right",
["cross"] = "full-junction",
["ending_up"] = "straight-base-vertical",
["ending_down"] = "alone",
["ending_right"] = "straight-base-horizontal",
["ending_left"] = "straight-base-horizontal",
}

local glow_translations = {
["straight-horizontal"] = "straight-base-horizontal",
["junction-up"] = "junction-down",
["junction-down"] = "junction-up",
}

local shadow_translations = {
["alone"] = "straight-base-vertical",
["straight-horizontal"] = "straight-base-horizontal",
["junction-down"] = "junction-up",
["junction-up"] = "junction-down",
["junction-left"] = "junction-right",
["junction-right"] = "junction-left",
}

local animations = {}
for picture_location, variant in pairs(variants) do
animations[picture_location] = {
layers = {
{
filename = "__pyalienlifegraphics2__/graphics/entity/vessel/hr-vessel-" .. (variant == "alone" and "straight-base-vertical" or variant) .. ".png",
priority = "high",
width = 640 / 5,
height = 768 / 6,
frame_count = 5 * 6,
line_length = 5,
shift = {0, 0},
scale = 0.335,
animation_speed = 0.5
},
{
filename = "__pyalienlifegraphics2__/graphics/entity/vessel/hr-vessel-" .. (glow_translations[variant] or variant) .. "-glow.png",
priority = "high",
width = 640 / 5,
height = 768 / 6,
frame_count = 5 * 6,
line_length = 5,
shift = {0, 0},
scale = 0.335,
animation_speed = 0.5,
draw_as_glow = true
},
{
filename = "__pyalienlifegraphics2__/graphics/entity/vessel/hr-vessel-" .. (shadow_translations[variant] or variant) .. "-shadow.png",
priority = "high",
width = 640 / 5,
height = 768 / 6,
frame_count = 5 * 6,
line_length = 5,
shift = {0, 0},
scale = 0.335,
animation_speed = 0.5,
draw_as_shadow = true
},
{
filename = "__core__/graphics/light-small.png",
priority = "high",
width = 150,
height = 150,
shift = {0, 0},
frame_count = 1,
repeat_count = 30,
draw_as_light = true,
tint = {0.5, 0.5, 1, 0.4}
}
}
}
end

local gap = {
filename = "__pyalienlifegraphics2__/graphics/entity/vessel/hr-vessel-straight-vertical.png",
priority = "high",
width = 640 / 5,
height = 768 / 6,
frame_count = 5 * 6,
line_length = 5,
shift = util.by_pixel(0, 8),
scale = 0.335,
animation_speed = 0.5
}

local gap_glow = {
filename = "__pyalienlifegraphics2__/graphics/entity/vessel/hr-vessel-straight-vertical-glow.png",
priority = "high",
width = 640 / 5,
height = 768 / 6,
frame_count = 5 * 6,
line_length = 5,
shift = util.by_pixel(0, 8),
scale = 0.335,
animation_speed = 0.5,
draw_as_glow = true,
}

local function fix_gap(picture_location)
table.insert(animations[picture_location].layers, 2, gap)
table.insert(animations[picture_location].layers, gap_glow)
end

-- fix gap for all pipes with a "down" connection
fix_gap("straight_vertical")
fix_gap("straight_vertical_window")
fix_gap("corner_down_right")
fix_gap("corner_down_left")
fix_gap("t_down")
fix_gap("t_right")
fix_gap("t_left")
fix_gap("ending_down")
fix_gap("cross")

local vessel = table.deepcopy(data.raw["pipe"]["pipe"])
vessel.icon_draw_specification = {scale = 0}
vessel.fluid_box = {
volume = 1,
pipe_covers = pipecoverspictures(), -- in case a real pipe is connected to a ghost
pipe_connections = {
{direction = defines.direction.north, position = {0, 0}, connection_category = "biofluid"},
{direction = defines.direction.east, position = {0, 0}, connection_category = "biofluid"},
Expand All @@ -91,6 +205,7 @@ vessel.fluid_box = {
hide_connection_info = true
}
vessel.name = "vessel"
vessel.pictures = animations
vessel.icon = data.raw.item["vessel"].icon
vessel.icon_size = data.raw.item["vessel"].icon_size
vessel.corpse = "small-remnants"
Expand Down Expand Up @@ -233,6 +348,7 @@ underground_pipe.fluid_box = {
}
}
}
underground_pipe.pictures = nil
underground_pipe.integration_patch = ug_pipe_integration
underground_pipe.integration_patch_render_layer = "lower-object"
data:extend {underground_pipe}

0 comments on commit 57bec87

Please sign in to comment.