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

Get rid of AutoShowMetal #1092

Open
sprunk opened this issue Nov 23, 2023 · 6 comments · May be fixed by #1851
Open

Get rid of AutoShowMetal #1092

sprunk opened this issue Nov 23, 2023 · 6 comments · May be fixed by #1851

Comments

@sprunk
Copy link
Collaborator

sprunk commented Nov 23, 2023

Bill of materials to be done before starting this ticket:


This is a map-side setting which cannot be controlled by a game, and which makes it so that the metal view is force-enabled when "build mex" becomes the active command.

Gameside control can already be achieved via Lua. Right now it has to be polling, but with #1091 a replacement should become as simple as:

function widget:ActiveCommandSet(cmdID)
  local isMex = cmdID < 0 and UnitDefs[-cmdID].extractsMetal > 0
  local isMetalViewOn = (Spring.GetMapDrawMode() == 'metal')
  if isMex ~= isMetalViewOn then
    Spring.SendCommands("showmetalmap")
  end
end

Therefore the proposal is to remove the mapside tag.

@saurtron
Copy link
Collaborator

a replacement should become as simple as:

I think the replacement needs something more, since some maps disable this logic, so wupget code should be able to apply the same heuristic (not sure what it is about but it's controlled per map so I think some may be disabling it?).

@saurtron
Copy link
Collaborator

saurtron commented Jan 5, 2025

Here is the final proposed widget to archieve autoshowmetal in a backwards compatible way (ie, respecting the map autoshowmetal declaration):

examples/Widgets/gui_autoshowmetal.lua

@AntlerForce
Copy link
Contributor

AntlerForce commented Jan 5, 2025

Here is the final proposed widget to archieve autoshowmetal in a backwards compatible way (ie, respecting the map autoshowmetal declaration):

examples/Widgets/gui_autoshowmetal.lua

Does it need to be respected? I don't think this is a value that mappers have ever been setting with forethought, moreso just carrying on whatever the value the base project had.

In what situations would you not want autoshowmetal = true?

@saurtron
Copy link
Collaborator

saurtron commented Jan 5, 2025

In what situations would you not want autoshowmetal = true?

Maybe for full-metal maps? No idea tbh just made the lua version to be fully compatible with current c++ code and also to address @lhog concerns.

@AntlerForce
Copy link
Contributor

In what situations would you not want autoshowmetal = true?

Maybe for full-metal maps? No idea tbh just made the lua version to be fully compatible with current c++ code and also to address @lhog concerns.

If disabling autoshowmetal on metal maps is the goal then respecting set map configured value isn't going to work, from a quick inspection at the very least Full Metal Plate and Adamantium Factory have autoshowmetal = true.

@saurtron
Copy link
Collaborator

saurtron commented Jan 5, 2025

If disabling autoshowmetal on metal maps is the goal then respecting set map configured value isn't going to work, from a quick inspection at the very least Full Metal Plate and Adamantium Factory have autoshowmetal = true.

Well, maybe those maps where supposed to use it but meaning was long forgot by time, what can I say, just replicated the c++ code to make sure not breaking anything we don't know about... maybe the 100+ maps all set it to true? No idea but it's very possible that had some reason for existing and could even be in use.

Anyways, the goal is simply to have a fully compatible implementation so eventually we'll get rid of the c++ one and let games do as they wish with that.

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

Successfully merging a pull request may close this issue.

3 participants