Suggestion:
Add return types to Decorate weapon functions like A_CustomPunch for accessing the actor hit by the attack (if any).
Return type for Decorate weapon functions
Moderator: GZDoom Developers
- Rip and Tear
- Posts: 185
- Joined: Tue May 02, 2017 3:54 pm
Re: Return type for Decorate weapon functions
I don't think that's possible for the simple reason that multiple actors can be damaged in one hit, and ZScript has no method of handling multiple return values like Lua (as far as I know).
Plus, certain "hits" have a delayed effect and therefore can't be returned by a function like this anyway.
Plus, certain "hits" have a delayed effect and therefore can't be returned by a function like this anyway.
- Rip and Tear
- Posts: 185
- Joined: Tue May 02, 2017 3:54 pm
Re: Return type for Decorate weapon functions
It wouldn't be feasible for every single attack function, but there are still functions like A_CustomPunch and A_Saw that preform instant hitscan attacks that can only hit one target.Rachael wrote:I don't think that's possible for the simple reason that multiple actors can be damaged in one hit, and ZScript has no method of handling multiple return values like Lua (as far as I know).
Plus, certain "hits" have a delayed effect and therefore can't be returned by a function like this anyway.
- phantombeta
- Posts: 2088
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: Return type for Decorate weapon functions
[wiki=ZScript_functions#Multiple_Returns]The wiki says it can return multiple values, apparently.[/wiki]Rachael wrote:I don't think that's possible for the simple reason that multiple actors can be damaged in one hit, and ZScript has no method of handling multiple return values like Lua (as far as I know).
Plus, certain "hits" have a delayed effect and therefore can't be returned by a function like this anyway.
Couldn't it return a dynamic array anyway? (Since IIRC ZScript has those natively)
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Return type for Decorate weapon functions
Multiple returns in the given context are not possible because you need to know up front how many values there are, and there's an internal compiler limit of 8.
Dynamic scripts cannot be returned because those are not but structs internally.
Dynamic scripts cannot be returned because those are not but structs internally.