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

[Bug]: Mex upgrade by right click ignores tech restrictions in campaign #6675

Open
BlackYps opened this issue Feb 25, 2025 · 2 comments · May be fixed by #6678
Open

[Bug]: Mex upgrade by right click ignores tech restrictions in campaign #6675

BlackYps opened this issue Feb 25, 2025 · 2 comments · May be fixed by #6678

Comments

@BlackYps
Copy link
Contributor

Describe the Bug

It appears the new QOL changes to mass extractors bypasses tech restrictions in campaign missions. It is minor in terms of priority, but this affects developers trying to balance low-tier campaign missions. This was noted by a user playing the original SC mission:

"I'm playing original SupCom campaigns right now. During Cybran mission 1 i noticed that if i right click my engineer on T1 mex, it begins upgrading to T2. I believe I shouldn't be able to do it this mission. I have option enabled to upgrade mexes when i right click with engineers so i guess it bypasses mission restrictions"

No mods were used to bypass restrictions and they were unable to upgrade the mass extractor through other means.

Reproduce the bug

Play SC cybran mission 1 and try to upgrade a mex by right clicking on it while you have the option enabled to upgrade mexes this way.

Screenshots

No response

Additional context

This bug report was brought to me. I have not verified it by testing.

@Garanas
Copy link
Member

Garanas commented Feb 25, 2025

If this is true then we have an interesting situation. The feature in question is the assist-to side effect, see also:

As far as I am aware there's no communication with a sim callback - this feature entirely exists in the UI using engine functions. Which means any UI mod can circumvent restrictions 😄 !

@lL1l1
Copy link
Contributor

lL1l1 commented Feb 27, 2025

The reason hotbuild/construction can't issue the order is because GetCommandData respects restrictions somehow.

Restrictions should be verified by the sim but 309f0fd disabled this verification in campaign specifically, so now we have:

fa/lua/sim/Unit.lua

Lines 2763 to 2780 in 1b5677a

---@param self Unit
---@param built Unit
---@param order string
---@return boolean
OnStartBuild = function(self, built, order)
self.BuildEffectsBag = self.BuildEffectsBag or TrashBag()
-- Prevent UI mods from violating game/scenario restrictions
local id = built.UnitId
local bp = built:GetBlueprint()
local bpSelf = self.Blueprint
if not ScenarioInfo.CampaignMode and Game.IsRestricted(id, self.Army) then
WARN('Unit.OnStartBuild() Army ' ..self.Army.. ' cannot build restricted unit: ' .. (bp.Description or id))
self:OnFailedToBuild() -- Don't use: self:OnStopBuild()
IssueClearFactoryCommands({self})
IssueToUnitClearCommands(self)
return false -- Report failure of OnStartBuild
end

order seems to be "Upgrade" | "Repair" | "MobileBuild" | "FactoryBuild", so instead of not ScenarioInfo.CampaignMode we can write order ~= "Repair"

@lL1l1 lL1l1 linked a pull request Feb 28, 2025 that will close this issue
2 tasks
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.

3 participants