You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently trying and noticed limitations with corner-case usages of static func:
static without instance on vanilla class
When calling a static func which expects its first parameter to be an instance of itself
e.g. public final static func CanApplyBreathingEffect(player: wref<PlayerPuppet>) -> Bool from example it works ✅
However, static func which does not take any parameter
e.g. public static func GetCriticalHealthThreshold() -> Float (from PlayerPuppet too) causes instant crash with the following error :
// from REDEngine/ReportQueue
Error reason: Unhandled exception
Expression: EXCEPTION_ACCESS_VIOLATION (0xC0000005)
Message: The thread attempted to read inaccessible data at 0x0.
File: <Unknown>(0)
I also tried specifying a fake player: PlayerPuppet as a parameter out of curiosity
e.g. pub fn get_critical_health_threshold(player: PlayerPuppet) -> f32; and then it doesn't crash but instead ends up as expected like:
[2023-09-28 12:20:41.578] [example] [error] Function 'My.TestSystemThruPlayer' has panicked: failed to invoke PlayerPuppet::GetCriticalHealthThreshold;PlayerPuppet: function not found
static without instance on custom class
Another attempt with a custom class of mine like:
module My
publicclassSystem extends ScriptableSystem {publicstaticfunc HelloStatic()->Int32{return42;
}}
// from mod's RED4ext log
[2023-09-28 11:44:12.381] [example] [error] Function 'My.TestSystem' has panicked: failed to invoke System::HelloStatic;: function not found
Other cases work just fine 👌
It's not blocking for me now since there's workarounds, but I report for completeness.
The text was updated successfully, but these errors were encountered:
I'm currently trying and noticed limitations with corner-case usages of
static func
:static without instance on vanilla class
When calling a
static func
which expects its first parameter to be an instance of itselfe.g.
public final static func CanApplyBreathingEffect(player: wref<PlayerPuppet>) -> Bool
fromexample
it works ✅However,
static func
which does not take any parametere.g.
public static func GetCriticalHealthThreshold() -> Float
(fromPlayerPuppet
too) causes instant crash with the following error :I also tried specifying a fake
player: PlayerPuppet
as a parameter out of curiositye.g.
pub fn get_critical_health_threshold(player: PlayerPuppet) -> f32;
and then it doesn't crash but instead ends up as expected like:static without instance on custom class
Another attempt with a custom class of mine like:
ends up like:
Other cases work just fine 👌
It's not blocking for me now since there's workarounds, but I report for completeness.
The text was updated successfully, but these errors were encountered: