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;
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!;
+ [Dependency] private readonly SharedHandsSystem _sharedHandsSystem = default!;
public override void Initialize()
{
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);
+ }
}
}
}
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
/// </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;
}
}
--- /dev/null
+- 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
+
\ No newline at end of file
id: Blindness
name: trait-blindness-name
description: trait-blindness-desc
+ traitGear: WhiteCane
whitelist:
components:
- Blindable
--- /dev/null
+{
+ "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
+ }
+ ]
+}