From 47492a92c9d4e615e44d7daee838af7e94a225d4 Mon Sep 17 00:00:00 2001 From: Octav Sandulescu Date: Wed, 30 Oct 2024 07:25:55 +0200 Subject: [PATCH] Use LuaRendering for overlay Also remove the rm_overlay entity, as it was a much more heavy-handed approach to the same outcome. Closes #175 --- graphics/rm_Overlay.png | Bin 2789 -> 0 bytes prototypes/prototypes.lua | 25 ------------------------- resmon.lua | 14 ++++++++------ 3 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 graphics/rm_Overlay.png diff --git a/graphics/rm_Overlay.png b/graphics/rm_Overlay.png deleted file mode 100644 index e9b4dc36370c524a3e6292375b105a4c4fab01c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2789 zcmV|D^_ww@lRz|vCuzLs)$;-`! zo*{AqUjza0dRV*yaMRE;fKCVhpQKsoe1Yhg01=zBIT!& zC1$=TK@rP|Ibo3vKKm@PqnO#LJhq6%Ij6Hz*<$V$@wQAMN5qJ)hzm2hoGcOF60t^# zFqJFfH{#e-4l@G)6iI9sa9D{VHW4w29}?su;^hF~NC{tY+*d5%WDCTXa!E_i;d2ub z1#}&jF5T4HnnCyEWTkKf0>c0%E1Ah>(_PY1)0w;+02c53Su*0<(nUqKG_|(0G&D0Z z{i;y^b@OjZ+}lNZ8Th$p5Uu}MTtq^NHl z*T1?CO*}7&0ztZsv2j*bmJyf3G7=Z`5B*PvzoDiKdLpOAxi2$L0#SX*@cY_n(^h55xYX z#km%V()bZjV~l{*bt*u9?FT3d5g^g~#a;iSZ@&02Abxq_DwB(I|L-^bXThc7C4-yr zInE_0gw7K3GZ**7&k~>k0Z0NWkO#^@9q0fwx1%qjZ=)yBuQ3=5 z4Wo^*!gyjLF-e%Um=erBOdIALW)L%unZshS@>qSW9o8Sq#0s#5*edK%>{;v(b^`kb zN5rY%%y90wC>#%$kE_5P!JWYk;U;klcqzOl-UjcFXXA75rT9jCH~u<)0>40zCTJ7v z2qAyk54cquI@7b&LHdZ`+zlTss6bJ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!O1p}D#{JO;G(*OVf24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV z0GgZ_00007bV*G`2i*t(6d)_euV1?W001pXL_t(o!|l#N0RR951h6Bp3aX3Yvn5z1 rJ9*T3CLkanARr(hARr(hARr)c|9b%~$@@Kd00000NkvXXu0mjfI7&Sk diff --git a/prototypes/prototypes.lua b/prototypes/prototypes.lua index 68c9a6b..d88cc1c 100644 --- a/prototypes/prototypes.lua +++ b/prototypes/prototypes.lua @@ -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', diff --git a/resmon.lua b/resmon.lua index d89f36c..e05e9b3 100644 --- a/resmon.lua +++ b/resmon.lua @@ -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