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

@@ -0,0 +1,9 @@
using Content.Shared.RatKing;
namespace Content.Client.RatKing;
/// <inheritdoc/>
public sealed class RatKingSystem : SharedRatKingSystem
{
}

View File

@@ -0,0 +1,13 @@
namespace Content.Server.NPC.HTN.Preconditions;
public sealed partial class HasOrdersPrecondition : HTNPrecondition
{
[Dependency] private readonly IEntityManager _entManager = default!;
[DataField("orders", required: true)] public Enum Orders = default!;
public override bool IsMet(NPCBlackboard blackboard)
{
return Equals(blackboard.GetValueOrDefault<Enum>(NPCBlackboard.CurrentOrders, _entManager), Orders);
}
}

View File

@@ -68,6 +68,20 @@ public sealed partial class MeleeOperator : HTNOperator, IHtnConditionalShutdown
blackboard.Remove<EntityUid>(TargetKey); blackboard.Remove<EntityUid>(TargetKey);
} }
public override void TaskShutdown(NPCBlackboard blackboard, HTNOperatorStatus status)
{
base.TaskShutdown(blackboard, status);
ConditionalShutdown(blackboard);
}
public override void PlanShutdown(NPCBlackboard blackboard)
{
base.PlanShutdown(blackboard);
ConditionalShutdown(blackboard);
}
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime) public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
{ {
base.Update(blackboard, frameTime); base.Update(blackboard, frameTime);

View File

@@ -320,6 +320,16 @@ public sealed partial class NPCBlackboard : IEnumerable<KeyValuePair<string, obj
public const string VisionRadius = "VisionRadius"; public const string VisionRadius = "VisionRadius";
public const string UtilityTarget = "UtilityTarget"; public const string UtilityTarget = "UtilityTarget";
/// <summary>
/// A configurable "order" enum that can be given to an NPC from an external source.
/// </summary>
public const string CurrentOrders = "CurrentOrders";
/// <summary>
/// A configurable target that's ordered by external sources.
/// </summary>
public const string CurrentOrderedTarget = "CurrentOrderedTarget";
public IEnumerator<KeyValuePair<string, object>> GetEnumerator() public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{ {
return _blackboard.GetEnumerator(); return _blackboard.GetEnumerator();

View File

@@ -0,0 +1,6 @@
namespace Content.Server.NPC.Queries.Considerations;
public sealed partial class OrderedTargetCon : UtilityConsideration
{
}

View File

@@ -191,6 +191,16 @@ public sealed class NPCUtilitySystem : EntitySystem
return 1f; return 1f;
} }
case OrderedTargetCon:
{
if (!blackboard.TryGetValue<EntityUid>(NPCBlackboard.CurrentOrderedTarget, out var orderedTarget, EntityManager))
return 0f;
if (targetUid != orderedTarget)
return 0f;
return 1f;
}
case TargetAccessibleCon: case TargetAccessibleCon:
{ {
if (_container.TryGetContainingContainer(targetUid, out var container)) if (_container.TryGetContainingContainer(targetUid, out var container))

View File

@@ -204,6 +204,11 @@ namespace Content.Server.Pointing.EntitySystems
viewerPointedAtMessage = Loc.GetString("pointing-system-point-at-you-other", ("otherName", playerName)); viewerPointedAtMessage = Loc.GetString("pointing-system-point-at-you-other", ("otherName", playerName));
var ev = new AfterPointedAtEvent(pointed);
RaiseLocalEvent(player, ref ev);
var gotev = new AfterGotPointedAtEvent(player);
RaiseLocalEvent(pointed, ref gotev);
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):user} pointed at {ToPrettyString(pointed):target} {Transform(pointed).Coordinates}"); _adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):user} pointed at {ToPrettyString(pointed):target} {Transform(pointed).Coordinates}");
} }
else else

View File

