Updated knight for v62 coilhead
Knight enters a brief cooldown after attacking Fixed knight LOS not working for 5+ players (I'm going to strangle zeekers)
This commit is contained in:
parent
523e7ed898
commit
a2531e246f
|
@ -41,6 +41,10 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
private bool setOnCooldown;
|
private bool setOnCooldown;
|
||||||
public float timeAtLastCooldown;
|
public float timeAtLastCooldown;
|
||||||
|
|
||||||
|
private Vector3 previousPosition;
|
||||||
|
private float checkPositionInterval;
|
||||||
|
private bool isMakingDistance;
|
||||||
|
|
||||||
// Token: 0x04000F2A RID: 3882
|
// Token: 0x04000F2A RID: 3882
|
||||||
private bool inCooldownAnimation;
|
private bool inCooldownAnimation;
|
||||||
|
|
||||||
|
@ -56,16 +60,16 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
}
|
}
|
||||||
|
|
||||||
[ServerRpc(RequireOwnership = false)]
|
[ServerRpc(RequireOwnership = false)]
|
||||||
public void SetCoilheadOnCooldownServerRpc(bool setTrue) {
|
public void SetCoilheadOnCooldownServerRpc(float cooldown) {
|
||||||
SetCoilheadOnCooldownClientRpc(setTrue);
|
SetCoilheadOnCooldownClientRpc(cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Token: 0x06000F6F RID: 3951 RVA: 0x000942FC File Offset: 0x000924FC
|
// Token: 0x06000F6F RID: 3951 RVA: 0x000942FC File Offset: 0x000924FC
|
||||||
[ClientRpc]
|
[ClientRpc]
|
||||||
public void SetCoilheadOnCooldownClientRpc(bool setTrue) {
|
public void SetCoilheadOnCooldownClientRpc(float cooldown) {
|
||||||
timeSpentMoving = 0f;
|
timeSpentMoving = 0f;
|
||||||
if (setTrue) {
|
if (cooldown > 0f) {
|
||||||
onCooldownPhase = 20f;
|
onCooldownPhase = cooldown;
|
||||||
setOnCooldown = true;
|
setOnCooldown = true;
|
||||||
inCooldownAnimation = true;
|
inCooldownAnimation = true;
|
||||||
SwitchToBehaviourStateOnLocalClient(0);
|
SwitchToBehaviourStateOnLocalClient(0);
|
||||||
|
@ -77,6 +81,7 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onCooldownPhase = 0f;
|
onCooldownPhase = 0f;
|
||||||
setOnCooldown = false;
|
setOnCooldown = false;
|
||||||
timeAtLastCooldown = Time.realtimeSinceStartup;
|
timeAtLastCooldown = Time.realtimeSinceStartup;
|
||||||
|
@ -143,7 +148,7 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
|
|
||||||
if (setOnCooldown) {
|
if (setOnCooldown) {
|
||||||
setOnCooldown = false;
|
setOnCooldown = false;
|
||||||
SetCoilheadOnCooldownClientRpc(false);
|
SetCoilheadOnCooldownClientRpc(0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
loseAggroTimer = 0f;
|
loseAggroTimer = 0f;
|
||||||
|
@ -198,6 +203,7 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
offMeshLinkCoroutine = null;
|
offMeshLinkCoroutine = null;
|
||||||
var currentOffMeshLinkData = agent.currentOffMeshLinkData;
|
var currentOffMeshLinkData = agent.currentOffMeshLinkData;
|
||||||
agent.CompleteOffMeshLink();
|
agent.CompleteOffMeshLink();
|
||||||
|
|
||||||
if (currentOffMeshLinkData.valid) {
|
if (currentOffMeshLinkData.valid) {
|
||||||
if (Vector3.SqrMagnitude(transform.position - currentOffMeshLinkData.startPos) < Vector3.SqrMagnitude(transform.position - currentOffMeshLinkData.endPos)) {
|
if (Vector3.SqrMagnitude(transform.position - currentOffMeshLinkData.startPos) < Vector3.SqrMagnitude(transform.position - currentOffMeshLinkData.endPos)) {
|
||||||
agent.Warp(currentOffMeshLinkData.startPos);
|
agent.Warp(currentOffMeshLinkData.startPos);
|
||||||
|
@ -286,7 +292,7 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
}
|
}
|
||||||
|
|
||||||
var flag = false;
|
var flag = false;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) {
|
||||||
if (PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && (StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 0.25f, 68f, 60, -1f) || StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 1.6f, 68f, 60, -1f)) && Vector3.Distance(StartOfRound.Instance.allPlayerScripts[i].gameplayCamera.transform.position, eye.position) > 0.3f) {
|
if (PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && (StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 0.25f, 68f, 60, -1f) || StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 1.6f, 68f, 60, -1f)) && Vector3.Distance(StartOfRound.Instance.allPlayerScripts[i].gameplayCamera.transform.position, eye.position) > 0.3f) {
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
@ -301,12 +307,9 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var num = 0f;
|
||||||
if (stoppingMovement) {
|
if (stoppingMovement) {
|
||||||
if (!animStopPoints.canAnimationStop && stopMovementTimer <= 0.27f) {
|
if (animStopPoints.canAnimationStop || stopMovementTimer > 0.27f) {
|
||||||
stopMovementTimer += Time.deltaTime;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasStopped) {
|
if (!hasStopped) {
|
||||||
hasStopped = true;
|
hasStopped = true;
|
||||||
DoSpringAnimation(false);
|
DoSpringAnimation(false);
|
||||||
|
@ -315,6 +318,10 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
DoSpringAnimation(true);
|
DoSpringAnimation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RoundManager.Instance.currentMineshaftElevator != null && Vector3.Distance(transform.position, RoundManager.Instance.currentMineshaftElevator.elevatorInsidePoint.position) < 1f) {
|
||||||
|
num = 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
if (mainCollider.isTrigger && Vector3.Distance(GameNetworkManager.Instance.localPlayerController.transform.position, transform.position) > 0.3f) {
|
if (mainCollider.isTrigger && Vector3.Distance(GameNetworkManager.Instance.localPlayerController.transform.position, transform.position) > 0.3f) {
|
||||||
mainCollider.isTrigger = false;
|
mainCollider.isTrigger = false;
|
||||||
}
|
}
|
||||||
|
@ -325,35 +332,57 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
agent.speed = 0f;
|
agent.speed = 0f;
|
||||||
movingTowardsTargetPlayer = false;
|
movingTowardsTargetPlayer = false;
|
||||||
SetDestinationToPosition(transform.position, false);
|
SetDestinationToPosition(transform.position, false);
|
||||||
return;
|
}
|
||||||
|
} else {
|
||||||
|
stopMovementTimer += Time.deltaTime;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stopMovementTimer = 0f;
|
stopMovementTimer = 0f;
|
||||||
if (hasStopped) {
|
if (hasStopped) {
|
||||||
hasStopped = false;
|
hasStopped = false;
|
||||||
mainCollider.isTrigger = true;
|
mainCollider.isTrigger = true;
|
||||||
|
isMakingDistance = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, currentChaseSpeed * 0.4597f, 5f * Time.deltaTime);
|
currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, currentChaseSpeed * 0.4597f, 5f * Time.deltaTime);
|
||||||
creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed);
|
creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed);
|
||||||
inCooldownAnimation = false;
|
inCooldownAnimation = false;
|
||||||
|
|
||||||
if (IsServer) {
|
if (IsServer) {
|
||||||
timeSpentMoving += Time.deltaTime;
|
if (checkPositionInterval <= 0f) {
|
||||||
if (timeSpentMoving > 20f)
|
checkPositionInterval = 0.65f;
|
||||||
{
|
isMakingDistance = (Vector3.Distance(transform.position, previousPosition) > 0.5f);
|
||||||
onCooldownPhase = 20f;
|
previousPosition = transform.position;
|
||||||
setOnCooldown = true;
|
} else {
|
||||||
inCooldownAnimation = true;
|
checkPositionInterval -= Time.deltaTime;
|
||||||
SetCoilheadOnCooldownClientRpc(true);
|
|
||||||
SwitchToBehaviourStateOnLocalClient(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isMakingDistance) {
|
||||||
|
num = 1f;
|
||||||
|
} else {
|
||||||
|
num = 0.2f;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (IsOwner) {
|
if (IsOwner) {
|
||||||
agent.speed = Mathf.Lerp(agent.speed, currentChaseSpeed, 4.5f * Time.deltaTime);
|
agent.speed = Mathf.Lerp(agent.speed, currentChaseSpeed, 4.5f * Time.deltaTime);
|
||||||
movingTowardsTargetPlayer = true;
|
movingTowardsTargetPlayer = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsServer) {
|
||||||
|
if (num > 0f) {
|
||||||
|
timeSpentMoving += Time.deltaTime * num;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeSpentMoving > 9f) {
|
||||||
|
onCooldownPhase = 11f;
|
||||||
|
setOnCooldown = true;
|
||||||
|
inCooldownAnimation = true;
|
||||||
|
SetCoilheadOnCooldownClientRpc(25f);
|
||||||
|
SwitchToBehaviourStateOnLocalClient(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Token: 0x06000F75 RID: 3957 RVA: 0x00094F98 File Offset: 0x00093198
|
// Token: 0x06000F75 RID: 3957 RVA: 0x00094F98 File Offset: 0x00093198
|
||||||
|
@ -393,6 +422,8 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
playerControllerB.DamagePlayer(90, true, true, CauseOfDeath.Mauling, 0);
|
playerControllerB.DamagePlayer(90, true, true, CauseOfDeath.Mauling, 0);
|
||||||
playerControllerB.JumpToFearLevel(1f, true);
|
playerControllerB.JumpToFearLevel(1f, true);
|
||||||
timeSinceHittingPlayer = Time.realtimeSinceStartup;
|
timeSinceHittingPlayer = Time.realtimeSinceStartup;
|
||||||
|
|
||||||
|
SetCoilheadOnCooldownServerRpc(5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace ScarletMansion {
|
||||||
public class Plugin : BaseUnityPlugin {
|
public class Plugin : BaseUnityPlugin {
|
||||||
public const string modGUID = "dev.ladyalice.scarletmansion";
|
public const string modGUID = "dev.ladyalice.scarletmansion";
|
||||||
private const string modName = "Scarlet Mansion";
|
private const string modName = "Scarlet Mansion";
|
||||||
private const string modVersion = "1.3.24";
|
private const string modVersion = "1.3.25";
|
||||||
|
|
||||||
public readonly Harmony harmony = new Harmony(modGUID);
|
public readonly Harmony harmony = new Harmony(modGUID);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue