diff --git a/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs b/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs new file mode 100644 index 0000000000..1af6a41efb --- /dev/null +++ b/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs @@ -0,0 +1,51 @@ +namespace Content.Server.SimpleStation14.Speech.Components; + +/// +/// Sends a random message from a list with a provided min/max time. +/// +[RegisterComponent] +public sealed partial class RandomBarkComponent : Component +{ + // Should the message be sent to the chat log? + [DataField, ViewVariables(VVAccess.ReadWrite)] + public bool ChatLog = false; + + // Minimum time an animal will go without speaking + [DataField, ViewVariables(VVAccess.ReadWrite)] + public int MinTime = 45; + + // Maximum time an animal will go without speaking + [DataField, ViewVariables(VVAccess.ReadWrite)] + public int MaxTime = 350; + + // Counter + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float BarkAccumulator = 8f; + + // Multiplier applied to the random time. Good for changing the frequency without having to specify exact values + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float BarkMultiplier = 1f; + + // List of things to be said. Filled with garbage to be modified by an accent, but can be specified in the .yml + [DataField, ViewVariables(VVAccess.ReadWrite)] + public IReadOnlyList Barks = new[] + { + "Bark", + "Boof", + "Woofums", + "Rawrl", + "Eeeeeee", + "Barkums", + "Awooooooooooooooooooo awoo awoooo", + "Grrrrrrrrrrrrrrrrrr", + "Rarrwrarrwr", + "Goddamn I love gold fish crackers", + "Bork bork boof boof bork bork boof boof boof bork", + "Bark", + "Boof", + "Woofums", + "Rawrl", + "Eeeeeee", + "Barkums", + }; +} diff --git a/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs b/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs new file mode 100644 index 0000000000..0d42a0deb2 --- /dev/null +++ b/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs @@ -0,0 +1,47 @@ +using Content.Server.Chat.Systems; +using Content.Shared.Mind.Components; +using Robust.Shared.Random; +using Content.Server.SimpleStation14.Speech.Components; + +namespace Content.Server.SimpleStation14.Speech.Systems; + +public sealed class RandomBarkSystem : EntitySystem +{ + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly ChatSystem _chat = default!; + [Dependency] private readonly EntityManager _entity = default!; + + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnInit); + } + + + private void OnInit(EntityUid uid, RandomBarkComponent barker, ComponentInit args) + { + barker.BarkAccumulator = _random.NextFloat(barker.MinTime, barker.MaxTime)*barker.BarkMultiplier; + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var barker)) + { + barker.BarkAccumulator -= frameTime; + if (barker.BarkAccumulator > 0) + continue; + + barker.BarkAccumulator = _random.NextFloat(barker.MinTime, barker.MaxTime) * barker.BarkMultiplier; + if (_entity.TryGetComponent(uid, out var actComp) && + actComp.HasMind) + continue; + + _chat.TrySendInGameICMessage(uid, _random.Pick(barker.Barks), InGameICChatType.Speak, barker.ChatLog ? ChatTransmitRange.Normal : ChatTransmitRange.HideChat); + } + } +} diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 2034997421..cb7c706e1c 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -63,6 +63,7 @@ - type: Tag tags: - VimPilot + - type: RandomBark - type: entity name: bee @@ -133,7 +134,13 @@ - ReagentId: GroundBee Quantity: 5 - type: ZombieImmune - + - type: RandomBark + barks: + - Bzzzzz + - Bzzz bzzz + - Bzzzzzzzzzzzz + - Bzz + barkMultiplier: 1.5 - type: entity name: bee @@ -234,6 +241,7 @@ - type: NpcFactionMember factions: - Passive + - type: RandomBark - type: entity id: FoodEggChickenFertilized @@ -526,6 +534,8 @@ - type: NpcFactionMember factions: - Passive + - type: RandomBark + barkMultiplier: 0.7 - type: entity name: white duck #Quack @@ -707,6 +717,16 @@ - type: GuideHelp guides: - Chef + - type: RandomBark + barks: + - Mooooooo + - Moo + - Huff + - Mooooooooooo + - Moooooo + - Moooo + barkMultiplier: 3 + - type: entity name: crab @@ -758,6 +778,12 @@ task: RuminantCompound - type: Body prototype: AnimalHemocyanin + - type: RandomBark + barks: + - click clack + - clack + - clickity clack + - clack clack - type: entity name: goat @@ -1161,6 +1187,8 @@ path: /Audio/Animals/monkey_scream.ogg - type: IdExaminable - type: AlwaysRevolutionaryConvertible + - type: RandomBark + barkMultiplier: 0.65 - type: entity name: guidebook monkey @@ -1305,6 +1333,8 @@ - type: BadFood - type: NonSpreaderZombie - type: PreventSpiller + - type: RandomBark + barkMultiplier: 0.3 - type: entity parent: MobMouse @@ -1523,6 +1553,18 @@ - type: Tag tags: - VimPilot + - type: RandomBark + barkMultiplier: 1.3 + barks: + - Croooaaaakkk + - Ribbit + - Ribbit + - Ribbit + - Crooaak + - Ribbit + - Ribbit + - Ribbit + - Bibbit # Would be cool to have some functionality for the parrot to be able to sit on stuff - type: entity @@ -1618,6 +1660,10 @@ - type: NpcFactionMember factions: - Passive + - type: RandomBark + barks: + - Wank + barkMultiplier: 0.6 - type: entity name: grenade penguin @@ -1842,6 +1888,14 @@ damageModifierSet: Scale - type: Puller needsHands: true + - type: RandomBark + barkMultiplier: 1.5 + barks: + - Hsssssss + - Hss + - Hsssss + - Hisss + - Hshsss # Code unique spider prototypes or combine them all into one spider and get a # random sprite state when you spawn it. @@ -1926,6 +1980,7 @@ tags: - DoorBumpOpener - FootstepSound + - type: RandomBark - type: entity name: tarantula @@ -2245,6 +2300,7 @@ - type: Tag tags: - VimPilot + - type: RandomBark - type: entity name: corrupted corgi @@ -2398,6 +2454,7 @@ - type: Tag tags: - VimPilot + - type: RandomBark - type: entity name: calico cat @@ -2556,6 +2613,10 @@ - type: Tag tags: - VimPilot + - type: RandomBark + barkMultiplier: 10 + barks: + - Sloth - type: entity name: ferret @@ -2621,13 +2682,14 @@ id: MobHamster description: A cute, fluffy, robust hamster. components: - - type: GhostRole - makeSentient: true - allowSpeech: true - allowMovement: true - name: ghost-role-information-hamster-name - description: ghost-role-information-hamster-description - - type: GhostTakeoverAvailable + # - type: GhostTakeoverAvailable + # makeSentient: true + # allowSpeech: true + # allowMovement: true + # whitelistRequired: false + # name: ghost-role-information-hamster-name + # description: ghost-role-information-hamster-description + # - type: GhostTakeoverAvailable - type: Speech speechVerb: SmallMob speechSounds: Squeak @@ -2745,6 +2807,8 @@ - type: MobPrice price: 60 - type: NonSpreaderZombie + - type: RandomBark + barkMultiplier: 0.45 - type: entity name: pig @@ -2817,3 +2881,4 @@ - type: NpcFactionMember factions: - Passive + - type: RandomBark diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml index eed313b86a..4bd0e0d916 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml @@ -301,6 +301,8 @@ tags: - CannotSuicide - VimPilot + - type: RandomBark + barkMultiplier: 1.3 - type: entity name: Paperwork @@ -398,6 +400,8 @@ tags: - CannotSuicide - VimPilot + - type: RandomBark + barkMultiplier: 1.1 - type: entity name: Morty diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml b/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml index edf89e30b4..a4fce3f651 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml @@ -106,4 +106,4 @@ - type: FloatingVisuals - type: Puller needsHands: True - + - type: Speech