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.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<string>()
{
"Wall",
}
};
/// <summary>
/// Where the entities go when dragon devours them, empties when the dragon is butchered.
/// </summary>

View File

@@ -112,9 +112,11 @@ namespace Content.Server.Dragon
/// <summary>
/// The devour action
/// </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;
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,34 +140,29 @@ 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<DoorComponent>(target)))
{
_popupSystem.PopupEntity(Loc.GetString("devour-action-popup-message-structure"), dragonuid, Filter.Entities(dragonuid));
_popupSystem.PopupEntity(Loc.GetString("devour-action-popup-message-structure"), uid, Filter.Entities(uid));
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();
_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(),
BreakOnTargetMove = true,
BreakOnUserMove = true,
BreakOnStun = true,
});
}
}
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-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!

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -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

View File

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 618 B

View File

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