* data initalizing * modular assembling * grips and blades sprites * first prototypes * jewerly decoration * disassemble modular weapon * grip start stats * blade modifiers * inhand sprites generation * resprites inhand, add sickle, add attempt modify size * auto inhand sprite parsing * icon default parsing * spear blade * mace ball * sword blade * sharedization + autonetwork hotswipe * wielding sprite support! * iron long grip * wielded sickle, fix ERROR sprite if state not added * Update grips.yml * wielded spear + ruby rework * wielding damage bonus modifier * modular size fix * fix storedOffset rotation * parts offset * fix inheriting modifiers * some bugfix and balance tweaks * DPS Meter * fix dividing by zero * rebalance * replace baseknife to modular knife. Delete ice knife spell * sickle and mace modular replace * modular spear & sword replacement. add wielded icons * Update CP14DPSMeterSystem.cs * back to serverization * grip disassemble drop again * clothing sprite generation code * back slot long grips and mace * remove jewerly slot, add more clothing states * finish clothing states * shovel modular * YEEEEE * anvil modular craft * bugfixes * more integration check fixes
113 lines
3.7 KiB
C#
113 lines
3.7 KiB
C#
using Content.Shared.DoAfter;
|
|
using Content.Shared.IdentityManagement;
|
|
using Content.Shared.Interaction;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Weapons.Melee.Events;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared._CP14.Temperature;
|
|
|
|
public abstract partial class CP14SharedFireSpreadSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<CP14FireSpreadComponent, OnFireChangedEvent>(OnFireChangedSpread);
|
|
SubscribeLocalEvent<CP14DespawnOnExtinguishComponent, OnFireChangedEvent>(OnFireChangedDespawn);
|
|
SubscribeLocalEvent<CP14DelayedIgnitionSourceComponent, OnFireChangedEvent>(OnIgnitionSourceFireChanged);
|
|
SubscribeLocalEvent<CP14DelayedIgnitionSourceComponent, AfterInteractEvent>(OnDelayedIgniteAttempt);
|
|
}
|
|
|
|
private void OnFireChangedDespawn(Entity<CP14DespawnOnExtinguishComponent> ent, ref OnFireChangedEvent args)
|
|
{
|
|
if (!args.OnFire)
|
|
QueueDel(ent);
|
|
}
|
|
|
|
private void OnFireChangedSpread(Entity<CP14FireSpreadComponent> ent, ref OnFireChangedEvent args)
|
|
{
|
|
if (args.OnFire)
|
|
{
|
|
EnsureComp<CP14ActiveFireSpreadingComponent>(ent);
|
|
}
|
|
else
|
|
{
|
|
if (HasComp<CP14ActiveFireSpreadingComponent>(ent))
|
|
RemCompDeferred<CP14ActiveFireSpreadingComponent>(ent);
|
|
}
|
|
|
|
ent.Comp.NextSpreadTime = _gameTiming.CurTime + TimeSpan.FromSeconds(ent.Comp.SpreadCooldownMax);
|
|
}
|
|
|
|
private void OnDelayedIgniteAttempt(Entity<CP14DelayedIgnitionSourceComponent> ent, ref AfterInteractEvent args)
|
|
{
|
|
if (!args.CanReach || args.Handled || args.Target == null)
|
|
return;
|
|
|
|
if (!ent.Comp.Enabled)
|
|
return;
|
|
|
|
var time = ent.Comp.Delay;
|
|
var caution = true;
|
|
|
|
if (TryComp<CP14IgnitionModifierComponent>(args.Target, out var modifier))
|
|
{
|
|
time *= modifier.IgnitionTimeModifier;
|
|
caution = !modifier.HideCaution;
|
|
}
|
|
|
|
_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager,
|
|
args.User,
|
|
time,
|
|
new CP14IgnitionDoAfter(),
|
|
args.Target,
|
|
args.Target,
|
|
ent)
|
|
{
|
|
BreakOnDamage = true,
|
|
BreakOnMove = true,
|
|
BreakOnDropItem = true,
|
|
BreakOnHandChange = true,
|
|
BlockDuplicate = true,
|
|
CancelDuplicate = true
|
|
});
|
|
|
|
var selfMessage = Loc.GetString("cp14-attempt-ignite-caution-self",
|
|
("target", MetaData(args.Target.Value).EntityName));
|
|
var otherMessage = Loc.GetString("cp14-attempt-ignite-caution",
|
|
("name", Identity.Entity(args.User, EntityManager)),
|
|
("target", Identity.Entity(args.Target.Value, EntityManager)));
|
|
_popup.PopupPredicted(selfMessage,
|
|
otherMessage,
|
|
args.User,
|
|
args.User,
|
|
caution ? PopupType.MediumCaution : PopupType.Small);
|
|
}
|
|
|
|
private void OnIgnitionSourceFireChanged(Entity<CP14DelayedIgnitionSourceComponent> ent, ref OnFireChangedEvent args)
|
|
{
|
|
ent.Comp.Enabled = args.OnFire;
|
|
Dirty(ent);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raised whenever an FlammableComponent OnFire is Changed
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public readonly record struct OnFireChangedEvent(bool OnFire)
|
|
{
|
|
public readonly bool OnFire = OnFire;
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public sealed partial class CP14IgnitionDoAfter : SimpleDoAfterEvent
|
|
{
|
|
}
|