-
Notifications
You must be signed in to change notification settings - Fork 57
feat: Implement Titan Nape Hook Removal on Hard difficulty (Issue #317) #333
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
base: main
Are you sure you want to change the base?
Conversation
| } | ||
| } | ||
|
|
||
| protected virtual IEnumerator NapeHookRemovalCoroutine(Hook hook) |
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.
We generally don't do timers/state transitions outside the main loop or physics loop as it 1. disconnects the logic from the main state machine and 2. the timer for coroutines isn't consistent.
| public virtual void OnHooked(Hook hook, Collider part) | ||
| { | ||
| bool isHardDifficulty = (int)SettingsManager.InGameCurrent.General.Difficulty.Value >= (int)GameDifficulty.Hard; | ||
| bool isNapeHit = part.gameObject.CompareTag("TitanNape"); |
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.
|
Used angles to find the nape hitbox now, exactly the back side. |
AutumnThyme
left a comment
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.
Sorry for the delay, there's other issues in the code.
I'm not sure if your solution will work in multiplayer.
It only handles one hook at a time and it makes assumptions about the owner of objects (local player owns hooks, masterclient owns all titans and controls the ai)
if a local player hooks a titan and notifies its instance of the titan that its hooked, the host has no idea and this state will just be ignored or corrupt some code later on due to mismatched state.
I'd recommend breaking this down into 4 things.
Hook signals to owner of titan its state on Hooked and if it was hooked, it must signal an unhook to the owner of the titan as well.
Titan owner sees this information and does its state management and disconnects hooks.
Titan signals back to hook and says it was removed.
Hook must determine if locally the hook that was removed was the hook on the titan or if the hook had already been released and/or attached to something new.
|
|
||
| float angle = Vector3.Angle(Cache.Transform.forward, hitDirection); | ||
|
|
||
| bool hitTheBack = angle > 120f; |
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.
Move this value into the titan config json
| } | ||
| else | ||
| { | ||
| _napeHookAnimDuration = 1.21f; |
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.
Move timing/size/attr constants into the titan config json for ease of modification by playtesters
| { | ||
| _napeHookToRemove.Detach(); | ||
| } | ||
| _napeHookToRemove = 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.
What happens in multiplayer when multiple people hook the neck?
|
|
||
| var titan = obj.transform.root.GetComponent<BaseTitan>(); | ||
| if (titan != null) | ||
| titan.OnHooked(this, finalHit.collider); |
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.
Does this work off host? From a glance, This code only runs if you're the owner of the hook and all titans actions are controlled by the host.

Implemented the nape hook removal feature. On Hard and Abnormal difficulties, titans will now react to hooks attached to their neck.
The reused animation is
"Amarture_VER2|grab.head.back.l", which is assigned to a newUnhookNapeanimation property.How It Works
Hook.cs:FixedUpdateHookingconfirms a successful hit (foundHit), it now notifies the titan that it has been hooked and sends a reference to the specific collider that was hit.Hook.csto allow the titan to check if the hook is still attached and to force it to detach.BaseTitan.cs:OnHooked(), receives the notification from the hook.Hardor greater.neck. If both conditions are met, it starts theNapeHookRemovalCoroutine.The Coroutine:
UnhookNapeanimation is played immediately.Notes
NapeHurtbox, but debugging showed that the hook's raycast always detects the largerneckcollider first. Tagging theneckinstead makes the feature work reliably without affecting the existing damage logic.