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

@@ -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,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<DoorComponent>(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)