From 3f989559b974e47351f5df5d43f2e1accc13da06 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 17 Jun 2022 10:30:49 +1000 Subject: [PATCH] Cleanup the remainder of dragon (#8881) * Cleanup the remainder of dragon - Fixed some of the niscellaneous changes made to yml - Made devour use a whitelist - Fixed spelling * name fix * a --- Content.Server/Dragon/DragonComponent.cs | 15 ++++++ Content.Server/Dragon/DragonSystem.cs | 45 ++++++++---------- .../Locale/en-US/actions/actions/dragon.ftl | 4 +- .../Entities/Mobs/Player/dragon.yml | 6 +-- .../Objects/Consumable/Food/meals.yml | 2 +- .../Objects/Specific/Janitorial/trashbag.yml | 1 - .../Structures/Doors/Firelocks/firelock.yml | 3 -- .../Entities/Structures/Walls/walls.yml | 4 +- .../{carpbirth.png => carp_summon.png} | Bin .../Textures/Interface/Actions/meta.json | 15 +++--- 10 files changed, 52 insertions(+), 43 deletions(-) rename Resources/Textures/Interface/Actions/{carpbirth.png => carp_summon.png} (100%) diff --git a/Content.Server/Dragon/DragonComponent.cs b/Content.Server/Dragon/DragonComponent.cs index d8bcac9db5..a17c317cd9 100644 --- a/Content.Server/Dragon/DragonComponent.cs +++ b/Content.Server/Dragon/DragonComponent.cs @@ -5,6 +5,7 @@ using Content.Shared.Actions; using Content.Shared.Chemistry.Reagent; using Content.Shared.Sound; using Content.Shared.Storage; +using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; @@ -78,6 +79,20 @@ namespace Content.Server.Dragon public CancellationTokenSource? CancelToken; + [ViewVariables(VVAccess.ReadWrite), DataField("devourWhitelist")] + public EntityWhitelist? DevourWhitelist = new() + { + Components = new string[] + { + "Door", + "MobState", + }, + Tags = new List() + { + "Wall", + } + }; + /// /// Where the entities go when dragon devours them, empties when the dragon is butchered. /// diff --git a/Content.Server/Dragon/DragonSystem.cs b/Content.Server/Dragon/DragonSystem.cs index c92a9359d3..b03c8fcb81 100644 --- a/Content.Server/Dragon/DragonSystem.cs +++ b/Content.Server/Dragon/DragonSystem.cs @@ -112,9 +112,11 @@ namespace Content.Server.Dragon /// /// The devour action /// - private void OnDevourAction(EntityUid dragonuid, DragonComponent component, DragonDevourActionEvent args) + private void OnDevourAction(EntityUid uid, DragonComponent component, DragonDevourActionEvent args) { - if (component.CancelToken != null || args.Handled) return; + if (component.CancelToken != null || + args.Handled || + component.DevourWhitelist?.IsValid(args.Target, EntityManager) != true) return; args.Handled = true; var target = args.Target; @@ -128,9 +130,9 @@ namespace Content.Server.Dragon case SharedDeadMobState: component.CancelToken = new CancellationTokenSource(); - _doAfterSystem.DoAfter(new DoAfterEventArgs(dragonuid, component.DevourTime, component.CancelToken.Token, target) + _doAfterSystem.DoAfter(new DoAfterEventArgs(uid, component.DevourTime, component.CancelToken.Token, target) { - UserFinishedEvent = new DragonStructureDevourComplete(dragonuid, target), + UserFinishedEvent = new DragonDevourComplete(uid, target), UserCancelledEvent = new DragonDevourCancelledEvent(), BreakOnTargetMove = true, BreakOnUserMove = true, @@ -138,33 +140,28 @@ namespace Content.Server.Dragon }); break; default: - _popupSystem.PopupEntity(Loc.GetString("devour-action-popup-message-fail-target-alive"), dragonuid, Filter.Entities(dragonuid)); + _popupSystem.PopupEntity(Loc.GetString("devour-action-popup-message-fail-target-alive"), uid, Filter.Entities(uid)); break; } return; } - // Absolutely ass solution but requires less yaml fuckery - // If it's a door (firelock, airlock, windoor), Wall or Window, dragon can eat it. - if (_tagSystem.HasTag(target, "Wall") || (_tagSystem.HasTag(target, "Window") || EntityManager.HasComponent(target))) + _popupSystem.PopupEntity(Loc.GetString("devour-action-popup-message-structure"), uid, Filter.Entities(uid)); + + if (component.SoundStructureDevour != null) + SoundSystem.Play(component.SoundStructureDevour.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid, component.SoundStructureDevour.Params); + + component.CancelToken = new CancellationTokenSource(); + + _doAfterSystem.DoAfter(new DoAfterEventArgs(uid, component.DevourTime, component.CancelToken.Token, target) { - _popupSystem.PopupEntity(Loc.GetString("devour-action-popup-message-structure"), dragonuid, Filter.Entities(dragonuid)); - - if (component.SoundStructureDevour != null) - SoundSystem.Play(component.SoundStructureDevour.GetSound(), Filter.Pvs(dragonuid, entityManager: EntityManager), dragonuid, component.SoundStructureDevour.Params); - - component.CancelToken = new CancellationTokenSource(); - - _doAfterSystem.DoAfter(new DoAfterEventArgs(dragonuid, component.DevourTime, component.CancelToken.Token, target) - { - UserFinishedEvent = new DragonStructureDevourComplete(dragonuid, target), - UserCancelledEvent = new DragonDevourCancelledEvent(), - BreakOnTargetMove = true, - BreakOnUserMove = true, - BreakOnStun = true, - }); - } + UserFinishedEvent = new DragonStructureDevourComplete(uid, target), + UserCancelledEvent = new DragonDevourCancelledEvent(), + BreakOnTargetMove = true, + BreakOnUserMove = true, + BreakOnStun = true, + }); } private void OnDragonSpawnAction(EntityUid dragonuid, DragonComponent component, DragonSpawnActionEvent args) diff --git a/Resources/Locale/en-US/actions/actions/dragon.ftl b/Resources/Locale/en-US/actions/actions/dragon.ftl index 582a10cf57..eaa98259c6 100644 --- a/Resources/Locale/en-US/actions/actions/dragon.ftl +++ b/Resources/Locale/en-US/actions/actions/dragon.ftl @@ -8,5 +8,5 @@ dragon-spawn-action-popup-message-fail-no-eggs = You don't have the stamina to c action-name-devour = [color=red]Devour[/color] action-description-devour = Attempt to break a structure with your jaws or swallow a creature. -action-name-carp-birth = Summon carp -action-description-carp-birth = Summon a carp to aid you at seizing the station! +action-name-carp-summon = Summon carp +action-description-carp-summon = Summon a carp to aid you at seizing the station! diff --git a/Resources/Prototypes/Entities/Mobs/Player/dragon.yml b/Resources/Prototypes/Entities/Mobs/Player/dragon.yml index 000e2bce25..23ce642caa 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/dragon.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/dragon.yml @@ -96,8 +96,8 @@ - Wall spawnAction: event: !type:DragonSpawnActionEvent - icon: Interface/Actions/carpbirth.png - name: action-name-carp-birth - description: action-description-carp-birth + icon: Interface/Actions/carp_summon.png + name: action-name-carp-summon + description: action-description-carp-summon useDelay: 5 diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/meals.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/meals.yml index 9b9b65e383..cb1e9cb493 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Food/meals.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/meals.yml @@ -371,7 +371,7 @@ name: Sashimi parent: FoodMealBase id: FoodMealSashimi - description: It's taste can only be described as "Exotic". The poisoning though? That's pretty common. + description: Its taste can only be described as "Exotic". The poisoning though? That's pretty common. components: - type: Sprite state: sashimi diff --git a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/trashbag.yml b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/trashbag.yml index f5957ae0de..049d7cc857 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/trashbag.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/trashbag.yml @@ -2,7 +2,6 @@ name: trash bag id: TrashBag parent: BaseStorageItem - description: The solution to space pollution. Rubbish removal revolution. components: - type: Sprite netSync: false diff --git a/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml b/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml index 89cbb1b588..3e63d5e4b2 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml @@ -8,9 +8,6 @@ alarmedBy: - FireAlarm - AirAlarm - - type: Tag - tags: - - RCDDeconstructWhitelist - type: ApcPowerReceiver - type: ExtensionCableReceiver - type: DeviceNetwork diff --git a/Resources/Prototypes/Entities/Structures/Walls/walls.yml b/Resources/Prototypes/Entities/Structures/Walls/walls.yml index 9398fde93e..3b2ad757c0 100644 --- a/Resources/Prototypes/Entities/Structures/Walls/walls.yml +++ b/Resources/Prototypes/Entities/Structures/Walls/walls.yml @@ -96,6 +96,7 @@ components: - type: Tag tags: + - RCDDeconstructWhitelist - Wall - type: Sprite sprite: Structures/Walls/cult.rsi @@ -335,9 +336,6 @@ id: WallReinforced name: reinforced wall components: - - type: Tag - tags: - - Wall - type: Sprite sprite: Structures/Walls/solid.rsi - type: Icon diff --git a/Resources/Textures/Interface/Actions/carpbirth.png b/Resources/Textures/Interface/Actions/carp_summon.png similarity index 100% rename from Resources/Textures/Interface/Actions/carpbirth.png rename to Resources/Textures/Interface/Actions/carp_summon.png diff --git a/Resources/Textures/Interface/Actions/meta.json b/Resources/Textures/Interface/Actions/meta.json index e4661a48c4..20880fc792 100644 --- a/Resources/Textures/Interface/Actions/meta.json +++ b/Resources/Textures/Interface/Actions/meta.json @@ -20,19 +20,22 @@ "name": "disarm" }, { - "name": "harm" + "name": "harm" }, { - "name": "manifest" + "name": "manifest" }, { - "name": "devour" - } + "name": "devour" + }, + { + "name": "carp_summon" + }, { "name": "ratKingArmy" }, { - "name": "ratKingDomain" + "name": "ratKingDomain" } ] -} +} \ No newline at end of file