Skip to content

Don't bind bogus Location or Facing lua properties for actors without Location or Facing#21684

Merged
PunkPun merged 2 commits intoOpenRA:bleedfrom
pchote:lua-properties
Jan 15, 2025
Merged

Don't bind bogus Location or Facing lua properties for actors without Location or Facing#21684
PunkPun merged 2 commits intoOpenRA:bleedfrom
pchote:lua-properties

Conversation

@pchote
Copy link
Member

@pchote pchote commented Dec 30, 2024

Fixes an issue brought up on Discord where HasProperty returns true but the script crashes when they are used on e.g. the player actor.

Testcase: add the following to the bottom of the RA shellmap's WorldLoaded function:

Utils.Do(Allies.GetActors(), function(f) if f.HasProperty("Location") then print(f.Location.X) end end)

Note: Similar changes really should be done for the other methods/properties in GeneralProperties, but those would be breaking API changes, so I don't want to deal with them here.

Copy link
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PunkPun PunkPun merged commit b9adbf8 into OpenRA:bleed Jan 15, 2025
@PunkPun
Copy link
Member

PunkPun commented Jan 15, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants