Skip to content

Commit

Permalink
Rummager cooldown (30s), goblin guidebook rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
whatston3 committed Sep 30, 2024
1 parent d96c5e9 commit 3011ca9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 11 deletions.
19 changes: 18 additions & 1 deletion Content.Shared/DeltaV/Abilities/RummagerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,21 @@
namespace Content.Shared.Abilities;

[RegisterComponent, NetworkedComponent]
public sealed partial class RummagerComponent : Component;
[AutoGenerateComponentState]
public sealed partial class RummagerComponent : Component
{
// Frontier: cooldowns per-rummager
/// <summary>
/// Frontier: Last time this entity has rummaged, used to check if cooldown has expired
/// </summary>
[ViewVariables]
public TimeSpan? LastRummaged;

/// <summary>
// Frontier: Minimum time between this entity's rummage attempts
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public TimeSpan Cooldown = TimeSpan.FromSeconds(30.0f);
// End Frontier
}
18 changes: 15 additions & 3 deletions Content.Shared/RatKing/SharedRatKingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public override void Initialize()
SubscribeLocalEvent<RatKingRummageableComponent, RatKingRummageDoAfterEvent>(OnDoAfterComplete);

SubscribeLocalEvent<RatKingRummageableComponent, ComponentInit>(OnComponentInit); // Goobstation - #660
SubscribeLocalEvent<RummagerComponent, ComponentInit>(OnRummgerComponentInit); // Frontier
}

private void OnStartup(EntityUid uid, RatKingComponent component, ComponentStartup args)
Expand Down Expand Up @@ -114,11 +115,18 @@ public void OnComponentInit(EntityUid uid, RatKingRummageableComponent component
Dirty(uid, component);
}

public void OnRummgerComponentInit(EntityUid uid, RummagerComponent component, ComponentInit args) // Frontier - per-rummager cooldown
{
component.LastRummaged = _gameTiming.CurTime;
Dirty(uid, component);
}

private void OnGetVerb(EntityUid uid, RatKingRummageableComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!HasComp<RummagerComponent>(args.User)
if (!TryComp<RummagerComponent>(args.User, out var rummager)
|| component.Looted
|| _gameTiming.CurTime < component.LastLooted + component.RummageCooldown)
|| _gameTiming.CurTime < component.LastLooted + component.RummageCooldown
|| _gameTiming.CurTime < rummager.LastRummaged + rummager.Cooldown) // Frontier: cooldown per rummager
// DeltaV - Use RummagerComponent instead of RatKingComponent
// (This is so we can give Rodentia rummage abilities)
// Additionally, adds a cooldown check
Expand Down Expand Up @@ -151,11 +159,15 @@ private void OnDoAfterComplete(EntityUid uid, RatKingRummageableComponent compon
var time = _gameTiming.CurTime;
if (args.Cancelled
|| component.Looted
|| time < component.LastLooted + component.RummageCooldown)
|| time < component.LastLooted + component.RummageCooldown
|| !TryComp<RummagerComponent>(args.User, out var rummager) // Frontier: must be a rummager (also, verify cooldowns)
|| time < rummager.LastRummaged + rummager.Cooldown) // Frontier: check cooldown
return;

component.LastLooted = time;
// End DeltaV change
rummager.LastRummaged = time; // Frontier: set rummager cooldown

Dirty(uid, component);
_audio.PlayPredicted(component.Sound, uid, args.User);

Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/Storage/EntitySystems/DumpableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ private void StartDoAfter(EntityUid storageUid, EntityUid targetUid, EntityUid u

private void OnDoAfter(EntityUid uid, DumpableComponent component, DumpableDoAfterEvent args)
{
if (args.Handled || args.Cancelled)
if (args.Handled || args.Cancelled) // DeltaV: conditions pushed into DumpContents
return;

DumpContents(uid, args.Args.Target, args.Args.User, component);
DumpContents(uid, args.Args.Target, args.Args.User, component); // DeltaV
}

// DeltaV: Refactor to allow dumping that doesn't require a verb
Expand Down
11 changes: 6 additions & 5 deletions Resources/ServerInfo/_NF/Guidebook/Mobs/Goblin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<GuideEntityEmbed Entity="MobGoblin" Caption=""/>
</Box>

Goblins are a race of humanoid beings, small, very loud and fragile.
Goblins are a race of humanoid beings. They tend to be small, very loud and fragile.

## Benefits

Expand All @@ -16,14 +16,15 @@

## Special

- Can Rummage in disposal chutes, which can dig up trash.
- Their small stature allows goblins to dive into toilets and mailing units.
- Uniqe chants and goblin speak.
- Can rummage in disposal chutes to dig up trash.
- Can dive into toilets and mailing units because of their small size.
- Unique chants.
- Inherently speak in Goblin Cant.

## Drawbacks

- Because of their small size they take [color=#ffa500]20% more Brute (Blunt/Slash/Piercing) damage[/color].
- Always triggers mousetraps, regardless of whether or not they are wearing shoes.
- Always triggers mousetraps, even when wearing shoes.
- They don't like to be sprayed with water or space cleaner.

</Document>

0 comments on commit 3011ca9

Please sign in to comment.