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
This commit is contained in:
metalgearsloth
2022-06-17 10:30:49 +10:00
committed by GitHub
parent 3dd0bf1217
commit 3f989559b9
10 changed files with 52 additions and 43 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Actions;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.Sound; using Content.Shared.Sound;
using Content.Shared.Storage; using Content.Shared.Storage;
using Content.Shared.Whitelist;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -78,6 +79,20 @@ namespace Content.Server.Dragon
public CancellationTokenSource? CancelToken; public CancellationTokenSource? CancelToken;
[ViewVariables(VVAccess.ReadWrite), DataField("devourWhitelist")]
public EntityWhitelist? DevourWhitelist = new()
{
Components = new string[]
{
"Door",
"MobState",
},
Tags = new List<string>()
{
"Wall",
}
};
/// <summary> /// <summary>
/// Where the entities go when dragon devours them, empties when the dragon is butchered. /// Where the entities go when dragon devours them, empties when the dragon is butchered.
/// </summary> /// </summary>

View File

@@ -112,9 +112,11 @@ namespace Content.Server.Dragon
/// <summary> /// <summary>
/// The devour action /// The devour action
/// </summary> /// </summary>
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; args.Handled = true;
var target = args.Target; var target = args.Target;
@@ -128,9 +130,9 @@ namespace Content.Server.Dragon
case SharedDeadMobState: case SharedDeadMobState:
component.CancelToken = new CancellationTokenSource(); 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(), UserCancelledEvent = new DragonDevourCancelledEvent(),
BreakOnTargetMove = true, BreakOnTargetMove = true,
BreakOnUserMove = true, BreakOnUserMove = true,
@@ -138,34 +140,29 @@ namespace Content.Server.Dragon
}); });
break; break;
default: 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; break;
} }
return; return;
} }
// Absolutely ass solution but requires less yaml fuckery _popupSystem.PopupEntity(Loc.GetString("devour-action-popup-message-structure"), uid, Filter.Entities(uid));
// 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<DoorComponent>(target)))
{
_popupSystem.PopupEntity(Loc.GetString("devour-action-popup-message-structure"), dragonuid, Filter.Entities(dragonuid));
if (component.SoundStructureDevour != null) if (component.SoundStructureDevour != null)
SoundSystem.Play(component.SoundStructureDevour.GetSound(), Filter.Pvs(dragonuid, entityManager: EntityManager), dragonuid, component.SoundStructureDevour.Params); SoundSystem.Play(component.SoundStructureDevour.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid, component.SoundStructureDevour.Params);
component.CancelToken = new CancellationTokenSource(); 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 DragonStructureDevourComplete(uid, target),
UserCancelledEvent = new DragonDevourCancelledEvent(), UserCancelledEvent = new DragonDevourCancelledEvent(),
BreakOnTargetMove = true, BreakOnTargetMove = true,
BreakOnUserMove = true, BreakOnUserMove = true,
BreakOnStun = true, BreakOnStun = true,
}); });
} }
}
private void OnDragonSpawnAction(EntityUid dragonuid, DragonComponent component, DragonSpawnActionEvent args) private void OnDragonSpawnAction(EntityUid dragonuid, DragonComponent component, DragonSpawnActionEvent args)
{ {

View File

@@ -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-name-devour = [color=red]Devour[/color]
action-description-devour = Attempt to break a structure with your jaws or swallow a creature. action-description-devour = Attempt to break a structure with your jaws or swallow a creature.
action-name-carp-birth = Summon carp action-name-carp-summon = Summon carp
action-description-carp-birth = Summon a carp to aid you at seizing the station! action-description-carp-summon = Summon a carp to aid you at seizing the station!

View File

@@ -96,8 +96,8 @@
- Wall - Wall
spawnAction: spawnAction:
event: !type:DragonSpawnActionEvent event: !type:DragonSpawnActionEvent
icon: Interface/Actions/carpbirth.png icon: Interface/Actions/carp_summon.png
name: action-name-carp-birth name: action-name-carp-summon
description: action-description-carp-birth description: action-description-carp-summon
useDelay: 5 useDelay: 5

View File

@@ -371,7 +371,7 @@
name: Sashimi name: Sashimi
parent: FoodMealBase parent: FoodMealBase
id: FoodMealSashimi 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: components:
- type: Sprite - type: Sprite
state: sashimi state: sashimi

View File

@@ -2,7 +2,6 @@
name: trash bag name: trash bag
id: TrashBag id: TrashBag
parent: BaseStorageItem parent: BaseStorageItem
description: The solution to space pollution. Rubbish removal revolution.
components: components:
- type: Sprite - type: Sprite
netSync: false netSync: false

View File

@@ -8,9 +8,6 @@
alarmedBy: alarmedBy:
- FireAlarm - FireAlarm
- AirAlarm - AirAlarm
- type: Tag
tags:
- RCDDeconstructWhitelist
- type: ApcPowerReceiver - type: ApcPowerReceiver
- type: ExtensionCableReceiver - type: ExtensionCableReceiver
- type: DeviceNetwork - type: DeviceNetwork

View File

@@ -96,6 +96,7 @@
components: components:
- type: Tag - type: Tag
tags: tags:
- RCDDeconstructWhitelist
- Wall - Wall
- type: Sprite - type: Sprite
sprite: Structures/Walls/cult.rsi sprite: Structures/Walls/cult.rsi
@@ -335,9 +336,6 @@
id: WallReinforced id: WallReinforced
name: reinforced wall name: reinforced wall
components: components:
- type: Tag
tags:
- Wall
- type: Sprite - type: Sprite
sprite: Structures/Walls/solid.rsi sprite: Structures/Walls/solid.rsi
- type: Icon - type: Icon

View File

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 618 B

View File

@@ -27,7 +27,10 @@
}, },
{ {
"name": "devour" "name": "devour"
} },
{
"name": "carp_summon"
},
{ {
"name": "ratKingArmy" "name": "ratKingArmy"
}, },