Световые приколы (#200)
* add: new visuals to health analyzer and new graphic funny light * fix: fix pointlight and analyzer visuals
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Content.Server._White.Lighting;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class PointLightBatteryComponent : Component
|
||||||
|
{
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool RequireBattery = true;
|
||||||
|
}
|
||||||
30
Content.Server/_White/Lighting/PointLightBatterySystem.cs
Normal file
30
Content.Server/_White/Lighting/PointLightBatterySystem.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using Content.Shared.Lightning;
|
||||||
|
using Content.Shared.PowerCell;
|
||||||
|
using Content.Shared.PowerCell.Components;
|
||||||
|
|
||||||
|
namespace Content.Server._White.Lighting;
|
||||||
|
|
||||||
|
public sealed class PointLightBatterySystem : SharedLightningSystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!;
|
||||||
|
[Dependency] private readonly SharedPowerCellSystem _cell = default!;
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<PointLightBatteryComponent, PowerCellChangedEvent>(OnBatteryLoose);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBatteryLoose(EntityUid uid, PointLightBatteryComponent component, PowerCellChangedEvent args)
|
||||||
|
{
|
||||||
|
if (!component.RequireBattery)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!_pointLightSystem.TryGetLight(uid, out var pointLightComponent))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var isBatteryCharged = _cell.HasDrawCharge(uid);
|
||||||
|
_pointLightSystem.SetEnabled(uid, isBatteryCharged && !args.Ejected, pointLightComponent);
|
||||||
|
|
||||||
|
RaiseLocalEvent(uid, new PointLightToggleEvent(isBatteryCharged && !args.Ejected), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ public abstract class SharedPowerCellSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<PowerCellSlotComponent, EntInsertedIntoContainerMessage>(OnCellInserted);
|
SubscribeLocalEvent<PowerCellSlotComponent, EntInsertedIntoContainerMessage>(OnCellInserted);
|
||||||
SubscribeLocalEvent<PowerCellSlotComponent, EntRemovedFromContainerMessage>(OnCellRemoved);
|
SubscribeLocalEvent<PowerCellSlotComponent, EntRemovedFromContainerMessage>(OnCellRemoved);
|
||||||
SubscribeLocalEvent<PowerCellSlotComponent, ContainerIsInsertingAttemptEvent>(OnCellInsertAttempt);
|
SubscribeLocalEvent<PowerCellSlotComponent, ContainerIsInsertingAttemptEvent>(OnCellInsertAttempt);
|
||||||
|
SubscribeLocalEvent<PowerCellSlotComponent, PowerCellChangedEvent>(OnPowerChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRejuvenate(EntityUid uid, PowerCellSlotComponent component, RejuvenateEvent args)
|
private void OnRejuvenate(EntityUid uid, PowerCellSlotComponent component, RejuvenateEvent args)
|
||||||
@@ -30,6 +31,16 @@ public abstract class SharedPowerCellSystem : EntitySystem
|
|||||||
RaiseLocalEvent(itemSlot.Item.Value, args);
|
RaiseLocalEvent(itemSlot.Item.Value, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPowerChanged(EntityUid uid, PowerCellSlotComponent component, PowerCellChangedEvent _)
|
||||||
|
{
|
||||||
|
if (!component.Initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var charged = HasDrawCharge(uid);
|
||||||
|
|
||||||
|
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, charged);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnCellInsertAttempt(EntityUid uid, PowerCellSlotComponent component, ContainerIsInsertingAttemptEvent args)
|
private void OnCellInsertAttempt(EntityUid uid, PowerCellSlotComponent component, ContainerIsInsertingAttemptEvent args)
|
||||||
{
|
{
|
||||||
if (!component.Initialized)
|
if (!component.Initialized)
|
||||||
@@ -51,14 +62,18 @@ public abstract class SharedPowerCellSystem : EntitySystem
|
|||||||
|
|
||||||
if (args.Container.ID != component.CellSlotId)
|
if (args.Container.ID != component.CellSlotId)
|
||||||
return;
|
return;
|
||||||
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, true);
|
|
||||||
RaiseLocalEvent(uid, new PowerCellChangedEvent(false), false);
|
var charged = HasDrawCharge(uid);
|
||||||
|
|
||||||
|
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, charged);
|
||||||
|
RaiseLocalEvent(uid, new PowerCellChangedEvent(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnCellRemoved(EntityUid uid, PowerCellSlotComponent component, EntRemovedFromContainerMessage args)
|
protected virtual void OnCellRemoved(EntityUid uid, PowerCellSlotComponent component, EntRemovedFromContainerMessage args)
|
||||||
{
|
{
|
||||||
if (args.Container.ID != component.CellSlotId)
|
if (args.Container.ID != component.CellSlotId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, false);
|
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, false);
|
||||||
RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false);
|
RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,12 @@
|
|||||||
sprite: Objects/Specific/Medical/healthanalyzer.rsi
|
sprite: Objects/Specific/Medical/healthanalyzer.rsi
|
||||||
state: icon
|
state: icon
|
||||||
layers:
|
layers:
|
||||||
- state: icon
|
- map: [ "analyzerLayerBody" ]
|
||||||
- state: analyzer
|
state: icon
|
||||||
shader: unshaded
|
|
||||||
visible: true
|
visible: true
|
||||||
map: [ "enum.PowerDeviceVisualLayers.Powered" ]
|
- map: [ "analyzerLayerScreen" ]
|
||||||
|
state: powered
|
||||||
|
visible: false
|
||||||
- type: Item
|
- type: Item
|
||||||
storedRotation: -90
|
storedRotation: -90
|
||||||
- type: ActivatableUI
|
- type: ActivatableUI
|
||||||
@@ -33,8 +34,8 @@
|
|||||||
visuals:
|
visuals:
|
||||||
enum.PowerCellSlotVisuals.Enabled:
|
enum.PowerCellSlotVisuals.Enabled:
|
||||||
enum.PowerDeviceVisualLayers.Powered:
|
enum.PowerDeviceVisualLayers.Powered:
|
||||||
True: { visible: true }
|
True: { state: powered, visible: true, shader: unshaded }
|
||||||
False: { visible: false }
|
False: { state: powered, visible: false }
|
||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides:
|
guides:
|
||||||
- Medical Doctor
|
- Medical Doctor
|
||||||
@@ -46,7 +47,14 @@
|
|||||||
components:
|
components:
|
||||||
- type: PowerCellDraw
|
- type: PowerCellDraw
|
||||||
drawRate: 1.2 #Calculated for 5 minutes on a small cell
|
drawRate: 1.2 #Calculated for 5 minutes on a small cell
|
||||||
|
- type: PowerCellSlot
|
||||||
|
cellSlotId: cell_slot
|
||||||
- type: ActivatableUIRequiresPowerCell
|
- type: ActivatableUIRequiresPowerCell
|
||||||
|
- type: PointLightBattery
|
||||||
|
- type: PointLight
|
||||||
|
radius: 1.2
|
||||||
|
energy: 0.5
|
||||||
|
color: "#7FB6C0"
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: HandheldHealthAnalyzerEmpty
|
id: HandheldHealthAnalyzerEmpty
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -8,7 +8,7 @@
|
|||||||
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/f07f847706d85b7cfa4b398e5175732212b69a63",
|
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/f07f847706d85b7cfa4b398e5175732212b69a63",
|
||||||
"states": [
|
"states": [
|
||||||
{
|
{
|
||||||
"name": "analyzer",
|
"name": "powered",
|
||||||
"delays": [
|
"delays": [
|
||||||
[
|
[
|
||||||
0.1,
|
0.1,
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 375 B |
Reference in New Issue
Block a user