From d6c3007fd688d61f2a987fadfbc04513289c4540 Mon Sep 17 00:00:00 2001 From: Pspritechologist <81725545+Pspritechologist@users.noreply.github.com> Date: Mon, 26 Dec 2022 02:58:53 -0500 Subject: [PATCH 1/7] Added RandomBarkComponent, which will cause an entity to speak at random from a specified list of strings. Fixed Service job Head label. Tweaked floor sign. --- .../Speech/Components/RandomBarkComponent.cs | 42 +++++++++ .../Speech/EntitySystems/RandomBarkSystem.cs | 35 ++++++++ .../Locale/en-US/job/job-supervisors.ftl | 7 +- .../Prototypes/Entities/Mobs/NPCs/animals.yml | 66 ++++++++++++++ .../Prototypes/Entities/Mobs/NPCs/bear.yml | 89 +++++++++++++++++++ .../Prototypes/Entities/Mobs/NPCs/pets.yml | 4 + .../Entities/Mobs/NPCs/simplemob.yml | 2 +- 7 files changed, 241 insertions(+), 4 deletions(-) create mode 100644 Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs create mode 100644 Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs create mode 100644 Resources/Prototypes/Entities/Mobs/NPCs/bear.yml diff --git a/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs b/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs new file mode 100644 index 0000000000..a6a78db6d2 --- /dev/null +++ b/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs @@ -0,0 +1,42 @@ +using Robust.Shared.Random; + +namespace Content.Server.SimpleStation14.Speech.RandomBark +{ + [RegisterComponent] + public sealed class RandomBarkComponent : Component + { + [Dependency] private readonly IRobustRandom _random = default!; + + // Minimum time an animal will go without speaking + [DataField("minTime")] + public int MinTime = 45; + + // Maximum time an animal will go without speaking + [DataField("maxTime")] + public int MaxTime = 350; + + // Counter + [DataField("barkAccumulator")] + public float BarkAccumulator = 8f; + + // Multiplier applied to the random time. Good for changing the frequency without having to specify exact values + [DataField("barkMultiplier")] + 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("barks"), ViewVariables(VVAccess.ReadWrite)] + public IReadOnlyList Barks = new[] { + "Bark", + "Boof", + "Woofums", + "Howling", + "Screeeeeeeeeeee", + "Barkums", + "OH MY GOD THE FIRE IT BURNS IT BURNS SO BAD!!", + "Death was here ;)", + "Ha ha not really lol", + "Goddamn I love gold fish crackers", + "This is going to be the really long default text, so I'm just going to keep typing and rambling on. You ever tried a churro? They're actually really good. I wasn't expecting much from them, thought they'd be like, dry and crunchy, but no, they're like a cakey thing. Yeah, right, you'd expect something drier, but no, it's actually soft and tasty, sugary, they're really nice." + }; + } +} diff --git a/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs b/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs new file mode 100644 index 0000000000..5ccee8c495 --- /dev/null +++ b/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs @@ -0,0 +1,35 @@ +using Content.Server.Chat.Systems; +using Content.Server.Chat.Managers; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; + +namespace Content.Server.SimpleStation14.Speech.RandomBark +{ + public sealed class RandomBarkSystem : EntitySystem + { + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly ChatSystem _chat = default!; + [Dependency] private readonly IChatManager _chatManager = default!; + + [ViewVariables(VVAccess.ReadWrite)] + + public override void Update(float frameTime) + { + base.Update(frameTime); + foreach (var barker in EntityQuery()) + { + barker.BarkAccumulator -= frameTime; + if (barker.BarkAccumulator <= 0) + { + barker.BarkAccumulator = _random.NextFloat(barker.MinTime, barker.MaxTime)*barker.BarkMultiplier; + _chat.TrySendInGameICMessage(barker.Owner, _random.Pick(barker.Barks), InGameICChatType.Speak, false); + } + } + } + public override void Initialize() + { + base.Initialize(); + } + } +} diff --git a/Resources/Locale/en-US/job/job-supervisors.ftl b/Resources/Locale/en-US/job/job-supervisors.ftl index 25a49f643e..aed61ecfbf 100644 --- a/Resources/Locale/en-US/job/job-supervisors.ftl +++ b/Resources/Locale/en-US/job/job-supervisors.ftl @@ -1,15 +1,16 @@ job-supervisors-centcom = CentCom official job-supervisors-captain = the captain job-supervisors-hop = the head of personnel +job-supervisors-hop-qm = the quartermaster and head of personnel job-supervisors-hos = the head of security job-supervisors-ce = the chief engineer job-supervisors-cmo = the chief medical officer job-supervisors-rd = the mystagogue -job-supervisors-qm = the logistics officer -job-supervisors-service = chefs, botanists, the bartender, and the head of personnel +job-supervisors-service = chefs, botanists, the bartender, and the chief service supervisor job-supervisors-engineering = station engineers, atmospheric technicians, and the chief engineer job-supervisors-medicine = medical doctors, chemists, and the chief medical officer job-supervisors-security = security officers, the warden, and the head of security -job-supervisors-science = scientists, and the mystagogue job-supervisors-hire = whoever hires you job-supervisors-everyone = absolutely everyone +job-supervisors-css = the chief service supervisor +job-supervisors-cc = central command, and discussion among the board of heads diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index ff776b67a1..38fe4b8864 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 @@ -131,6 +132,13 @@ reagents: - ReagentId: GroundBee Quantity: 5 + - type: RandomBark + barks: + - Bzzzzz + - Bzzz bzzz + - Bzzzzzzzzzzzz + - Bzz + barkMultiplier: 1.5 - type: entity name: bee @@ -230,6 +238,7 @@ - type: NpcFactionMember factions: - Passive + - type: RandomBark - type: entity id: FoodEggChickenFertilized @@ -315,6 +324,8 @@ - type: NpcFactionMember factions: - Passive + - type: RandomBark + barkMultiplier: 0.7 - type: entity name: white duck #Quack @@ -496,6 +507,16 @@ - type: GuideHelp guides: - Chef + - type: RandomBark + barks: + - Mooooooo + - Moo + - Huff + - Mooooooooooo + - Moooooo + - Moooo + barkMultiplier: 3 + - type: entity name: crab @@ -544,6 +565,12 @@ - type: HTN rootTask: task: RuminantCompound + - type: RandomBark + barks: + - click clack + - clack + - clickity clack + - clack clack - type: entity name: goat @@ -727,6 +754,9 @@ rootTask: task: SimpleHostileCompound - type: Puller + - type: ReplacementAccent + accent: monkey + - type: RandomBark - type: entity name: kangaroo @@ -936,6 +966,8 @@ path: /Audio/Animals/monkey_scream.ogg - type: IdExaminable - type: AlwaysRevolutionaryConvertible + - type: RandomBark + barkMultiplier: 0.65 - type: entity name: guidebook monkey @@ -1069,6 +1101,8 @@ - type: Puller needsHands: true - type: FelinidFood # Nyanotrasen - Felinid, ability to eat mice, see Content.Server/Nyanotrasen/Abilities/Felinid/FelinidSystem.cs + - type: RandomBark + barkMultiplier: 0.3 - type: entity parent: MobMouse @@ -1287,6 +1321,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 @@ -1382,6 +1428,10 @@ - type: NpcFactionMember factions: - Passive + - type: RandomBark + barks: + - Wank + barkMultiplier: 0.6 - type: entity name: grenade penguin @@ -1606,6 +1656,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. @@ -1684,6 +1742,7 @@ bloodReagent: SpiderBlood - type: Speech speechVerb: Arachnid + - type: RandomBark - type: entity name: tarantula @@ -1988,6 +2047,7 @@ - type: Tag tags: - VimPilot + - type: RandomBark - type: entity name: corrupted corgi @@ -2135,6 +2195,7 @@ - type: Tag tags: - VimPilot + - type: RandomBark - type: entity name: calico cat @@ -2260,6 +2321,10 @@ - type: Tag tags: - VimPilot + - type: RandomBark + barkMultiplier: 10 + barks: + - Sloth - type: entity name: ferret @@ -2520,3 +2585,4 @@ - type: NpcFactionMember factions: - Passive + - type: RandomBark diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml b/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml new file mode 100644 index 0000000000..27a48fa0de --- /dev/null +++ b/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml @@ -0,0 +1,89 @@ +- type: entity + name: space bear + id: MobBearSpace + parent: SimpleSpaceMobBase + description: It looks friendly. Why don't you give it a hug? + components: + - type: InputMover + - type: MobMover + - type: HTN + rootTask: SimpleHostileCompound + - type: Faction + factions: + - SimpleHostile + - type: Sprite + drawdepth: Mobs + layers: + - map: [ "enum.DamageStateVisualLayers.Base" ] + state: bear + sprite: Mobs/Animals/bear.rsi + - type: Fixtures + fixtures: + - shape: + !type:PhysShapeCircle + radius: 0.5 + density: 400 + mask: + - MobMask + layer: + - MobLayer + - type: MovementAlwaysTouching + - type: MobState + thresholds: + 0: Alive + 150: Dead + - type: Stamina + excess: 150 + - type: Appearance + - type: DamageStateVisuals + states: + Alive: + Base: bear + Critical: + Base: bear_dead + Dead: + Base: bear_dead + - type: Butcherable + spawned: + - id: FoodMeatBear + amount: 3 + - id: MaterialHideBear + amount: 1 + prob: 0.3 + - type: Bloodstream + bloodMaxVolume: 500 + - type: CombatMode + disarmAction: + enabled: false + autoPopulate: false + name: action-name-disarm + - type: Temperature + heatDamageThreshold: 500 + coldDamageThreshold: 0 + - type: MeleeWeapon + hidden: true + angle: 0 + animation: WeaponArcClaw + damage: + groups: + Brute: 15 + - type: ReplacementAccent + accent: genericAggressive + - type: GhostTakeoverAvailable + prob: 0.05 + name: space bear + description: | + You're a bear! Do bear things. + - type: RandomBark + +- type: entity + id: MobBearSpaceSalvage + parent: MobBearSpace + suffix: "Salvage Ruleset" + components: + - type: GhostTakeoverAvailable + prob: 0.05 + name: space bear on salvage wreck + description: | + Defend the loot inside the salvage wreck! + - type: SalvageMobRestrictions diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml index 88d7cbaae2..b78338e788 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml @@ -285,6 +285,8 @@ tags: - CannotSuicide - VimPilot + - type: RandomBark + barkMultiplier: 1.3 - type: entity name: Paperwork @@ -382,6 +384,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 fb9cedbe11..62a4f66433 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml @@ -107,4 +107,4 @@ - type: FloatingVisuals - type: Puller needsHands: false - + - type: Speech From af9e08f6f3ff454c177a6a53ecef22a6add3f89c Mon Sep 17 00:00:00 2001 From: Pspritechologist <81725545+Pspritechologist@users.noreply.github.com> Date: Tue, 7 Feb 2023 16:42:08 -0500 Subject: [PATCH 2/7] Parkstation tweaks --- .../Speech/EntitySystems/RandomBarkSystem.cs | 24 ++++++++++++++----- .../Prototypes/Entities/Mobs/NPCs/animals.yml | 17 +++++++------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs b/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs index 5ccee8c495..3fd0c79949 100644 --- a/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs +++ b/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs @@ -1,5 +1,6 @@ using Content.Server.Chat.Systems; using Content.Server.Chat.Managers; +using Content.Shared.Mind.Components; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -11,8 +12,19 @@ public sealed class RandomBarkSystem : EntitySystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ChatSystem _chat = default!; [Dependency] private readonly IChatManager _chatManager = default!; + [Dependency] private readonly EntityManager _entities = default!; - [ViewVariables(VVAccess.ReadWrite)] + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnInit); + } + + public void OnInit(EntityUid uid, RandomBarkComponent barker, ComponentInit args) + { + barker.BarkAccumulator = _random.NextFloat(barker.MinTime, barker.MaxTime)*barker.BarkMultiplier; + } public override void Update(float frameTime) { @@ -23,13 +35,13 @@ public override void Update(float frameTime) if (barker.BarkAccumulator <= 0) { barker.BarkAccumulator = _random.NextFloat(barker.MinTime, barker.MaxTime)*barker.BarkMultiplier; - _chat.TrySendInGameICMessage(barker.Owner, _random.Pick(barker.Barks), InGameICChatType.Speak, false); + if (_entities.TryGetComponent(barker.Owner, out var actComp) && + actComp.HasMind) + continue; + + _chat.TrySendInGameICMessage(barker.Owner, _random.Pick(barker.Barks), InGameICChatType.Speak, !barker.ChatLog); } } } - public override void Initialize() - { - base.Initialize(); - } } } diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 38fe4b8864..5795b211df 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -2390,13 +2390,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 @@ -2513,6 +2514,8 @@ BaseResistTime: 3 - type: MobPrice price: 60 + - type: RandomBark + barkMultiplier: 0.45 - type: entity name: pig From fbdbc23c984a5941fd53beb33dc9f72a4a280658 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 29 Oct 2023 11:26:03 -0700 Subject: [PATCH 3/7] uh --- .../Speech/Components/RandomBarkComponent.cs | 77 +++++++++++-------- .../Speech/EntitySystems/RandomBarkSystem.cs | 47 ----------- .../Speech/Systems/RandomBarkSystem.cs | 44 +++++++++++ 3 files changed, 87 insertions(+), 81 deletions(-) delete mode 100644 Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs create mode 100644 Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs diff --git a/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs b/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs index a6a78db6d2..85cb21c7bd 100644 --- a/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs +++ b/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs @@ -1,42 +1,51 @@ -using Robust.Shared.Random; +namespace Content.Server.SimpleStation14.Speech.Components; -namespace Content.Server.SimpleStation14.Speech.RandomBark +/// +/// Sends a random message from a list with a provided min/max time. +/// +[RegisterComponent] +public sealed partial class RandomBarkComponent : Component { - [RegisterComponent] - public sealed class RandomBarkComponent : Component - { - [Dependency] private readonly IRobustRandom _random = default!; + // Should the message be sent to the chat log? + [DataField("chatlog")] + public bool Chatlog = false; - // Minimum time an animal will go without speaking - [DataField("minTime")] - public int MinTime = 45; + // Minimum time an animal will go without speaking + [DataField("minTime")] + public int MinTime = 45; - // Maximum time an animal will go without speaking - [DataField("maxTime")] - public int MaxTime = 350; + // Maximum time an animal will go without speaking + [DataField("maxTime")] + public int MaxTime = 350; - // Counter - [DataField("barkAccumulator")] - public float BarkAccumulator = 8f; + // Counter + [DataField("barkAccumulator")] + public float BarkAccumulator = 8f; - // Multiplier applied to the random time. Good for changing the frequency without having to specify exact values - [DataField("barkMultiplier")] - public float BarkMultiplier = 1f; + // Multiplier applied to the random time. Good for changing the frequency without having to specify exact values + [DataField("barkMultiplier")] + 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("barks"), ViewVariables(VVAccess.ReadWrite)] - public IReadOnlyList Barks = new[] { - "Bark", - "Boof", - "Woofums", - "Howling", - "Screeeeeeeeeeee", - "Barkums", - "OH MY GOD THE FIRE IT BURNS IT BURNS SO BAD!!", - "Death was here ;)", - "Ha ha not really lol", - "Goddamn I love gold fish crackers", - "This is going to be the really long default text, so I'm just going to keep typing and rambling on. You ever tried a churro? They're actually really good. I wasn't expecting much from them, thought they'd be like, dry and crunchy, but no, they're like a cakey thing. Yeah, right, you'd expect something drier, but no, it's actually soft and tasty, sugary, they're really nice." - }; - } + // List of things to be said. Filled with garbage to be modified by an accent, but can be specified in the .yml + [DataField("barks"), 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/EntitySystems/RandomBarkSystem.cs b/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs deleted file mode 100644 index 3fd0c79949..0000000000 --- a/Content.Server/SimpleStation14/Speech/EntitySystems/RandomBarkSystem.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Content.Server.Chat.Systems; -using Content.Server.Chat.Managers; -using Content.Shared.Mind.Components; -using Robust.Shared.Prototypes; -using Robust.Shared.Random; - -namespace Content.Server.SimpleStation14.Speech.RandomBark -{ - public sealed class RandomBarkSystem : EntitySystem - { - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly ChatSystem _chat = default!; - [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly EntityManager _entities = default!; - - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnInit); - } - - public 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); - foreach (var barker in EntityQuery()) - { - barker.BarkAccumulator -= frameTime; - if (barker.BarkAccumulator <= 0) - { - barker.BarkAccumulator = _random.NextFloat(barker.MinTime, barker.MaxTime)*barker.BarkMultiplier; - if (_entities.TryGetComponent(barker.Owner, out var actComp) && - actComp.HasMind) - continue; - - _chat.TrySendInGameICMessage(barker.Owner, _random.Pick(barker.Barks), InGameICChatType.Speak, !barker.ChatLog); - } - } - } - } -} diff --git a/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs b/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs new file mode 100644 index 0000000000..da39bc92be --- /dev/null +++ b/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs @@ -0,0 +1,44 @@ +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 _entities = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnInit); + } + + public 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); + + while (EntityQueryEnumerator().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 (_entities.TryGetComponent(uid, out var actComp) && + actComp.HasMind) + continue; + + _chat.TrySendInGameICMessage(uid, _random.Pick(barker.Barks), InGameICChatType.Speak, barker.Chatlog ? ChatTransmitRange.Normal : ChatTransmitRange.HideChat); + } + } +} From 7a8b7e1fcf2189d08da040f29255b3d549cb0872 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 29 Oct 2023 11:29:56 -0700 Subject: [PATCH 4/7] fix random things that were commited --- .../Locale/en-US/job/job-supervisors.ftl | 7 +- .../Prototypes/Entities/Mobs/NPCs/bear.yml | 89 ------------------- 2 files changed, 3 insertions(+), 93 deletions(-) delete mode 100644 Resources/Prototypes/Entities/Mobs/NPCs/bear.yml diff --git a/Resources/Locale/en-US/job/job-supervisors.ftl b/Resources/Locale/en-US/job/job-supervisors.ftl index aed61ecfbf..25a49f643e 100644 --- a/Resources/Locale/en-US/job/job-supervisors.ftl +++ b/Resources/Locale/en-US/job/job-supervisors.ftl @@ -1,16 +1,15 @@ job-supervisors-centcom = CentCom official job-supervisors-captain = the captain job-supervisors-hop = the head of personnel -job-supervisors-hop-qm = the quartermaster and head of personnel job-supervisors-hos = the head of security job-supervisors-ce = the chief engineer job-supervisors-cmo = the chief medical officer job-supervisors-rd = the mystagogue -job-supervisors-service = chefs, botanists, the bartender, and the chief service supervisor +job-supervisors-qm = the logistics officer +job-supervisors-service = chefs, botanists, the bartender, and the head of personnel job-supervisors-engineering = station engineers, atmospheric technicians, and the chief engineer job-supervisors-medicine = medical doctors, chemists, and the chief medical officer job-supervisors-security = security officers, the warden, and the head of security +job-supervisors-science = scientists, and the mystagogue job-supervisors-hire = whoever hires you job-supervisors-everyone = absolutely everyone -job-supervisors-css = the chief service supervisor -job-supervisors-cc = central command, and discussion among the board of heads diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml b/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml deleted file mode 100644 index 27a48fa0de..0000000000 --- a/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml +++ /dev/null @@ -1,89 +0,0 @@ -- type: entity - name: space bear - id: MobBearSpace - parent: SimpleSpaceMobBase - description: It looks friendly. Why don't you give it a hug? - components: - - type: InputMover - - type: MobMover - - type: HTN - rootTask: SimpleHostileCompound - - type: Faction - factions: - - SimpleHostile - - type: Sprite - drawdepth: Mobs - layers: - - map: [ "enum.DamageStateVisualLayers.Base" ] - state: bear - sprite: Mobs/Animals/bear.rsi - - type: Fixtures - fixtures: - - shape: - !type:PhysShapeCircle - radius: 0.5 - density: 400 - mask: - - MobMask - layer: - - MobLayer - - type: MovementAlwaysTouching - - type: MobState - thresholds: - 0: Alive - 150: Dead - - type: Stamina - excess: 150 - - type: Appearance - - type: DamageStateVisuals - states: - Alive: - Base: bear - Critical: - Base: bear_dead - Dead: - Base: bear_dead - - type: Butcherable - spawned: - - id: FoodMeatBear - amount: 3 - - id: MaterialHideBear - amount: 1 - prob: 0.3 - - type: Bloodstream - bloodMaxVolume: 500 - - type: CombatMode - disarmAction: - enabled: false - autoPopulate: false - name: action-name-disarm - - type: Temperature - heatDamageThreshold: 500 - coldDamageThreshold: 0 - - type: MeleeWeapon - hidden: true - angle: 0 - animation: WeaponArcClaw - damage: - groups: - Brute: 15 - - type: ReplacementAccent - accent: genericAggressive - - type: GhostTakeoverAvailable - prob: 0.05 - name: space bear - description: | - You're a bear! Do bear things. - - type: RandomBark - -- type: entity - id: MobBearSpaceSalvage - parent: MobBearSpace - suffix: "Salvage Ruleset" - components: - - type: GhostTakeoverAvailable - prob: 0.05 - name: space bear on salvage wreck - description: | - Defend the loot inside the salvage wreck! - - type: SalvageMobRestrictions From b44af6110bcd6708e242f29943801b3d91f00431 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sat, 16 Dec 2023 23:23:16 -0800 Subject: [PATCH 5/7] remove component DataField name specifiers and make every variable VVRW --- .../Speech/Components/RandomBarkComponent.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs b/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs index 85cb21c7bd..1af6a41efb 100644 --- a/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs +++ b/Content.Server/SimpleStation14/Speech/Components/RandomBarkComponent.cs @@ -7,27 +7,27 @@ namespace Content.Server.SimpleStation14.Speech.Components; public sealed partial class RandomBarkComponent : Component { // Should the message be sent to the chat log? - [DataField("chatlog")] - public bool Chatlog = false; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public bool ChatLog = false; // Minimum time an animal will go without speaking - [DataField("minTime")] + [DataField, ViewVariables(VVAccess.ReadWrite)] public int MinTime = 45; // Maximum time an animal will go without speaking - [DataField("maxTime")] + [DataField, ViewVariables(VVAccess.ReadWrite)] public int MaxTime = 350; // Counter - [DataField("barkAccumulator")] + [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("barkMultiplier")] + [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("barks"), ViewVariables(VVAccess.ReadWrite)] + [DataField, ViewVariables(VVAccess.ReadWrite)] public IReadOnlyList Barks = new[] { "Bark", From 0ea194bbafef1e48281fd7875372dfb65353c25f Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sat, 16 Dec 2023 23:24:23 -0800 Subject: [PATCH 6/7] system no longer infinitely adds functions infinitely adding entity queries which freezes the game --- .../Speech/Systems/RandomBarkSystem.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs b/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs index da39bc92be..0d42a0deb2 100644 --- a/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs +++ b/Content.Server/SimpleStation14/Speech/Systems/RandomBarkSystem.cs @@ -9,7 +9,8 @@ public sealed class RandomBarkSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ChatSystem _chat = default!; - [Dependency] private readonly EntityManager _entities = default!; + [Dependency] private readonly EntityManager _entity = default!; + public override void Initialize() { @@ -18,7 +19,8 @@ public override void Initialize() SubscribeLocalEvent(OnInit); } - public void OnInit(EntityUid uid, RandomBarkComponent barker, ComponentInit args) + + private void OnInit(EntityUid uid, RandomBarkComponent barker, ComponentInit args) { barker.BarkAccumulator = _random.NextFloat(barker.MinTime, barker.MaxTime)*barker.BarkMultiplier; } @@ -27,18 +29,19 @@ public override void Update(float frameTime) { base.Update(frameTime); - while (EntityQueryEnumerator().MoveNext(out var uid, out var barker)) + 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 (_entities.TryGetComponent(uid, out var actComp) && + 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); + _chat.TrySendInGameICMessage(uid, _random.Pick(barker.Barks), InGameICChatType.Speak, barker.ChatLog ? ChatTransmitRange.Normal : ChatTransmitRange.HideChat); } } } From 63dc116db1952a03e5bfb0c898cc280ad5424a8e Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sat, 16 Dec 2023 23:37:14 -0800 Subject: [PATCH 7/7] gorillas don't bark because monkeys don't have an accent --- Resources/Prototypes/Entities/Mobs/NPCs/animals.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index d0d6b668ad..7a91df3b6f 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -754,9 +754,6 @@ rootTask: task: SimpleHostileCompound - type: Puller - - type: ReplacementAccent - accent: monkey - - type: RandomBark - type: entity name: kangaroo