ACF-Team / ACF-3

ACF
MIT License
67 stars 53 forks source link

[BUG] acfGetLinkedWheels() Starfall function returns broken entities #395

Closed dobriyprop closed 3 months ago

dobriyprop commented 3 months ago

Short Description

Starfall errors out when trying to do anything with Entities returned by acfGetLinkedWheels() function

Branch and Version

Git-dev-e1a5d73

Console Error Logs

[AdvDupe2Notify]    Pasting...
SF:libs/xinput_car_controller_lib.txt:747: attempt to call method 'entIndex' (a nil value)
stack traceback:
    SF:libs/xinput_car_controller_lib.txt:747: in function 'init'
    SF:c9merc.txt:68: in main chunk
[AdvDupe2Notify]    Finished Pasting!

How to Reproduce

1) Get linked wheels entities from a gearbox/engine using acfGetLinkedWheels() 2) Try to get their indices with <wheelentity>:entIndex() 3) Receive an error from above attempt to call method 'entIndex' (a nil value)

Solution

In function function ents_methods:acfGetLinkedWheels() ... end

https://github.com/ACF-Team/ACF-3/blob/e1a5d738fdc2a9d77e36b55703b6bfbe8319f79a/lua/starfall/libs_sh/acffunctions.lua#L1914

Entities written to Wheels array has to be wrapped Wheels[Count] = Wheel -> Wheels[Count] = wrap(Wheel)