Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: add on obj created thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 10, 2024
1 parent 915a519 commit 6212e49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 5 additions & 2 deletions RotationSolver.Basic/Rotations/Duties/DutyRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using ECommons.Hooks.ActionEffectTypes;

namespace RotationSolver.Basic.Rotations.Duties;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

partial class DutyRotation : IDisposable
{
Expand Down Expand Up @@ -406,6 +405,11 @@ private void CanInvoke(float last, uint id)
}
}

public virtual void OnNewActor(GameObject actor)
{

}

public virtual void OnActorVfxNew(in VfxNewData data)
{

Expand Down Expand Up @@ -445,4 +449,3 @@ internal IAction[] AllActions
}
}
}
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
16 changes: 15 additions & 1 deletion RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ internal static partial class TargetUpdater
static readonly ObjectListDelay<BattleChara>
_raisePartyTargets = new(() => Service.Config.RaiseDelay),
_raiseAllTargets = new(() => Service.Config.RaiseDelay);

internal unsafe static void UpdateTarget()
{
var battles = Svc.Objects.OfType<BattleChara>();

DataCenter.AllTargets.Delay(battles.GetObjectInRadius(30));
UpdateHostileTargets(DataCenter.AllTargets);
UpdateFriends(DataCenter.AllTargets
Expand All @@ -26,6 +26,20 @@ internal unsafe static void UpdateTarget()
UpdateNamePlate(battles);
}

private static GameObject[] _lastObjs = [];
private static void UpdateNewCharactors()
{
foreach (var obj in Svc.Objects.Except(_lastObjs))
{
#if DEBUG
Svc.Log.Debug($"Find a new object {obj.Name.TextValue}");
#endif
DataCenter.RightNowDutyRotation?.OnNewActor(obj);
}

_lastObjs = [.. Svc.Objects];
}

private static DateTime _lastUpdateTimeToKill = DateTime.MinValue;
private static readonly TimeSpan _timeToKillSpan = TimeSpan.FromSeconds(0.5);
private static void UpdateTimeToKill(IEnumerable<BattleChara> allTargets)
Expand Down

0 comments on commit 6212e49

Please sign in to comment.