Port medibot + bot spawners from nyano (#9854)
* Port medibot + bot spawners from nyano * Make the injection thresholds constants * Remove warning * Check against const in system too * resolving systems just isn't worth it * only resolve entity manager once * Reduceother resolves too * fix post-merge * woops
This commit is contained in:
24
Content.Server/AI/Operators/Bots/InjectOperator.cs
Normal file
24
Content.Server/AI/Operators/Bots/InjectOperator.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Content.Server.AI.EntitySystems;
|
||||
|
||||
namespace Content.Server.AI.Operators.Bots
|
||||
{
|
||||
public sealed class InjectOperator : AiOperator
|
||||
{
|
||||
private EntityUid _medibot;
|
||||
private EntityUid _target;
|
||||
public InjectOperator(EntityUid medibot, EntityUid target)
|
||||
{
|
||||
_medibot = medibot;
|
||||
_target = target;
|
||||
}
|
||||
|
||||
public override Outcome Execute(float frameTime)
|
||||
{
|
||||
var injectSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InjectNearbySystem>();
|
||||
if (injectSystem.Inject(_medibot, _target))
|
||||
return Outcome.Success;
|
||||
|
||||
return Outcome.Failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Content.Server/AI/Operators/Speech/SpeechOperator.cs
Normal file
22
Content.Server/AI/Operators/Speech/SpeechOperator.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Content.Server.Chat.Systems;
|
||||
|
||||
namespace Content.Server.AI.Operators.Speech
|
||||
{
|
||||
public sealed class SpeakOperator : AiOperator
|
||||
{
|
||||
private EntityUid _speaker;
|
||||
private string _speechString;
|
||||
public SpeakOperator(EntityUid speaker, string speechString)
|
||||
{
|
||||
_speaker = speaker;
|
||||
_speechString = speechString;
|
||||
}
|
||||
|
||||
public override Outcome Execute(float frameTime)
|
||||
{
|
||||
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
||||
chatSystem.TrySendInGameICMessage(_speaker, _speechString, InGameICChatType.Speak, false);
|
||||
return Outcome.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user