Злые НПС (#1329)

This commit is contained in:
Vigers Ray 2025-02-11 04:28:02 +03:00 committed by GitHub
parent e374d64152
commit ef001b596c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 240 additions and 28 deletions

View file

@ -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<EntityUid, TimeSpan> AttackMemories = new();
}

View file

@ -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<AttackOnInteractionFailComponent, InteractionFailureEvent>(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<AttackOnInteractionFailComponent, FactionExceptionComponent>();
while (query.MoveNext(out var uid, out var retaliationComponent, out var factionException))
{
foreach (var entity in new ValueList<EntityUid>(retaliationComponent.AttackMemories.Keys))
{
if (!TerminatingOrDeleted(entity) && _timing.CurTime < retaliationComponent.AttackMemories[entity])
continue;
_npcFaction.DeAggroEntity((uid, factionException), entity);
}
}
}
}

View file

@ -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

View file

@ -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 } едва не кусает вас за пальцы!

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -57,7 +57,7 @@
- type: entity
id: VentbullMigration
parent: BaseGameRule
noSpawn: true
categories: [ HideSpawnMenu ]
components:
- type: StationEvent
weight: 5