Code cleanup: Dirty(Comp) (#26238)

* Replaced uses of Dirty(Component) with Dirty(Uid, Component)
Modified some systems (notably pulling-related) to use uids.

* Missed a few

* Revert changes to pulling

* No
This commit is contained in:
Tayrtahn
2024-03-19 23:27:02 -04:00
committed by GitHub
parent c28cbe40c3
commit 4a83c36585
74 changed files with 245 additions and 249 deletions

View File

@@ -124,9 +124,9 @@ public sealed class WeatherSystem : SharedWeatherSystem
comp.Occlusion = occlusion;
}
protected override bool SetState(WeatherState state, WeatherComponent comp, WeatherData weather, WeatherPrototype weatherProto)
protected override bool SetState(EntityUid uid, WeatherState state, WeatherComponent comp, WeatherData weather, WeatherPrototype weatherProto)
{
if (!base.SetState(state, comp, weather, weatherProto))
if (!base.SetState(uid, state, comp, weather, weatherProto))
return false;
if (!Timing.IsFirstTimePredicted)
@@ -164,7 +164,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
continue;
// New weather
StartWeather(component, ProtoMan.Index<WeatherPrototype>(proto), weather.EndTime);
StartWeather(uid, component, ProtoMan.Index<WeatherPrototype>(proto), weather.EndTime);
}
}
}

View File

@@ -130,9 +130,9 @@ namespace Content.IntegrationTests.Tests.Tag
Assert.Multiple(() =>
{
// Cannot add the starting tag again
Assert.That(tagSystem.AddTag(sTagComponent, StartingTag), Is.False);
Assert.That(tagSystem.AddTags(sTagComponent, StartingTag, StartingTag), Is.False);
Assert.That(tagSystem.AddTags(sTagComponent, new List<string> { StartingTag, StartingTag }), Is.False);
Assert.That(tagSystem.AddTag(sTagDummy, sTagComponent, StartingTag), Is.False);
Assert.That(tagSystem.AddTags(sTagDummy, sTagComponent, StartingTag, StartingTag), Is.False);
Assert.That(tagSystem.AddTags(sTagDummy, sTagComponent, new List<string> { StartingTag, StartingTag }), Is.False);
// Has the starting tag
Assert.That(tagSystem.HasTag(sTagComponent, StartingTag), Is.True);
@@ -157,22 +157,22 @@ namespace Content.IntegrationTests.Tests.Tag
Assert.That(tagSystem.HasAllTags(sTagComponent, new List<string> { StartingTag, AddedTag }), Is.False);
// Cannot remove a tag that does not exist
Assert.That(tagSystem.RemoveTag(sTagComponent, AddedTag), Is.False);
Assert.That(tagSystem.RemoveTags(sTagComponent, AddedTag, AddedTag), Is.False);
Assert.That(tagSystem.RemoveTags(sTagComponent, new List<string> { AddedTag, AddedTag }), Is.False);
Assert.That(tagSystem.RemoveTag(sTagDummy, sTagComponent, AddedTag), Is.False);
Assert.That(tagSystem.RemoveTags(sTagDummy, sTagComponent, AddedTag, AddedTag), Is.False);
Assert.That(tagSystem.RemoveTags(sTagDummy, sTagComponent, new List<string> { AddedTag, AddedTag }), Is.False);
});
// Can add the new tag
Assert.That(tagSystem.AddTag(sTagComponent, AddedTag), Is.True);
Assert.That(tagSystem.AddTag(sTagDummy, sTagComponent, AddedTag), Is.True);
Assert.Multiple(() =>
{
// Cannot add it twice
Assert.That(tagSystem.AddTag(sTagComponent, AddedTag), Is.False);
Assert.That(tagSystem.AddTag(sTagDummy, sTagComponent, AddedTag), Is.False);
// Cannot add existing tags
Assert.That(tagSystem.AddTags(sTagComponent, StartingTag, AddedTag), Is.False);
Assert.That(tagSystem.AddTags(sTagComponent, new List<string> { StartingTag, AddedTag }), Is.False);
Assert.That(tagSystem.AddTags(sTagDummy, sTagComponent, StartingTag, AddedTag), Is.False);
Assert.That(tagSystem.AddTags(sTagDummy, sTagComponent, new List<string> { StartingTag, AddedTag }), Is.False);
// Now has two tags
Assert.That(sTagComponent.Tags, Has.Count.EqualTo(2));
@@ -191,16 +191,16 @@ namespace Content.IntegrationTests.Tests.Tag
Assert.Multiple(() =>
{
// Remove the existing starting tag
Assert.That(tagSystem.RemoveTag(sTagComponent, StartingTag), Is.True);
Assert.That(tagSystem.RemoveTag(sTagDummy, sTagComponent, StartingTag), Is.True);
// Remove the existing added tag
Assert.That(tagSystem.RemoveTags(sTagComponent, AddedTag, AddedTag), Is.True);
Assert.That(tagSystem.RemoveTags(sTagDummy, sTagComponent, AddedTag, AddedTag), Is.True);
});
Assert.Multiple(() =>
{
// No tags left to remove
Assert.That(tagSystem.RemoveTags(sTagComponent, new List<string> { StartingTag, AddedTag }), Is.False);
Assert.That(tagSystem.RemoveTags(sTagDummy, sTagComponent, new List<string> { StartingTag, AddedTag }), Is.False);
// No tags left in the component
Assert.That(sTagComponent.Tags, Is.Empty);

View File

@@ -638,13 +638,13 @@ public sealed partial class AdminVerbSystem
{
Text = "Remove gravity",
Category = VerbCategory.Smite,
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Structures/Machines/gravity_generator.rsi"), "off"),
Icon = new SpriteSpecifier.Rsi(new("/Textures/Structures/Machines/gravity_generator.rsi"), "off"),
Act = () =>
{
var grav = EnsureComp<MovementIgnoreGravityComponent>(args.Target);
grav.Weightless = true;
Dirty(grav);
Dirty(args.Target, grav);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-smite-remove-gravity-description"),
@@ -741,7 +741,7 @@ public sealed partial class AdminVerbSystem
var movementSpeed = EnsureComp<MovementSpeedModifierComponent>(args.Target);
(movementSpeed.BaseSprintSpeed, movementSpeed.BaseWalkSpeed) = (movementSpeed.BaseWalkSpeed, movementSpeed.BaseSprintSpeed);
Dirty(movementSpeed);
Dirty(args.Target, movementSpeed);
_popupSystem.PopupEntity(Loc.GetString("admin-smite-run-walk-swap-prompt"), args.Target,
args.Target, PopupType.LargeCaution);

View File

@@ -58,7 +58,7 @@ public partial class AtmosphereSystem
component.Space = space;
component.Mixture = mixture;
Dirty(component);
Dirty(uid, component);
}
public void SetMapGasMixture(EntityUid uid, GasMixture? mixture, MapAtmosphereComponent? component = null)
@@ -67,7 +67,7 @@ public partial class AtmosphereSystem
return;
component.Mixture = mixture;
Dirty(component);
Dirty(uid, component);
}
public void SetMapSpace(EntityUid uid, bool space, MapAtmosphereComponent? component = null)
@@ -76,6 +76,6 @@ public partial class AtmosphereSystem
return;
component.Space = space;
Dirty(component);
Dirty(uid, component);
}
}

View File

@@ -93,9 +93,9 @@ namespace Content.Server.Atmos.EntitySystems
else
component.LastPosition = null;
component.Enabled = true;
Dirty(component);
Dirty(uid, component);
UpdateAppearance(uid, component);
if(!HasComp<ActiveGasAnalyzerComponent>(uid))
if (!HasComp<ActiveGasAnalyzerComponent>(uid))
AddComp<ActiveGasAnalyzerComponent>(uid);
UpdateAnalyzer(uid, component);
}
@@ -105,7 +105,7 @@ namespace Content.Server.Atmos.EntitySystems
/// </summary>
private void OnDropped(EntityUid uid, GasAnalyzerComponent component, DroppedEvent args)
{
if(args.User is var userId && component.Enabled)
if (args.User is var userId && component.Enabled)
_popup.PopupEntity(Loc.GetString("gas-analyzer-shutoff"), userId, userId);
DisableAnalyzer(uid, component, args.User);
}
@@ -122,7 +122,7 @@ namespace Content.Server.Atmos.EntitySystems
_userInterface.TryClose(uid, GasAnalyzerUiKey.Key, actor.PlayerSession);
component.Enabled = false;
Dirty(component);
Dirty(uid, component);
UpdateAppearance(uid, component);
RemCompDeferred<ActiveGasAnalyzerComponent>(uid);
}

View File

@@ -118,10 +118,11 @@ namespace Content.Server.Atmos.EntitySystems
}
// PVS was turned off, ensure data gets sent to all clients.
foreach (var (grid, meta) in EntityQuery<GasTileOverlayComponent, MetaDataComponent>(true))
var query = EntityQueryEnumerator<GasTileOverlayComponent, MetaDataComponent>();
while (query.MoveNext(out var uid, out var grid, out var meta))
{
grid.ForceTick = _gameTiming.CurTick;
Dirty(grid, meta);
Dirty(uid, grid, meta);
}
}
@@ -264,9 +265,10 @@ namespace Content.Server.Atmos.EntitySystems
private void UpdateOverlayData(GameTick curTick)
{
// TODO parallelize?
foreach (var (overlay, gam, meta) in EntityQuery<GasTileOverlayComponent, GridAtmosphereComponent, MetaDataComponent>(true))
var query = EntityQueryEnumerator<GasTileOverlayComponent, GridAtmosphereComponent, MetaDataComponent>();
while (query.MoveNext(out var uid, out var overlay, out var gam, out var meta))
{
bool changed = false;
var changed = false;
foreach (var index in overlay.InvalidTiles)
{
var chunkIndex = GetGasChunkIndices(index);
@@ -278,7 +280,7 @@ namespace Content.Server.Atmos.EntitySystems
}
if (changed)
Dirty(overlay, meta);
Dirty(uid, overlay, meta);
overlay.InvalidTiles.Clear();
}

View File

@@ -34,7 +34,7 @@ namespace Content.Server.BarSign.Systems
_metaData.SetEntityDescription(uid, Loc.GetString(newPrototype.Description), meta);
component.Current = newPrototype.ID;
Dirty(component);
Dirty(uid, component);
}
}
}

View File

@@ -39,7 +39,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
args.Verbs.Add(new InteractionVerb()
{
Text = Loc.GetString("chameleon-component-verb-text"),
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/settings.svg.192dpi.png")),
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/settings.svg.192dpi.png")),
Act = () => TryOpenUi(uid, args.User, component)
});
}
@@ -91,7 +91,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
UpdateIdentityBlocker(uid, component, proto);
UpdateVisuals(uid, component);
UpdateUi(uid, component);
Dirty(component);
Dirty(uid, component);
}
private void UpdateIdentityBlocker(EntityUid uid, ChameleonClothingComponent component, EntityPrototype proto)

View File

@@ -89,10 +89,11 @@ namespace Content.Server.Decals
playerData.Clear();
}
foreach (var (grid, meta) in EntityQuery<DecalGridComponent, MetaDataComponent>(true))
var query = EntityQueryEnumerator<DecalGridComponent, MetaDataComponent>();
while (query.MoveNext(out var uid, out var grid, out var meta))
{
grid.ForceTick = _timing.CurTick;
Dirty(grid, meta);
Dirty(uid, grid, meta);
}
}

View File

@@ -255,7 +255,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
/// </summary>
private void UpdateModeAppearance(EntityUid userUid, EntityUid configuratorUid, NetworkConfiguratorComponent configurator)
{
Dirty(configurator);
Dirty(configuratorUid, configurator);
_appearanceSystem.SetData(configuratorUid, NetworkConfiguratorVisuals.Mode, configurator.LinkModeActive);
var pitch = configurator.LinkModeActive ? 1 : 0.8f;

View File

@@ -340,7 +340,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
if (!args.Powered)
{
component.NextFlush = null;
Dirty(component);
Dirty(uid, component);
return;
}
@@ -396,7 +396,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
component.State = state;
UpdateVisualState(uid, component);
UpdateInterface(uid, component, component.Powered);
Dirty(component, metadata);
Dirty(uid, component, metadata);
if (state == DisposalsPressureState.Ready)
{
@@ -477,7 +477,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
}
if (count != component.RecentlyEjected.Count)
Dirty(component, metadata);
Dirty(uid, component, metadata);
}
public bool TryInsert(EntityUid unitId, EntityUid toInsertId, EntityUid? userId, DisposalUnitComponent? unit = null)
@@ -783,7 +783,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
var flushTime = TimeSpan.FromSeconds(Math.Min((component.NextFlush ?? TimeSpan.MaxValue).TotalSeconds, automaticTime.TotalSeconds));
component.NextFlush = flushTime;
Dirty(component);
Dirty(uid, component);
}
public void AfterInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid inserted, EntityUid? user = null, bool doInsert = false)

View File

@@ -67,7 +67,7 @@ public sealed class DragonRiftSystem : EntitySystem
if (comp.State < DragonRiftState.AlmostFinished && comp.Accumulator > comp.MaxAccumulator / 2f)
{
comp.State = DragonRiftState.AlmostFinished;
Dirty(comp);
Dirty(uid, comp);
var location = xform.LocalPosition;
_chat.DispatchGlobalAnnouncement(Loc.GetString("carp-rift-warning", ("location", location)), playSound: false, colorOverride: Color.Red);

View File

@@ -93,7 +93,7 @@ public sealed partial class EnsnareableSystem
component.Ensnared = target;
_container.Insert(ensnare, ensnareable.Container);
ensnareable.IsEnsnared = true;
Dirty(ensnareable);
Dirty(target, ensnareable);
UpdateAlert(target, ensnareable);
var ev = new EnsnareEvent(component.WalkSpeed, component.SprintSpeed);
@@ -107,7 +107,7 @@ public sealed partial class EnsnareableSystem
/// <param name="user">The entity that is freeing the target</param>
/// <param name="ensnare">The entity used to ensnare</param>
/// <param name="component">The ensnaring component</param>
public void TryFree(EntityUid target, EntityUid user, EntityUid ensnare, EnsnaringComponent component)
public void TryFree(EntityUid target, EntityUid user, EntityUid ensnare, EnsnaringComponent component)
{
//Don't do anything if they don't have the ensnareable component.
if (!HasComp<EnsnareableComponent>(target))
@@ -148,7 +148,7 @@ public sealed partial class EnsnareableSystem
_container.Remove(ensnare, ensnareable.Container, force: true);
ensnareable.IsEnsnared = ensnareable.Container.ContainedEntities.Count > 0;
Dirty(ensnareable);
Dirty(component.Ensnared.Value, ensnareable);
component.Ensnared = null;
UpdateAlert(target, ensnareable);

View File

@@ -45,7 +45,7 @@ public sealed partial class EnsnareableSystem : SharedEnsnareableSystem
}
component.IsEnsnared = component.Container.ContainedEntities.Count > 0;
Dirty(component);
Dirty(uid, component);
ensnaring.Ensnared = null;
_hands.PickupOrDrop(args.Args.User, args.Args.Used.Value);

View File

@@ -41,7 +41,7 @@ namespace Content.Server.Gravity
gravity.Enabled = enabled;
var ev = new GravityChangedEvent(uid, enabled);
RaiseLocalEvent(uid, ref ev, true);
Dirty(gravity);
Dirty(uid, gravity);
if (HasComp<MapGridComponent>(uid))
{
@@ -71,7 +71,7 @@ namespace Content.Server.Gravity
gravity.Enabled = true;
var ev = new GravityChangedEvent(uid, true);
RaiseLocalEvent(uid, ref ev, true);
Dirty(gravity);
Dirty(uid, gravity);
if (HasComp<MapGridComponent>(uid))
{

View File

@@ -29,7 +29,7 @@ public sealed class HotPotatoSystem : SharedHotPotatoSystem
comp.CanTransfer = false;
_ambientSound.SetAmbience(uid, true);
_damageOnHolding.SetEnabled(uid, true);
Dirty(comp);
Dirty(uid, comp);
}
private void OnMeleeHit(EntityUid uid, HotPotatoComponent comp, MeleeHitEvent args)
@@ -56,6 +56,6 @@ public sealed class HotPotatoSystem : SharedHotPotatoSystem
break;
}
comp.CanTransfer = false;
Dirty(comp);
Dirty(uid, comp);
}
}

View File

@@ -29,7 +29,7 @@ public sealed partial class HumanoidAppearanceSystem
{
Text = "Modify markings",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Mobs/Customization/reptilian_parts.rsi"), "tail_smooth"),
Icon = new SpriteSpecifier.Rsi(new("/Textures/Mobs/Customization/reptilian_parts.rsi"), "tail_smooth"),
Act = () =>
{
_uiSystem.TryOpen(uid, HumanoidMarkingModifierKey.Key, actor.PlayerSession);
@@ -63,7 +63,7 @@ public sealed partial class HumanoidAppearanceSystem
component.CustomBaseLayers[message.Layer] = message.Info.Value;
}
Dirty(component);
Dirty(uid, component);
if (message.ResendState)
{
@@ -88,7 +88,7 @@ public sealed partial class HumanoidAppearanceSystem
}
component.MarkingSet = message.MarkingSet;
Dirty(component);
Dirty(uid, component);
if (message.ResendState)
{

View File

@@ -64,7 +64,7 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
grammar.Gender = sourceHumanoid.Gender;
}
Dirty(targetHumanoid);
Dirty(target, targetHumanoid);
}
/// <summary>
@@ -85,7 +85,7 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
humanoid.MarkingSet.Remove(prototype.MarkingCategory, marking);
if (sync)
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>
@@ -106,7 +106,7 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
}
humanoid.MarkingSet.Remove(category, index);
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>
@@ -135,7 +135,7 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
}
humanoid.MarkingSet.Replace(category, index, marking);
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>
@@ -162,7 +162,7 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
markings[index].SetColor(i, colors[i]);
}
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>

View File

@@ -35,7 +35,7 @@ public sealed class SwappableInstrumentSystem : EntitySystem
Priority = priority,
Act = () =>
{
_sharedInstrument.SetInstrumentProgram(instrument, entry.Value.Item1, entry.Value.Item2);
_sharedInstrument.SetInstrumentProgram(uid, instrument, entry.Value.Item1, entry.Value.Item2);
_popup.PopupEntity(Loc.GetString("swappable-instrument-component-style-set", ("style", entry.Key)),
args.User, args.User);
}

View File

@@ -19,6 +19,6 @@ public sealed class RotatingLightSystem : SharedRotatingLightSystem
return;
comp.Enabled = args.Enabled;
Dirty(comp);
Dirty(uid, comp);
}
}

View File

@@ -130,7 +130,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
return false;
Container.Remove(item, active.ReclaimingContainer);
Dirty(component);
Dirty(uid, component);
// scales the output if the process was interrupted.
var completion = 1f - Math.Clamp((float) Math.Round((active.EndTime - Timing.CurTime) / active.Duration),

View File

@@ -110,7 +110,7 @@ public sealed partial class MechSystem : SharedMechSystem
component.Energy = battery.CurrentCharge;
component.MaxEnergy = battery.MaxCharge;
Dirty(component);
Dirty(uid, component);
_actionBlocker.UpdateCanMove(uid);
}
@@ -140,7 +140,7 @@ public sealed partial class MechSystem : SharedMechSystem
component.Energy = component.MaxEnergy;
_actionBlocker.UpdateCanMove(uid);
Dirty(component);
Dirty(uid, component);
}
private void OnRemoveEquipmentMessage(EntityUid uid, MechComponent component, MechEquipmentRemoveMessage args)
@@ -338,7 +338,7 @@ public sealed partial class MechSystem : SharedMechSystem
{
Log.Debug($"Battery charge was not equal to mech charge. Battery {batteryComp.CurrentCharge}. Mech {component.Energy}");
component.Energy = batteryComp.CurrentCharge;
Dirty(component);
Dirty(uid, component);
}
_actionBlocker.UpdateCanMove(uid);
return true;
@@ -358,7 +358,7 @@ public sealed partial class MechSystem : SharedMechSystem
_actionBlocker.UpdateCanMove(uid);
Dirty(component);
Dirty(uid, component);
UpdateUserInterface(uid, component);
}
@@ -373,7 +373,7 @@ public sealed partial class MechSystem : SharedMechSystem
_actionBlocker.UpdateCanMove(uid);
Dirty(component);
Dirty(uid, component);
UpdateUserInterface(uid, component);
}

View File

@@ -113,7 +113,7 @@ public sealed class NameIdentifierSystem : EntitySystem
_metaData.SetEntityName(uid, group.FullName
? uniqueName
: $"{meta.EntityName} ({uniqueName})", meta);
Dirty(component);
Dirty(uid, component);
}
private void InitialSetupPrototypes()

View File

@@ -67,7 +67,7 @@ public sealed class ConveyorController : SharedConveyorController
{
component.Powered = args.Powered;
UpdateAppearance(uid, component);
Dirty(component);
Dirty(uid, component);
}
private void UpdateAppearance(EntityUid uid, ConveyorComponent component)
@@ -106,7 +106,7 @@ public sealed class ConveyorController : SharedConveyorController
_materialReclaimer.SetReclaimerEnabled(uid, component.State != ConveyorState.Off);
UpdateAppearance(uid, component);
Dirty(component);
Dirty(uid, component);
}
/// <summary>

View File

@@ -54,7 +54,7 @@ public sealed class NavMapSystem : SharedNavMapSystem
private void OnStationInit(StationGridAddedEvent ev)
{
var comp = EnsureComp<NavMapComponent>(ev.GridId);
RefreshGrid(comp, Comp<MapGridComponent>(ev.GridId));
RefreshGrid(ev.GridId, comp, Comp<MapGridComponent>(ev.GridId));
}
private void OnNavMapBeaconStartup(EntityUid uid, NavMapBeaconComponent component, ComponentStartup args)
@@ -164,7 +164,7 @@ public sealed class NavMapSystem : SharedNavMapSystem
if (!TryComp<MapGridComponent>(uid, out var grid))
return;
RefreshGrid(component, grid);
RefreshGrid(uid, component, grid);
}
private void OnNavMapSplit(ref GridSplitEvent args)
@@ -177,13 +177,13 @@ public sealed class NavMapSystem : SharedNavMapSystem
foreach (var grid in args.NewGrids)
{
var newComp = EnsureComp<NavMapComponent>(grid);
RefreshGrid(newComp, gridQuery.GetComponent(grid));
RefreshGrid(grid, newComp, gridQuery.GetComponent(grid));
}
RefreshGrid(comp, gridQuery.GetComponent(args.Grid));
RefreshGrid(args.Grid, comp, gridQuery.GetComponent(args.Grid));
}
private void RefreshGrid(NavMapComponent component, MapGridComponent grid)
private void RefreshGrid(EntityUid uid, NavMapComponent component, MapGridComponent grid)
{
component.Chunks.Clear();
@@ -199,7 +199,7 @@ public sealed class NavMapSystem : SharedNavMapSystem
component.Chunks[chunkOrigin] = chunk;
}
RefreshTile(grid, component, chunk, tile.Value.GridIndices);
RefreshTile(uid, grid, component, chunk, tile.Value.GridIndices);
}
}
@@ -291,7 +291,7 @@ public sealed class NavMapSystem : SharedNavMapSystem
if (navMap.Chunks.TryGetValue(chunkOrigin, out var chunk))
{
RefreshTile(oldGrid, navMap, chunk, ev.TilePos);
RefreshTile(ev.OldGrid, oldGrid, navMap, chunk, ev.TilePos);
}
}
@@ -318,10 +318,10 @@ public sealed class NavMapSystem : SharedNavMapSystem
navMap.Chunks[chunkOrigin] = chunk;
}
RefreshTile(grid, navMap, chunk, tile);
RefreshTile(xform.GridUid.Value, grid, navMap, chunk, tile);
}
private void RefreshTile(MapGridComponent grid, NavMapComponent component, NavMapChunk chunk, Vector2i tile)
private void RefreshTile(EntityUid uid, MapGridComponent grid, NavMapComponent component, NavMapChunk chunk, Vector2i tile)
{
var relative = SharedMapSystem.GetChunkRelative(tile, ChunkSize);
var existing = chunk.TileData;
@@ -356,7 +356,7 @@ public sealed class NavMapSystem : SharedNavMapSystem
if (existing == chunk.TileData)
return;
Dirty(component);
Dirty(uid, component);
}
/// <summary>

View File

@@ -67,7 +67,7 @@ public sealed partial class PowerCellSystem
{
component.CanDraw = canDraw;
component.CanUse = canUse;
Dirty(component);
Dirty(uid, component);
}
}
@@ -80,7 +80,7 @@ public sealed partial class PowerCellSystem
{
component.CanDraw = canDraw;
component.CanUse = canUse;
Dirty(component);
Dirty(uid, component);
}
}
}

View File

@@ -18,7 +18,7 @@ public sealed partial class ResearchSystem
var unusedId = EntityQuery<ResearchServerComponent>(true)
.Max(s => s.Id) + 1;
component.Id = unusedId;
Dirty(component);
Dirty(uid, component);
}
private void OnServerShutdown(EntityUid uid, ResearchServerComponent component, ComponentShutdown args)
@@ -74,7 +74,7 @@ public sealed partial class ResearchSystem
SyncClientWithServer(client, clientComponent: clientComponent);
if (dirtyServer)
Dirty(serverComponent);
Dirty(server, serverComponent);
var ev = new ResearchRegistrationChangedEvent(server);
RaiseLocalEvent(client, ref ev);
@@ -117,7 +117,7 @@ public sealed partial class ResearchSystem
if (dirtyServer)
{
Dirty(serverComponent);
Dirty(server, serverComponent);
}
var ev = new ResearchRegistrationChangedEvent(null);
@@ -167,6 +167,6 @@ public sealed partial class ResearchSystem
{
RaiseLocalEvent(client, ref ev);
}
Dirty(component);
Dirty(uid, component);
}
}

View File

@@ -21,7 +21,7 @@ public sealed partial class ResearchSystem
primaryDb.UnlockedTechnologies = otherDb.UnlockedTechnologies;
primaryDb.UnlockedRecipes = otherDb.UnlockedRecipes;
Dirty(primaryDb);
Dirty(primaryUid, primaryDb);
var ev = new TechnologyDatabaseModifiedEvent();
RaiseLocalEvent(primaryUid, ref ev);
@@ -125,7 +125,7 @@ public sealed partial class ResearchSystem
continue;
component.UnlockedRecipes.Add(unlock);
}
Dirty(component);
Dirty(uid, component);
var ev = new TechnologyDatabaseModifiedEvent();
RaiseLocalEvent(uid, ref ev);
@@ -144,7 +144,7 @@ public sealed partial class ResearchSystem
return;
component.UnlockedRecipes.Add(recipe);
Dirty(component);
Dirty(uid, component);
var ev = new TechnologyDatabaseModifiedEvent();
RaiseLocalEvent(uid, ref ev);
@@ -185,6 +185,6 @@ public sealed partial class ResearchSystem
component.SupportedDisciplines = new List<string>();
component.UnlockedTechnologies = new List<string>();
component.UnlockedRecipes = new List<string>();
Dirty(component);
Dirty(uid, component);
}
}

View File

@@ -318,7 +318,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
pilotComponent.Console = uid;
ActionBlockerSystem.UpdateCanMove(entity);
pilotComponent.Position = EntityManager.GetComponent<TransformComponent>(entity).Coordinates;
Dirty(pilotComponent);
Dirty(entity, pilotComponent);
}
public void RemovePilot(EntityUid pilotUid, PilotComponent pilotComponent)

View File

@@ -281,7 +281,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
component.Activated = true;
InstallAllModules(uid, component);
Dirty(component);
Dirty(uid, component);
_movementSpeedModifier.RefreshMovementSpeedModifiers(uid);
}
@@ -295,7 +295,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
component.Activated = false;
DisableAllModules(uid, component);
Dirty(component);
Dirty(uid, component);
_movementSpeedModifier.RefreshMovementSpeedModifiers(uid);
}

View File

@@ -63,7 +63,7 @@ public sealed class RandomSpriteSystem: SharedRandomSpriteSystem
}
}
Dirty(component);
Dirty(uid, component);
}
private void OnGetState(EntityUid uid, RandomSpriteComponent component, ref ComponentGetState args)

View File

@@ -12,7 +12,7 @@ public sealed class ParacusiaSystem : SharedParacusiaSystem
return;
}
component.Sounds = sounds;
Dirty(component);
Dirty(uid, component);
}
public void SetTime(EntityUid uid, float minTime, float maxTime, ParacusiaComponent? component = null)
@@ -23,7 +23,7 @@ public sealed class ParacusiaSystem : SharedParacusiaSystem
}
component.MinTimeBetweenIncidents = minTime;
component.MaxTimeBetweenIncidents = maxTime;
Dirty(component);
Dirty(uid, component);
}
public void SetDistance(EntityUid uid, float maxSoundDistance, ParacusiaComponent? component = null)
@@ -33,6 +33,6 @@ public sealed class ParacusiaSystem : SharedParacusiaSystem
return;
}
component.MaxSoundDistance = maxSoundDistance;
Dirty(component);
Dirty(uid, component);
}
}

View File

@@ -51,7 +51,7 @@ public sealed partial class GunSystem
if (component.Shots != shots || component.Capacity != maxShots)
{
Dirty(component);
Dirty(uid, component);
}
component.Shots = shots;

View File

@@ -13,6 +13,6 @@ public sealed partial class GunSystem
return;
component.CurrentIndex = index;
Dirty(component);
Dirty(revolverUid, component);
}
}

View File

@@ -18,6 +18,6 @@ public sealed class RandomInstrumentArtifactSystem : EntitySystem
private void OnStartup(EntityUid uid, RandomInstrumentArtifactComponent component, ComponentStartup args)
{
var instrument = EnsureComp<InstrumentComponent>(uid);
_instrument.SetInstrumentProgram(instrument, (byte) _random.Next(0, 127), 0);
_instrument.SetInstrumentProgram(uid, instrument, (byte) _random.Next(0, 127), 0);
}
}

View File

@@ -185,7 +185,7 @@ namespace Content.Server.Zombies
Dirty(target, pryComp);
}
Dirty(melee);
Dirty(target, melee);
//The zombie gets the assigned damage weaknesses and strengths
_damageable.SetDamageModifierSetId(target, "Zombie");

View File

@@ -54,7 +54,7 @@ public abstract partial class SharedBuckleSystem
private void OnBuckleMove(EntityUid uid, BuckleComponent component, ref MoveEvent ev)
{
if (component.BuckledTo is not {} strapUid)
if (component.BuckledTo is not { } strapUid)
return;
if (!TryComp<StrapComponent>(strapUid, out var strapComp))
@@ -85,7 +85,7 @@ public abstract partial class SharedBuckleSystem
{
Act = () => TryUnbuckle(uid, args.User, buckleComp: component),
Text = Loc.GetString("verb-categories-unbuckle"),
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/unbuckle.svg.192dpi.png"))
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/unbuckle.svg.192dpi.png"))
};
if (args.Target == args.User && args.Using == null)
@@ -191,7 +191,7 @@ public abstract partial class SharedBuckleSystem
ActionBlocker.UpdateCanMove(buckleUid);
UpdateBuckleStatus(buckleUid, buckleComp, strapComp);
Dirty(buckleComp);
Dirty(buckleUid, buckleComp);
}
/// <summary>
@@ -468,8 +468,7 @@ public abstract partial class SharedBuckleSystem
if (strapComp.BuckledEntities.Remove(buckleUid))
{
strapComp.OccupiedSize -= buckleComp.Size;
//Dirty(strapUid);
Dirty(strapComp);
Dirty(strapUid, strapComp);
}
_joints.RefreshRelay(buckleUid);

View File

@@ -20,22 +20,22 @@ public abstract partial class SharedBuckleSystem
{
SubscribeLocalEvent<StrapComponent, ComponentStartup>(OnStrapStartup);
SubscribeLocalEvent<StrapComponent, ComponentShutdown>(OnStrapShutdown);
SubscribeLocalEvent<StrapComponent, ComponentRemove>((_, c, _) => StrapRemoveAll(c));
SubscribeLocalEvent<StrapComponent, ComponentRemove>((e, c, _) => StrapRemoveAll(e, c));
SubscribeLocalEvent<StrapComponent, EntInsertedIntoContainerMessage>(OnStrapEntModifiedFromContainer);
SubscribeLocalEvent<StrapComponent, EntRemovedFromContainerMessage>(OnStrapEntModifiedFromContainer);
SubscribeLocalEvent<StrapComponent, GetVerbsEvent<InteractionVerb>>(AddStrapVerbs);
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnStrapContainerGettingInsertedAttempt);
SubscribeLocalEvent<StrapComponent, InteractHandEvent>(OnStrapInteractHand);
SubscribeLocalEvent<StrapComponent, DestructionEventArgs>((_,c,_) => StrapRemoveAll(c));
SubscribeLocalEvent<StrapComponent, BreakageEventArgs>((_, c, _) => StrapRemoveAll(c));
SubscribeLocalEvent<StrapComponent, DestructionEventArgs>((e, c, _) => StrapRemoveAll(e, c));
SubscribeLocalEvent<StrapComponent, BreakageEventArgs>((e, c, _) => StrapRemoveAll(e, c));
SubscribeLocalEvent<StrapComponent, DragDropTargetEvent>(OnStrapDragDropTarget);
SubscribeLocalEvent<StrapComponent, CanDropTargetEvent>(OnCanDropTarget);
SubscribeLocalEvent<StrapComponent, FoldAttemptEvent>(OnAttemptFold);
SubscribeLocalEvent<StrapComponent, MoveEvent>(OnStrapMoveEvent);
SubscribeLocalEvent<StrapComponent, MachineDeconstructedEvent>((_, c, _) => StrapRemoveAll(c));
SubscribeLocalEvent<StrapComponent, MachineDeconstructedEvent>((e, c, _) => StrapRemoveAll(e, c));
}
private void OnStrapStartup(EntityUid uid, StrapComponent component, ComponentStartup args)
@@ -48,7 +48,7 @@ public abstract partial class SharedBuckleSystem
if (LifeStage(uid) > EntityLifeStage.MapInitialized)
return;
StrapRemoveAll(component);
StrapRemoveAll(uid, component);
}
private void OnStrapEntModifiedFromContainer(EntityUid uid, StrapComponent component, ContainerModifiedMessage message)
@@ -153,7 +153,7 @@ public abstract partial class SharedBuckleSystem
}
// If the user is currently holding/pulling an entity that can be buckled, add a verb for that.
if (args.Using is {Valid: true} @using &&
if (args.Using is { Valid: true } @using &&
TryComp<BuckleComponent>(@using, out var usingBuckle) &&
StrapHasSpace(uid, usingBuckle, component) &&
_interaction.InRangeUnobstructed(@using, args.Target, range: usingBuckle.Range))
@@ -232,7 +232,7 @@ public abstract partial class SharedBuckleSystem
}
ReAttach(buckledEntity, uid, buckled, component);
Dirty(buckled);
Dirty(buckledEntity, buckled);
}
}
@@ -258,7 +258,7 @@ public abstract partial class SharedBuckleSystem
/// <summary>
/// Remove everything attached to the strap
/// </summary>
private void StrapRemoveAll(StrapComponent strapComp)
private void StrapRemoveAll(EntityUid uid, StrapComponent strapComp)
{
foreach (var entity in strapComp.BuckledEntities.ToArray())
{
@@ -267,7 +267,7 @@ public abstract partial class SharedBuckleSystem
strapComp.BuckledEntities.Clear();
strapComp.OccupiedSize = 0;
Dirty(strapComp);
Dirty(uid, strapComp);
}
private bool StrapHasSpace(EntityUid strapUid, BuckleComponent buckleComp, StrapComponent? strapComp = null)
@@ -313,6 +313,6 @@ public abstract partial class SharedBuckleSystem
strapComp.Enabled = enabled;
if (!enabled)
StrapRemoveAll(strapComp);
StrapRemoveAll(strapUid, strapComp);
}
}

View File

@@ -89,7 +89,7 @@ namespace Content.Shared.Containers.ItemSlots
/// </summary>
public void AddItemSlot(EntityUid uid, string id, ItemSlot slot, ItemSlotsComponent? itemSlots = null)
{
itemSlots ??= EntityManager.EnsureComponent<ItemSlotsComponent>(uid);
itemSlots ??= EnsureComp<ItemSlotsComponent>(uid);
DebugTools.AssertOwner(uid, itemSlots);
if (itemSlots.Slots.TryGetValue(id, out var existing))
@@ -103,7 +103,7 @@ namespace Content.Shared.Containers.ItemSlots
slot.ContainerSlot = _containers.EnsureContainer<ContainerSlot>(uid, id);
itemSlots.Slots[id] = slot;
Dirty(itemSlots);
Dirty(uid, itemSlots);
}
/// <summary>
@@ -127,7 +127,7 @@ namespace Content.Shared.Containers.ItemSlots
if (itemSlots.Slots.Count == 0)
EntityManager.RemoveComponent(uid, itemSlots);
else
Dirty(itemSlots);
Dirty(uid, itemSlots);
}
public bool TryGetSlot(EntityUid uid, string slotId, [NotNullWhen(true)] out ItemSlot? itemSlot, ItemSlotsComponent? component = null)

View File

@@ -285,7 +285,7 @@ public sealed partial class StaminaSystem : EntitySystem
}
EnsureComp<ActiveStaminaComponent>(uid);
Dirty(component);
Dirty(uid, component);
if (value <= 0)
return;
@@ -345,7 +345,7 @@ public sealed partial class StaminaSystem : EntitySystem
comp.NextUpdate += TimeSpan.FromSeconds(1f);
TakeStaminaDamage(uid, -comp.Decay, comp);
Dirty(comp);
Dirty(uid, comp);
}
}
@@ -368,7 +368,7 @@ public sealed partial class StaminaSystem : EntitySystem
// Give them buffer before being able to be re-stunned
component.NextUpdate = _timing.CurTime + component.StunTime + StamCritBufferTime;
EnsureComp<ActiveStaminaComponent>(uid);
Dirty(component);
Dirty(uid, component);
_adminLogger.Add(LogType.Stamina, LogImpact.Medium, $"{ToPrettyString(uid):user} entered stamina crit");
}
@@ -385,7 +385,7 @@ public sealed partial class StaminaSystem : EntitySystem
component.NextUpdate = _timing.CurTime;
SetStaminaAlert(uid, component);
RemComp<ActiveStaminaComponent>(uid);
Dirty(component);
Dirty(uid, component);
_adminLogger.Add(LogType.Stamina, LogImpact.Low, $"{ToPrettyString(uid):user} recovered from stamina crit");
}
}

View File

@@ -69,7 +69,7 @@ namespace Content.Shared.Decals
// This **shouldn't** be required, but just in case we ever get entity prototypes that have decal grids, we
// need to ensure that we send an initial full state to players.
Dirty(component);
Dirty(uid, component);
}
protected Dictionary<Vector2i, DecalChunk>? ChunkCollection(EntityUid gridEuid, DecalGridComponent? comp = null)

View File

@@ -59,7 +59,7 @@ public abstract class SharedDiceSystem : EntitySystem
}
die.CurrentValue = (side - die.Offset) * die.Multiplier;
Dirty(die);
Dirty(uid, die);
UpdateVisuals(uid, die);
}

View File

@@ -20,7 +20,7 @@ namespace Content.Shared.Electrocution
return;
insulated.Coefficient = siemensCoefficient;
Dirty(insulated);
Dirty(uid, insulated);
}
/// <param name="uid">Entity being electrocuted.</param>

View File

@@ -19,7 +19,7 @@ public sealed class EmoteSystem : EntitySystem
if (component.Enabled == value)
return;
Dirty(component);
Dirty(uid, component);
}
private void OnEmoteAttempt(EmoteAttemptEvent args)

View File

@@ -214,7 +214,7 @@ namespace Content.Shared.Friction
return;
friction.Modifier = value;
Dirty(friction);
Dirty(entityUid, friction);
}
}
}

View File

@@ -33,7 +33,7 @@ public abstract class SharedFloatingVisualizerSystem : EntitySystem
return false;
component.CanFloat = GravitySystem.IsWeightless(uid, xform: transform);
Dirty(component);
Dirty(uid, component);
return component.CanFloat;
}

View File

@@ -24,7 +24,7 @@ public abstract partial class SharedGravitySystem
ShakeGrid(uid, gravity);
comp.ShakeTimes--;
comp.NextShake += TimeSpan.FromSeconds(ShakeCooldown);
Dirty(comp);
Dirty(uid, comp);
}
}
}
@@ -44,7 +44,7 @@ public abstract partial class SharedGravitySystem
}
shake.ShakeTimes = 10;
Dirty(shake);
Dirty(uid, shake);
}
protected virtual void ShakeGrid(EntityUid uid, GravityComponent? comp = null) {}

View File

@@ -99,7 +99,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
}
if (dirty)
Dirty(humanoid);
Dirty(uid, humanoid);
}
protected virtual void SetLayerVisibility(
@@ -147,7 +147,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
humanoid.MarkingSet = new(oldMarkings, prototype.MarkingPoints, _markingManager, _prototypeManager);
if (sync)
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>
@@ -177,7 +177,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
humanoid.SkinColor = skinColor;
if (sync)
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>
@@ -201,7 +201,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
humanoid.CustomBaseLayers[layer] = new(id);
if (sync)
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>
@@ -222,7 +222,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
humanoid.CustomBaseLayers[layer] = new(null, color);
if (sync)
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>
@@ -244,7 +244,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
if (sync)
{
Dirty(humanoid);
Dirty(uid, humanoid);
}
}
@@ -329,7 +329,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
humanoid.Age = profile.Age;
Dirty(humanoid);
Dirty(uid, humanoid);
}
/// <summary>
@@ -362,7 +362,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
humanoid.MarkingSet.AddBack(prototype.MarkingCategory, markingObject);
if (sync)
Dirty(humanoid);
Dirty(uid, humanoid);
}
private void EnsureDefaultMarkings(EntityUid uid, HumanoidAppearanceComponent? humanoid)
@@ -396,6 +396,6 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
humanoid.MarkingSet.AddBack(prototype.MarkingCategory, markingObject);
if (sync)
Dirty(humanoid);
Dirty(uid, humanoid);
}
}

View File

@@ -77,7 +77,7 @@ public abstract class SharedImplanterSystem : EntitySystem
var ev = new TransferDnaEvent { Donor = target, Recipient = implanter };
RaiseLocalEvent(target, ref ev);
Dirty(component);
Dirty(implanter, component);
}
public bool CanImplant(
@@ -156,7 +156,7 @@ public abstract class SharedImplanterSystem : EntitySystem
if (component.CurrentMode == ImplanterToggleMode.Draw && !component.ImplantOnly && !permanentFound)
ImplantMode(implanter, component);
Dirty(component);
Dirty(implanter, component);
}
}

View File

@@ -12,10 +12,10 @@ public abstract class SharedInstrumentSystem : EntitySystem
{
}
public void SetInstrumentProgram(SharedInstrumentComponent component, byte program, byte bank)
public void SetInstrumentProgram(EntityUid uid, SharedInstrumentComponent component, byte program, byte bank)
{
component.InstrumentBank = bank;
component.InstrumentProgram = program;
Dirty(component);
Dirty(uid, component);
}
}

View File

@@ -29,7 +29,7 @@ public abstract class SharedHandheldLightSystem : EntitySystem
UpdateVisuals(uid, component);
// Want to make sure client has latest data on level so battery displays properly.
Dirty(component);
Dirty(uid, component);
}
private void OnHandleState(EntityUid uid, HandheldLightComponent component, ref ComponentHandleState args)

View File

@@ -17,13 +17,13 @@ public abstract class SharedRgbLightControllerSystem : EntitySystem
args.State = new RgbLightControllerState(component.CycleRate, component.Layers);
}
public void SetLayers(EntityUid uid, List<int>? layers, RgbLightControllerComponent? rgb = null)
public void SetLayers(EntityUid uid, List<int>? layers, RgbLightControllerComponent? rgb = null)
{
if (!Resolve(uid, ref rgb))
return;
rgb.Layers = layers;
Dirty(rgb);
Dirty(uid, rgb);
}
public void SetCycleRate(EntityUid uid, float rate, RgbLightControllerComponent? rgb = null)
@@ -32,6 +32,6 @@ public abstract class SharedRgbLightControllerSystem : EntitySystem
return;
rgb.CycleRate = Math.Clamp(0.01f, rate, 1); // lets not give people seizures
Dirty(rgb);
Dirty(uid, rgb);
}
}

View File

@@ -194,7 +194,7 @@ public abstract class SharedMechSystem : EntitySystem
if (_net.IsServer)
_popup.PopupEntity(popupString, uid);
Dirty(component);
Dirty(uid, component);
}
/// <summary>
@@ -278,7 +278,7 @@ public abstract class SharedMechSystem : EntitySystem
return false;
component.Energy = FixedPoint2.Clamp(component.Energy + delta, 0, component.MaxEnergy);
Dirty(component);
Dirty(uid, component);
UpdateUserInterface(uid, component);
return true;
}
@@ -306,7 +306,7 @@ public abstract class SharedMechSystem : EntitySystem
UpdateAppearance(uid, component);
}
Dirty(component);
Dirty(uid, component);
UpdateUserInterface(uid, component);
}

View File

@@ -58,7 +58,7 @@ public sealed class SpeedModifierContactsSystem : EntitySystem
}
component.WalkSpeedModifier = walkSpeed;
component.SprintSpeedModifier = sprintSpeed;
Dirty(component);
Dirty(uid, component);
_toUpdate.UnionWith(_physics.GetContactingEntities(uid));
}

View File

@@ -85,7 +85,7 @@ public sealed class HungerSystem : EntitySystem
component.Thresholds[HungerThreshold.Dead],
component.Thresholds[HungerThreshold.Overfed]);
UpdateCurrentThreshold(uid, component);
Dirty(component);
Dirty(uid, component);
}
private void UpdateCurrentThreshold(EntityUid uid, HungerComponent? component = null)
@@ -98,7 +98,7 @@ public sealed class HungerSystem : EntitySystem
return;
component.CurrentThreshold = calculatedHungerThreshold;
DoHungerThresholdEffects(uid, component);
Dirty(component);
Dirty(uid, component);
}
private void DoHungerThresholdEffects(EntityUid uid, HungerComponent? component = null, bool force = false)

View File

@@ -100,10 +100,10 @@ public abstract class SharedConveyorController : VirtualController
transform.LocalPosition = localPos;
// Force it awake for collisionwake reasons.
Physics.SetAwake(entity, body, true);
Physics.SetAwake((entity, body), true);
Physics.SetSleepTime(body, 0f);
}
Dirty(comp);
Dirty(uid, comp);
}
private static Vector2 Convey(Vector2 direction, float speed, float frameTime, Vector2 itemRelative)

View File

@@ -36,7 +36,7 @@ public sealed class RCDAmmoSystem : EntitySystem
if (args.Handled || !args.CanReach || !_timing.IsFirstTimePredicted)
return;
if (args.Target is not {Valid: true} target ||
if (args.Target is not { Valid: true } target ||
!HasComp<RCDComponent>(target) ||
!TryComp<LimitedChargesComponent>(target, out var charges))
return;
@@ -53,7 +53,7 @@ public sealed class RCDAmmoSystem : EntitySystem
_popup.PopupClient(Loc.GetString("rcd-ammo-component-after-interact-refilled"), target, user);
_charges.AddCharges(target, count, charges);
comp.Charges -= count;
Dirty(comp);
Dirty(uid, comp);
// prevent having useless ammo with 0 charges
if (comp.Charges <= 0)

View File

@@ -312,7 +312,7 @@ public sealed class RCDSystem : EntitySystem
var mode = (int) comp.Mode;
mode = ++mode % RcdModeCount;
comp.Mode = (RcdMode) mode;
Dirty(comp);
Dirty(uid, comp);
var msg = Loc.GetString("rcd-component-change-mode", ("mode", comp.Mode.ToString()));
_popup.PopupClient(msg, uid, user);

View File

@@ -66,7 +66,7 @@ public abstract class SharedEventHorizonSystem : EntitySystem
return;
eventHorizon.Radius = value;
Dirty(eventHorizon);
Dirty(uid, eventHorizon);
if (updateFixture)
UpdateEventHorizonFixture(uid, eventHorizon: eventHorizon);
}
@@ -89,7 +89,7 @@ public abstract class SharedEventHorizonSystem : EntitySystem
return;
eventHorizon.CanBreachContainment = value;
Dirty(eventHorizon);
Dirty(uid, eventHorizon);
if (updateFixture)
UpdateEventHorizonFixture(uid, eventHorizon: eventHorizon);
}
@@ -112,7 +112,7 @@ public abstract class SharedEventHorizonSystem : EntitySystem
return;
eventHorizon.ColliderFixtureId = value;
Dirty(eventHorizon);
Dirty(uid, eventHorizon);
if (updateFixture)
UpdateEventHorizonFixture(uid, eventHorizon: eventHorizon);
}
@@ -135,7 +135,7 @@ public abstract class SharedEventHorizonSystem : EntitySystem
return;
eventHorizon.ConsumerFixtureId = value;
Dirty(eventHorizon);
Dirty(uid, eventHorizon);
if (updateFixture)
UpdateEventHorizonFixture(uid, eventHorizon: eventHorizon);
}

View File

@@ -23,8 +23,8 @@ namespace Content.Shared.Stacks
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
[Dependency] protected readonly SharedHandsSystem Hands = default!;
[Dependency] protected readonly SharedTransformSystem Xform = default!;
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] protected readonly SharedPopupSystem Popup = default!;
[Dependency] private readonly SharedStorageSystem _storage = default!;
@@ -175,7 +175,7 @@ namespace Content.Shared.Stacks
// Server-side override deletes the entity if count == 0
component.Count = amount;
Dirty(component);
Dirty(uid, component);
Appearance.SetData(uid, StackVisuals.Actual, component.Count);
RaiseLocalEvent(uid, new StackCountChangedEvent(old, component.Count));

View File

@@ -56,7 +56,7 @@ namespace Content.Shared.Standing
return false;
standingState.Standing = false;
Dirty(standingState);
Dirty(uid, standingState);
RaiseLocalEvent(uid, new DownedEvent(), false);
// Seemed like the best place to put it

View File

@@ -58,7 +58,7 @@ public sealed class StationRecordKeyStorageSystem : EntitySystem
var key = keyStorage.Key;
keyStorage.Key = null;
Dirty(keyStorage);
Dirty(uid, keyStorage);
return key;
}

View File

@@ -207,7 +207,7 @@ namespace Content.Shared.StatusEffect
_alertsSystem.ShowAlert(uid, proto.Alert.Value, null, cooldown1);
}
Dirty(status);
Dirty(uid, status);
RaiseLocalEvent(uid, new StatusEffectAddedEvent(uid, key));
return true;
}
@@ -283,7 +283,7 @@ namespace Content.Shared.StatusEffect
RemComp<ActiveStatusEffectsComponent>(uid);
}
Dirty(status);
Dirty(uid, status);
RaiseLocalEvent(uid, new StatusEffectEndedEvent(uid, key));
return true;
}
@@ -307,7 +307,7 @@ namespace Content.Shared.StatusEffect
failed = true;
}
Dirty(status);
Dirty(uid, status);
return failed;
}
@@ -381,7 +381,7 @@ namespace Content.Shared.StatusEffect
_alertsSystem.ShowAlert(uid, proto.Alert.Value, null, cooldown);
}
Dirty(status);
Dirty(uid, status);
return true;
}
@@ -417,7 +417,7 @@ namespace Content.Shared.StatusEffect
_alertsSystem.ShowAlert(uid, proto.Alert.Value, null, cooldown);
}
Dirty(status);
Dirty(uid, status);
return true;
}
@@ -438,7 +438,7 @@ namespace Content.Shared.StatusEffect
status.ActiveEffects[key].Cooldown = (_gameTiming.CurTime, _gameTiming.CurTime + time);
Dirty(status);
Dirty(uid, status);
return true;
}

View File

@@ -135,7 +135,7 @@ public sealed class BinSystem : EntitySystem
_container.Insert(toInsert, component.ItemContainer);
component.Items.Add(toInsert);
Dirty(component);
Dirty(uid, component);
return true;
}
@@ -151,7 +151,7 @@ public sealed class BinSystem : EntitySystem
if (!Resolve(uid, ref component))
return false;
if (!component.Items.Any())
if (component.Items.Count == 0)
return false;
if (toRemove == null || toRemove != component.Items.LastOrDefault())
@@ -161,7 +161,7 @@ public sealed class BinSystem : EntitySystem
return false;
component.Items.Remove(toRemove.Value);
Dirty(component);
Dirty(uid, component);
return true;
}
}

View File

@@ -1,7 +1,5 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Administration.Logs;
using Content.Shared.Audio;
using Content.Shared.DragDrop;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory.Events;
@@ -11,16 +9,12 @@ using Content.Shared.Database;
using Content.Shared.Hands;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Systems;
using Content.Shared.Standing;
using Content.Shared.StatusEffect;
using Content.Shared.Throwing;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Player;
namespace Content.Shared.Stunnable;
@@ -82,19 +76,19 @@ public abstract class SharedStunSystem : EntitySystem
switch (args.NewMobState)
{
case MobState.Alive:
{
break;
}
{
break;
}
case MobState.Critical:
{
_statusEffect.TryRemoveStatusEffect(uid, "Stun");
break;
}
{
_statusEffect.TryRemoveStatusEffect(uid, "Stun");
break;
}
case MobState.Dead:
{
_statusEffect.TryRemoveStatusEffect(uid, "Stun");
break;
}
{
_statusEffect.TryRemoveStatusEffect(uid, "Stun");
break;
}
case MobState.Invalid:
default:
return;
@@ -238,11 +232,11 @@ public abstract class SharedStunSystem : EntitySystem
return;
// Set it to half the help interval so helping is actually useful...
knocked.HelpTimer = knocked.HelpInterval/2f;
knocked.HelpTimer = knocked.HelpInterval / 2f;
_statusEffect.TryRemoveTime(uid, "KnockedDown", TimeSpan.FromSeconds(knocked.HelpInterval));
_audio.PlayPredicted(knocked.StunAttemptSound, uid, args.User);
Dirty(knocked);
Dirty(uid, knocked);
args.Handled = true;
}

View File

@@ -35,7 +35,7 @@ public abstract class SharedTrayScannerSystem : EntitySystem
return;
scanner.Enabled = enabled;
Dirty(scanner);
Dirty(uid, scanner);
// We don't remove from _activeScanners on disabled, because the update function will handle that, as well as
// managing the revealed subfloor entities

View File

@@ -75,7 +75,7 @@ public sealed class TagSystem : EntitySystem
/// </exception>
public bool AddTag(EntityUid entity, string id)
{
return AddTag(EnsureComp<TagComponent>(entity), id);
return AddTag(entity, EnsureComp<TagComponent>(entity), id);
}
/// <summary>
@@ -91,7 +91,7 @@ public sealed class TagSystem : EntitySystem
/// </exception>
public bool AddTags(EntityUid entity, params string[] ids)
{
return AddTags(EnsureComp<TagComponent>(entity), ids);
return AddTags(entity, EnsureComp<TagComponent>(entity), ids);
}
/// <summary>
@@ -107,7 +107,7 @@ public sealed class TagSystem : EntitySystem
/// </exception>
public bool AddTags(EntityUid entity, IEnumerable<string> ids)
{
return AddTags(EnsureComp<TagComponent>(entity), ids);
return AddTags(entity, EnsureComp<TagComponent>(entity), ids);
}
/// <summary>
@@ -125,7 +125,7 @@ public sealed class TagSystem : EntitySystem
public bool TryAddTag(EntityUid entity, string id)
{
return TryComp<TagComponent>(entity, out var component) &&
AddTag(component, id);
AddTag(entity, component, id);
}
/// <summary>
@@ -143,7 +143,7 @@ public sealed class TagSystem : EntitySystem
public bool TryAddTags(EntityUid entity, params string[] ids)
{
return TryComp<TagComponent>(entity, out var component) &&
AddTags(component, ids);
AddTags(entity, component, ids);
}
/// <summary>
@@ -161,7 +161,7 @@ public sealed class TagSystem : EntitySystem
public bool TryAddTags(EntityUid entity, IEnumerable<string> ids)
{
return TryComp<TagComponent>(entity, out var component) &&
AddTags(component, ids);
AddTags(entity, component, ids);
}
/// <summary>
@@ -299,7 +299,7 @@ public sealed class TagSystem : EntitySystem
public bool RemoveTag(EntityUid entity, string id)
{
return TryComp<TagComponent>(entity, out var component) &&
RemoveTag(component, id);
RemoveTag(entity, component, id);
}
/// <summary>
@@ -316,7 +316,7 @@ public sealed class TagSystem : EntitySystem
public bool RemoveTags(EntityUid entity, params string[] ids)
{
return TryComp<TagComponent>(entity, out var component) &&
RemoveTags(component, ids);
RemoveTags(entity, component, ids);
}
/// <summary>
@@ -333,7 +333,7 @@ public sealed class TagSystem : EntitySystem
public bool RemoveTags(EntityUid entity, IEnumerable<string> ids)
{
return TryComp<TagComponent>(entity, out var component) &&
RemoveTags(component, ids);
RemoveTags(entity, component, ids);
}
/// <summary>
@@ -344,14 +344,14 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception>
public bool AddTag(TagComponent component, string id)
public bool AddTag(EntityUid uid, TagComponent component, string id)
{
AssertValidTag(id);
var added = component.Tags.Add(id);
if (added)
{
Dirty(component);
Dirty(uid, component);
return true;
}
@@ -366,9 +366,9 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public bool AddTags(TagComponent component, params string[] ids)
public bool AddTags(EntityUid uid, TagComponent component, params string[] ids)
{
return AddTags(component, ids.AsEnumerable());
return AddTags(uid, component, ids.AsEnumerable());
}
/// <summary>
@@ -379,7 +379,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public bool AddTags(TagComponent component, IEnumerable<string> ids)
public bool AddTags(EntityUid uid, TagComponent component, IEnumerable<string> ids)
{
var count = component.Tags.Count;
@@ -391,7 +391,7 @@ public sealed class TagSystem : EntitySystem
if (component.Tags.Count > count)
{
Dirty(component);
Dirty(uid, component);
return true;
}
@@ -557,13 +557,13 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception>
public bool RemoveTag(TagComponent component, string id)
public bool RemoveTag(EntityUid uid, TagComponent component, string id)
{
AssertValidTag(id);
if (component.Tags.Remove(id))
{
Dirty(component);
Dirty(uid, component);
return true;
}
@@ -580,9 +580,9 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public bool RemoveTags(TagComponent component, params string[] ids)
public bool RemoveTags(EntityUid uid, TagComponent component, params string[] ids)
{
return RemoveTags(component, ids.AsEnumerable());
return RemoveTags(uid, component, ids.AsEnumerable());
}
/// <summary>
@@ -593,7 +593,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public bool RemoveTags(TagComponent component, IEnumerable<string> ids)
public bool RemoveTags(EntityUid uid, TagComponent component, IEnumerable<string> ids)
{
var count = component.Tags.Count;
@@ -605,7 +605,7 @@ public sealed class TagSystem : EntitySystem
if (component.Tags.Count < count)
{
Dirty(component);
Dirty(uid, component);
return true;
}

View File

@@ -87,7 +87,7 @@ public sealed class LinkedEntitySystem : EntitySystem
/// <param name="secondLink">Resolve comp</param>
/// <returns>Whether unlinking was successful (e.g. they both were actually linked to one another)</returns>
public bool TryUnlink(EntityUid first, EntityUid second,
LinkedEntityComponent? firstLink=null, LinkedEntityComponent? secondLink=null)
LinkedEntityComponent? firstLink = null, LinkedEntityComponent? secondLink = null)
{
if (!Resolve(first, ref firstLink))
return false;
@@ -101,8 +101,8 @@ public sealed class LinkedEntitySystem : EntitySystem
_appearance.SetData(first, LinkedEntityVisuals.HasAnyLinks, firstLink.LinkedEntities.Any());
_appearance.SetData(second, LinkedEntityVisuals.HasAnyLinks, secondLink.LinkedEntities.Any());
Dirty(firstLink);
Dirty(secondLink);
Dirty(first, firstLink);
Dirty(second, secondLink);
if (firstLink.LinkedEntities.Count == 0 && firstLink.DeleteOnEmptyLinks)
QueueDel(first);

View File

@@ -71,7 +71,7 @@ public abstract class SharedDamageMarkerSystem : EntitySystem
marker.Marker = projectile.Weapon.Value;
marker.EndTime = _timing.CurTime + component.Duration;
component.Amount--;
Dirty(marker);
Dirty(args.OtherEntity, marker);
if (_netManager.IsServer)
{
@@ -81,7 +81,7 @@ public abstract class SharedDamageMarkerSystem : EntitySystem
}
else
{
Dirty(component);
Dirty(uid, component);
}
}
}

View File

@@ -21,17 +21,17 @@ namespace Content.Shared.Weapons.Misc;
public abstract partial class SharedTetherGunSystem : EntitySystem
{
[Dependency] private readonly INetManager _netManager = default!;
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly MobStateSystem _mob = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedJointSystem _joints = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly INetManager _netManager = default!;
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly MobStateSystem _mob = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedJointSystem _joints = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly ThrownItemSystem _thrown = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly ThrownItemSystem _thrown = default!;
private const string TetherJoint = "tether";
@@ -282,7 +282,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
RemComp<TetheredComponent>(component.Tethered.Value);
_blocker.UpdateCanMove(component.Tethered.Value);
component.Tethered = null;
Dirty(component);
Dirty(gunUid, component);
}
[Serializable, NetSerializable]

View File

@@ -49,19 +49,19 @@ public sealed class RechargeBasicEntityAmmoSystem : EntitySystem
if (ammo.Count == ammo.Capacity)
{
recharge.NextCharge = null;
Dirty(recharge);
Dirty(uid, recharge);
continue;
}
recharge.NextCharge = recharge.NextCharge.Value + TimeSpan.FromSeconds(recharge.RechargeCooldown);
Dirty(recharge);
Dirty(uid, recharge);
}
}
private void OnInit(EntityUid uid, RechargeBasicEntityAmmoComponent component, MapInitEvent args)
{
component.NextCharge = _timing.CurTime;
Dirty(component);
Dirty(uid, component);
}
private void OnExamined(EntityUid uid, RechargeBasicEntityAmmoComponent component, ExaminedEvent args)
@@ -86,7 +86,7 @@ public sealed class RechargeBasicEntityAmmoSystem : EntitySystem
if (recharge.NextCharge == null || recharge.NextCharge < _timing.CurTime)
{
recharge.NextCharge = _timing.CurTime + TimeSpan.FromSeconds(recharge.RechargeCooldown);
Dirty(recharge);
Dirty(uid, recharge);
}
}
}

View File

@@ -25,7 +25,7 @@ public sealed class RechargeCycleAmmoSystem : EntitySystem
return;
_gun.UpdateBasicEntityAmmoCount(uid, basic.Count.Value + 1, basic);
Dirty(basic);
Dirty(uid, basic);
args.Handled = true;
}
}

View File

@@ -117,7 +117,7 @@ public abstract partial class SharedGunSystem : EntitySystem
if (melee.NextAttack > component.NextFire)
{
component.NextFire = melee.NextAttack;
Dirty(component);
Dirty(uid, component);
}
}

View File

@@ -15,8 +15,8 @@ public abstract class SharedWeatherSystem : EntitySystem
[Dependency] protected readonly IGameTiming Timing = default!;
[Dependency] protected readonly IMapManager MapManager = default!;
[Dependency] protected readonly IPrototypeManager ProtoMan = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
[Dependency] private readonly MetaDataSystem _metadata = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
[Dependency] private readonly MetaDataSystem _metadata = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
private EntityQuery<BlockWeatherComponent> _blockQuery;
@@ -129,7 +129,7 @@ public abstract class SharedWeatherSystem : EntitySystem
// Shutting down
if (endTime != null && remainingTime < WeatherComponent.ShutdownTime)
{
SetState(WeatherState.Ending, comp, weather, weatherProto);
SetState(uid, WeatherState.Ending, comp, weather, weatherProto);
}
// Starting up
else
@@ -139,7 +139,7 @@ public abstract class SharedWeatherSystem : EntitySystem
if (elapsed < WeatherComponent.StartupTime)
{
SetState(WeatherState.Starting, comp, weather, weatherProto);
SetState(uid, WeatherState.Starting, comp, weather, weatherProto);
}
}
@@ -182,15 +182,15 @@ public abstract class SharedWeatherSystem : EntitySystem
}
if (proto != null)
StartWeather(weatherComp, proto, endTime);
StartWeather(mapUid, weatherComp, proto, endTime);
}
/// <summary>
/// Run every tick when the weather is running.
/// </summary>
protected virtual void Run(EntityUid uid, WeatherData weather, WeatherPrototype weatherProto, float frameTime) {}
protected virtual void Run(EntityUid uid, WeatherData weather, WeatherPrototype weatherProto, float frameTime) { }
protected void StartWeather(WeatherComponent component, WeatherPrototype weather, TimeSpan? endTime)
protected void StartWeather(EntityUid uid, WeatherComponent component, WeatherPrototype weather, TimeSpan? endTime)
{
if (component.Weather.ContainsKey(weather.ID))
return;
@@ -202,7 +202,7 @@ public abstract class SharedWeatherSystem : EntitySystem
};
component.Weather.Add(weather.ID, data);
Dirty(component);
Dirty(uid, component);
}
protected virtual void EndWeather(EntityUid uid, WeatherComponent component, string proto)
@@ -216,13 +216,13 @@ public abstract class SharedWeatherSystem : EntitySystem
Dirty(uid, component);
}
protected virtual bool SetState(WeatherState state, WeatherComponent component, WeatherData weather, WeatherPrototype weatherProto)
protected virtual bool SetState(EntityUid uid, WeatherState state, WeatherComponent component, WeatherData weather, WeatherPrototype weatherProto)
{
if (weather.State.Equals(state))
return false;
weather.State = state;
Dirty(component);
Dirty(uid, component);
return true;
}