Priority Deliveries (#36968)

This commit is contained in:
ScarKy0
2025-04-27 11:13:52 +02:00
committed by GitHub
parent 497f43ec65
commit 2a5cf10aa6
9 changed files with 230 additions and 13 deletions

View File

@@ -69,7 +69,7 @@ public abstract class SharedDeliverySystem : EntitySystem
var multiplier = GetDeliveryMultiplier(ent);
var totalSpesos = Math.Round(ent.Comp.BaseSpesoReward * multiplier);
args.PushMarkup(Loc.GetString("delivery-earnings-examine", ("spesos", totalSpesos)));
args.PushMarkup(Loc.GetString("delivery-earnings-examine", ("spesos", totalSpesos)), -1);
}
}
@@ -238,7 +238,18 @@ public abstract class SharedDeliverySystem : EntitySystem
// If we're trying to unlock, always remove the priority tape
if (!isLocked)
_appearance.SetData(uid, DeliveryVisuals.IsPriority, false);
_appearance.SetData(uid, DeliveryVisuals.PriorityState, DeliveryPriorityState.Off);
}
public void UpdatePriorityVisuals(Entity<DeliveryPriorityComponent> ent)
{
if (!TryComp<DeliveryComponent>(ent, out var delivery))
return;
if (delivery.IsLocked && !delivery.IsOpened)
{
_appearance.SetData(ent, DeliveryVisuals.PriorityState, ent.Comp.Expired ? DeliveryPriorityState.Inactive : DeliveryPriorityState.Active);
}
}
protected void UpdateDeliverySpawnerVisuals(EntityUid uid, int contents)
@@ -257,7 +268,10 @@ public abstract class SharedDeliverySystem : EntitySystem
var ev = new GetDeliveryMultiplierEvent();
RaiseLocalEvent(ent, ref ev);
return ev.AdditiveMultiplier * ev.MultiplicativeMultiplier;
// Ensure the multiplier can never go below 0.
var totalMultiplier = Math.Max(ev.AdditiveMultiplier * ev.MultiplicativeMultiplier, 0);
return totalMultiplier;
}
protected virtual void GrantSpesoReward(Entity<DeliveryComponent?> ent) { }