Basic wrenchable component (#418)
This commit is contained in:
committed by
Pieter-Jan Briers
parent
4720353fa2
commit
1e425f3c28
@@ -44,6 +44,7 @@ namespace Content.Client
|
|||||||
|
|
||||||
var registerIgnore = new[]
|
var registerIgnore = new[]
|
||||||
{
|
{
|
||||||
|
"Wrenchable",
|
||||||
"AmmoBox",
|
"AmmoBox",
|
||||||
"Breakable",
|
"Breakable",
|
||||||
"Pickaxe",
|
"Pickaxe",
|
||||||
|
|||||||
41
Content.Server/GameObjects/Components/Wrenchable.cs
Normal file
41
Content.Server/GameObjects/Components/Wrenchable.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||||
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.Components
|
||||||
|
{
|
||||||
|
[RegisterComponent]
|
||||||
|
public class Wrenchable : Component, IAttackBy
|
||||||
|
{
|
||||||
|
public override string Name => "Wrenchable";
|
||||||
|
private AudioSystem _audioSystem;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
_audioSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
if (!eventArgs.AttackWith.HasComponent<WrenchComponent>())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Owner.TryGetComponent(out PhysicsComponent physics))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
physics.Anchored = !physics.Anchored;
|
||||||
|
_audioSystem.Play("/Audio/items/ratchet.ogg", Owner);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,12 @@
|
|||||||
id: computerBase
|
id: computerBase
|
||||||
name: Computer
|
name: Computer
|
||||||
components:
|
components:
|
||||||
|
- type: Physics
|
||||||
|
mass: 25
|
||||||
|
Anchored: true
|
||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
IsScrapingFloor: true
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
bounds: "-0.5,-0.25,0.5,0.25"
|
bounds: "-0.5,-0.25,0.5,0.25"
|
||||||
@@ -15,6 +19,7 @@
|
|||||||
- type: Computer
|
- type: Computer
|
||||||
- type: PowerDevice
|
- type: PowerDevice
|
||||||
priority: High
|
priority: High
|
||||||
|
- type: Wrenchable
|
||||||
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Buildings/computer.rsi
|
sprite: Buildings/computer.rsi
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
- type: PowerDevice
|
- type: PowerDevice
|
||||||
priority: Low
|
priority: Low
|
||||||
- type: Wires
|
- type: Wires
|
||||||
|
- type: Wrenchable
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: VendingMachine
|
parent: VendingMachine
|
||||||
|
|||||||
Reference in New Issue
Block a user