Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LuaRendering for overlay #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed graphics/rm_Overlay.png
Binary file not shown.
25 changes: 0 additions & 25 deletions prototypes/prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,6 @@ data:extend(
},
},

{
type = 'container',
name = 'rm_overlay',
flags = { 'placeable-neutral', 'player-creation', 'not-repairable' },
icon = '__YARM__/graphics/rm_Overlay.png',
icon_size = 32,

max_health = 1,
order = 'z[resource-monitor]',

collision_mask = { layers = { resource = true } },
collision_box = { { -0.35, -0.35 }, { 0.35, 0.35 } },

selection_box = { { -0.5, -0.5 }, { 0.5, 0.5 } },
inventory_size = 1,
picture =
{
filename = '__YARM__/graphics/rm_Overlay.png',
priority = 'extra-high',
width = 32,
height = 32,
shift = { 0.0, 0.0 }
}
},

{
type = 'font',
name = 'yarm-gui-font',
Expand Down
14 changes: 8 additions & 6 deletions resmon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,14 @@ function resmon.put_marker_at(surface, pos, player_data)
return
end

local overlay = surface.create_entity { name = "rm_overlay",
force = game.forces.neutral,
position = pos }
overlay.minable = false
overlay.destructible = false
overlay.operable = false
local overlay = rendering.draw_rectangle {
left_top = { math.floor(pos.x), math.floor(pos.y) },
right_bottom = { math.floor(pos.x+1), math.floor(pos.y+1) },
filled = true,
color = { 0, 0, 0.5, 0.4 },
surface = surface,
draw_on_ground = true,
}
table.insert(player_data.overlays, overlay)
end

Expand Down