@@ -1,50 +0,0 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.RatKing
{
[RegisterComponent]
public sealed partial class RatKingComponent : Component
{
[DataField("actionRaiseArmy", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionRaiseArmy = "ActionRatKingRaiseArmy";
/// <summary>
/// The action for the Raise Army ability
/// </summary>
[DataField("actionRaiseArmyEntity")] public EntityUid? ActionRaiseArmyEntity;
/// <summary>
/// The amount of hunger one use of Raise Army consumes
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("hungerPerArmyUse", required: true)]
public float HungerPerArmyUse = 25f;
/// <summary>
/// The entity prototype of the mob that Raise Army summons
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("armyMobSpawnId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ArmyMobSpawnId = "MobRatServant";
[DataField("actionDomain", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionDomain = "ActionRatKingDomain";
/// <summary>
/// The action for the Domain ability
/// </summary>
[DataField("actionDomainEntity")]
public EntityUid? ActionDomainEntity;
/// <summary>
/// The amount of hunger one use of Domain consumes
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("hungerPerDomainUse", required: true)]
public float HungerPerDomainUse = 50f;
/// <summary>
/// How many moles of Miasma are released after one us of Domain
/// </summary>
[DataField("molesMiasmaPerDomain")]
public float MolesMiasmaPerDomain = 100f;
}
}

View File

@@ -1,19 +1,30 @@
using Content.Server.Actions; using System.Numerics;
using Content.Server.Atmos.EntitySystems; 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.Server.Popups;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Dataset;
using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems; using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Pointing;
using Content.Shared.RatKing; using Content.Shared.RatKing;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server.RatKing 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 AtmosphereSystem _atmos = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly HTNSystem _htn = default!;
[Dependency] private readonly HungerSystem _hunger = default!; [Dependency] private readonly HungerSystem _hunger = default!;
[Dependency] private readonly NPCSystem _npc = default!;
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly TransformSystem _xform = default!; [Dependency] private readonly TransformSystem _xform = default!;
@@ -21,16 +32,9 @@ namespace Content.Server.RatKing
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<RatKingComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<RatKingComponent, RatKingRaiseArmyActionEvent>(OnRaiseArmy); SubscribeLocalEvent<RatKingComponent, RatKingRaiseArmyActionEvent>(OnRaiseArmy);
SubscribeLocalEvent<RatKingComponent, RatKingDomainActionEvent>(OnDomain); SubscribeLocalEvent<RatKingComponent, RatKingDomainActionEvent>(OnDomain);
} SubscribeLocalEvent<RatKingComponent, AfterPointedAtEvent>(OnPointedAt);
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);
} }
/// <summary> /// <summary>
@@ -52,7 +56,14 @@ namespace Content.Server.RatKing
} }
args.Handled = true; args.Handled = true;
_hunger.ModifyHunger(uid, -component.HungerPerArmyUse, hunger); _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> /// <summary>
@@ -83,5 +94,42 @@ namespace Content.Server.RatKing
var tileMix = _atmos.GetTileMixture(transform.GridUid, transform.MapUid, indices, true); var tileMix = _atmos.GetTileMixture(transform.GridUid, transform.MapUid, indices, true);
tileMix?.AdjustMoles(Gas.Miasma, component.MolesMiasmaPerDomain); 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);
}
} }
} }

View File

@@ -204,6 +204,19 @@ public abstract class SharedActionsSystem : EntitySystem
Dirty(actionId.Value, action); Dirty(actionId.Value, action);
} }
public void StartUseDelay(EntityUid? actionId)
{
if (actionId == null)
return;
var action = GetActionData(actionId);
if (action == null || action.UseDelay == null)
return;
action.Cooldown = (GameTiming.CurTime, GameTiming.CurTime + action.UseDelay.Value);
Dirty(actionId.Value, action);
}
#region ComponentStateManagement #region ComponentStateManagement
public virtual void Dirty(EntityUid? actionId) public virtual void Dirty(EntityUid? actionId)
{ {

View File

@@ -17,3 +17,17 @@ public sealed class PointingAttemptEvent : EntityEventArgs
Target = target; Target = target;
} }
} }
/// <summary>
/// Raised on the entity who is pointing after they point at something.
/// </summary>
/// <param name="Pointed"></param>
[ByRefEvent]
public readonly record struct AfterPointedAtEvent(EntityUid Pointed);
/// <summary>
/// Raised on an entity after they are pointed at by another entity.
/// </summary>
/// <param name="Pointer"></param>
[ByRefEvent]
public readonly record struct AfterGotPointedAtEvent(EntityUid Pointer);

View File

