White Cane for Blind People (#16318)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Traits;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
@@ -9,6 +11,7 @@ public sealed class TraitSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly ISerializationManager _serializationManager = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _sharedHandsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -41,6 +44,18 @@ public sealed class TraitSystem : EntitySystem
|
||||
comp.Owner = args.Mob;
|
||||
EntityManager.AddComponent(args.Mob, comp);
|
||||
}
|
||||
|
||||
// Add item required by the trait
|
||||
if (traitPrototype.TraitGear != null)
|
||||
{
|
||||
if (!TryComp(args.Mob, out HandsComponent? handsComponent))
|
||||
continue;
|
||||
|
||||
var coords = Transform(args.Mob).Coordinates;
|
||||
var inhandEntity = EntityManager.SpawnEntity(traitPrototype.TraitGear, coords);
|
||||
_sharedHandsSystem.TryPickup(args.Mob, inhandEntity, checkActionBlocker: false,
|
||||
handsComp: handsComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using static Robust.Shared.Prototypes.EntityPrototype; // don't worry about it
|
||||
|
||||
namespace Content.Shared.Traits
|
||||
@@ -43,5 +44,11 @@ namespace Content.Shared.Traits
|
||||
/// </summary>
|
||||
[DataField("components")]
|
||||
public ComponentRegistry Components { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gear that is given to the player, when they pick this trait.
|
||||
/// </summary>
|
||||
[DataField("traitGear", required: false, customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string TraitGear = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
- type: entity
|
||||
parent: BaseItem
|
||||
id: WhiteCane
|
||||
name: white cane
|
||||
description: This isn't for you. It's for the people who can't figure out you're blind when you ask if cargo is the bar.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Weapons/Melee/white_cane.rsi
|
||||
state: icon
|
||||
- type: Item
|
||||
size: 15
|
||||
sprite: Objects/Weapons/Melee/white_cane.rsi
|
||||
- type: MeleeWeapon
|
||||
damage:
|
||||
types:
|
||||
Blunt: 5
|
||||
- type: StaminaDamageOnHit
|
||||
damage: 5
|
||||
- type: Wieldable
|
||||
- type: IncreaseDamageOnWield
|
||||
damage:
|
||||
types:
|
||||
Blunt: 3
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
id: Blindness
|
||||
name: trait-blindness-name
|
||||
description: trait-blindness-desc
|
||||
traitGear: WhiteCane
|
||||
whitelist:
|
||||
components:
|
||||
- Blindable
|
||||
|
||||
BIN
Resources/Textures/Objects/Weapons/Melee/white_cane.rsi/icon.png
Normal file
BIN
Resources/Textures/Objects/Weapons/Melee/white_cane.rsi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 665 B |
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": "CC-BY-SA-4.0",
|
||||
"copyright": "Sprited by Tristan Thomas",
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "icon"
|
||||
},
|
||||
{
|
||||
"name": "inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "wielded-inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "wielded-inhand-right",
|
||||
"directions": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Reference in New Issue
Block a user