forked from Simple-Station/Einstein-Engines
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Simple-Station#208 from Memeji/Nikko-Species
Rodentia Species
- Loading branch information
Showing
122 changed files
with
2,530 additions
and
41 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Content.Server/DeltaV/Storage/EntitySystems/MouthStorageSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Content.Server.Nutrition; | ||
using Content.Server.Speech; | ||
using Content.Server.Speech.EntitySystems; | ||
using Content.Shared.DeltaV.Storage.Components; | ||
using Content.Shared.DeltaV.Storage.EntitySystems; | ||
using Content.Shared.Storage; | ||
|
||
namespace Content.Server.DeltaV.Storage.EntitySystems; | ||
|
||
public sealed class MouthStorageSystem : SharedMouthStorageSystem | ||
{ | ||
[Dependency] private readonly ReplacementAccentSystem _replacement = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<MouthStorageComponent, AccentGetEvent>(OnAccent); | ||
SubscribeLocalEvent<MouthStorageComponent, IngestionAttemptEvent>(OnIngestAttempt); | ||
} | ||
|
||
// Force you to mumble if you have items in your mouth | ||
private void OnAccent(EntityUid uid, MouthStorageComponent component, AccentGetEvent args) | ||
{ | ||
if (IsMouthBlocked(component)) | ||
args.Message = _replacement.ApplyReplacements(args.Message, "mumble"); | ||
} | ||
|
||
// Attempting to eat or drink anything with items in your mouth won't work | ||
private void OnIngestAttempt(EntityUid uid, MouthStorageComponent component, IngestionAttemptEvent args) | ||
{ | ||
if (!IsMouthBlocked(component)) | ||
return; | ||
|
||
if (!TryComp<StorageComponent>(component.MouthId, out var storage)) | ||
return; | ||
|
||
var firstItem = storage.Container.ContainedEntities[0]; | ||
args.Blocker = firstItem; | ||
args.Cancel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
Content.Shared/DeltaV/Abilities/AlwaysTriggerMousetrapComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using Robust.Shared.GameStates; | ||
namespace Content.Shared.Abilities; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class AlwaysTriggerMousetrapComponent : Component; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using Robust.Shared.GameStates; | ||
namespace Content.Shared.Abilities; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class RummagerComponent : Component; |
33 changes: 33 additions & 0 deletions
33
Content.Shared/DeltaV/Storage/Components/MouthStorageComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Content.Shared.DeltaV.Storage.EntitySystems; | ||
using Content.Shared.FixedPoint; | ||
using Robust.Shared.Containers; | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Shared.DeltaV.Storage.Components; | ||
|
||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] | ||
[Access(typeof(SharedMouthStorageSystem))] | ||
public sealed partial class MouthStorageComponent : Component | ||
{ | ||
public const string MouthContainerId = "mouth"; | ||
|
||
[DataField, AutoNetworkedField] | ||
public EntProtoId? OpenStorageAction; | ||
|
||
[DataField, AutoNetworkedField] | ||
public EntityUid? Action; | ||
|
||
[DataField] | ||
public EntProtoId MouthProto = "ActionOpenMouthStorage"; | ||
|
||
[ViewVariables] | ||
public Container Mouth = default!; | ||
|
||
[DataField] | ||
public EntityUid? MouthId; | ||
|
||
// Mimimum inflicted damage on hit to spit out items | ||
[DataField] | ||
public FixedPoint2 SpitDamageThreshold = FixedPoint2.New(2); | ||
} |
84 changes: 84 additions & 0 deletions
84
Content.Shared/DeltaV/Storage/EntitySystems/SharedMouthStorageSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using Content.Shared.Actions; | ||
using Content.Shared.CombatMode; | ||
using Content.Shared.Damage; | ||
using Content.Shared.DeltaV.Storage.Components; | ||
using Content.Shared.Examine; | ||
using Content.Shared.IdentityManagement; | ||
using Content.Shared.Standing; | ||
using Content.Shared.Storage; | ||
using Content.Shared.Storage.EntitySystems; | ||
using Robust.Shared.Containers; | ||
using Robust.Shared.Map; | ||
|
||
namespace Content.Shared.DeltaV.Storage.EntitySystems; | ||
|
||
public abstract class SharedMouthStorageSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly DumpableSystem _dumpableSystem = default!; | ||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!; | ||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<MouthStorageComponent, MapInitEvent>(OnMouthStorageInit); | ||
SubscribeLocalEvent<MouthStorageComponent, DownedEvent>(DropAllContents); | ||
SubscribeLocalEvent<MouthStorageComponent, DisarmedEvent>(DropAllContents); | ||
SubscribeLocalEvent<MouthStorageComponent, DamageChangedEvent>(OnDamageModified); | ||
SubscribeLocalEvent<MouthStorageComponent, ExaminedEvent>(OnExamined); | ||
} | ||
|
||
protected bool IsMouthBlocked(MouthStorageComponent component) | ||
{ | ||
if (!TryComp<StorageComponent>(component.MouthId, out var storage)) | ||
return false; | ||
|
||
return storage.Container.ContainedEntities.Count > 0; | ||
} | ||
|
||
private void OnMouthStorageInit(EntityUid uid, MouthStorageComponent component, MapInitEvent args) | ||
{ | ||
if (string.IsNullOrWhiteSpace(component.MouthProto)) | ||
return; | ||
|
||
component.Mouth = _containerSystem.EnsureContainer<Container>(uid, MouthStorageComponent.MouthContainerId); | ||
component.Mouth.ShowContents = false; | ||
component.Mouth.OccludesLight = false; | ||
|
||
var mouth = Spawn(component.MouthProto, new EntityCoordinates(uid, 0, 0)); | ||
_containerSystem.Insert(mouth, component.Mouth); | ||
component.MouthId = mouth; | ||
|
||
if (!string.IsNullOrWhiteSpace(component.OpenStorageAction) && component.Action == null) | ||
_actionsSystem.AddAction(uid, ref component.Action, component.OpenStorageAction, mouth); | ||
} | ||
|
||
private void DropAllContents(EntityUid uid, MouthStorageComponent component, EntityEventArgs args) | ||
{ | ||
if (component.MouthId == null) | ||
return; | ||
|
||
_dumpableSystem.DumpContents(component.MouthId.Value, uid, uid); | ||
} | ||
|
||
private void OnDamageModified(EntityUid uid, MouthStorageComponent component, DamageChangedEvent args) | ||
{ | ||
if (args.DamageDelta == null | ||
|| !args.DamageIncreased | ||
|| args.DamageDelta.GetTotal() < component.SpitDamageThreshold) | ||
return; | ||
|
||
DropAllContents(uid, component, args); | ||
} | ||
|
||
// Other people can see if this person has items in their mouth. | ||
private void OnExamined(EntityUid uid, MouthStorageComponent component, ExaminedEvent args) | ||
{ | ||
if (IsMouthBlocked(component)) | ||
{ | ||
var subject = Identity.Entity(uid, EntityManager); | ||
args.PushMarkup(Loc.GetString("mouth-storage-examine-condition-occupied", ("entity", subject))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Resources/Locale/en-US/deltav/actions/crawl-under-objects.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
crawl-under-objects-toggle-on = Now sneaking | ||
crawl-under-objects-toggle-off = Now standing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.