Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,134 @@
using GamePath;
using System.Collections.Generic;
using System.Runtime.Remoting.Messaging;
using UnityEngine;
public class EAIFollowPlayer : EAIApproachAndAttackTarget
{
private readonly List<Entity> NearbyEntities = new List<Entity>();
private EntityAlive entityTarget;
private Vector3 entityTargetPos;
private Vector3 entityTargetVel;
public bool isTargetToEat;
private bool isEating;
private float homeTimeout;
private bool hasHome;
private bool isGoingHome;
private int pathCounter;
private float chaseTimeMax;
private int relocateTicks;
private int attackTimeout;
public override bool CanExecute()
{
return true;
}
public override void Start()
{
if (entityTarget != null)
{
this.entityTargetPos = this.entityTarget.position;
this.isTargetToEat = this.entityTarget.IsDead();
}
this.entityTargetVel = Vector3.zero;
this.isEating = false;
this.theEntity.IsEating = false;
this.homeTimeout = (this.theEntity.IsSleeper ? 90f : this.chaseTimeMax);
this.hasHome = (this.homeTimeout > 0f);
this.isGoingHome = false;
if (this.theEntity.ChaseReturnLocation == Vector3.zero)
{
this.theEntity.ChaseReturnLocation = (this.theEntity.IsSleeper ? this.theEntity.SleeperSpawnPosition : this.theEntity.position);
}
this.pathCounter = 0;
this.relocateTicks = 0;
this.attackTimeout = 5;
}
public override void Update()
{
//Log.Out("EAIFollowPlayer-Update START");
// No entity, so no need to do anything.
if (entityTarget == null)
{
Log.Out("EAIFollowPlayer-Update entityTarget == null");
EntityPlayer closestPlayer = null;
float num = 200 * 200;
float num2 = float.MaxValue;
for (int i = this.theEntity.world.Players.list.Count - 1; i >= 0; i--)
{
EntityPlayer entityPlayer = this.theEntity.world.Players.list[i];
if (!entityPlayer.IsDead() && entityPlayer.Spawned)
{
//Log.Out("FOUND PLAYER: " + entityPlayer.EntityName);
float distanceSq = entityPlayer.GetDistanceSq(this.theEntity.position);
if (distanceSq < num2 && distanceSq <= num)
{
num2 = distanceSq;
closestPlayer = entityPlayer;
}
}
}
if (closestPlayer != null)
{
entityTarget = closestPlayer;
}
else
{
return;
}
}
else
{
entityTargetPos = entityTarget.position;
}
// Let the entity keep looking at you, otherwise it may just sping around.
theEntity.SetLookPosition(entityTargetPos);
theEntity.RotateTo(entityTargetPos.x, entityTargetPos.y + 2, entityTargetPos.z, 8f, 8f);
//Log.Out("EAIFollowPlayer-Update entityTargetPos: " + entityTargetPos);
var a = theEntity.position - entityTargetPos;
if (a.sqrMagnitude < 20f)
{
//Log.Out("EAIFollowPlayer-Update Entity is too close. Ending pathing.");
//DisplayLog("Entity is too close. Ending pathing.");
pathCounter = 0;
return;
}
theEntity.moveHelper.CalcIfUnreachablePos();
// if the entity is not calculating a path, check how many nodes are left, and reset the path counter if its too low.
if (!PathFinderThread.Instance.IsCalculatingPath(theEntity.entityId))
{
var path = theEntity.navigator.getPath();
if (path != null && path.NodeCountRemaining() <= 2)
pathCounter = 0;
}
if (--pathCounter <= 0 && !PathFinderThread.Instance.IsCalculatingPath(theEntity.entityId))
{
//DisplayLog(" Path Counter is 0: Finding new path to " + entityTargetPos);
// If its still not calculating a path, find a new path to the leader
pathCounter = 6 + theEntity.rand.RandomRange(10);
PathFinderThread.Instance.FindPath(theEntity, entityTarget.position, theEntity.GetMoveSpeedAggro(), true, this);
}
if (theEntity.Climbing)
{
//Log.Out("EAIFollowPlayer-Update Entity is climbing");
return;
}
// If there's no path, calculate one.
if (theEntity.navigator.noPathAndNotPlanningOne())
{
//DisplayLog("No Path and Not Planning One. Searching for new path to : " + entityTargetPos);
PathFinderThread.Instance.FindPath(theEntity, entityTarget.position, theEntity.GetMoveSpeedAggro(), true, this);
}
}
}

View File

@@ -0,0 +1,110 @@
using System;
using UnityEngine;
using UnityEngine.Scripting;
[Preserve]
public class EAILookCompanion : EAIBase
{
public EAILookCompanion()
{
this.MutexBits = 1;
}
public override bool CanExecute()
{
if (this.theEntity.Buffs.GetCustomVar("onMission") == 1f)
{
return false;
}
//Log.Out("EAILookCompanion-CanExecute START");
if (this.theEntity.Buffs.GetCustomVar("$Leader") == 0f)
{
return false;
}
bool stopAttacking = this.theEntity.Buffs.HasBuff("buffNPCModStopAttacking") ||
this.theEntity.Buffs.HasBuff("FuriousRamsayStandStill");
if (stopAttacking)
{
//Log.Out("EAILookCompanion-CanExecute STOP ATTACKING OR STAND STILL");
this.theEntity.SetRevengeTarget(null);
this.theEntity.SetAttackTarget(null, 0);
return false;
}
if (this.theEntity.GetAttackTarget() != null)
{
return false;
}
return this.manager.lookTime > 0f;
}
public override void Start()
{
this.waitTicks = (int)(this.manager.lookTime * 20f);
this.manager.lookTime = 0f;
this.theEntity.GetEntitySenses().Clear();
this.viewTicks = 0;
this.theEntity.Jumping = false;
this.theEntity.moveHelper.Stop();
}
public override bool Continue()
{
if (this.theEntity.Buffs.GetCustomVar("onMission") == 1f)
{
return false;
}
bool stopAttacking = this.theEntity.Buffs.HasBuff("buffNPCModStopAttacking") ||
this.theEntity.Buffs.HasBuff("FuriousRamsayStandStill");
if (stopAttacking)
{
//Log.Out("EAILookCompanion-CanExecute STOP ATTACKING OR STAND STILL");
this.theEntity.SetRevengeTarget(null);
this.theEntity.SetAttackTarget(null, 0);
return false;
}
//Log.Out("EAILookCompanion-Continue START");
if (this.theEntity.bodyDamage.CurrentStun != EnumEntityStunType.None)
{
return false;
}
this.waitTicks--;
if (this.waitTicks <= 0)
{
return false;
}
this.viewTicks--;
if (this.viewTicks <= 0)
{
this.viewTicks = 40;
Vector3 headPosition = this.theEntity.getHeadPosition();
Vector3 vector = this.theEntity.GetForwardVector();
vector = Quaternion.Euler(base.RandomFloat * 60f - 30f, base.RandomFloat * 120f - 60f, 0f) * vector;
this.theEntity.SetLookPosition(headPosition + vector);
}
return true;
}
public override void Reset()
{
this.theEntity.SetLookPosition(Vector3.zero);
}
public override string ToString()
{
return string.Format("{0}, wait {1}", base.ToString(), ((float)this.waitTicks / 20f).ToCultureInvariantString());
}
private int waitTicks;
private int viewTicks;
}