FlashLightVisualizer refactor + low power handheld light light radius fix (#11768)
* refactor: Removes FlashLightVisualizer (based on obsolete code) in favor or merging its functionality with HandheldLightComponent fix: Low power lighting radius animations for lanterns, floodlights and flashlights now properly restore the original light radius when going back to full power * refactor: Use the LightBehaviour component to animate HandheldLights refactor: Remove unneeded HandheldLight definitions in some yaml files (already inherited by parents) fix: Properly change the server side PointLightComponent Enabled property when turning HandheldLights on/off feat: ReverseWhenFinished property on Fade light behaviours * Empty commit to rerun CI with the new engine PR * fix: Restore the correct HandheldLight addPrefix property, whoops * refactor: blinkingBehaviourID -> blinkingBehaviourId, radiatingBehaviourID -> radiatingBehaviourId
This commit is contained in:
@@ -187,8 +187,12 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
public bool TurnOff(HandheldLightComponent component, bool makeNoise = true)
|
||||
{
|
||||
if (!component.Activated) return false;
|
||||
if (!component.Activated || !TryComp<PointLightComponent>(component.Owner, out var pointLightComponent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pointLightComponent.Enabled = false;
|
||||
SetActivated(component.Owner, false, component, makeNoise);
|
||||
component.Level = null;
|
||||
_activeLights.Remove(component);
|
||||
@@ -197,7 +201,10 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
public bool TurnOn(EntityUid user, HandheldLightComponent component)
|
||||
{
|
||||
if (component.Activated) return false;
|
||||
if (component.Activated || !TryComp<PointLightComponent>(component.Owner, out var pointLightComponent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_powerCell.TryGetBatteryFromSlot(component.Owner, out var battery) &&
|
||||
!TryComp(component.Owner, out battery))
|
||||
@@ -217,6 +224,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
pointLightComponent.Enabled = true;
|
||||
SetActivated(component.Owner, true, component, true);
|
||||
_activeLights.Add(component);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user