Skip to content

Commit

Permalink
updating mimic rule
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed May 8, 2024
1 parent c964f91 commit 84afa69
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions Content.Server/Antag/MobReplacementRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ protected override void Started(EntityUid uid, MobReplacementRuleComponent compo
{
var spawnLocation = _random.PickAndTake(spawns);
BuildAMimicWorkshop(spawnLocation.Entity, component);

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

k--;
}
_chatSystem.DispatchStationAnnouncement(stations[0], Loc.GetString("station-event-rampant-intelligence-announcement"), playDefaultSound: true,
colorOverride: Color.Red, sender: "Central Command");
}
}

Expand Down Expand Up @@ -111,6 +114,20 @@ public void BuildAMimicWorkshop(EntityUid uid, MobReplacementRuleComponent compo
if (xform.Anchored)
_transform.Unanchor(uid, xform);

SetupMimicNPC(uid, component);

if (TryComp<AdvertiseComponent>(uid, out var vendor))
{
SetupMimicVendor(uid, component, vendor);
}
}
/// <summary>
/// This handles getting the entity ready to be a hostile NPC
/// </summary>
/// <param name="uid"></param>
/// <param name="component"></param>
private void SetupMimicNPC(EntityUid uid, MobReplacementRuleComponent component)
{
_physics.SetBodyType(uid, BodyType.KinematicController);
_npcFaction.AddFaction(uid, "SimpleHostile");

Expand All @@ -132,16 +149,21 @@ public void BuildAMimicWorkshop(EntityUid uid, MobReplacementRuleComponent compo
htn.RootTask = new HTNCompoundTask() { Task = "SimpleHostileCompound" };
htn.Blackboard.SetValue(NPCBlackboard.NavSmash, true);
_npc.WakeNPC(uid, htn);
}
/// <summary>
/// Handling specific interactions with vending machines
/// </summary>
/// <param name="uid"></param>
/// <param name="mimicComponent"></param>
/// <param name="vendorComponent"></param>
private void SetupMimicVendor(EntityUid uid, MobReplacementRuleComponent mimicComponent, AdvertiseComponent vendorComponent)
{
vendorComponent.MinimumWait = 5;
vendorComponent.MaximumWait = 15;
_advertise.SayAdvertisement(uid, vendorComponent);
_advertise.RefreshTimer(uid, vendorComponent);

if (TryComp<ApcPowerReceiverComponent>(uid, out var aPC))
aPC.NeedsPower = false;

if (TryComp<AdvertiseComponent>(uid, out var bark))
{
bark.MinimumWait = 5;
bark.MaximumWait = 15;
_advertise.SayAdvertisement(uid, bark);
_advertise.RefreshTimer(uid, bark);
}
}
}

0 comments on commit 84afa69

Please sign in to comment.