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 error when Cybran air factories die while building #6636

Merged
merged 4 commits into from
Feb 7, 2025

Conversation

lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Jan 26, 2025

Issue

When a Cybran air factory dies while building the following error occurs:

warning: Error running lua script: ...\fa\lua\effectutilities.lua(345): attempt to loop over field `BuildEffectBones' (a nil value)
         stack traceback:
         	...\fa\lua\effectutilities.lua(345): in function <...\fa\lua\effectutilities.lua:341>
         	...\fa\lua\sim\units\cybran\cairfactoryunit.lua(62): in function <...\fa\lua\sim\units\cybran\cairfactoryunit.lua:56>

The error occurs because the wrong blueprint value is passed to the function, and it occurs after the factory dies because the function is stuck in a loop before the erroring code runs. The loop can be traced to b7169ab (10 years ago) where the Cybran naval factory build beams which are forked in a thread were added to land/air factories without being forked.

Description of the proposed changes

  • Fix the wrong value being passed
  • Fork the build beam thread so that the other effects work: a glow under the unit, sparks on the tips of the build arms, and sparks in the unit hitbox. The build animation is noticeably brighter because of these functional effects.
    • Since it's been 10 years I'd recommend taking a close look. I think it's a good addition so I didn't change anything.
  • Fix related intellisense warnings (unknown global and wrong param type)

Testing done on the proposed changes

Spawn factories and build something in them. There should be no errors in the log and the aforementioned effects should be visible.
Paragon + all land/air factories affected:

   CreateUnitAtMouse('urb0202', 0,   14.55,    7.91,  0.00000)
   CreateUnitAtMouse('urb0302', 0,   14.55,   -2.09,  0.00000)
   CreateUnitAtMouse('xab1401', 0,    1.55,   -6.09,  0.00000)
   CreateUnitAtMouse('urb0102', 0,   18.55,   16.91,  0.00000)
   CreateUnitAtMouse('zrb9602', 0,   24.55,   -1.09,  0.00000)
   CreateUnitAtMouse('urb0301', 0,  -23.45,  -11.09,  0.00000)
   CreateUnitAtMouse('zrb9502', 0,   23.55,    7.91,  0.00000)
   CreateUnitAtMouse('urb0201', 0,  -23.45,   -3.09,  0.00000)
   CreateUnitAtMouse('zrb9601', 0,  -15.45,  -11.09,  0.00000)
   CreateUnitAtMouse('urb0101', 0,  -19.45,    4.91,  0.00000)
   CreateUnitAtMouse('zrb9501', 0,  -15.45,   -3.09,  0.00000)

Despite having using the function in CSeaFactoryUnit, Cybran naval factories are not affected as their unit scripts replace CreateBuildEffects with the fancier 1/2/3 build arm component's CreateBuildEffects.

Checklist

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

@lL1l1 lL1l1 added type: bug area: sim Area that is affected by the Simulation of the Game labels Jan 26, 2025
@lL1l1 lL1l1 added this to the Development Iteration I of 2025 milestone Jan 26, 2025
@lL1l1 lL1l1 added the area: graphics Anything Related to the Game Graphics label Jan 26, 2025
@lL1l1 lL1l1 marked this pull request as ready for review February 5, 2025 05:08
@Garanas Garanas merged commit 71b1568 into FAForever:develop Feb 7, 2025
5 checks passed
@lL1l1 lL1l1 deleted the Fix/cybran-air-factory-error branch February 12, 2025 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Anything Related to the Game Graphics area: sim Area that is affected by the Simulation of the Game type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants