From ef001b596cc2a31d718ecfb14ee7d3fe4ba062b7 Mon Sep 17 00:00:00 2001 From: Vigers Ray <60344369+VigersRay@users.noreply.github.com> Date: Tue, 11 Feb 2025 04:28:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=BB=D1=8B=D0=B5=20=D0=9D=D0=9F=D0=A1?= =?UTF-8?q?=20(#1329)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AttackOnInteractionFailComponent.cs | 11 ++ .../Pibble/AttackOnInteractionFailSystem.cs | 45 +++++ .../interaction-popup-component.ftl | 1 + .../interaction-popup-component.ftl | 2 +- .../Prototypes/Entities/Mobs/NPCs/animals.yml | 155 +++++++++++++++--- .../Prototypes/Entities/Mobs/NPCs/pets.yml | 38 ++++- .../_Sunrise/Entities/Mobs/NPCs/dogs.yml | 14 +- .../Prototypes/_Sunrise/GameRules/events.yml | 2 +- 8 files changed, 240 insertions(+), 28 deletions(-) create mode 100644 Content.Server/_Sunrise/Pibble/AttackOnInteractionFailComponent.cs create mode 100644 Content.Server/_Sunrise/Pibble/AttackOnInteractionFailSystem.cs diff --git a/Content.Server/_Sunrise/Pibble/AttackOnInteractionFailComponent.cs b/Content.Server/_Sunrise/Pibble/AttackOnInteractionFailComponent.cs new file mode 100644 index 0000000000..51dc96658a --- /dev/null +++ b/Content.Server/_Sunrise/Pibble/AttackOnInteractionFailComponent.cs @@ -0,0 +1,11 @@ +namespace Content.Server._Sunrise.Pibble; + +[RegisterComponent] +public sealed partial class AttackOnInteractionFailComponent : Component +{ + [DataField("attackMemoryLength"), ViewVariables(VVAccess.ReadWrite)] + public TimeSpan? AttackMemoryLength; + + [DataField("attackMemories")] + public Dictionary AttackMemories = new(); +} diff --git a/Content.Server/_Sunrise/Pibble/AttackOnInteractionFailSystem.cs b/Content.Server/_Sunrise/Pibble/AttackOnInteractionFailSystem.cs new file mode 100644 index 0000000000..b9b4280cb8 --- /dev/null +++ b/Content.Server/_Sunrise/Pibble/AttackOnInteractionFailSystem.cs @@ -0,0 +1,45 @@ +using Content.Shared.Interaction.Events; +using Content.Shared.NPC.Components; +using Content.Shared.NPC.Systems; +using Robust.Shared.Collections; +using Robust.Shared.Timing; + +namespace Content.Server._Sunrise.Pibble; + +public sealed class AttackOnInteractionFailSystem : EntitySystem +{ + [Dependency] private readonly NpcFactionSystem _npcFaction = default!; + [Dependency] private readonly IGameTiming _timing = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnInteractionFailure); + } + + private void OnInteractionFailure(EntityUid uid, AttackOnInteractionFailComponent component, InteractionFailureEvent args) + { + _npcFaction.AggroEntity(uid, args.User); + if (component.AttackMemoryLength is {} memoryLength) + component.AttackMemories[args.User] = _timing.CurTime + memoryLength; + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var retaliationComponent, out var factionException)) + { + foreach (var entity in new ValueList(retaliationComponent.AttackMemories.Keys)) + { + if (!TerminatingOrDeleted(entity) && _timing.CurTime < retaliationComponent.AttackMemories[entity]) + continue; + + _npcFaction.DeAggroEntity((uid, factionException), entity); + } + } + } +} + + diff --git a/Resources/Locale/en-US/_strings/interaction/interaction-popup-component.ftl b/Resources/Locale/en-US/_strings/interaction/interaction-popup-component.ftl index 7996db570b..b606eb4843 100644 --- a/Resources/Locale/en-US/_strings/interaction/interaction-popup-component.ftl +++ b/Resources/Locale/en-US/_strings/interaction/interaction-popup-component.ftl @@ -53,6 +53,7 @@ petting-failure-bear = You reach out to pet {THE($target)}, but {SUBJECT($target petting-failure-monkey = You reach out to pet {THE($target)}, but {SUBJECT($target)} almost {CONJUGATE-BASIC($target, "bite", "bites")} your fingers! petting-failure-nymph = You reach out to pet {THE($target)}, but {SUBJECT($target)} {CONJUGATE-BASIC($target, "move", "moves")} {POSS-ADJ($target)} branches away. petting-failure-shadow = You try to pet {THE($target)}, but your hand passes through the cold darkness of {POSS-ADJ($target)} body. +petting-failure-dog = You reach out to pet {THE($target)}, and {SUBJECT($target)} lunges at you! ## Petting silicons diff --git a/Resources/Locale/ru-RU/_strings/interaction/interaction-popup-component.ftl b/Resources/Locale/ru-RU/_strings/interaction/interaction-popup-component.ftl index 66fe15c157..1394939958 100644 --- a/Resources/Locale/ru-RU/_strings/interaction/interaction-popup-component.ftl +++ b/Resources/Locale/ru-RU/_strings/interaction/interaction-popup-component.ftl @@ -48,7 +48,7 @@ petting-failure-raccoon = Вы тянетесь погладить { $target }, petting-failure-dragon = Вы поднимаете руку, но { $target } издаёт рёв, и вы решаете, что не хотите стать кормом для карпов. petting-failure-hamster = Вы тянетесь погладить { $target }, но { $target } пытается укусить вас за палец, и только ваши молниеносные рефлексы спасают вас от почти смертельной травмы. petting-failure-bear = Вы думаете погладить { $target }, но { $target } рычит, заставляя вас подумать ещё раз. - +petting-failure-dog = Вы тянетесь погладить { $target }, но {SUBJECT($target)} рычит на вас! ## Knocking on windows petting-failure-monkey = Вы тянетесь погладить { $target }, но { $target } едва не кусает вас за пальцы! diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index b42bdafd58..fe04dfbbb9 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -64,9 +64,15 @@ - type: Tag tags: - VimPilot - - type: NightVision #Sunrise - Night vision + # Sunrise-Start + - type: NightVision isToggle: true color: "#808080" + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: bee @@ -244,7 +250,11 @@ prototype: Chiken - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity parent: MobChicken @@ -682,7 +692,11 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: white duck #Quack @@ -870,6 +884,12 @@ guides: - Chef - FoodRecipes + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: crab @@ -942,7 +962,11 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: goat @@ -1048,7 +1072,9 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + # Sunrise-End # Note that we gotta make this bitch vomit someday when you feed it anthrax or sumthin. Needs to be a small item thief too and aggressive if attacked. - type: entity @@ -1101,7 +1127,11 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: gorilla @@ -1157,6 +1187,15 @@ - type: HTN rootTask: task: SimpleHostileCompound + # Sunrise-start + - type: InteractionPopup + successChance: 0.2 + interactSuccessString: petting-success-generic + interactFailureString: petting-failure-generic + interactSuccessSpawn: EffectHearts + - type: AttackOnInteractionFail + attackMemoryLength: 10 + # Sunrise-End - type: entity name: kangaroo @@ -1244,6 +1283,15 @@ - type: HTN rootTask: task: SimpleHostileCompound + # Sunrise-start + - type: InteractionPopup + successChance: 0.2 + interactSuccessString: petting-success-generic + interactFailureString: petting-failure-generic + interactSuccessSpawn: EffectHearts + - type: AttackOnInteractionFail + attackMemoryLength: 10 + # Sunrise-End - type: entity name: boxing kangaroo @@ -1372,7 +1420,10 @@ methods: [ Touch ] effects: - !type:WashCreamPieReaction - + # Sunrise-start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + # Sunrise-end - type: entity @@ -1406,10 +1457,6 @@ Burn: 3 clumsySound: path: /Audio/Animals/monkey_scream.ogg - # Sunrise-start - - type: Carriable - - type: CanEscapeInventory - # Sunrise-end - type: entity @@ -1573,10 +1620,10 @@ name: ghost-role-information-kobold-name description: ghost-role-information-kobold-description rules: ghost-role-information-nonantagonist-rules - # Sunrise Start + # Sunrise Start - type: Body prototype: Kobold - # Sunrise End + # Sunrise-End - type: entity name: kobold @@ -1808,7 +1855,8 @@ Taco: RatTaco Burger: RatBurger Skewer: RatSkewer - - type: NightVision #Sunrise - Night vision + # Sunrise-Start + - type: NightVision isToggle: true color: "#808080" - type: HolidayVisuals @@ -1818,6 +1866,7 @@ - type: HolidayRsiSwap sprite: festive: _Sunrise/Mobs/Animals/mouse_santa.rsi + # Sunrise-End - type: entity parent: MobMouse @@ -2001,7 +2050,11 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity @@ -2051,6 +2104,12 @@ interactSuccessSpawn: EffectHearts - type: Bloodstream bloodMaxVolume: 50 + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: frog @@ -2111,6 +2170,12 @@ - type: Tag tags: - VimPilot + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End # Would be cool to have some functionality for the parrot to be able to sit on stuff - type: entity @@ -2167,6 +2232,12 @@ path: /Audio/Animals/parrot_raught.ogg - type: Bloodstream bloodMaxVolume: 50 + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: penguin @@ -2231,7 +2302,11 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: grenade penguin @@ -2352,9 +2427,15 @@ - type: Damageable damageContainer: Biological damageModifierSet: Scale + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException - type: NightVision #Sunrise - Night vision isToggle: true color: "#808080" + # Sunrise-End # Code unique spider prototypes or combine them all into one spider and get a # random sprite state when you spawn it. @@ -2457,6 +2538,10 @@ - Arachnids - type: Carriable - type: CanEscapeInventory + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException # Sunrise-end - type: entity @@ -2640,6 +2725,10 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException # Sunrise-end - type: entity @@ -2718,6 +2807,10 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException # Sunrise-end - type: entity @@ -2927,6 +3020,12 @@ heatDamage: types: Heat : 1 #per second, scales with temperature & other constants + # Sunrise-start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-end - type: entity name: corgi puppy @@ -3025,11 +3124,15 @@ tags: - VimPilot # Sunrise-start - - type: NightVision #Sunrise - Night vision + - type: NightVision isToggle: true color: "#808080" - type: Carriable - type: CanEscapeInventory + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException # Sunrise-end - type: entity @@ -3307,7 +3410,11 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: hamster @@ -3452,6 +3559,12 @@ - type: FireVisuals sprite: Mobs/Effects/onfire.rsi normalState: Mouse_burning + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: pig @@ -3528,7 +3641,11 @@ prototype: ManeaterAnimal - type: Carriable - type: CanEscapeInventory - # Sunrise-end + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: diona nymph diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml index b546582486..9e69dbec39 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml @@ -270,6 +270,10 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException # Sunrise-end - type: entity @@ -317,7 +321,7 @@ - type: InteractionPopup successChance: 0.5 interactSuccessString: petting-success-dog - interactFailureString: petting-failure-generic + interactFailureString: petting-failure-dog # Sunrise-Edit interactSuccessSpawn: EffectHearts interactSuccessSound: path: /Audio/Animals/small_dog_bark_happy.ogg @@ -334,6 +338,10 @@ # Sunrise-start - type: Carriable - type: CanEscapeInventory + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException # Sunrise-end - type: entity @@ -397,7 +405,6 @@ - type: Inventory speciesId: dog templateId: pet - - type: DogVision # Sunrise-DogVision - type: DamageStateVisuals states: Alive: @@ -415,7 +422,7 @@ - type: InteractionPopup successChance: 0.7 interactSuccessString: petting-success-dog - interactFailureString: petting-failure-generic + interactFailureString: petting-failure-dog # Sunrise-Edit interactSuccessSpawn: EffectHearts interactSuccessSound: path: /Audio/Animals/small_dog_bark_happy.ogg @@ -430,8 +437,13 @@ - type: StealTarget stealGroup: AnimalWalter # Sunrise-start + - type: DogVision - type: Carriable - type: CanEscapeInventory + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException # Sunrise-end - type: entity @@ -521,6 +533,12 @@ tags: - CannotSuicide - VimPilot + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: Alexander @@ -551,7 +569,7 @@ description: The captain's trustworthy fox. components: - type: InteractionPopup - successChance: 1 + successChance: 0.7 # Sunrise-Edit interactSuccessString: petting-success-soft-floofy interactFailureString: petting-failure-generic interactSuccessSpawn: EffectHearts @@ -573,6 +591,12 @@ - VimPilot - type: StealTarget stealGroup: AnimalRenault + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: Hamlet @@ -691,6 +715,12 @@ - FootstepSound - type: StealTarget stealGroup: AnimalShiva + # Sunrise-Start + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + # Sunrise-End - type: entity name: Willow diff --git a/Resources/Prototypes/_Sunrise/Entities/Mobs/NPCs/dogs.yml b/Resources/Prototypes/_Sunrise/Entities/Mobs/NPCs/dogs.yml index 65f42d70e1..b0e046ebf8 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Mobs/NPCs/dogs.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Mobs/NPCs/dogs.yml @@ -60,12 +60,12 @@ - type: ReplacementAccent accent: dog - type: InteractionPopup - successChance: 0.7 + successChance: 0.5 interactSuccessString: petting-success-dog - interactFailureString: petting-failure-pibble + interactFailureString: petting-failure-dog + interactSuccessSpawn: EffectHearts interactSuccessSound: path: /Audio/Animals/small_dog_bark_happy.ogg - hostileOnFail: true - type: HTN rootTask: task: SimpleHostileCompound @@ -85,6 +85,14 @@ description: Верный друг человека... Или нет? rules: ghost-role-information-nonantagonist-rules - type: GhostTakeoverAvailable + - type: DogVision + - type: AttackOnInteractionFail + attackMemoryLength: 10 + - type: NPCRetaliation + - type: FactionException + - type: NpcFactionMember + factions: + - Passive - type: entity parent: MobPibble diff --git a/Resources/Prototypes/_Sunrise/GameRules/events.yml b/Resources/Prototypes/_Sunrise/GameRules/events.yml index f644382e55..81c9d5248f 100644 --- a/Resources/Prototypes/_Sunrise/GameRules/events.yml +++ b/Resources/Prototypes/_Sunrise/GameRules/events.yml @@ -57,7 +57,7 @@ - type: entity id: VentbullMigration parent: BaseGameRule - noSpawn: true + categories: [ HideSpawnMenu ] components: - type: StationEvent weight: 5