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

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

Closed
narc0tiq opened this issue Oct 23, 2024 · 1 comment · Fixed by #179
Closed

Comments

@narc0tiq
Copy link
Owner

narc0tiq commented Oct 23, 2024

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:

YARM/resmon.lua

Lines 408 to 421 in 9eedf5c

function resmon.put_marker_at(surface, pos, player_data)
if math.floor(pos.x) % settings.global["YARM-overlay-step"].value ~= 0 or
math.floor(pos.y) % settings.global["YARM-overlay-step"].value ~= 0 then
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
table.insert(player_data.overlays, overlay)
end

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
Copy link
Collaborator

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

narc0tiq added a commit that referenced this issue Oct 30, 2024
Also remove the rm_overlay entity, as it was a much more heavy-handed approach to the same outcome.

Closes #175
narc0tiq added a commit that referenced this issue Oct 30, 2024
Also remove the rm_overlay entity, as it was a much more heavy-handed approach to the same outcome.

Closes #175
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants