-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync leviathans gameplay #2106
base: master
Are you sure you want to change the base?
Sync leviathans gameplay #2106
Conversation
Would require some tests :) |
1fcd2d9
to
3762c2c
Compare
There's still the following to be looked into (but most of the code is ready for review):
|
NitroxPatcher/Patches/Dynamic/Creature_ChooseBestAction_Patch.cs
Outdated
Show resolved
Hide resolved
NitroxPatcher/Patches/Dynamic/AttackCyclops_UpdateAggression_Patch.cs
Outdated
Show resolved
Hide resolved
float aggressiveToNoise = __instance.aggressiveToNoise.Value; | ||
|
||
Resolve<IPacketSender>().Send(new AttackCyclopsTargetChanged(creatureId, targetId, aggressiveToNoise)); | ||
ErrorMessage.AddMessage($"[SEND] {__instance.gameObject.name} attacks {__instance.currentTarget.name}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinning debug message so it's not forgotten.
NitroxPatcher/Patches/Dynamic/AttackCyclops_OnCollisionEnter_Patch.cs
Outdated
Show resolved
Hide resolved
NitroxPatcher/Patches/Dynamic/SeamothTorpedoWhirlpool_Register_Patch.cs
Outdated
Show resolved
Hide resolved
The latest Sea Dragons sync code wasn't tested because it's really hard without #2113 |
NitroxServer/Communication/Packets/Processors/SeaDragonAttackTargetProcessor.cs
Outdated
Show resolved
Hide resolved
NitroxServer/Communication/Packets/Processors/AggressiveWhenSeeTargetChangedProcessor.cs
Show resolved
Hide resolved
NitroxPatcher/Patches/Dynamic/SeaDrargon_ReleaseExosuit_Patch.cs
Outdated
Show resolved
Hide resolved
NitroxPatcher/Patches/Dynamic/RangedAttackLastTarget_StartCasting_Patch.cs
Outdated
Show resolved
Hide resolved
NitroxPatcher/Patches/Dynamic/RangedAttackLastTarget_StartCharging_Patch.cs
Outdated
Show resolved
Hide resolved
862ae97
to
bad5975
Compare
// TODO: Adapt this code when #1780 is merged | ||
Utils.PlayEnvSound(seaDragonMeleeAttack.attackSound, collider.transform.position, 20f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1780 is now merged :D
torpedo.tr.rotation = rotation; | ||
torpedo.OnHit(default); | ||
torpedo.Deactivate(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not heaving the component an expected case? Or should it be logged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the local player, the torpedo might have already exploded while the packet is received with latency. i'll add a comment explaining it
NitroxServer/Communication/Packets/Processors/AggressiveWhenSeeTargetChangedProcessor.cs
Show resolved
Hide resolved
NitroxPatcher/Patches/Dynamic/RangedAttackLastTarget_StartCharging_Patch.cs
Outdated
Show resolved
Hide resolved
// In this method, players are priority targets. This will also account for the local player case | ||
IEcoTarget ecoTarget = EcoRegionManager.main.FindNearestTarget(RemotePlayer.PLAYER_ECO_TARGET_TYPE, __instance.transform.position, __instance.isTargetValidFilter, __instance.maxSearchRings); | ||
if (ecoTarget != null && __instance.IsTargetValid(ecoTarget.GetGameObject())) | ||
{ | ||
__result = ecoTarget.GetGameObject(); | ||
return false; | ||
} | ||
|
||
// To redirect the call to base.GetAggressionTarget(), we ensure the if is skipped in the original method | ||
float timeLastPlayerAttack = __instance.timeLastPlayerAttack; | ||
__instance.timeLastPlayerAttack = Time.time; | ||
|
||
__result = __instance.GetAggressionTarget(); | ||
|
||
__instance.timeLastPlayerAttack = timeLastPlayerAttack; | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this now also target the local player? I don't know if the local player is included in RemotePlayer.PLAYER_ECO_TARGET_TYPE
so maybe this comment is pointless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This target type is applied to the local player too in PlayerInitialSyncProcessor.SetPlayerGameObjectId
, so yes the local player will still be targetted
* BroadcastSeaDragonAttackRemotePlayer(this, target); <---- INSERTED LINE | ||
* if (component4 != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a little to early, no? Broadcasting before all checks are done if the exosuit can even be grabed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, all that counts is whether or not component4
is null, which I check in BroadcastSeaDragonAttackRemotePlayer
so the broadcast is fine at this place
return new CodeMatcher(instructions).End() | ||
.InsertAndAdvance([ | ||
new CodeInstruction(OpCodes.Ldarg_0), | ||
new CodeInstruction(OpCodes.Ldarg_1), | ||
new CodeInstruction(OpCodes.Ldarg_2), | ||
new CodeInstruction(OpCodes.Call, Reflect.Method(() => BroadcastSwatAttack(default, default, default))) | ||
]) | ||
.InstructionEnumeration(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this works? won't this add the instructions after the ret?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I am. It does add instructions before the ret.
…th inventory not storing torpedos
… creature type whitelist
c6f169c
to
93619cb
Compare
Creature sync:
Creature behaviours:
Weapon sync:
Other related issues:
TODO when everything is done:
- [ ] Ensure crash fishes can target other playersPOSTPONED to another PR (will be short but required both this one and #2101 )