Merge remote-tracking branch 'refs/remotes/upstream/master' into ed-17-05-2024-upstream
This commit is contained in:
@@ -27,6 +27,9 @@ public sealed class IdCardSystem : SharedIdCardSystem
|
||||
|
||||
private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowavedEvent args)
|
||||
{
|
||||
if (!component.CanMicrowave)
|
||||
return;
|
||||
|
||||
if (TryComp<AccessComponent>(uid, out var access))
|
||||
{
|
||||
float randomPick = _random.NextFloat();
|
||||
|
||||
@@ -205,47 +205,30 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!flammable.OnFire && !otherFlammable.OnFire)
|
||||
return; // Neither are on fire
|
||||
|
||||
if (flammable.OnFire && otherFlammable.OnFire)
|
||||
// Both are on fire -> equalize fire stacks.
|
||||
// Weight each thing's firestacks by its mass
|
||||
var mass1 = 1f;
|
||||
var mass2 = 1f;
|
||||
if (_physicsQuery.TryComp(uid, out var physics) && _physicsQuery.TryComp(otherUid, out var otherPhys))
|
||||
{
|
||||
// Both are on fire -> equalize fire stacks.
|
||||
// Weight each thing's firestacks by its mass
|
||||
var mass1 = 1f;
|
||||
var mass2 = 1f;
|
||||
if (_physicsQuery.TryComp(uid, out var physics) && _physicsQuery.TryComp(otherUid, out var otherPhys))
|
||||
{
|
||||
mass1 = physics.Mass;
|
||||
mass2 = otherPhys.Mass;
|
||||
}
|
||||
|
||||
var total = mass1 + mass2;
|
||||
var avg = (flammable.FireStacks * mass1 + otherFlammable.FireStacks * mass2) / total;
|
||||
flammable.FireStacks = flammable.CanExtinguish ? avg : Math.Max(flammable.FireStacks, avg);
|
||||
otherFlammable.FireStacks = otherFlammable.CanExtinguish ? avg : Math.Max(otherFlammable.FireStacks, avg);
|
||||
UpdateAppearance(uid, flammable);
|
||||
UpdateAppearance(otherUid, otherFlammable);
|
||||
return;
|
||||
mass1 = physics.Mass;
|
||||
mass2 = otherPhys.Mass;
|
||||
}
|
||||
|
||||
// Only one is on fire -> attempt to spread the fire.
|
||||
var (srcUid, srcFlammable, destUid, destFlammable) = flammable.OnFire
|
||||
? (uid, flammable, otherUid, otherFlammable)
|
||||
: (otherUid, otherFlammable, uid, flammable);
|
||||
// when the thing on fire is more massive than the other, the following happens:
|
||||
// - the thing on fire loses a small number of firestacks
|
||||
// - the other thing gains a large number of firestacks
|
||||
// so a person on fire engulfs a mouse, but an engulfed mouse barely does anything to a person
|
||||
var total = mass1 + mass2;
|
||||
var avg = (flammable.FireStacks + otherFlammable.FireStacks) / total;
|
||||
|
||||
// if the thing on fire has less mass, spread less firestacks and vice versa
|
||||
var ratio = 0.5f;
|
||||
if (_physicsQuery.TryComp(srcUid, out var srcPhysics) && _physicsQuery.TryComp(destUid, out var destPhys))
|
||||
{
|
||||
ratio *= srcPhysics.Mass / destPhys.Mass;
|
||||
}
|
||||
|
||||
var lost = srcFlammable.FireStacks * ratio;
|
||||
destFlammable.FireStacks += lost;
|
||||
Ignite(destUid, srcUid, destFlammable);
|
||||
if (srcFlammable.CanExtinguish)
|
||||
{
|
||||
srcFlammable.FireStacks -= lost;
|
||||
UpdateAppearance(srcUid, srcFlammable);
|
||||
}
|
||||
// swap the entity losing stacks depending on whichever has the most firestack kilos
|
||||
var (src, dest) = flammable.FireStacks * mass1 > otherFlammable.FireStacks * mass2
|
||||
? (-1f, 1f)
|
||||
: (1f, -1f);
|
||||
// bring each entity to the same firestack mass, firestacks being scaled by the other's mass
|
||||
AdjustFireStacks(uid, src * avg * mass2, flammable, ignite: true);
|
||||
AdjustFireStacks(otherUid, dest * avg * mass1, otherFlammable, ignite: true);
|
||||
}
|
||||
|
||||
private void OnIsHot(EntityUid uid, FlammableComponent flammable, IsHotEvent args)
|
||||
@@ -283,17 +266,30 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
_appearance.SetData(uid, ToggleableLightVisuals.Enabled, flammable.OnFire, appearance);
|
||||
}
|
||||
|
||||
public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null)
|
||||
public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null, bool ignite = false)
|
||||
{
|
||||
if (!Resolve(uid, ref flammable))
|
||||
return;
|
||||
|
||||
flammable.FireStacks = MathF.Min(MathF.Max(flammable.MinimumFireStacks, flammable.FireStacks + relativeFireStacks), flammable.MaximumFireStacks);
|
||||
SetFireStacks(uid, flammable.FireStacks + relativeFireStacks, flammable, ignite);
|
||||
}
|
||||
|
||||
if (flammable.OnFire && flammable.FireStacks <= 0)
|
||||
public void SetFireStacks(EntityUid uid, float stacks, FlammableComponent? flammable = null, bool ignite = false)
|
||||
{
|
||||
if (!Resolve(uid, ref flammable))
|
||||
return;
|
||||
|
||||
flammable.FireStacks = MathF.Min(MathF.Max(flammable.MinimumFireStacks, stacks), flammable.MaximumFireStacks);
|
||||
|
||||
if (flammable.FireStacks <= 0)
|
||||
{
|
||||
Extinguish(uid, flammable);
|
||||
}
|
||||
else
|
||||
{
|
||||
flammable.OnFire = ignite;
|
||||
UpdateAppearance(uid, flammable);
|
||||
}
|
||||
}
|
||||
|
||||
public void Extinguish(EntityUid uid, FlammableComponent? flammable = null)
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Rotting;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -22,83 +16,16 @@ public sealed class RottingSystem : SharedRottingSystem
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
|
||||
[Dependency] private readonly ContainerSystem _container = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PerishableComponent, MapInitEvent>(OnPerishableMapInit);
|
||||
SubscribeLocalEvent<PerishableComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||
SubscribeLocalEvent<PerishableComponent, ExaminedEvent>(OnPerishableExamined);
|
||||
|
||||
SubscribeLocalEvent<RottingComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<RottingComponent, MobStateChangedEvent>(OnRottingMobStateChanged);
|
||||
SubscribeLocalEvent<RottingComponent, BeingGibbedEvent>(OnGibbed);
|
||||
SubscribeLocalEvent<RottingComponent, RejuvenateEvent>(OnRejuvenate);
|
||||
|
||||
SubscribeLocalEvent<TemperatureComponent, IsRottingEvent>(OnTempIsRotting);
|
||||
}
|
||||
|
||||
private void OnPerishableMapInit(EntityUid uid, PerishableComponent component, MapInitEvent args)
|
||||
{
|
||||
component.RotNextUpdate = _timing.CurTime + component.PerishUpdateRate;
|
||||
}
|
||||
|
||||
private void OnMobStateChanged(EntityUid uid, PerishableComponent component, MobStateChangedEvent args)
|
||||
{
|
||||
if (args.NewMobState != MobState.Dead && args.OldMobState != MobState.Dead)
|
||||
return;
|
||||
|
||||
if (HasComp<RottingComponent>(uid))
|
||||
return;
|
||||
|
||||
component.RotAccumulator = TimeSpan.Zero;
|
||||
component.RotNextUpdate = _timing.CurTime + component.PerishUpdateRate;
|
||||
}
|
||||
|
||||
private void OnShutdown(EntityUid uid, RottingComponent component, ComponentShutdown args)
|
||||
{
|
||||
if (TryComp<PerishableComponent>(uid, out var perishable))
|
||||
{
|
||||
perishable.RotNextUpdate = TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRottingMobStateChanged(EntityUid uid, RottingComponent component, MobStateChangedEvent args)
|
||||
{
|
||||
if (args.NewMobState == MobState.Dead)
|
||||
return;
|
||||
RemCompDeferred(uid, component);
|
||||
}
|
||||
|
||||
public bool IsRotProgressing(EntityUid uid, PerishableComponent? perishable)
|
||||
{
|
||||
// things don't perish by default.
|
||||
if (!Resolve(uid, ref perishable, false))
|
||||
return false;
|
||||
|
||||
// only dead things or inanimate objects can rot
|
||||
if (TryComp<MobStateComponent>(uid, out var mobState) && !_mobState.IsDead(uid, mobState))
|
||||
return false;
|
||||
|
||||
if (_container.TryGetOuterContainer(uid, Transform(uid), out var container) &&
|
||||
HasComp<AntiRottingContainerComponent>(container.Owner))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var ev = new IsRottingEvent();
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
return !ev.Handled;
|
||||
}
|
||||
|
||||
public bool IsRotten(EntityUid uid, RottingComponent? rotting = null)
|
||||
{
|
||||
return Resolve(uid, ref rotting, false);
|
||||
}
|
||||
|
||||
private void OnGibbed(EntityUid uid, RottingComponent component, BeingGibbedEvent args)
|
||||
{
|
||||
if (!TryComp<PhysicsComponent>(uid, out var physics))
|
||||
@@ -112,36 +39,6 @@ public sealed class RottingSystem : SharedRottingSystem
|
||||
tileMix?.AdjustMoles(Gas.Ammonia, molsToDump);
|
||||
}
|
||||
|
||||
private void OnPerishableExamined(Entity<PerishableComponent> perishable, ref ExaminedEvent args)
|
||||
{
|
||||
int stage = PerishStage(perishable, MaxStages);
|
||||
if (stage < 1 || stage > MaxStages)
|
||||
{
|
||||
// We dont push an examined string if it hasen't started "perishing" or it's already rotting
|
||||
return;
|
||||
}
|
||||
|
||||
var isMob = HasComp<MobStateComponent>(perishable);
|
||||
var description = "perishable-" + stage + (!isMob ? "-nonmob" : string.Empty);
|
||||
args.PushMarkup(Loc.GetString(description, ("target", Identity.Entity(perishable, EntityManager))));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return an integer from 0 to maxStage representing how close to rotting an entity is. Used to
|
||||
/// generate examine messages for items that are starting to rot.
|
||||
/// </summary>
|
||||
public int PerishStage(Entity<PerishableComponent> perishable, int maxStages)
|
||||
{
|
||||
if (perishable.Comp.RotAfter.TotalSeconds == 0 || perishable.Comp.RotAccumulator.TotalSeconds == 0)
|
||||
return 0;
|
||||
return (int)(1 + maxStages * perishable.Comp.RotAccumulator.TotalSeconds / perishable.Comp.RotAfter.TotalSeconds);
|
||||
}
|
||||
|
||||
private void OnRejuvenate(EntityUid uid, RottingComponent component, RejuvenateEvent args)
|
||||
{
|
||||
RemCompDeferred<RottingComponent>(uid);
|
||||
}
|
||||
|
||||
private void OnTempIsRotting(EntityUid uid, TemperatureComponent component, ref IsRottingEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
@@ -149,29 +46,6 @@ public sealed class RottingSystem : SharedRottingSystem
|
||||
args.Handled = component.CurrentTemperature < Atmospherics.T0C + 0.85f;
|
||||
}
|
||||
|
||||
|
||||
public void ReduceAccumulator(EntityUid uid, TimeSpan time)
|
||||
{
|
||||
if (!TryComp<PerishableComponent>(uid, out var perishable))
|
||||
return;
|
||||
|
||||
if (!TryComp<RottingComponent>(uid, out var rotting))
|
||||
{
|
||||
perishable.RotAccumulator -= time;
|
||||
return;
|
||||
}
|
||||
var total = (rotting.TotalRotTime + perishable.RotAccumulator) - time;
|
||||
|
||||
if (total < perishable.RotAfter)
|
||||
{
|
||||
RemCompDeferred(uid, rotting);
|
||||
perishable.RotAccumulator = total;
|
||||
}
|
||||
|
||||
else
|
||||
rotting.TotalRotTime = total - perishable.RotAfter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is anything speeding up the decay?
|
||||
/// e.g. buried in a grave
|
||||
|
||||
@@ -107,9 +107,8 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
quantity = sol.Volume;
|
||||
reagentColor = sol.GetColor(_prototypeManager);
|
||||
}
|
||||
var storedAmount = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", quantity));
|
||||
|
||||
inventory.Add(new ReagentInventoryItem(storageSlotId, reagentLabel, storedAmount, reagentColor));
|
||||
inventory.Add(new ReagentInventoryItem(storageSlotId, reagentLabel, quantity, reagentColor));
|
||||
}
|
||||
|
||||
return inventory;
|
||||
|
||||
@@ -27,7 +27,7 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly RadioSystem _radio = default!;
|
||||
[Dependency] private readonly SharedIdCardSystem _idCard = default!;
|
||||
[Dependency] private readonly StationRecordsSystem _stationRecords = default!;
|
||||
[Dependency] private readonly StationRecordsSystem _records = default!;
|
||||
[Dependency] private readonly StationSystem _station = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||
|
||||
@@ -80,7 +80,7 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS
|
||||
if (!CheckSelected(ent, msg.Actor, out var mob, out var key))
|
||||
return;
|
||||
|
||||
if (!_stationRecords.TryGetRecord<CriminalRecord>(key.Value, out var record) || record.Status == msg.Status)
|
||||
if (!_records.TryGetRecord<CriminalRecord>(key.Value, out var record) || record.Status == msg.Status)
|
||||
return;
|
||||
|
||||
// validate the reason
|
||||
@@ -106,7 +106,7 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS
|
||||
// will probably never fail given the checks above
|
||||
_criminalRecords.TryChangeStatus(key.Value, msg.Status, msg.Reason);
|
||||
|
||||
var name = RecordName(key.Value);
|
||||
var name = _records.RecordName(key.Value);
|
||||
var officer = Loc.GetString("criminal-records-console-unknown-officer");
|
||||
if (_idCard.TryFindIdCard(mob.Value, out var id) && id.Comp.FullName is { } fullName)
|
||||
officer = fullName;
|
||||
@@ -145,7 +145,6 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS
|
||||
ent.Comp.SecurityChannel, ent);
|
||||
|
||||
UpdateUserInterface(ent);
|
||||
UpdateCriminalIdentity(name, msg.Status);
|
||||
}
|
||||
|
||||
private void OnAddHistory(Entity<CriminalRecordsConsoleComponent> ent, ref CriminalRecordAddHistory msg)
|
||||
@@ -189,15 +188,15 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS
|
||||
return;
|
||||
}
|
||||
|
||||
var listing = _stationRecords.BuildListing((owningStation.Value, stationRecords), console.Filter);
|
||||
var listing = _records.BuildListing((owningStation.Value, stationRecords), console.Filter);
|
||||
|
||||
var state = new CriminalRecordsConsoleState(listing, console.Filter);
|
||||
if (console.ActiveKey is { } id)
|
||||
{
|
||||
// get records to display when a crewmember is selected
|
||||
var key = new StationRecordKey(id, owningStation.Value);
|
||||
_stationRecords.TryGetRecord(key, out state.StationRecord, stationRecords);
|
||||
_stationRecords.TryGetRecord(key, out state.CriminalRecord, stationRecords);
|
||||
_records.TryGetRecord(key, out state.StationRecord, stationRecords);
|
||||
_records.TryGetRecord(key, out state.CriminalRecord, stationRecords);
|
||||
state.SelectedKey = id;
|
||||
}
|
||||
|
||||
@@ -232,17 +231,6 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name from a record, or empty string if this somehow fails.
|
||||
/// </summary>
|
||||
private string RecordName(StationRecordKey key)
|
||||
{
|
||||
if (!_stationRecords.TryGetRecord<GeneralStationRecord>(key, out var record))
|
||||
return "";
|
||||
|
||||
return record.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the new identity's name has a criminal record attached to it, and gives the entity the icon that
|
||||
/// belongs to the status if it does.
|
||||
@@ -255,14 +243,14 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS
|
||||
// TODO use the entity's station? Not the station of the map that it happens to currently be on?
|
||||
var station = _station.GetStationInMap(xform.MapID);
|
||||
|
||||
if (station != null && _stationRecords.GetRecordByName(station.Value, name) is { } id)
|
||||
if (station != null && _records.GetRecordByName(station.Value, name) is { } id)
|
||||
{
|
||||
if (_stationRecords.TryGetRecord<CriminalRecord>(new StationRecordKey(id, station.Value),
|
||||
if (_records.TryGetRecord<CriminalRecord>(new StationRecordKey(id, station.Value),
|
||||
out var record))
|
||||
{
|
||||
if (record.Status != SecurityStatus.None)
|
||||
{
|
||||
SetCriminalIcon(name, record.Status, uid);
|
||||
_criminalRecords.SetCriminalIcon(name, record.Status, uid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.CriminalRecords.Components;
|
||||
using Content.Shared.CriminalRecords.Systems;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Security;
|
||||
using Content.Shared.StationRecords;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -14,6 +15,7 @@ namespace Content.Server.CriminalRecords.Systems;
|
||||
public sealed class CriminalRecordsHackerSystem : SharedCriminalRecordsHackerSystem
|
||||
{
|
||||
[Dependency] private readonly ChatSystem _chat = default!;
|
||||
[Dependency] private readonly CriminalRecordsSystem _criminalRecords = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly StationSystem _station = default!;
|
||||
@@ -38,8 +40,7 @@ public sealed class CriminalRecordsHackerSystem : SharedCriminalRecordsHackerSys
|
||||
foreach (var (key, record) in _records.GetRecordsOfType<CriminalRecord>(station))
|
||||
{
|
||||
var reason = _random.Pick(reasons.Values);
|
||||
record.Status = SecurityStatus.Wanted;
|
||||
record.Reason = reason;
|
||||
_criminalRecords.OverwriteStatus(new StationRecordKey(key, station), record, SecurityStatus.Wanted, reason);
|
||||
// no radio message since spam
|
||||
// no history since lazy and its easy to remove anyway
|
||||
// main damage with this is existing arrest warrants are lost and to anger beepsky
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.StationRecords.Systems;
|
||||
using Content.Shared.CriminalRecords;
|
||||
using Content.Shared.CriminalRecords.Systems;
|
||||
using Content.Shared.Security;
|
||||
using Content.Shared.StationRecords;
|
||||
using Content.Server.GameTicking;
|
||||
@@ -15,10 +16,10 @@ namespace Content.Server.CriminalRecords.Systems;
|
||||
/// - See security officers' actions in Criminal Records in the radio
|
||||
/// - See reasons for any action with no need to ask the officer personally
|
||||
/// </summary>
|
||||
public sealed class CriminalRecordsSystem : EntitySystem
|
||||
public sealed class CriminalRecordsSystem : SharedCriminalRecordsSystem
|
||||
{
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly StationRecordsSystem _stationRecords = default!;
|
||||
[Dependency] private readonly StationRecordsSystem _records = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -29,28 +30,40 @@ public sealed class CriminalRecordsSystem : EntitySystem
|
||||
|
||||
private void OnGeneralRecordCreated(AfterGeneralRecordCreatedEvent ev)
|
||||
{
|
||||
_stationRecords.AddRecordEntry(ev.Key, new CriminalRecord());
|
||||
_stationRecords.Synchronize(ev.Key);
|
||||
_records.AddRecordEntry(ev.Key, new CriminalRecord());
|
||||
_records.Synchronize(ev.Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to change the status of the record found by the StationRecordKey.
|
||||
/// Reason should only be passed if status is Wanted.
|
||||
/// Reason should only be passed if status is Wanted, nullability isn't checked.
|
||||
/// </summary>
|
||||
/// <returns>True if the status is changed, false if not</returns>
|
||||
public bool TryChangeStatus(StationRecordKey key, SecurityStatus status, string? reason)
|
||||
{
|
||||
// don't do anything if its the same status
|
||||
if (!_stationRecords.TryGetRecord<CriminalRecord>(key, out var record)
|
||||
if (!_records.TryGetRecord<CriminalRecord>(key, out var record)
|
||||
|| status == record.Status)
|
||||
return false;
|
||||
|
||||
OverwriteStatus(key, record, status, reason);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the status without checking previous status or reason nullability.
|
||||
/// </summary>
|
||||
public void OverwriteStatus(StationRecordKey key, CriminalRecord record, SecurityStatus status, string? reason)
|
||||
{
|
||||
record.Status = status;
|
||||
record.Reason = reason;
|
||||
|
||||
_stationRecords.Synchronize(key);
|
||||
var name = _records.RecordName(key);
|
||||
if (name != string.Empty)
|
||||
UpdateCriminalIdentity(name, status);
|
||||
|
||||
return true;
|
||||
_records.Synchronize(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -59,7 +72,7 @@ public sealed class CriminalRecordsSystem : EntitySystem
|
||||
/// <returns>True if adding succeeded, false if not</returns>
|
||||
public bool TryAddHistory(StationRecordKey key, CrimeHistory entry)
|
||||
{
|
||||
if (!_stationRecords.TryGetRecord<CriminalRecord>(key, out var record))
|
||||
if (!_records.TryGetRecord<CriminalRecord>(key, out var record))
|
||||
return false;
|
||||
|
||||
record.History.Add(entry);
|
||||
@@ -81,7 +94,7 @@ public sealed class CriminalRecordsSystem : EntitySystem
|
||||
/// <returns>True if the line was removed, false if not</returns>
|
||||
public bool TryDeleteHistory(StationRecordKey key, uint index)
|
||||
{
|
||||
if (!_stationRecords.TryGetRecord<CriminalRecord>(key, out var record))
|
||||
if (!_records.TryGetRecord<CriminalRecord>(key, out var record))
|
||||
return false;
|
||||
|
||||
if (index >= record.History.Count)
|
||||
|
||||
@@ -36,7 +36,7 @@ public sealed class IgnitionSourceSystem : EntitySystem
|
||||
/// </summary>
|
||||
public void SetIgnited(Entity<IgnitionSourceComponent?> ent, bool ignited = true)
|
||||
{
|
||||
if (!Resolve(ent, ref ent.Comp))
|
||||
if (!Resolve(ent, ref ent.Comp, false))
|
||||
return;
|
||||
|
||||
ent.Comp.Ignited = ignited;
|
||||
|
||||
@@ -39,6 +39,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
||||
[Dependency] private readonly IConsoleHost _console = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IParallelManager _parallel = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmos = default!;
|
||||
@@ -119,6 +120,9 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
||||
SetSeed(uid, component, _random.Next());
|
||||
}
|
||||
|
||||
if (_proto.TryIndex(component.Template, out var biome))
|
||||
SetTemplate(uid, component, biome);
|
||||
|
||||
var xform = Transform(uid);
|
||||
var mapId = xform.MapID;
|
||||
|
||||
@@ -151,6 +155,15 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
||||
}
|
||||
}
|
||||
|
||||
public void SetEnabled(Entity<BiomeComponent?> ent, bool enabled = true)
|
||||
{
|
||||
if (!Resolve(ent, ref ent.Comp) || ent.Comp.Enabled == enabled)
|
||||
return;
|
||||
|
||||
ent.Comp.Enabled = enabled;
|
||||
Dirty(ent, ent.Comp);
|
||||
}
|
||||
|
||||
public void SetSeed(EntityUid uid, BiomeComponent component, int seed, bool dirty = true)
|
||||
{
|
||||
component.Seed = seed;
|
||||
|
||||
@@ -223,6 +223,17 @@ public sealed class StationRecordsSystem : SharedStationRecordsSystem
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name for a record, or an empty string if it has no record.
|
||||
/// </summary>
|
||||
public string RecordName(StationRecordKey key)
|
||||
{
|
||||
if (!TryGetRecord<GeneralStationRecord>(key, out var record))
|
||||
return string.Empty;
|
||||
|
||||
return record.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all records of a specific type from a station.
|
||||
/// </summary>
|
||||
|
||||
@@ -496,7 +496,7 @@ namespace Content.Server.Strip
|
||||
|
||||
if (!_handsSystem.TryGetHand(target, handName, out var handSlot, target.Comp))
|
||||
{
|
||||
_popupSystem.PopupCursor(Loc.GetString("strippable-component-item-slot-free-message", ("owner", target)), user);
|
||||
_popupSystem.PopupCursor(Loc.GetString("strippable-component-item-slot-free-message", ("owner", Identity.Name(target, EntityManager, user))), user);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ namespace Content.Server.Strip
|
||||
|
||||
if (!_handsSystem.CanDropHeld(target, handSlot, false))
|
||||
{
|
||||
_popupSystem.PopupCursor(Loc.GetString("strippable-component-cannot-drop-message", ("owner", target)), user);
|
||||
_popupSystem.PopupCursor(Loc.GetString("strippable-component-cannot-drop-message", ("owner", Identity.Name(target, EntityManager, user))), user);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user