Eris computer sprites, visualizer.
@@ -0,0 +1,76 @@
|
|||||||
|
using Content.Shared.GameObjects.Components;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
|
namespace Content.Client.GameObjects.Components
|
||||||
|
{
|
||||||
|
public sealed class ComputerVisualizer2D : AppearanceVisualizer
|
||||||
|
{
|
||||||
|
private string KeyboardState = "generic_key";
|
||||||
|
private string ScreenState = "generic";
|
||||||
|
|
||||||
|
public override void LoadData(YamlMappingNode node)
|
||||||
|
{
|
||||||
|
base.LoadData(node);
|
||||||
|
|
||||||
|
if (node.TryGetNode("key", out var scalar))
|
||||||
|
{
|
||||||
|
KeyboardState = scalar.AsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.TryGetNode("screen", out scalar))
|
||||||
|
{
|
||||||
|
ScreenState = scalar.AsString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void InitializeEntity(IEntity entity)
|
||||||
|
{
|
||||||
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
var sprite = entity.GetComponent<ISpriteComponent>();
|
||||||
|
sprite.LayerSetState(Layers.Screen, ScreenState);
|
||||||
|
sprite.LayerSetState(Layers.Keyboard, $"{KeyboardState}_off");
|
||||||
|
sprite.LayerSetState(Layers.KeyboardOn, KeyboardState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
|
{
|
||||||
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||||
|
|
||||||
|
if (!component.TryGetData(ComputerVisuals.Powered, out bool powered))
|
||||||
|
{
|
||||||
|
powered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
component.TryGetData(ComputerVisuals.Broken, out bool broken);
|
||||||
|
|
||||||
|
if (broken)
|
||||||
|
{
|
||||||
|
sprite.LayerSetState(Layers.Body, "broken");
|
||||||
|
sprite.LayerSetState(Layers.Screen, "computer_broken");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprite.LayerSetState(Layers.Body, "computer");
|
||||||
|
sprite.LayerSetState(Layers.Screen, ScreenState);
|
||||||
|
}
|
||||||
|
|
||||||
|
sprite.LayerSetVisible(Layers.Screen, powered);
|
||||||
|
sprite.LayerSetVisible(Layers.KeyboardOn, powered);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Layers
|
||||||
|
{
|
||||||
|
Body,
|
||||||
|
Screen,
|
||||||
|
Keyboard,
|
||||||
|
KeyboardOn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Content.Server/GameObjects/Components/ComputerComponent.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using Content.Server.GameObjects.Components.Power;
|
||||||
|
using Content.Shared.GameObjects.Components;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.Components
|
||||||
|
{
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class ComputerComponent : SharedComputerComponent
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
if (Owner.TryGetComponent(out PowerDeviceComponent powerDevice))
|
||||||
|
{
|
||||||
|
powerDevice.OnPowerStateChanged += PowerDeviceOnOnPowerStateChanged;
|
||||||
|
|
||||||
|
if (Owner.TryGetComponent(out AppearanceComponent appearance))
|
||||||
|
{
|
||||||
|
appearance.SetData(ComputerVisuals.Powered, powerDevice.Powered);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PowerDeviceOnOnPowerStateChanged(object sender, PowerStateEventArgs e)
|
||||||
|
{
|
||||||
|
if (Owner.TryGetComponent(out AppearanceComponent appearance))
|
||||||
|
{
|
||||||
|
appearance.SetData(ComputerVisuals.Powered, e.Powered);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared.GameObjects.Components
|
||||||
|
{
|
||||||
|
public class SharedComputerComponent : Component
|
||||||
|
{
|
||||||
|
public override string Name => "Computer";
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum ComputerVisuals
|
||||||
|
{
|
||||||
|
// Bool
|
||||||
|
Powered,
|
||||||
|
|
||||||
|
// Bool
|
||||||
|
Broken
|
||||||
|
}
|
||||||
|
}
|
||||||
117
Resources/Prototypes/Entities/buildings/computers.yml
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
- type: entity
|
||||||
|
id: computerBase
|
||||||
|
name: Computer
|
||||||
|
components:
|
||||||
|
- type: Clickable
|
||||||
|
- type: Collidable
|
||||||
|
- type: BoundingBox
|
||||||
|
- type: Icon
|
||||||
|
sprite: Buildings/computer.rsi
|
||||||
|
state: computer
|
||||||
|
|
||||||
|
- type: Computer
|
||||||
|
- type: PowerDevice
|
||||||
|
priority: High
|
||||||
|
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Buildings/computer.rsi
|
||||||
|
layers:
|
||||||
|
- state: computer
|
||||||
|
map: ["enum.ComputerVisualizer2D+Layers.Body"]
|
||||||
|
- state: generic_key_off
|
||||||
|
map: ["enum.ComputerVisualizer2D+Layers.Keyboard"]
|
||||||
|
- state: generic
|
||||||
|
shader: unshaded
|
||||||
|
map: ["enum.ComputerVisualizer2D+Layers.Screen"]
|
||||||
|
- state: generic_key
|
||||||
|
shader: unshaded
|
||||||
|
map: ["enum.ComputerVisualizer2D+Layers.KeyboardOn"]
|
||||||
|
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: ComputerVisualizer2D
|
||||||
|
key: generic_key
|
||||||
|
screen: generic
|
||||||
|
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: computerAlert
|
||||||
|
parent: computerBase
|
||||||
|
name: Alerts Computer
|
||||||
|
components:
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: ComputerVisualizer2D
|
||||||
|
key: atmos_key
|
||||||
|
screen: "alert:2"
|
||||||
|
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: computerPowerMonitoring
|
||||||
|
parent: computerBase
|
||||||
|
name: Power Monitoring Computer
|
||||||
|
components:
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: ComputerVisualizer2D
|
||||||
|
key: power_key
|
||||||
|
screen: power_monitor
|
||||||
|
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: computerSupplyOrdering
|
||||||
|
parent: computerBase
|
||||||
|
name: Supply Ordering Computer
|
||||||
|
components:
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: ComputerVisualizer2D
|
||||||
|
key: tech_key
|
||||||
|
screen: supply
|
||||||
|
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: computerMedicalRecords
|
||||||
|
parent: computerBase
|
||||||
|
name: Medical Records Computer
|
||||||
|
components:
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: ComputerVisualizer2D
|
||||||
|
key: med_key
|
||||||
|
screen: medcomp
|
||||||
|
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: computerResearchAndDevelopment
|
||||||
|
parent: computerBase
|
||||||
|
name: R&D Computer
|
||||||
|
components:
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: ComputerVisualizer2D
|
||||||
|
key: rd_key
|
||||||
|
screen: rdcomp
|
||||||
|
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: computerId
|
||||||
|
parent: computerBase
|
||||||
|
name: ID Card Computer
|
||||||
|
components:
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: ComputerVisualizer2D
|
||||||
|
key: id_key
|
||||||
|
screen: id
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: computerComms
|
||||||
|
parent: computerBase
|
||||||
|
name: Communications Computer
|
||||||
|
components:
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: ComputerVisualizer2D
|
||||||
|
key: generic_key
|
||||||
|
screen: comm
|
||||||
BIN
Resources/Textures/Buildings/computer.rsi/ai-fixer-404.png
Normal file
|
After Width: | Height: | Size: 270 B |
BIN
Resources/Textures/Buildings/computer.rsi/ai-fixer-empty.png
Normal file
|
After Width: | Height: | Size: 371 B |
BIN
Resources/Textures/Buildings/computer.rsi/ai-fixer-full.png
Normal file
|
After Width: | Height: | Size: 594 B |
BIN
Resources/Textures/Buildings/computer.rsi/ai-fixer-on.png
Normal file
|
After Width: | Height: | Size: 379 B |
BIN
Resources/Textures/Buildings/computer.rsi/ai-fixer.png
Normal file
|
After Width: | Height: | Size: 635 B |
BIN
Resources/Textures/Buildings/computer.rsi/aiupload.png
Normal file
|
After Width: | Height: | Size: 717 B |
BIN
Resources/Textures/Buildings/computer.rsi/aiupload_key.png
Normal file
|
After Width: | Height: | Size: 867 B |
BIN
Resources/Textures/Buildings/computer.rsi/alert:0.png
Normal file
|
After Width: | Height: | Size: 838 B |
BIN
Resources/Textures/Buildings/computer.rsi/alert:1.png
Normal file
|
After Width: | Height: | Size: 834 B |
BIN
Resources/Textures/Buildings/computer.rsi/alert:2.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/area_atmos.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/atmos_key.png
Normal file
|
After Width: | Height: | Size: 406 B |
BIN
Resources/Textures/Buildings/computer.rsi/atmos_key_off.png
Normal file
|
After Width: | Height: | Size: 575 B |
BIN
Resources/Textures/Buildings/computer.rsi/broken.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/cameras.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/comm.png
Normal file
|
After Width: | Height: | Size: 995 B |
BIN
Resources/Textures/Buildings/computer.rsi/comm_logs.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/comm_monitor.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/command.png
Normal file
|
After Width: | Height: | Size: 714 B |
BIN
Resources/Textures/Buildings/computer.rsi/computer.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/computer_broken.png
Normal file
|
After Width: | Height: | Size: 668 B |
BIN
Resources/Textures/Buildings/computer.rsi/crew.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/dna.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/engie_cams.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/engine.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/entertainment.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/eris_control.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/error.png
Normal file
|
After Width: | Height: | Size: 533 B |
BIN
Resources/Textures/Buildings/computer.rsi/explosive.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/forensic.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/generic.png
Normal file
|
After Width: | Height: | Size: 653 B |
BIN
Resources/Textures/Buildings/computer.rsi/generic_key.png
Normal file
|
After Width: | Height: | Size: 338 B |
BIN
Resources/Textures/Buildings/computer.rsi/generic_key_off.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/holocontrol.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/id.png
Normal file
|
After Width: | Height: | Size: 964 B |
BIN
Resources/Textures/Buildings/computer.rsi/id_key.png
Normal file
|
After Width: | Height: | Size: 421 B |
BIN
Resources/Textures/Buildings/computer.rsi/id_key_off.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/mass_driver.png
Normal file
|
After Width: | Height: | Size: 329 B |
BIN
Resources/Textures/Buildings/computer.rsi/mecha.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/med_key.png
Normal file
|
After Width: | Height: | Size: 482 B |
BIN
Resources/Textures/Buildings/computer.rsi/med_key_off.png
Normal file
|
After Width: | Height: | Size: 568 B |
BIN
Resources/Textures/Buildings/computer.rsi/medcomp.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
1
Resources/Textures/Buildings/computer.rsi/meta.json
Normal file
BIN
Resources/Textures/Buildings/computer.rsi/mining.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/mining_key.png
Normal file
|
After Width: | Height: | Size: 503 B |
BIN
Resources/Textures/Buildings/computer.rsi/mining_key_off.png
Normal file
|
After Width: | Height: | Size: 568 B |
BIN
Resources/Textures/Buildings/computer.rsi/power_key.png
Normal file
|
After Width: | Height: | Size: 347 B |
BIN
Resources/Textures/Buildings/computer.rsi/power_key_off.png
Normal file
|
After Width: | Height: | Size: 643 B |
BIN
Resources/Textures/Buildings/computer.rsi/power_monitor.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/power_monitor_warn.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/rd_key.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
Resources/Textures/Buildings/computer.rsi/rd_key_off.png
Normal file
|
After Width: | Height: | Size: 405 B |
BIN
Resources/Textures/Buildings/computer.rsi/rdcomp.png
Normal file
|
After Width: | Height: | Size: 620 B |
BIN
Resources/Textures/Buildings/computer.rsi/recharge_comp.png
Normal file
|
After Width: | Height: | Size: 645 B |
BIN
Resources/Textures/Buildings/computer.rsi/recharge_comp_on.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/request.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/robot.png
Normal file
|
After Width: | Height: | Size: 607 B |
BIN
Resources/Textures/Buildings/computer.rsi/security.png
Normal file
|
After Width: | Height: | Size: 719 B |
BIN
Resources/Textures/Buildings/computer.rsi/security_key.png
Normal file
|
After Width: | Height: | Size: 429 B |
BIN
Resources/Textures/Buildings/computer.rsi/security_key_off.png
Normal file
|
After Width: | Height: | Size: 704 B |
BIN
Resources/Textures/Buildings/computer.rsi/shuttle.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/solar_screen.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/supply.png
Normal file
|
After Width: | Height: | Size: 600 B |
BIN
Resources/Textures/Buildings/computer.rsi/syndie_key.png
Normal file
|
After Width: | Height: | Size: 500 B |
BIN
Resources/Textures/Buildings/computer.rsi/syndie_key_off.png
Normal file
|
After Width: | Height: | Size: 689 B |
BIN
Resources/Textures/Buildings/computer.rsi/syndishuttle.png
Normal file
|
After Width: | Height: | Size: 800 B |
BIN
Resources/Textures/Buildings/computer.rsi/tank.png
Normal file
|
After Width: | Height: | Size: 769 B |
BIN
Resources/Textures/Buildings/computer.rsi/tcboss.png
Normal file
|
After Width: | Height: | Size: 914 B |
BIN
Resources/Textures/Buildings/computer.rsi/tech_key.png
Normal file
|
After Width: | Height: | Size: 503 B |
BIN
Resources/Textures/Buildings/computer.rsi/tech_key_off.png
Normal file
|
After Width: | Height: | Size: 568 B |
BIN
Resources/Textures/Buildings/computer.rsi/teleport.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/teleport_key.png
Normal file
|
After Width: | Height: | Size: 392 B |
BIN
Resources/Textures/Buildings/computer.rsi/teleport_key_off.png
Normal file
|
After Width: | Height: | Size: 679 B |
BIN
Resources/Textures/Buildings/computer.rsi/telesci.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Resources/Textures/Buildings/computer.rsi/telesci_key.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
Resources/Textures/Buildings/computer.rsi/telesci_key_off.png
Normal file
|
After Width: | Height: | Size: 405 B |
BIN
Resources/Textures/Buildings/computer.rsi/turbinecomp.png
Normal file
|
After Width: | Height: | Size: 616 B |