narc0tiq / YARM

Yet another variant of the Resource Monitor for Factorio
https://mods.factorio.com/mod/YARM
MIT License
59 stars 43 forks source link

Improvement: use LuaRendering instead of making an inoperable chest as an overlay marker #175

Open narc0tiq opened 1 month ago

narc0tiq commented 1 month ago

Currently, the overlays are done by placing a rm_overlay entity belonging to the neutral force and telling it to be unminable, inoperable, and indestructible. While this technically works, it's also placing a fairly high-cost item into the world when we really just wanted to draw some blue on top of the tiles we know about, so the player can know we know about them.

The control code that places the overlay entities is found here: https://github.com/narc0tiq/YARM/blob/9eedf5c821ecf46fe36a5f28bbc962dbfd933910/resmon.lua#L408-L421

Since we now have LuaRendering for this purpose, which provides a convenient draw_rectangle (or even draw_sprite if someone is feeling creative!), why don't we just use that?

P.S.: Yes, I should have done this years ago.

wchristian commented 1 month ago

The link to luarendering isn't rendered correctly. :D

Also hmm, i was thinking draw_polygon, but that's only after skimming. Sounds like a very good change though. Don't know when i'll get around to it, since the past two days were hectic, but i would wanna do this soon, yes. :D