From af1fdd8441a56aabfe623459e3720745d6c8f7f3 Mon Sep 17 00:00:00 2001 From: Extremelyd1 Date: Mon, 25 Dec 2023 13:59:24 +0100 Subject: [PATCH] Improvements to Radiance --- .../Client/Entity/Action/EntityFsmActions.cs | 41 +++++++++++++++++ HKMP/Game/Client/Entity/EntitySpawner.cs | 46 +++++++++++++++++++ HKMP/Game/Client/Entity/EntityType.cs | 3 ++ HKMP/Resource/entity-registry.json | 21 +++++++++ 4 files changed, 111 insertions(+) diff --git a/HKMP/Game/Client/Entity/Action/EntityFsmActions.cs b/HKMP/Game/Client/Entity/Action/EntityFsmActions.cs index 39be81b..080e261 100644 --- a/HKMP/Game/Client/Entity/Action/EntityFsmActions.cs +++ b/HKMP/Game/Client/Entity/Action/EntityFsmActions.cs @@ -875,6 +875,47 @@ private static void ApplyNetworkDataFromAction(EntityNetworkData data, SetFsmBoo fsmBool.Value = setValue; } + #endregion + + #region SetFsmInt + + private static bool GetNetworkDataFromAction(EntityNetworkData data, SetFsmInt action) { + if (action.setValue == null) { + return false; + } + + var gameObject = action.Fsm.GetOwnerDefaultTarget(action.gameObject); + if (gameObject == action.Fsm.GameObject) { + return false; + } + + var setValue = action.setValue.Value; + data.Packet.Write(setValue); + + return true; + } + + private static void ApplyNetworkDataFromAction(EntityNetworkData data, SetFsmInt action) { + var setValue = data.Packet.ReadInt(); + + var gameObject = action.Fsm.GetOwnerDefaultTarget(action.gameObject); + if (gameObject == null) { + return; + } + + var fsm = ActionHelpers.GetGameObjectFsm(gameObject, action.fsmName.Value); + if (fsm == null) { + return; + } + + var fsmInt = fsm.FsmVariables.GetFsmInt(action.variableName.Value); + if (fsmInt == null) { + return; + } + + fsmInt.Value = setValue; + } + #endregion #region SetFsmFloat diff --git a/HKMP/Game/Client/Entity/EntitySpawner.cs b/HKMP/Game/Client/Entity/EntitySpawner.cs index e1bf131..79fbd15 100644 --- a/HKMP/Game/Client/Entity/EntitySpawner.cs +++ b/HKMP/Game/Client/Entity/EntitySpawner.cs @@ -135,6 +135,24 @@ List clientFsms } } + if (spawningType is EntityType.Radiance or EntityType.AbsoluteRadiance) { + if (spawnedType == EntityType.RadianceOrb) { + return SpawnRadianceOrb(clientFsms[3]); + } + + if (spawnedType == EntityType.RadianceNail) { + return SpawnRadianceNail(clientFsms[3]); + } + + if (spawnedType == EntityType.RadianceNailComb) { + return SpawnRadianceNailComb(clientFsms[3]); + } + } + + if (spawningType == EntityType.RadianceNailComb && spawnedType == EntityType.RadianceNail) { + return SpawnRadianceNailFromComb(clientFsms[0]); + } + return null; } @@ -437,4 +455,32 @@ private static GameObject SpawnGrimmFirebatObject(PlayMakerFSM fsm) { return SpawnFromGlobalPool(action, gameObject); } + + private static GameObject SpawnRadianceOrb(PlayMakerFSM fsm) { + var action = fsm.GetFirstAction("Spawn Fireball"); + var gameObject = action.gameObject.Value; + + return SpawnFromGlobalPool(action, gameObject); + } + + private static GameObject SpawnRadianceNail(PlayMakerFSM fsm) { + var action = fsm.GetFirstAction("CW Spawn"); + var gameObject = action.gameObject.Value; + + return SpawnFromGlobalPool(action, gameObject); + } + + private static GameObject SpawnRadianceNailComb(PlayMakerFSM fsm) { + var action = fsm.GetFirstAction("Comb Top"); + var gameObject = action.gameObject.Value; + + return SpawnFromGlobalPool(action, gameObject); + } + + private static GameObject SpawnRadianceNailFromComb(PlayMakerFSM fsm) { + var action = fsm.GetFirstAction("RG1"); + var gameObject = action.gameObject.Value; + + return SpawnFromGlobalPool(action, gameObject); + } } diff --git a/HKMP/Game/Client/Entity/EntityType.cs b/HKMP/Game/Client/Entity/EntityType.cs index 122ba83..365b812 100644 --- a/HKMP/Game/Client/Entity/EntityType.cs +++ b/HKMP/Game/Client/Entity/EntityType.cs @@ -187,6 +187,9 @@ internal enum EntityType { HornetSentinelSpike, HollowKnight, Radiance, + RadianceOrb, + RadianceNailComb, + RadianceNail, GreyPrinceZote, Zoteling, VolatileZoteling, diff --git a/HKMP/Resource/entity-registry.json b/HKMP/Resource/entity-registry.json index b30a186..df05bb0 100644 --- a/HKMP/Resource/entity-registry.json +++ b/HKMP/Resource/entity-registry.json @@ -1120,6 +1120,27 @@ "type": "Radiance", "fsm_name": "Control" }, + { + "base_object_name": "Radiant Orb", + "type": "RadianceOrb", + "fsm_name": "Orb Control" + }, + { + "base_object_name": "Radiant Nail Comb", + "type": "RadianceNailComb", + "fsm_name": "Control", + "components": [ + "Rotation" + ] + }, + { + "base_object_name": "Radiant Nail", + "type": "RadianceNail", + "fsm_name": "Control", + "components": [ + "Rotation" + ] + }, { "base_object_name": "Grey Prince", "type": "GreyPrinceZote",