feat(codegen): GameEventsGenerator add FieldOverrides#1
feat(codegen): GameEventsGenerator add FieldOverrides#1isMADAO wants to merge 2 commits intoswiftly-solution:mainfrom
Conversation
|
Did you try to see if it works with plugins that still have the old API? like the plugins built with the old data types to see if it still works with the new binary |
|
Testing in progress |
plugin sw2 version1.2.2 & 1.3.2 Test code[GameEventHandler(HookMode.Post)]
public HookResult OnPlayerHurtPost(EventPlayerHurt eventObj)
{
if (eventObj.UserIdPlayer is not { IsValid: true }) return HookResult.Continue;
var pawnHealth = eventObj.UserIdPlayer.PlayerPawn!.Health;
var eventHealth = eventObj.Health;
Core.PlayerManager.SendChat($"OnPlayerHurtTest>> pawnHealth[{pawnHealth}], eventHealth[{eventHealth}], HitGroup[{eventObj.HitGroup}]");
return HookResult.Continue;
}ErrorTestPlugin | 04/26 06:28:37 | Error | SwiftlyS2.Core.GameEvents.GameEventCallback Looks more serious than I thought. |
|
Here are all my changes: isMADAO/swiftlys2@29c78f1 |
|
yeah, i understand that, the issue is that we need to keep compatibility with the old code, maybe add new methods to act like how you want, but with a new name, something like |
|
instead of replacing the old ones |
|
If it were only special schema types like |
|
you can add a new method, and i think the name would be the original name + Typed |
|
Adding new methods would preserve compatibility, but as I said, it would bloat the framework. And the overridden field types are simply wrong — for something like |
|
https://discord.com/channels/1419042580980699159/1421117496169074719/1497902943935008799 |
The types provided in the .gameevents files may not always match reality. We can override specific fields as needed.
I changed the hitgroup field in the
player_hurtandplayer_deathevents to the HitGroup_t type. This is a breaking change and may affect existing plugins, but it's friendlier from a user-experience standpoint.swiftly-solution/swiftlys2#307