Skip to content

Commit

Permalink
фикус
Browse files Browse the repository at this point in the history
  • Loading branch information
FaDeOkno committed Nov 22, 2024
1 parent c09f1ff commit 5a3f57a
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Content.Shared.Tag;
using Robust.Shared.Prototypes;

namespace Content.Server.NPC.Queries.Considerations;

/// <summary>
/// Returns 1f if the target is alive or 0f if not.
/// </summary>
public sealed partial class TargetTagNotPresentCon : UtilityConsideration
{
[DataField(required: true)]
public ProtoId<TagPrototype> Tag;
}
9 changes: 9 additions & 0 deletions Content.Server/NPC/Systems/NPCUtilitySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Content.Shared.NPC.Systems;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Tag;
using Content.Shared.Tools.Systems;
using Content.Shared.Weapons.Melee;
using Content.Shared.Weapons.Ranged.Components;
Expand Down Expand Up @@ -53,6 +54,7 @@ public sealed class NPCUtilitySystem : EntitySystem
[Dependency] private readonly ExamineSystemShared _examine = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
[Dependency] private readonly MobThresholdSystem _thresholdSystem = default!;
[Dependency] private readonly TagSystem _tag = default!;

private EntityQuery<PuddleComponent> _puddleQuery;
private EntityQuery<TransformComponent> _xformQuery;
Expand Down Expand Up @@ -358,6 +360,13 @@ private float GetScore(NPCBlackboard blackboard, EntityUid targetUid, UtilityCon
return 1f;
return 0f;
}
// ADT tweak start
case TargetTagNotPresentCon tag:
{
return !_tag.HasTag(targetUid, tag.Tag) ? 1f : 0f;
}
// ADT tweak end

default:
throw new NotImplementedException();
}
Expand Down
10 changes: 7 additions & 3 deletions Resources/Prototypes/ADT/Entities/Mobs/Species/Ursus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
components:
- type: HumanoidAppearance
species: UrsusSpecies
- type: NpcFactionMember
factions:
- Ursus
- type: MobThresholds
thresholds:
0: Alive
Expand Down Expand Up @@ -129,6 +126,13 @@
short: true
shortscale: 0.98
shortDensity: 0.7
- type: Tag
tags:
- CanPilot
- FootstepSound
- DoorBumpOpener
- AnomalyHost
- ADTSpaceMobIgnored

- type: entity
save: false
Expand Down
3 changes: 0 additions & 3 deletions Resources/Prototypes/ADT/Entities/Mobs/Species/ipc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
Critical: BorgCrit
Dead: BorgDead
allowRevives: true # Для воскрешения достаточно починить урон. - ss220.
- type: NpcFactionMember
factions:
- NanoTrasen
- type: TypingIndicator
proto: robot
- type: Destructible
Expand Down
9 changes: 9 additions & 0 deletions Resources/Prototypes/ADT/NPCs/Combat/melee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- type: htnCompound
id: SpaceMobMeleeCombatCompound
branches:
- tasks:
- !type:HTNPrimitiveTask
operator: !type:UtilityOperator
proto: SpaceMobNearbyMeleeTargets
- !type:HTNCompoundTask
task: BeforeMeleeAttackTargetCompound
9 changes: 9 additions & 0 deletions Resources/Prototypes/ADT/NPCs/mob.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- type: htnCompound
id: SpaceMobHostileCompound
branches:
- tasks:
- !type:HTNCompoundTask
task: SpaceMobMeleeCombatCompound
- tasks:
- !type:HTNCompoundTask
task: IdleCompound
20 changes: 20 additions & 0 deletions Resources/Prototypes/ADT/NPCs/utility_queries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- type: utilityQuery
id: SpaceMobNearbyMeleeTargets
query:
- !type:NearbyHostilesQuery
considerations:
- !type:TargetIsAliveCon
curve: !type:BoolCurve
- !type:TargetDistanceCon
curve: !type:PresetCurve
preset: TargetDistance
- !type:TargetHealthCon
curve: !type:PresetCurve
preset: TargetHealth
- !type:TargetAccessibleCon
curve: !type:BoolCurve
- !type:TargetInLOSOrCurrentCon
curve: !type:BoolCurve
- !type:TargetTagNotPresentCon
curve: !type:BoolCurve
tag: ADTSpaceMobIgnored
10 changes: 0 additions & 10 deletions Resources/Prototypes/ADT/ai_factions.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
- type: npcFaction
id: Ursus
hostile:
- SimpleHostile
- Syndicate
- Xeno
- Zombie
- Revolutionary
- DroneAntag

- type: npcFaction
id: ADTSpaceMobs
hostile:
Expand Down
6 changes: 6 additions & 0 deletions Resources/Prototypes/ADT/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,9 @@

- type: Tag
id: ADTChemistryAmbience

- type: Tag
id: ADTBeerCan

- type: Tag
id: ADTSpaceMobIgnored
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- type: MobMover
- type: HTN
rootTask:
task: SimpleHostileCompound
task: SpaceMobHostileCompound # ADT tweak
blackboard:
NavSmash: !type:Bool
true
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/space.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
components:
- type: HTN
rootTask:
task: SimpleHostileCompound
task: SpaceMobHostileCompound # ADT tweak
- type: NpcFactionMember
factions:
- SimpleHostile
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/spacetick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- type: MobMover
- type: HTN
rootTask:
task: SimpleHostileCompound
task: SpaceMobHostileCompound # ADT tweak
- type: NpcFactionMember
factions:
- SimpleHostile
Expand Down

0 comments on commit 5a3f57a

Please sign in to comment.