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

Fix Megalith's GetCommandQueue not functioning as expected #6578

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Dec 8, 2024

Issue

When checking the Megalith's UserUnit:GetCommandQueue, it would return its default factory rally point instead of its own move orders.

Description of the proposed changes

  • Remove the FACTORY category that causes this behavior.
    • This required an adjustment to fix hotbuild's building functionality due to how it filters builders and factories. I explored an alternative with defining the CONSTRUCTION category as units that can start builds of other units but it would be incompatible with mods.
  • Annotate some related categories' engine functionality.

Testing done on the proposed changes

Used the following command to confirm that units with the `FACTORY` category have this behavior.
UI_Lua 
local count = 0
local units = {}
for i,v in __blueprints do
	if type(i) == 'number' or string.find(i, '/') then continue end
	if v.CategoriesHash["MOBILE"] and not v.CategoriesHash["INSIGNIFICANTUNIT"] then
		units[count + 1] = CreateUnitAtMouse(i, GetFocusArmy()-1, math.mod(count, 17)*9, math.floor(count/17)*9, 0)
		count = count + 1
	end
end
ForkThread(function()
	WaitTicks(20)
	units = UISelectionByCategory('ALLUNITS', false, false, false, false)
	for _, unit in GetSelectedUnits() do
		local queue = unit:GetCommandQueue()
		if not table.empty(queue) then
			LOG('this unit has commands for no reason', unit:GetBlueprint().BlueprintId, repr(queue))
		end
	end
	IssueCommand('UNITCOMMAND_DestroySelf')
end)

Made sure that hotbuild issues the correct order so that Megalith can build a blueprint on the ground instead of building like a factory.

Additional Context

I noticed the Fatboy has the CONSTRUCTION category, but aircraft carriers do not, so Fatboy is a bit out of place for mobile factories.

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

lL1l1 added 4 commits December 7, 2024 23:13
It would return its default factory rally point instead of its own move orders

Annotate some related categories
Incompatible UI with mods, judging by the changes required to long-standing categories
@lL1l1 lL1l1 added type: bug area: ui Anything to do with the User Interface of the Game area: unit-blueprint related to issues in unit blueprints (*_unit.bp) labels Dec 8, 2024
@lL1l1 lL1l1 added this to the Development I of 2025 milestone Dec 8, 2024
@lL1l1 lL1l1 changed the title Fix/megalith command queue Fix Megalith's GetCommandQueue not functioning as expected Dec 8, 2024
@lL1l1 lL1l1 marked this pull request as ready for review December 8, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ui Anything to do with the User Interface of the Game area: unit-blueprint related to issues in unit blueprints (*_unit.bp) type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant