Make energy swords use RgbLightController (#7344)

This commit is contained in:
Leon Friedrich
2022-04-16 17:11:48 +12:00
committed by GitHub
parent 1dcaa2d44b
commit a231429cb4
35 changed files with 240 additions and 583 deletions

View File

@@ -183,10 +183,13 @@ namespace Content.Server.Light.EntitySystems
_actionSystem.SetToggled(component.ToggleAction, false);
_activeLights.Remove(component);
component.LastLevel = null;
component.Dirty(EntityManager);
Dirty(component);
if (TryComp(component.Owner, out AppearanceComponent? appearance))
appearance.SetData(ToggleableLightVisuals.Enabled, false);
if (makeNoise)
SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOffSound.GetSound(), component.Owner);
SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.TurnOffSound.GetSound(), component.Owner);
return true;
}
@@ -197,7 +200,7 @@ namespace Content.Server.Light.EntitySystems
if (!_powerCell.TryGetBatteryFromSlot(component.Owner, out var battery))
{
SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOnFailSound.GetSound(), component.Owner);
SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.TurnOnFailSound.GetSound(), component.Owner);
_popup.PopupEntity(Loc.GetString("handheld-light-component-cell-missing-message"), component.Owner, Filter.Entities(user));
return false;
}
@@ -207,7 +210,7 @@ namespace Content.Server.Light.EntitySystems
// Simple enough.
if (component.Wattage > battery.CurrentCharge)
{
SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOnFailSound.GetSound(), component.Owner);
SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.TurnOnFailSound.GetSound(), component.Owner);
_popup.PopupEntity(Loc.GetString("handheld-light-component-cell-dead-message"), component.Owner, Filter.Entities(user));
return false;
}
@@ -219,7 +222,10 @@ namespace Content.Server.Light.EntitySystems
component.LastLevel = GetLevel(component);
Dirty(component);
SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOnSound.GetSound(), component.Owner);
if (TryComp(component.Owner, out AppearanceComponent? appearance))
appearance.SetData(ToggleableLightVisuals.Enabled, true);
SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.TurnOnSound.GetSound(), component.Owner);
return true;
}