Skip to content

Commit

Permalink
update mimic spawns
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed May 8, 2024
1 parent 84afa69 commit 7126614
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
18 changes: 18 additions & 0 deletions Content.Server/Antag/Mimic/MobReplacementRuleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,22 @@ public sealed partial class MobReplacementRuleComponent : Component
/// </summary>
[DataField]
public float Chance = 0.001f;

[DataField("doAnnouncement")]
public bool DoAnnouncement = true;

[DataField("mimicMeleeDamage")]
public float MimicMeleeDamage = 20f;

[DataField("mimicMoveSpeed")]
public float MimicMoveSpeed = 1f;

[DataField("mimicAIType")]
public string MimicAIType = "SimpleHostileCompound";

[DataField("mimicSmashGlass")]
public bool MimicSmashGlass = true;

[DataField("vendorModify")]
public bool VendorModify = true;
}
15 changes: 9 additions & 6 deletions Content.Server/Antag/MobReplacementRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected override void Started(EntityUid uid, MobReplacementRuleComponent compo
|| ownerStation != stations[0])
return;

// Make sure that we aren't running this on something that is already a mimic
if (HasComp<CombatModeComponent>(vendingUid))
continue;

Expand All @@ -74,7 +75,8 @@ protected override void Started(EntityUid uid, MobReplacementRuleComponent compo
var spawnLocation = _random.PickAndTake(spawns);
BuildAMimicWorkshop(spawnLocation.Entity, component);

if (k == MathF.MaxMagnitude(component.NumberToReplace, 1))
if (k == MathF.MaxMagnitude(component.NumberToReplace, 1)
&& component.DoAnnouncement)
_chatSystem.DispatchStationAnnouncement(stations[0], Loc.GetString("station-event-rampant-intelligence-announcement"), playDefaultSound: true,
colorOverride: Color.Red, sender: "Central Command");

Expand Down Expand Up @@ -116,7 +118,8 @@ public void BuildAMimicWorkshop(EntityUid uid, MobReplacementRuleComponent compo

SetupMimicNPC(uid, component);

if (TryComp<AdvertiseComponent>(uid, out var vendor))
if (TryComp<AdvertiseComponent>(uid, out var vendor)
&& component.VendorModify)
{
SetupMimicVendor(uid, component, vendor);
}
Expand All @@ -137,17 +140,17 @@ private void SetupMimicNPC(EntityUid uid, MobReplacementRuleComponent component)
{
DamageDict = new()
{
{ "Blunt", 20 }
{ "Blunt", component.MimicMeleeDamage }
}
};
melee.Damage = dspec;

var movementSpeed = EnsureComp<MovementSpeedModifierComponent>(uid);
(movementSpeed.BaseSprintSpeed, movementSpeed.BaseWalkSpeed) = (1, 1);
(movementSpeed.BaseSprintSpeed, movementSpeed.BaseWalkSpeed) = (component.MimicMoveSpeed, component.MimicMoveSpeed);

var htn = EnsureComp<HTNComponent>(uid);
htn.RootTask = new HTNCompoundTask() { Task = "SimpleHostileCompound" };
htn.Blackboard.SetValue(NPCBlackboard.NavSmash, true);
htn.RootTask = new HTNCompoundTask() { Task = component.MimicAIType };
htn.Blackboard.SetValue(NPCBlackboard.NavSmash, component.MimicSmashGlass);
_npc.WakeNPC(uid, htn);
}
/// <summary>
Expand Down

0 comments on commit 7126614

Please sign in to comment.