Skip to content

Commit

Permalink
Improvements to Radiance
Browse files Browse the repository at this point in the history
  • Loading branch information
Extremelyd1 committed Dec 25, 2023
1 parent 479d8f3 commit af1fdd8
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
41 changes: 41 additions & 0 deletions HKMP/Game/Client/Entity/Action/EntityFsmActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 46 additions & 0 deletions HKMP/Game/Client/Entity/EntitySpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,24 @@ List<PlayMakerFSM> 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;
}

Expand Down Expand Up @@ -437,4 +455,32 @@ private static GameObject SpawnGrimmFirebatObject(PlayMakerFSM fsm) {

return SpawnFromGlobalPool(action, gameObject);
}

private static GameObject SpawnRadianceOrb(PlayMakerFSM fsm) {
var action = fsm.GetFirstAction<SpawnObjectFromGlobalPool>("Spawn Fireball");
var gameObject = action.gameObject.Value;

return SpawnFromGlobalPool(action, gameObject);
}

private static GameObject SpawnRadianceNail(PlayMakerFSM fsm) {
var action = fsm.GetFirstAction<SpawnObjectFromGlobalPool>("CW Spawn");
var gameObject = action.gameObject.Value;

return SpawnFromGlobalPool(action, gameObject);
}

private static GameObject SpawnRadianceNailComb(PlayMakerFSM fsm) {
var action = fsm.GetFirstAction<SpawnObjectFromGlobalPool>("Comb Top");
var gameObject = action.gameObject.Value;

return SpawnFromGlobalPool(action, gameObject);
}

private static GameObject SpawnRadianceNailFromComb(PlayMakerFSM fsm) {
var action = fsm.GetFirstAction<SpawnObjectFromGlobalPool>("RG1");
var gameObject = action.gameObject.Value;

return SpawnFromGlobalPool(action, gameObject);
}
}
3 changes: 3 additions & 0 deletions HKMP/Game/Client/Entity/EntityType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ internal enum EntityType {
HornetSentinelSpike,
HollowKnight,
Radiance,
RadianceOrb,
RadianceNailComb,
RadianceNail,
GreyPrinceZote,
Zoteling,
VolatileZoteling,
Expand Down
21 changes: 21 additions & 0 deletions HKMP/Resource/entity-registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit af1fdd8

Please sign in to comment.