diff --git a/Content.Server/Imperial/HamMaggotson/PullableHelmet/Components/PullableHelmetComponent.cs b/Content.Server/Imperial/HamMaggotson/PullableHelmet/Components/PullableHelmetComponent.cs new file mode 100644 index 00000000000..24abbab3681 --- /dev/null +++ b/Content.Server/Imperial/HamMaggotson/PullableHelmet/Components/PullableHelmetComponent.cs @@ -0,0 +1,43 @@ +using Content.Shared.Storage; +using Robust.Shared.Audio; +using Robust.Shared.Prototypes; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; +using Content.Shared.Inventory; +namespace Content.Server.Imperial.HamMaggotson.PullableHelmet.Components; + + +[RegisterComponent] +public sealed partial class PullableHelmetComponent : Component +{ + [DataField("toggledPrototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer))] + public string ToggledPrototype = string.Empty; + + [DataField("untoggledPrototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer))] + [AutoNetworkedField] + public string UntoggledPrototype = string.Empty; + + [DataField("toggled"), AutoNetworkedField] + public bool Toggled = false; + [DataField] + public SlotFlags? Slot; + [DataField("requiredSlot")] + public SlotFlags RequiredFlags = SlotFlags.HEAD; + [DataField] + public LocId PullDownText = "pulldownhelmet-verb"; + + [DataField] + public LocId PullUpText = "pulluphelmet-verb"; + [DataField] + public TimeSpan Delay = TimeSpan.FromSeconds(2); + [DataField] + public SoundSpecifier PullUpSound { get; set; } = new SoundPathSpecifier("/Audio/Imperial/HamMaggotson/helmet_pullup.ogg"); + [DataField] + public SoundSpecifier PullDownSound { get; set; } = new SoundPathSpecifier("/Audio/Imperial/HamMaggotson/helmet_pulldown.ogg"); + [DataField] + public EntProtoId PullAction = "ToggleK63Helmet"; + + [DataField] + public EntityUid? Action; +} diff --git a/Content.Server/Imperial/HamMaggotson/PullableHelmet/Systems/PullableHelmetSystem.cs b/Content.Server/Imperial/HamMaggotson/PullableHelmet/Systems/PullableHelmetSystem.cs new file mode 100644 index 00000000000..7afbe982858 --- /dev/null +++ b/Content.Server/Imperial/HamMaggotson/PullableHelmet/Systems/PullableHelmetSystem.cs @@ -0,0 +1,116 @@ +using Content.Shared.Clothing.Components; +using Content.Shared.Foldable; +using Content.Shared.Inventory; +using Content.Shared.Item; +using Content.Shared.Clothing.EntitySystems; +using Content.Shared.Verbs; +using Content.Server.Imperial.HamMaggotson.PullableHelmet.Components; +using Content.Shared.Popups; +using Content.Shared.DoAfter; +using Robust.Shared.Containers; +using Content.Shared.Imperial.HamMaggotson.PullableHelmet; +using Robust.Shared.Audio.Systems; +using Content.Shared.Actions; +namespace Content.Server.Imperial.HamMaggotson.PullableHelmet.Systems; + +public sealed class PullableHelmetSystem : EntitySystem +{ + [Dependency] private readonly ClothingSystem _clothingSystem = default!; + [Dependency] private readonly SharedContainerSystem _container = default!; + [Dependency] private readonly InventorySystem _inventory = default!; + [Dependency] private readonly SharedItemSystem _itemSystem = default!; + [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly SharedDoAfterSystem _doAfter = default!; + [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; + [Dependency] private readonly ActionContainerSystem _actionContainer = default!; + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent>(AddPullVerb); + SubscribeLocalEvent(TryToggleHelmet); + SubscribeLocalEvent(TryStartDoAfter); + SubscribeLocalEvent(OnMapInit); + SubscribeLocalEvent(OnGetActions); + } + + private void AddPullVerb(EntityUid uid, PullableHelmetComponent component, GetVerbsEvent args) + { + if (!args.CanAccess || !args.CanInteract || args.Hands == null) + return; + + AlternativeVerb verb = new() + { + Act = () => TryStartDoAfter(args.User, (uid, component)), + Text = component.Toggled ? Loc.GetString(component.PullUpText) : Loc.GetString(component.PullDownText), + Priority = component.Toggled ? 0 : 2, + }; + + args.Verbs.Add(verb); + } + + private void TryStartDoAfter(EntityUid user, Entity ent) + { + _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, + user, + ent.Comp.Delay, + new PullHelmetDoAfterEvent(), + ent, + ent) + { + NeedHand = true, + }); + } + + private void TryStartDoAfter(Entity ent, ref PullHelmetActionEvent args) + { + _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, + args.Performer, + ent.Comp.Delay, + new PullHelmetDoAfterEvent(), + ent, + ent) + { + NeedHand = true, + }); + } + + public void TryToggleHelmet(EntityUid uid, PullableHelmetComponent component, ref PullHelmetDoAfterEvent args) + { + var user = args.User; + if (!_inventory.InSlotWithFlags(uid, component.RequiredFlags)) + return; + component.Toggled = !component.Toggled; + var newPrototype = component.Toggled ? component.ToggledPrototype : component.UntoggledPrototype; + var sound = component.Toggled ? component.PullDownSound : component.PullUpSound; + var newEntity = Spawn(newPrototype, Transform(uid).Coordinates); + if (!TryComp(newEntity, out var hlm)) + { + QueueDel(newEntity); + return; + } + hlm.Toggled = component.Toggled; + if (_inventory.TryGetContainingSlot(uid, out var slot)) + { + _inventory.TryUnequip(user, slot.Name); + _inventory.TryEquip(user, newEntity, slot.Name); + QueueDel(uid); + _audio.PlayPvs(sound, user); + } + } + private void OnGetActions(EntityUid uid, PullableHelmetComponent component, GetItemActionsEvent args) + { + if (component.Action != null + && (args.SlotFlags & component.RequiredFlags) == component.RequiredFlags) + { + args.AddAction(component.Action.Value); + } + } + + private void OnMapInit(EntityUid uid, PullableHelmetComponent component, MapInitEvent args) + { + if (_actionContainer.EnsureAction(uid, ref component.Action, out var action, component.PullAction)) + _actionsSystem.SetEntityIcon((component.Action.Value, action), uid); + } +} diff --git a/Content.Shared/Imperial/HamMaggotson/PullableHelmet/PullHelmetAction.cs b/Content.Shared/Imperial/HamMaggotson/PullableHelmet/PullHelmetAction.cs new file mode 100644 index 00000000000..d528fd59ec8 --- /dev/null +++ b/Content.Shared/Imperial/HamMaggotson/PullableHelmet/PullHelmetAction.cs @@ -0,0 +1,4 @@ +using Content.Shared.Actions; +namespace Content.Shared.Imperial.HamMaggotson.PullableHelmet; +public sealed partial class PullHelmetActionEvent : InstantActionEvent +{} diff --git a/Content.Shared/Imperial/HamMaggotson/PullableHelmet/PullHelmetDoAfter.cs b/Content.Shared/Imperial/HamMaggotson/PullableHelmet/PullHelmetDoAfter.cs new file mode 100644 index 00000000000..f3614c47da9 --- /dev/null +++ b/Content.Shared/Imperial/HamMaggotson/PullableHelmet/PullHelmetDoAfter.cs @@ -0,0 +1,7 @@ +using Content.Shared.DoAfter; +using Robust.Shared.Serialization; + +namespace Content.Shared.Imperial.HamMaggotson.PullableHelmet; + +[Serializable, NetSerializable] +public sealed partial class PullHelmetDoAfterEvent : SimpleDoAfterEvent; diff --git a/Resources/Audio/Imperial/HamMaggotson/helmet_pulldown.ogg b/Resources/Audio/Imperial/HamMaggotson/helmet_pulldown.ogg new file mode 100644 index 00000000000..4abe4e6aff0 Binary files /dev/null and b/Resources/Audio/Imperial/HamMaggotson/helmet_pulldown.ogg differ diff --git a/Resources/Audio/Imperial/HamMaggotson/helmet_pullup.ogg b/Resources/Audio/Imperial/HamMaggotson/helmet_pullup.ogg new file mode 100644 index 00000000000..273540c51d3 Binary files /dev/null and b/Resources/Audio/Imperial/HamMaggotson/helmet_pullup.ogg differ diff --git a/Resources/Locale/ru-RU/Imperial/DeadSector/helmets.ftl b/Resources/Locale/ru-RU/Imperial/DeadSector/helmets.ftl index 172abebc50c..86f6863ecc6 100644 --- a/Resources/Locale/ru-RU/Imperial/DeadSector/helmets.ftl +++ b/Resources/Locale/ru-RU/Imperial/DeadSector/helmets.ftl @@ -24,3 +24,16 @@ ent-ClothingHeadHelmetWoodGrouseGreen = исследовательский "Гл ent-ClothingHeadHelmetPSY = ПСИ-Шлем .desc = Шлем модели ПСИ, среднеразмерный шлем, имеет металлическую окраску и встроенную гарнитуру. + +ent-ClothingHeadHelmetK63Alternate = { ent-ClothingHeadHelmetK63 } + .desc = { ent-ClothingHeadHelmetK63.desc } + +ent-ClothingHeadHelmetK63AlternateLowered = { ent-ClothingHeadHelmetK63Alternate } + .desc = { ent-ClothingHeadHelmetK63Alternate.desc } + + +ent-ClothingHeadHelmetK63Lowered = { ent-ClothingHeadHelmetK63 } + .desc = { ent-ClothingHeadHelmetK63.desc } + +ent-ToggleK63Helmet = Сдвинуть забрало + .desc = Сдвинуть забрало шлема. diff --git a/Resources/Locale/ru-RU/Imperial/HamMaggotson/verb.ftl b/Resources/Locale/ru-RU/Imperial/HamMaggotson/verb.ftl new file mode 100644 index 00000000000..390c64d4d77 --- /dev/null +++ b/Resources/Locale/ru-RU/Imperial/HamMaggotson/verb.ftl @@ -0,0 +1,2 @@ +pulldownhelmet-verb = Опустить забрало +pulluphelmet-verb = Поднять забрало diff --git a/Resources/Prototypes/Imperial/Clothing/Helmets/k6_3.yml b/Resources/Prototypes/Imperial/Clothing/Helmets/k6_3.yml index f1f94df534d..9708e15c782 100644 --- a/Resources/Prototypes/Imperial/Clothing/Helmets/k6_3.yml +++ b/Resources/Prototypes/Imperial/Clothing/Helmets/k6_3.yml @@ -6,9 +6,9 @@ suffix: DeadSector components: - type: Sprite - sprite: Imperial/Clothing/Head/Helmets/k6_3.rsi + sprite: Imperial/Clothing/Head/Helmets/k6_3_new.rsi - type: Clothing - sprite: Imperial/Clothing/Head/Helmets/k6_3.rsi + sprite: Imperial/Clothing/Head/Helmets/k6_3_new.rsi quickEquip: true clothingVisuals: head: @@ -21,20 +21,128 @@ Blunt: 0.7 Slash: 0.7 Piercing: 0.93 - Heat: 0.93 - Shock: 0.8 - type: ExplosionResistance - damageCoefficient: 0.7 + damageCoefficient: 0.75 - type: HideLayerClothing slots: - Hair - HeadTop + - type: PullableHelmet + untoggledPrototype: ClothingHeadHelmetK63 + toggledPrototype: ClothingHeadHelmetK63Lowered + pullAction: ToggleK63Helmet + +- type: entity + id: ClothingHeadHelmetK63Lowered + parent: ClothingHeadHelmetK63 + name: fire helmet + categories: [ HideSpawnMenu ] + description: An atmos tech's best friend. Provides some heat resistance and looks cool. + suffix: DeadSector + components: + - type: Sprite + sprite: Imperial/Clothing/Head/Helmets/k6_3_new.rsi + state: icon-off + - type: Clothing + sprite: Imperial/Clothing/Head/Helmets/k6_3_new.rsi + quickEquip: true + clothingVisuals: + head: + - state: on-equipped-HELMET + - type: Item + size: Normal + - type: Armor + modifiers: + coefficients: + Blunt: 0.7 + Slash: 0.7 + Piercing: 0.75 + Heat: 0.75 + Shock: 0.75 + - type: ExplosionResistance + damageCoefficient: 0.5 + - type: HideLayerClothing + slots: + - Hair + - HeadTop + - type: IngestionBlocker -# gloves - type: entity id: ToggleK63Helmet name: Toggle ninja gloves description: Toggles all glove actions on left click. Includes your doorjack, draining power, stunning enemies and hacking certain computers. components: - type: InstantAction - event: !type:ToggleActionEvent {} + event: !type:PullHelmetActionEvent + - type: Action + itemIconStyle: BigItem + useDelay: 1 + +- type: entity + id: ClothingHeadHelmetK63Alternate + parent: ClothingHeadHelmetBase + name: fire helmet + description: An atmos tech's best friend. Provides some heat resistance and looks cool. + suffix: DeadSector + components: + - type: Sprite + sprite: Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi + - type: Clothing + sprite: Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi + quickEquip: true + clothingVisuals: + head: + - state: off-equipped-HELMET + - type: Item + size: Normal + - type: Armor + modifiers: + coefficients: + Blunt: 0.7 + Slash: 0.7 + Piercing: 0.93 + - type: ExplosionResistance + damageCoefficient: 0.7 + - type: HideLayerClothing + slots: + - Hair + - HeadTop + - type: PullableHelmet + untoggledPrototype: ClothingHeadHelmetK63Alternate + toggledPrototype: ClothingHeadHelmetK63AlternateLowered + pullAction: ToggleK63Helmet + +- type: entity + id: ClothingHeadHelmetK63AlternateLowered + parent: ClothingHeadHelmetK63Alternate + name: fire helmet + categories: [ HideSpawnMenu ] + description: An atmos tech's best friend. Provides some heat resistance and looks cool. + suffix: DeadSector + components: + - type: Sprite + sprite: Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi + state: icon-off + - type: Clothing + sprite: Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi + quickEquip: true + clothingVisuals: + head: + - state: on-equipped-HELMET + - type: Item + size: Normal + - type: Armor + modifiers: + coefficients: + Blunt: 0.7 + Slash: 0.7 + Piercing: 0.75 + Heat: 0.75 + Shock: 0.75 + - type: ExplosionResistance + damageCoefficient: 0.5 + - type: HideLayerClothing + slots: + - Hair + - HeadTop + - type: IngestionBlocker diff --git a/Resources/Prototypes/Imperial/HamMaggotson/Entities/clothing.yml b/Resources/Prototypes/Imperial/HamMaggotson/Entities/clothing.yml index 6b8cff1ad55..b1b995e828c 100644 --- a/Resources/Prototypes/Imperial/HamMaggotson/Entities/clothing.yml +++ b/Resources/Prototypes/Imperial/HamMaggotson/Entities/clothing.yml @@ -21,3 +21,5 @@ - type: StaminaResistance damageCoefficient: 0.85 # Imperial Space Stamina Resistance End + + diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/icon-off.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/icon-off.png new file mode 100644 index 00000000000..1835d39f4fa Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/icon-off.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/icon.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/icon.png new file mode 100644 index 00000000000..6f29121a80e Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/icon.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/inhand-left.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/inhand-left.png new file mode 100644 index 00000000000..135130abea8 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/inhand-left.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/inhand-right.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/inhand-right.png new file mode 100644 index 00000000000..ca444f2efb2 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/inhand-right.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/meta.json b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/meta.json new file mode 100644 index 00000000000..83e4281b819 --- /dev/null +++ b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/meta.json @@ -0,0 +1,33 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Create by @lune_felix", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "icon-off" + }, + { + "name": "off-equipped-HELMET", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + }, + { + "name": "on-equipped-HELMET", + "directions": 4 + }, + { + "name": "inhand-left", + "directions": 4 + } + ] + } diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/off-equipped-HELMET.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/off-equipped-HELMET.png new file mode 100644 index 00000000000..438968b9636 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/off-equipped-HELMET.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/on-equipped-HELMET.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/on-equipped-HELMET.png new file mode 100644 index 00000000000..000b75da525 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new.rsi/on-equipped-HELMET.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/icon-off.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/icon-off.png new file mode 100644 index 00000000000..af0a05fbc36 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/icon-off.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/icon.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/icon.png new file mode 100644 index 00000000000..5679cda9875 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/icon.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/inhand-left.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/inhand-left.png new file mode 100644 index 00000000000..b61ae53b76e Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/inhand-left.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/inhand-right.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/inhand-right.png new file mode 100644 index 00000000000..430026ec913 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/inhand-right.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/meta.json b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/meta.json new file mode 100644 index 00000000000..83e4281b819 --- /dev/null +++ b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/meta.json @@ -0,0 +1,33 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Create by @lune_felix", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "icon-off" + }, + { + "name": "off-equipped-HELMET", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + }, + { + "name": "on-equipped-HELMET", + "directions": 4 + }, + { + "name": "inhand-left", + "directions": 4 + } + ] + } diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/off-equipped-HELMET.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/off-equipped-HELMET.png new file mode 100644 index 00000000000..704e7e77b17 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/off-equipped-HELMET.png differ diff --git a/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/on-equipped-HELMET.png b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/on-equipped-HELMET.png new file mode 100644 index 00000000000..7d844eaea87 Binary files /dev/null and b/Resources/Textures/Imperial/Clothing/Head/Helmets/k6_3_new_alt.rsi/on-equipped-HELMET.png differ