Computers now spawn with circuit boards, add arcade circuitboards.
This commit is contained in:
@@ -1,13 +1,28 @@
|
|||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Server.GameObjects.Components.Container;
|
||||||
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Log;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components
|
namespace Content.Server.GameObjects.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class ComputerComponent : SharedComputerComponent
|
public sealed class ComputerComponent : SharedComputerComponent, IMapInit
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
|
private string _boardPrototype;
|
||||||
|
|
||||||
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
{
|
||||||
|
base.ExposeData(serializer);
|
||||||
|
serializer.DataField(ref _boardPrototype, "board", string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -21,6 +36,8 @@ namespace Content.Server.GameObjects.Components
|
|||||||
appearance.SetData(ComputerVisuals.Powered, powerReceiver.Powered);
|
appearance.SetData(ComputerVisuals.Powered, powerReceiver.Powered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CreateComputerBoard();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRemove()
|
public override void OnRemove()
|
||||||
@@ -40,5 +57,36 @@ namespace Content.Server.GameObjects.Components
|
|||||||
appearance.SetData(ComputerVisuals.Powered, e.Powered);
|
appearance.SetData(ComputerVisuals.Powered, e.Powered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the corresponding computer board on the computer.
|
||||||
|
/// This exists so when you deconstruct computers that were serialized with the map,
|
||||||
|
/// you can retrieve the computer board.
|
||||||
|
/// </summary>
|
||||||
|
private void CreateComputerBoard()
|
||||||
|
{
|
||||||
|
// We don't do anything if this is null or empty.
|
||||||
|
if (string.IsNullOrEmpty(_boardPrototype))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var container = ContainerManagerComponent.Ensure<Container>("board", Owner, out var existed);
|
||||||
|
|
||||||
|
if (existed)
|
||||||
|
{
|
||||||
|
// We already contain a board. Note: We don't check if it's the right one!
|
||||||
|
if (container.ContainedEntities.Count != 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var board = Owner.EntityManager.SpawnEntity(_boardPrototype, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
|
if(!container.Insert(board))
|
||||||
|
Logger.Warning($"Couldn't insert board {board} to computer {Owner}!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MapInit()
|
||||||
|
{
|
||||||
|
CreateComputerBoard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
type: SpaceVillainArcadeBoundUserInterface
|
type: SpaceVillainArcadeBoundUserInterface
|
||||||
- key: enum.WiresUiKey.Key
|
- key: enum.WiresUiKey.Key
|
||||||
type: WiresBoundUserInterface
|
type: WiresBoundUserInterface
|
||||||
|
- type: Computer
|
||||||
|
board: SpaceVillainArcadeComputerCircuitboard
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: BlockGameArcade
|
id: BlockGameArcade
|
||||||
@@ -69,3 +71,5 @@
|
|||||||
type: BlockGameBoundUserInterface
|
type: BlockGameBoundUserInterface
|
||||||
- key: enum.WiresUiKey.Key
|
- key: enum.WiresUiKey.Key
|
||||||
type: WiresBoundUserInterface
|
type: WiresBoundUserInterface
|
||||||
|
- type: Computer
|
||||||
|
board: BlockGameArcadeComputerCircuitboard
|
||||||
|
|||||||
@@ -168,6 +168,8 @@
|
|||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.CargoConsoleUiKey.Key
|
- key: enum.CargoConsoleUiKey.Key
|
||||||
type: CargoConsoleBoundUserInterface
|
type: CargoConsoleBoundUserInterface
|
||||||
|
- type: Computer
|
||||||
|
board: SupplyComputerCircuitboard
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: ComputerSupplyRequest
|
id: ComputerSupplyRequest
|
||||||
@@ -182,6 +184,8 @@
|
|||||||
screen: request
|
screen: request
|
||||||
- type: CargoConsole
|
- type: CargoConsole
|
||||||
requestOnly: true
|
requestOnly: true
|
||||||
|
- type: Computer
|
||||||
|
board: SupplyRequestComputerCircuitboard
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: ComputerMedicalRecords
|
id: ComputerMedicalRecords
|
||||||
@@ -219,6 +223,8 @@
|
|||||||
- type: PowerReceiver
|
- type: PowerReceiver
|
||||||
load: 200
|
load: 200
|
||||||
priority: Low
|
priority: Low
|
||||||
|
- type: Computer
|
||||||
|
board: ResearchComputerCircuitboard
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: ComputerId
|
id: ComputerId
|
||||||
@@ -238,6 +244,8 @@
|
|||||||
- type: ComputerVisualizer
|
- type: ComputerVisualizer
|
||||||
key: id_key
|
key: id_key
|
||||||
screen: id
|
screen: id
|
||||||
|
- type: Computer
|
||||||
|
board: IDComputerCircuitboard
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: computerBodyScanner
|
id: computerBodyScanner
|
||||||
@@ -255,6 +263,8 @@
|
|||||||
- type: ComputerVisualizer
|
- type: ComputerVisualizer
|
||||||
key: generic_key
|
key: generic_key
|
||||||
screen: generic
|
screen: generic
|
||||||
|
- type: Computer
|
||||||
|
board: BodyScannerComputerCircuitboard
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: ComputerComms
|
id: ComputerComms
|
||||||
@@ -272,6 +282,8 @@
|
|||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.CommunicationsConsoleUiKey.Key
|
- key: enum.CommunicationsConsoleUiKey.Key
|
||||||
type: CommunicationsConsoleBoundUserInterface
|
type: CommunicationsConsoleBoundUserInterface
|
||||||
|
- type: Computer
|
||||||
|
board: CommsComputerCircuitboard
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: ComputerSolarControl
|
id: ComputerSolarControl
|
||||||
@@ -289,3 +301,5 @@
|
|||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.SolarControlConsoleUiKey.Key
|
- key: enum.SolarControlConsoleUiKey.Key
|
||||||
type: SolarControlConsoleBoundUserInterface
|
type: SolarControlConsoleBoundUserInterface
|
||||||
|
- type: Computer
|
||||||
|
board: SolarControlComputerCircuitboard
|
||||||
|
|||||||
@@ -64,3 +64,19 @@
|
|||||||
components:
|
components:
|
||||||
- type: ComputerBoard
|
- type: ComputerBoard
|
||||||
prototype: ComputerSolarControl
|
prototype: ComputerSolarControl
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: SpaceVillainArcadeComputerCircuitboard
|
||||||
|
parent: BaseComputerCircuitboard
|
||||||
|
name: space villain arcade computer circuit board
|
||||||
|
components:
|
||||||
|
- type: ComputerBoard
|
||||||
|
prototype: Arcade
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: BlockGameArcadeComputerCircuitboard
|
||||||
|
parent: BaseComputerCircuitboard
|
||||||
|
name: block game arcade computer circuit board
|
||||||
|
components:
|
||||||
|
- type: ComputerBoard
|
||||||
|
prototype: BlockGameArcade
|
||||||
|
|||||||
Reference in New Issue
Block a user