@@ -11,3 +11,12 @@ public sealed partial class RatKingDomainActionEvent : InstantActionEvent
{ {
} }
public sealed partial class RatKingOrderActionEvent : InstantActionEvent
{
/// <summary>
/// The type of order being given
/// </summary>
[DataField("type")]
public RatKingOrderType Type;
}

View File

@@ -0,0 +1,111 @@
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.RatKing;
[RegisterComponent, NetworkedComponent, Access(typeof(SharedRatKingSystem))]
[AutoGenerateComponentState]
public sealed partial class RatKingComponent : Component
{
[DataField("actionRaiseArmy", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionRaiseArmy = "ActionRatKingRaiseArmy";
/// <summary>
/// The action for the Raise Army ability
/// </summary>
[DataField("actionRaiseArmyEntity")]
public EntityUid? ActionRaiseArmyEntity;
/// <summary>
/// The amount of hunger one use of Raise Army consumes
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("hungerPerArmyUse", required: true)]
public float HungerPerArmyUse = 25f;
/// <summary>
/// The entity prototype of the mob that Raise Army summons
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("armyMobSpawnId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ArmyMobSpawnId = "MobRatServant";
[DataField("actionDomain", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionDomain = "ActionRatKingDomain";
/// <summary>
/// The action for the Domain ability
/// </summary>
[DataField("actionDomainEntity")]
public EntityUid? ActionDomainEntity;
/// <summary>
/// The amount of hunger one use of Domain consumes
/// </summary>
[DataField("hungerPerDomainUse", required: true), ViewVariables(VVAccess.ReadWrite)]
public float HungerPerDomainUse = 50f;
/// <summary>
/// How many moles of Miasma are released after one us of Domain
/// </summary>
[DataField("molesMiasmaPerDomain"), ViewVariables(VVAccess.ReadWrite)]
public float MolesMiasmaPerDomain = 100f;
/// <summary>
/// The current order that the Rat King assigned.
/// </summary>
[DataField("currentOrders"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public RatKingOrderType CurrentOrder = RatKingOrderType.Loose;
/// <summary>
/// The servants that the rat king is currently controlling
/// </summary>
[DataField("servants")]
public HashSet<EntityUid> Servants = new();
[DataField("actionOrderStay", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionOrderStay = "ActionRatKingOrderStay";
[DataField("actionOrderStayEntity")]
public EntityUid? ActionOrderStayEntity;
[DataField("actionOrderFollow", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionOrderFollow = "ActionRatKingOrderFollow";
[DataField("actionOrderFollowEntity")]
public EntityUid? ActionOrderFollowEntity;
[DataField("actionOrderCheeseEm", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionOrderCheeseEm = "ActionRatKingOrderCheeseEm";
[DataField("actionOrderCheeseEmEntity")]
public EntityUid? ActionOrderCheeseEmEntity;
[DataField("actionOrderLoose", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionOrderLoose = "ActionRatKingOrderLoose";
[DataField("actionOrderLooseEntity")]
public EntityUid? ActionOrderLooseEntity;
/// <summary>
/// A dictionary with an order type to the corresponding callout dataset.
/// </summary>
[DataField("orderCallouts")]
public Dictionary<RatKingOrderType, string> OrderCallouts = new()
{
{ RatKingOrderType.Stay, "RatKingCommandStay" },
{ RatKingOrderType.Follow, "RatKingCommandFollow" },
{ RatKingOrderType.CheeseEm, "RatKingCommandCheeseEm" },
{ RatKingOrderType.Loose, "RatKingCommandLoose" }
};
}
[Serializable, NetSerializable]
public enum RatKingOrderType : byte
{
Stay,
Follow,
CheeseEm,
Loose
}

View File

@@ -0,0 +1,42 @@
using Content.Shared.Random;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.RatKing;
/// <summary>
/// This is used for entities that can be
/// rummaged through by the rat king to get loot.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SharedRatKingSystem))]
[AutoGenerateComponentState]
public sealed partial class RatKingRummageableComponent : Component
{
/// <summary>
/// Whether or not this entity has been rummaged through already.
/// </summary>
[DataField("looted"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public bool Looted;
/// <summary>
/// How long it takes to rummage through a rummageable container.
/// </summary>
[DataField("rummageDuration"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public float RummageDuration = 3f;
/// <summary>
/// A weighted random entity prototype containing the different loot that rummaging can provide.
/// </summary>
[DataField("rummageLoot", customTypeSerializer: typeof(PrototypeIdSerializer<WeightedRandomEntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public string RummageLoot = "RatKingLoot";
/// <summary>
/// Sound played on rummage completion.
/// </summary>
[DataField("sound")]
public SoundSpecifier? Sound = new SoundCollectionSpecifier("storageRustle");
}

View File

@@ -0,0 +1,15 @@
using Robust.Shared.GameStates;
namespace Content.Shared.RatKing;
[RegisterComponent, NetworkedComponent, Access(typeof(SharedRatKingSystem))]
[AutoGenerateComponentState]
public sealed partial class RatKingServantComponent : Component
{
/// <summary>
/// The king this rat belongs to.
/// </summary>
[DataField("king")]
[AutoNetworkedField]
public EntityUid? King;
}

View File

@@ -0,0 +1,163 @@
using Content.Shared.Actions;
using Content.Shared.DoAfter;
using Content.Shared.Random;
using Content.Shared.Random.Helpers;
using Content.Shared.Verbs;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
namespace Content.Shared.RatKing;
public abstract class SharedRatKingSystem : EntitySystem
{
[Dependency] private readonly INetManager _net = default!;
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
[Dependency] protected readonly IRobustRandom Random = default!;
[Dependency] private readonly SharedActionsSystem _action = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<RatKingComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<RatKingComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<RatKingComponent, RatKingOrderActionEvent>(OnOrderAction);
SubscribeLocalEvent<RatKingServantComponent, ComponentShutdown>(OnServantShutdown);
SubscribeLocalEvent<RatKingRummageableComponent, GetVerbsEvent<AlternativeVerb>>(OnGetVerb);
SubscribeLocalEvent<RatKingRummageableComponent, RatKingRummageDoAfterEvent>(OnDoAfterComplete);
}
private void OnStartup(EntityUid uid, RatKingComponent component, ComponentStartup args)
{
if (!TryComp(uid, out ActionsComponent? comp))
return;
_action.AddAction(uid, ref component.ActionRaiseArmyEntity, component.ActionRaiseArmy, holderComp: comp);
_action.AddAction(uid, ref component.ActionDomainEntity, component.ActionDomain, holderComp: comp);
_action.AddAction(uid, ref component.ActionOrderStayEntity, component.ActionOrderStay, holderComp: comp);
_action.AddAction(uid, ref component.ActionOrderFollowEntity, component.ActionOrderFollow, holderComp: comp);
_action.AddAction(uid, ref component.ActionOrderCheeseEmEntity, component.ActionOrderCheeseEm, holderComp: comp);
_action.AddAction(uid, ref component.ActionOrderLooseEntity, component.ActionOrderLoose, holderComp: comp);
UpdateActions(uid, component);
}
private void OnShutdown(EntityUid uid, RatKingComponent component, ComponentShutdown args)
{
foreach (var servant in component.Servants)
{
if (TryComp(servant, out RatKingServantComponent? servantComp))
servantComp.King = null;
}
if (!TryComp(uid, out ActionsComponent? comp))
return;
_action.RemoveAction(uid, component.ActionRaiseArmyEntity, comp);
_action.RemoveAction(uid, component.ActionDomainEntity, comp);
_action.RemoveAction(uid, component.ActionOrderStayEntity, comp);
_action.RemoveAction(uid, component.ActionOrderFollowEntity, comp);
_action.RemoveAction(uid, component.ActionOrderCheeseEmEntity, comp);
_action.RemoveAction(uid, component.ActionOrderLooseEntity, comp);
}
private void OnOrderAction(EntityUid uid, RatKingComponent component, RatKingOrderActionEvent args)
{
if (component.CurrentOrder == args.Type)
return;
args.Handled = true;
component.CurrentOrder = args.Type;
Dirty(uid, component);
DoCommandCallout(uid, component);
UpdateActions(uid, component);
UpdateAllServants(uid, component);
}
private void OnServantShutdown(EntityUid uid, RatKingServantComponent component, ComponentShutdown args)
{
if (TryComp(component.King, out RatKingComponent? ratKingComponent))
ratKingComponent.Servants.Remove(uid);
}
private void UpdateActions(EntityUid uid, RatKingComponent? component = null)
{
if (!Resolve(uid, ref component))
return;
_action.SetToggled(component.ActionOrderStayEntity, component.CurrentOrder == RatKingOrderType.Stay);
_action.SetToggled(component.ActionOrderFollowEntity, component.CurrentOrder == RatKingOrderType.Follow);
_action.SetToggled(component.ActionOrderCheeseEmEntity, component.CurrentOrder == RatKingOrderType.CheeseEm);
_action.SetToggled(component.ActionOrderLooseEntity, component.CurrentOrder == RatKingOrderType.Loose);
_action.StartUseDelay(component.ActionOrderStayEntity);
_action.StartUseDelay(component.ActionOrderFollowEntity);
_action.StartUseDelay(component.ActionOrderCheeseEmEntity);
_action.StartUseDelay(component.ActionOrderLooseEntity);
}
private void OnGetVerb(EntityUid uid, RatKingRummageableComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!HasComp<RatKingComponent>(args.User) || component.Looted)
return;
args.Verbs.Add(new AlternativeVerb
{
Text = Loc.GetString("rat-king-rummage-text"),
Priority = 0,
Act = () =>
{
_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.RummageDuration,
new RatKingRummageDoAfterEvent(), uid, uid)
{
BlockDuplicate = true,
BreakOnDamage = true,
BreakOnUserMove = true
});
}
});
}
private void OnDoAfterComplete(EntityUid uid, RatKingRummageableComponent component, RatKingRummageDoAfterEvent args)
{
if (args.Cancelled || component.Looted)
return;
component.Looted = true;
Dirty(uid, component);
_audio.PlayPvs(component.Sound, uid);
var spawn = PrototypeManager.Index<WeightedRandomEntityPrototype>(component.RummageLoot).Pick(Random);
if (_net.IsServer)
Spawn(spawn, Transform(uid).Coordinates);
}
public void UpdateAllServants(EntityUid uid, RatKingComponent component)
{
foreach (var servant in component.Servants)
{
UpdateServantNpc(servant, component.CurrentOrder);
}
}
public virtual void UpdateServantNpc(EntityUid uid, RatKingOrderType orderType)
{
}
public virtual void DoCommandCallout(EntityUid uid, RatKingComponent component)
{
}
}
[Serializable, NetSerializable]
public sealed partial class RatKingRummageDoAfterEvent : SimpleDoAfterEvent
{
}

View File

@@ -1,3 +1,5 @@
rat-king-domain-popup = A cloud of miasma is released into the air! rat-king-domain-popup = A cloud of miasma is released into the air!
rat-king-too-hungry = You are too hungry to use this ability! rat-king-too-hungry = You are too hungry to use this ability!
rat-king-rummage-text = Rummage

View File

@@ -0,0 +1,26 @@
- type: dataset
id: RatKingCommandStay
values:
- "Sit!"
- "Stay!"
- "Stop!"
- type: dataset
id: RatKingCommandFollow
values:
- "Heel!"
- "Follow!"
- type: dataset
id: RatKingCommandCheeseEm
values:
- "Attack!"
- "Sic!"
- "Kill!"
- "Cheese 'Em!"
- type: dataset
id: RatKingCommandLoose
values:
- "Free!"
- "Loose!"

View File

@@ -2,6 +2,7 @@
name: Trash Spawner name: Trash Spawner
id: RandomSpawner id: RandomSpawner
parent: MarkerBase parent: MarkerBase
suffix: 50
components: components:
- type: Sprite - type: Sprite
layers: layers:
@@ -35,3 +36,13 @@
offset: 0.2 offset: 0.2
placement: placement:
mode: AlignTileAny mode: AlignTileAny
- type: entity
parent: RandomSpawner
id: RandomSpawner100
suffix: 100
placement:
mode: AlignTileAny
components:
- type: RandomSpawner
chance: 1

View File

@@ -21,7 +21,7 @@
factions: factions:
- SimpleHostile - SimpleHostile
- type: Sprite - type: Sprite
drawdepth: Mobs drawdepth: SmallMobs
sprite: Mobs/Animals/regalrat.rsi sprite: Mobs/Animals/regalrat.rsi
layers: layers:
- map: ["enum.DamageStateVisualLayers.Base"] - map: ["enum.DamageStateVisualLayers.Base"]
@@ -78,6 +78,8 @@
states: states:
Alive: Alive:
Base: regalrat Base: regalrat
Critical:
Base: critical
Dead: Dead:
Base: dead Base: dead
- type: GhostRole - type: GhostRole
@@ -89,7 +91,6 @@
- type: Tag - type: Tag
tags: tags:
- CannotSuicide - CannotSuicide
- DoorBumpOpener
- FootstepSound - FootstepSound
- type: NoSlip - type: NoSlip
- type: RatKing - type: RatKing
@@ -118,7 +119,6 @@
suffix: Buff suffix: Buff
components: components:
- type: Sprite - type: Sprite
drawdepth: Mobs
sprite: Mobs/Animals/buffrat.rsi sprite: Mobs/Animals/buffrat.rsi
scale: 1.2, 1.2 scale: 1.2, 1.2
layers: layers:
@@ -139,17 +139,6 @@
damage: damage:
types: types:
Blunt: 66 #oof ouch owie my bones Blunt: 66 #oof ouch owie my bones
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeCircle
radius: 0.35
density: 400
mask:
- MobMask
layer:
- MobLayer
- type: SlowOnDamage - type: SlowOnDamage
speedModifierThresholds: speedModifierThresholds:
200: 0.7 200: 0.7
@@ -163,6 +152,7 @@
id: MobRatServant id: MobRatServant
parent: SimpleMobBase parent: SimpleMobBase
description: He's da mini rat. He don't make da roolz. description: He's da mini rat. He don't make da roolz.
noSpawn: true #Must be configured to a King or the AI breaks.
components: components:
- type: CombatMode - type: CombatMode
- type: MovementSpeedModifier - type: MovementSpeedModifier
@@ -172,7 +162,14 @@
- type: MobMover - type: MobMover
- type: HTN - type: HTN
rootTask: rootTask:
task: SimpleHostileCompound task: RatServantCompound
blackboard:
IdleRange: !type:Single
3.5
FollowCloseRange: !type:Single
2.0
FollowRange: !type:Single
3.0
- type: Reactive - type: Reactive
groups: groups:
Flammable: [Touch] Flammable: [Touch]
@@ -254,16 +251,9 @@
Female: Mouse Female: Mouse
Unsexed: Mouse Unsexed: Mouse
wilhelmProbability: 0.001 wilhelmProbability: 0.001
- type: GhostRole
makeSentient: true
name: ghost-role-information-rat-servant-name
description: ghost-role-information-rat-servant-description
rules: ghost-role-information-rat-servant-rules
- type: GhostTakeoverAvailable
- type: Tag - type: Tag
tags: tags:
- CannotSuicide - CannotSuicide
- DoorBumpOpener
- FootstepSound - FootstepSound
- type: NoSlip - type: NoSlip
- type: MobPrice - type: MobPrice
@@ -276,6 +266,13 @@
guides: guides:
- MinorAntagonists - MinorAntagonists
- type: weightedRandomEntity
id: RatKingLoot
weights:
RandomSpawner100: 66 #garbage
FoodCheese: 28 #food
IngotGold1: 5 #loot
- type: entity - type: entity
id: ActionRatKingRaiseArmy id: ActionRatKingRaiseArmy
name: Raise Army name: Raise Army
@@ -283,10 +280,11 @@
noSpawn: true noSpawn: true
components: components:
- type: InstantAction - type: InstantAction
icon: Interface/Actions/ratKingArmy.png
itemIconStyle: NoItem
event: !type:RatKingRaiseArmyActionEvent
useDelay: 4 useDelay: 4
icon:
sprite: Interface/Actions/actions_rat_king.rsi
state: ratKingArmy
event: !type:RatKingRaiseArmyActionEvent
- type: entity - type: entity
id: ActionRatKingDomain id: ActionRatKingDomain
@@ -295,7 +293,84 @@
noSpawn: true noSpawn: true
components: components:
- type: InstantAction - type: InstantAction
useDelay: 10 useDelay: 6
icon: Interface/Actions/ratKingDomain.png icon:
itemIconStyle: NoItem sprite: Interface/Actions/actions_rat_king.rsi
state: ratKingDomain
event: !type:RatKingDomainActionEvent event: !type:RatKingDomainActionEvent
- type: entity
id: ActionRatKingOrderStay
name: Stay
description: Command your army to stand in place.
noSpawn: true
components:
- type: InstantAction
useDelay: 1
icon:
sprite: Interface/Actions/actions_rat_king.rsi
state: stayOff
iconOn:
sprite: Interface/Actions/actions_rat_king.rsi
state: stay
event:
!type:RatKingOrderActionEvent
type: Stay
priority: 5
- type: entity
id: ActionRatKingOrderFollow
name: Follow
description: Command your army to follow you around.
noSpawn: true
components:
- type: InstantAction
useDelay: 1
icon:
sprite: Interface/Actions/actions_rat_king.rsi
state: followOff
iconOn:
sprite: Interface/Actions/actions_rat_king.rsi
state: follow
event:
!type:RatKingOrderActionEvent
type: Follow
priority: 6
- type: entity
id: ActionRatKingOrderCheeseEm
name: Cheese 'Em
description: Command your army to attack whoever you point at.
noSpawn: true
components:
- type: InstantAction
useDelay: 1
icon:
sprite: Interface/Actions/actions_rat_king.rsi
state: attackOff
iconOn:
sprite: Interface/Actions/actions_rat_king.rsi
state: attack
event:
!type:RatKingOrderActionEvent
type: CheeseEm
priority: 7
- type: entity
id: ActionRatKingOrderLoose
name: Loose
description: Command your army to act at their own will.
noSpawn: true
components:
- type: InstantAction
useDelay: 1
icon:
sprite: Interface/Actions/actions_rat_king.rsi
state: looseOff
iconOn:
sprite: Interface/Actions/actions_rat_king.rsi
state: loose
event:
!type:RatKingOrderActionEvent
type: Loose
priority: 8

View File

@@ -132,7 +132,6 @@
solution: cube solution: cube
- type: Rehydratable - type: Rehydratable
possibleSpawns: possibleSpawns:
- MobRatServant
- MobCarpHolo - MobCarpHolo
- MobXenoRavager - MobXenoRavager
- MobAngryBee - MobAngryBee

View File

@@ -86,6 +86,7 @@
interfaces: interfaces:
- key: enum.DisposalUnitUiKey.Key - key: enum.DisposalUnitUiKey.Key
type: DisposalUnitBoundUserInterface type: DisposalUnitBoundUserInterface
- type: RatKingRummageable
- type: entity - type: entity
id: MailingUnit id: MailingUnit

View File

@@ -176,13 +176,11 @@
- type: VentCrittersRule - type: VentCrittersRule
entries: entries:
- id: MobMouse - id: MobMouse
prob: 0.015 prob: 0.02
- id: MobMouse1 - id: MobMouse1
prob: 0.015 prob: 0.02
- id: MobMouse2 - id: MobMouse2
prob: 0.015 prob: 0.02
- id: MobRatServant
prob: 0.015
specialEntries: specialEntries:
- id: SpawnPointGhostRatKing - id: SpawnPointGhostRatKing
prob: 0.005 prob: 0.005

View File

@@ -25,6 +25,28 @@
- !type:HTNCompoundTask - !type:HTNCompoundTask
task: MeleeAttackTargetCompound task: MeleeAttackTargetCompound
- type: htnCompound
id: RatServantCombatCompound
branches:
- preconditions:
- !type:ActiveHandComponentPrecondition
components:
- type: MeleeWeapon
damage:
types:
Brute: 0
invert: true
tasks:
- !type:HTNCompoundTask
task: PickupMeleeCompound
- tasks:
- !type:HTNPrimitiveTask
operator: !type:UtilityOperator
proto: OrderedTargets
- !type:HTNCompoundTask
task: MeleeAttackOrderedTargetCompound
- type: htnCompound - type: htnCompound
id: PickupMeleeCompound id: PickupMeleeCompound
branches: branches:
@@ -79,3 +101,36 @@
id: MeleeService id: MeleeService
proto: NearbyMeleeTargets proto: NearbyMeleeTargets
key: Target key: Target
- type: htnCompound
id: MeleeAttackOrderedTargetCompound
preconditions:
- !type:KeyExistsPrecondition
key: Target
branches:
- tasks:
- !type:HTNPrimitiveTask
operator: !type:MoveToOperator
shutdownState: PlanFinished
pathfindInPlanning: true
removeKeyOnFinish: false
targetKey: TargetCoordinates
pathfindKey: TargetPathfind
rangeKey: MeleeRange
- !type:HTNPrimitiveTask
operator: !type:JukeOperator
jukeType: Away
- !type:HTNPrimitiveTask
operator: !type:MeleeOperator
targetKey: Target
preconditions:
- !type:KeyExistsPrecondition
key: Target
- !type:TargetInRangePrecondition
targetKey: Target
rangeKey: MeleeRange
services:
- !type:UtilityService
id: MeleeService
proto: OrderedTargets
key: Target

View File

@@ -9,6 +9,16 @@
- !type:HTNCompoundTask - !type:HTNCompoundTask
task: IdleCompound task: IdleCompound
- type: htnCompound
id: RatServantTargetAttackCompound
branches:
- tasks:
- !type:HTNCompoundTask
task: RatServantCombatCompound
- tasks:
- !type:HTNCompoundTask
task: IdleCompound
- type: htnCompound - type: htnCompound
id: MouseCompound id: MouseCompound
branches: branches:

View File

@@ -0,0 +1,28 @@
- type: htnCompound
id: RatServantCompound
branches:
- preconditions:
- !type:HasOrdersPrecondition
orders: enum.RatKingOrderType.Stay
tasks:
- !type:HTNCompoundTask
task: IdleCompound
- preconditions:
- !type:HasOrdersPrecondition
orders: enum.RatKingOrderType.Follow
tasks:
- !type:HTNCompoundTask
task: FollowCompound
- preconditions:
- !type:HasOrdersPrecondition
orders: enum.RatKingOrderType.CheeseEm
tasks:
- !type:HTNCompoundTask
task: RatServantTargetAttackCompound
- preconditions:
- !type:HasOrdersPrecondition
orders: enum.RatKingOrderType.Loose
tasks:
- !type:HTNCompoundTask
task: SimpleHostileCompound

View File

@@ -99,6 +99,27 @@
- !type:TargetInLOSOrCurrentCon - !type:TargetInLOSOrCurrentCon
curve: !type:BoolCurve curve: !type:BoolCurve
- type: utilityQuery
id: OrderedTargets
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
# they gotta be what we ordered
- !type:OrderedTargetCon
curve: !type:BoolCurve
- type: utilityQuery - type: utilityQuery
id: NearbyMeleeWeapons id: NearbyMeleeWeapons
query: query:

View File

@@ -234,10 +234,9 @@
scaleByQuantity: true scaleByQuantity: true
ignoreResistances: true ignoreResistances: true
damage: damage:
types: Groups:
Blunt: -4 Brute: -5
Slash: -3 Burn: -5
Piercing: -3
- type: reagent - type: reagent
id: NitrousOxide id: NitrousOxide

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

View File

@@ -0,0 +1,41 @@
{
"version": 1,
"license": "CC0-1.0",
"copyright": "Created by EmoGarbage404 (github). ratKingArmy and ratKingDomain taken from https://github.com/tgstation/tgstation/commit/3d049e69fe71a0be2133005e65ea469135d648c8",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "attack"
},
{
"name": "attackOff"
},
{
"name": "follow"
},
{
"name": "followOff"
},
{
"name": "loose"
},
{
"name": "looseOff"
},
{
"name": "stay"
},
{
"name": "stayOff"
},
{
"name": "ratKingArmy"
},
{
"name": "ratKingDomain"
}
]
}

View File

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 388 B

View File

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

View File

@@ -28,12 +28,6 @@
{ {
"name": "carp_summon" "name": "carp_summon"
}, },
{
"name": "ratKingArmy"
},
{
"name": "ratKingDomain"
},
{ {
"name": "zombie-turn" "name": "zombie-turn"
}, },

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

View File

@@ -7,6 +7,9 @@
"license": "CC-BY-SA-3.0", "license": "CC-BY-SA-3.0",
"copyright": "Taken from https://github.com/tgstation/tgstation/commit/53d1f1477d22a11a99c6c6924977cd431075761b Changed by Alekshhh", "copyright": "Taken from https://github.com/tgstation/tgstation/commit/53d1f1477d22a11a99c6c6924977cd431075761b Changed by Alekshhh",
"states": [ "states": [
{
"name": "critical"
},
{ {
"name": "dead" "name": "dead"
}, },