Auto-summon pupils to the principal after fight breaks, with a corridor FIFO queue.
This commit is contained in:
@@ -331,6 +331,11 @@ internal static class PresenceSystem
|
||||
var bound = Duty.IsOtherStaff(person)
|
||||
? slot.Kind != DaySlotKind.Outside
|
||||
: slot.Kind == DaySlotKind.Lesson && lessons.Any(lesson => lesson.Period == slot.Index);
|
||||
if (DirectorSummonSystem.IsSummoned(school, person.Id))
|
||||
{
|
||||
bound = true;
|
||||
}
|
||||
|
||||
if (activity.IsActive && TalkActions.IsTalk(activity.ActionId))
|
||||
{
|
||||
if (!bound || TalkActions.IsWhisper(activity.ActionId) || TalkActions.IsFight(activity.ActionId))
|
||||
@@ -342,6 +347,11 @@ internal static class PresenceSystem
|
||||
activity = PersonActivity.Idle;
|
||||
}
|
||||
|
||||
if (activity.IsActive && ActivitySystem.IsPrincipalHearing(activity.ActionId))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!presence.IsOnCampus)
|
||||
{
|
||||
intent = Intent.None;
|
||||
@@ -354,6 +364,11 @@ internal static class PresenceSystem
|
||||
school.Catalog!,
|
||||
now,
|
||||
school.SchoolWeekDays);
|
||||
if (DirectorSummonSystem.TryDutyRoom(school, person.Id, out var summonArrive))
|
||||
{
|
||||
dest = summonArrive;
|
||||
}
|
||||
|
||||
presence = dest is null
|
||||
? Presence.OffCampus
|
||||
: PresenceStepper.StartWalk(Presence.OffCampus, walks, dest, headingHome: false);
|
||||
@@ -364,7 +379,7 @@ internal static class PresenceSystem
|
||||
return null;
|
||||
}
|
||||
|
||||
if (plan.WalkHomeAt is { } leave && now >= leave)
|
||||
if (plan.WalkHomeAt is { } leave && now >= leave && !DirectorSummonSystem.IsSummoned(school, person.Id))
|
||||
{
|
||||
activity = PersonActivity.Idle;
|
||||
intent = Intent.None;
|
||||
@@ -379,6 +394,12 @@ internal static class PresenceSystem
|
||||
school.Catalog!,
|
||||
now,
|
||||
school.SchoolWeekDays);
|
||||
if (DirectorSummonSystem.TryDutyRoom(school, person.Id, out var summonRoom))
|
||||
{
|
||||
duty = summonRoom;
|
||||
bound = true;
|
||||
}
|
||||
|
||||
if (duty is null)
|
||||
{
|
||||
activity = PersonActivity.Idle;
|
||||
@@ -416,18 +437,20 @@ internal static class PresenceSystem
|
||||
|
||||
var changing = activity.IsActive && ActivitySystem.IsChangeClothes(activity.ActionId);
|
||||
var inTalk = activity.IsActive && TalkActions.IsTalk(activity.ActionId);
|
||||
var inHearing = activity.IsActive && ActivitySystem.IsPrincipalHearing(activity.ActionId);
|
||||
|
||||
if (decision.WalkTo is not null
|
||||
&& !decision.WalkTo.Equals(presence.NodeId, StringComparison.Ordinal)
|
||||
&& activity.IsActive
|
||||
&& !changing
|
||||
&& !inTalk)
|
||||
&& !inTalk
|
||||
&& !inHearing)
|
||||
{
|
||||
activity = PersonActivity.Idle;
|
||||
}
|
||||
|
||||
intent = decision.Intent;
|
||||
if (decision.WalkTo is not null && !changing && !inTalk)
|
||||
if (decision.WalkTo is not null && !changing && !inTalk && !inHearing)
|
||||
{
|
||||
presence = PresenceStepper.StartWalk(presence, walks, decision.WalkTo, headingHome: false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user