Rat King Milsim + Buffs (#20190)

* rat king update

* rummaging

* buuuuunnnnncccchhh of shit

* the last of it

* make rat servants not ghost roles

* pissma buff and cooldown
This commit is contained in:
Nemanja
2023-09-22 16:01:05 -04:00
committed by GitHub
parent eebf2c0039
commit f16ff3a2d9
42 changed files with 801 additions and 106 deletions

View File

@@ -1,19 +1,30 @@
using Content.Server.Actions;
using System.Numerics;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Chat.Systems;
using Content.Server.NPC;
using Content.Server.NPC.HTN;
using Content.Server.NPC.Systems;
using Content.Server.Popups;
using Content.Shared.Atmos;
using Content.Shared.Dataset;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Pointing;
using Content.Shared.RatKing;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server.RatKing
{
public sealed class RatKingSystem : EntitySystem
/// <inheritdoc/>
public sealed class RatKingSystem : SharedRatKingSystem
{
[Dependency] private readonly ActionsSystem _action = default!;
[Dependency] private readonly AtmosphereSystem _atmos = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly HTNSystem _htn = default!;
[Dependency] private readonly HungerSystem _hunger = default!;
[Dependency] private readonly NPCSystem _npc = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly TransformSystem _xform = default!;
@@ -21,16 +32,9 @@ namespace Content.Server.RatKing
{
base.Initialize();
SubscribeLocalEvent<RatKingComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<RatKingComponent, RatKingRaiseArmyActionEvent>(OnRaiseArmy);
SubscribeLocalEvent<RatKingComponent, RatKingDomainActionEvent>(OnDomain);
}
private void OnMapInit(EntityUid uid, RatKingComponent component, MapInitEvent args)
{
_action.AddAction(uid, ref component.ActionRaiseArmyEntity, component.ActionRaiseArmy);
_action.AddAction(uid, ref component.ActionDomainEntity, component.ActionDomain);
SubscribeLocalEvent<RatKingComponent, AfterPointedAtEvent>(OnPointedAt);
}
/// <summary>
@@ -52,7 +56,14 @@ namespace Content.Server.RatKing
}
args.Handled = true;
_hunger.ModifyHunger(uid, -component.HungerPerArmyUse, hunger);
Spawn(component.ArmyMobSpawnId, Transform(uid).Coordinates); //spawn the little mouse boi
var servant = Spawn(component.ArmyMobSpawnId, Transform(uid).Coordinates);
var comp = EnsureComp<RatKingServantComponent>(servant);
comp.King = uid;
Dirty(servant, comp);
component.Servants.Add(servant);
_npc.SetBlackboard(servant, NPCBlackboard.FollowTarget, new EntityCoordinates(uid, Vector2.Zero));
UpdateServantNpc(servant, component.CurrentOrder);
}
/// <summary>
@@ -83,5 +94,42 @@ namespace Content.Server.RatKing
var tileMix = _atmos.GetTileMixture(transform.GridUid, transform.MapUid, indices, true);
tileMix?.AdjustMoles(Gas.Miasma, component.MolesMiasmaPerDomain);
}
private void OnPointedAt(EntityUid uid, RatKingComponent component, ref AfterPointedAtEvent args)
{
if (component.CurrentOrder != RatKingOrderType.CheeseEm)
return;
foreach (var servant in component.Servants)
{
_npc.SetBlackboard(servant, NPCBlackboard.CurrentOrderedTarget, args.Pointed);
}
}
public override void UpdateServantNpc(EntityUid uid, RatKingOrderType orderType)
{
base.UpdateServantNpc(uid, orderType);
if (!TryComp<HTNComponent>(uid, out var htn))
return;
if (htn.Plan != null)
_htn.ShutdownPlan(htn);
_npc.SetBlackboard(uid, NPCBlackboard.CurrentOrders, orderType);
_htn.Replan(htn);
}
public override void DoCommandCallout(EntityUid uid, RatKingComponent component)
{
base.DoCommandCallout(uid, component);
if (!component.OrderCallouts.TryGetValue(component.CurrentOrder, out var datasetId) ||
!PrototypeManager.TryIndex<DatasetPrototype>(datasetId, out var datasetPrototype))
return;
var msg = Random.Pick(datasetPrototype.Values);
_chat.TrySendInGameICMessage(uid, msg, InGameICChatType.Speak, true);
}
}
}