* NPC spiders now spin webs * oops * move logic to always update next spawn, to prevent rare web spam * WebSpawnCooldown is timespan * remove vv * add web spawn method, no sus action event method call * dont spin web immediately at spawn * move NextWebSpawn value init to update * oop * remove unused game timing * web spawn cooldown to 45
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Content.Shared.Actions;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
namespace Content.Shared.Spider;
|
|
|
|
[RegisterComponent, NetworkedComponent]
|
|
[Access(typeof(SharedSpiderSystem))]
|
|
public sealed partial class SpiderComponent : Component
|
|
{
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
[DataField("webPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
|
public string WebPrototype = "SpiderWeb";
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
[DataField("webAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
|
public string WebAction = "ActionSpiderWeb";
|
|
|
|
[DataField] public EntityUid? Action;
|
|
|
|
/// <summary>
|
|
/// Whether the spider will spawn webs when not controlled by a player.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool SpawnsWebsAsNonPlayer = true;
|
|
|
|
/// <summary>
|
|
/// The cooldown in seconds between web spawns when not controlled by a player.
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan WebSpawnCooldown = TimeSpan.FromSeconds(45f);
|
|
|
|
/// <summary>
|
|
/// The next time the spider can spawn a web when not controlled by a player.
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan? NextWebSpawn;
|
|
}
|
|
|
|
public sealed partial class SpiderWebActionEvent : InstantActionEvent { }
|