Shooting NPCs and more (#18042)

* Add pirate shooting

* Shooting working

* Basics working

* Refactor time

* More conversion

* Update primitives

* Update yml

* weh

* Building again

* Draft

* weh

* b

* Start shutdown

* Starting to take form

* Code side done

* is it worky

* Fix prototypes

* stuff

* Shitty working

* Juke events working

* Even more cleanup

* RTX

* Fix interaction combat mode and compquery

* GetAmmoCount relays

* Fix rotation speed

* Juke fixes

* fixes

* weh

* The collision avoidance never ends

* Fixes

* Pause support

* framework

* lazy

* Fix idling

* Fix drip

* goobed

* Fix takeover shutdown bug

* Merge fixes

* shitter

* Fix carpos
This commit is contained in:
metalgearsloth
2023-08-02 10:48:56 +10:00
committed by GitHub
parent 018e465fad
commit c31c848afd
103 changed files with 2089 additions and 810 deletions

View File

@@ -3,7 +3,9 @@ using System.Diagnostics.CodeAnalysis;
using Content.Server.Interaction;
using Content.Shared.Access.Systems;
using Content.Shared.ActionBlocker;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using JetBrains.Annotations;
using Robust.Shared.Utility;
@@ -27,9 +29,10 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
{MeleeMissChance, 0.3f},
{"MeleeRange", 1f},
{"MinimumIdleTime", 2f},
{"MovementRangeClose", 0.2f},
{"MovementRange", 1.5f},
{"RangedRange", 10f},
{"RotateSpeed", MathF.PI},
{"RotateSpeed", float.MaxValue},
{"VisionRadius", 10f},
};
@@ -151,6 +154,7 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
switch (key)
{
case Access:
{
if (!TryGetValue(Owner, out owner, entManager))
{
return false;
@@ -159,7 +163,33 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
var access = entManager.EntitySysManager.GetEntitySystem<AccessReaderSystem>();
value = access.FindAccessTags(owner);
return true;
}
case ActiveHand:
{
if (!TryGetValue(Owner, out owner, entManager) ||
!entManager.TryGetComponent<HandsComponent>(owner, out var hands) ||
hands.ActiveHand == null)
{
return false;
}
value = hands.ActiveHand;
return true;
}
case ActiveHandFree:
{
if (!TryGetValue(Owner, out owner, entManager) ||
!entManager.TryGetComponent<HandsComponent>(owner, out var hands) ||
hands.ActiveHand == null)
{
return false;
}
value = hands.ActiveHand.IsEmpty;
return true;
}
case CanMove:
{
if (!TryGetValue(Owner, out owner, entManager))
{
return false;
@@ -168,7 +198,53 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
var blocker = entManager.EntitySysManager.GetEntitySystem<ActionBlockerSystem>();
value = blocker.CanMove(owner);
return true;
}
case FreeHands:
{
if (!TryGetValue(Owner, out owner, entManager) ||
!entManager.TryGetComponent<HandsComponent>(owner, out var hands) ||
hands.ActiveHand == null)
{
return false;
}
var handos = new List<string>();
foreach (var (id, hand) in hands.Hands)
{
if (!hand.IsEmpty)
continue;
handos.Add(id);
}
value = handos;
return true;
}
case Inventory:
{
if (!TryGetValue(Owner, out owner, entManager) ||
!entManager.TryGetComponent<HandsComponent>(owner, out var hands) ||
hands.ActiveHand == null)
{
return false;
}
var handos = new List<string>();
foreach (var (id, hand) in hands.Hands)
{
if (!hand.IsEmpty)
continue;
handos.Add(id);
}
value = handos;
return true;
}
case OwnerCoordinates:
{
if (!TryGetValue(Owner, out owner, entManager))
{
return false;
@@ -181,6 +257,7 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
}
return false;
}
default:
return false;
}
@@ -200,8 +277,12 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
*/
public const string Access = "Access";
public const string ActiveHand = "ActiveHand";
public const string ActiveHandFree = "ActiveHandFree";
public const string CanMove = "CanMove";
public const string FreeHands = "FreeHands";
public const string FollowTarget = "FollowTarget";
public const string Inventory = "Inventory";
public const string MedibotInjectRange = "MedibotInjectRange";
public const string MeleeMissChance = "MeleeMissChance";
@@ -237,7 +318,7 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
public const string RotateSpeed = "RotateSpeed";
public const string VisionRadius = "VisionRadius";
public const string UtilityTarget = "Target";
public const string UtilityTarget = "UtilityTarget";
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{