Adds explosion when attempting to microwave metal / bugfix (#23887)

This commit is contained in:
TinManTim
2024-01-23 17:59:09 -05:00
committed by GitHub
parent 424d3c8dc6
commit f499dfb63a
8 changed files with 153 additions and 44 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Kitchen; using Content.Shared.Kitchen;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Kitchen.Components; namespace Content.Server.Kitchen.Components;
@@ -14,6 +15,10 @@ public sealed partial class ActiveMicrowaveComponent : Component
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
public float TotalTime; public float TotalTime;
[ViewVariables(VVAccess.ReadWrite)]
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan MalfunctionTime = TimeSpan.Zero;
[ViewVariables] [ViewVariables]
public (FoodRecipePrototype?, int) PortionedRecipe; public (FoodRecipePrototype?, int) PortionedRecipe;
} }

View File

@@ -1,3 +1,4 @@
using Content.Shared.Construction.Prototypes;
using Content.Shared.DeviceLinking; using Content.Shared.DeviceLinking;
using Content.Shared.Item; using Content.Shared.Item;
using Robust.Shared.Audio; using Robust.Shared.Audio;
@@ -12,8 +13,10 @@ namespace Content.Server.Kitchen.Components
{ {
[DataField("cookTimeMultiplier"), ViewVariables(VVAccess.ReadWrite)] [DataField("cookTimeMultiplier"), ViewVariables(VVAccess.ReadWrite)]
public float CookTimeMultiplier = 1; public float CookTimeMultiplier = 1;
[DataField("baseHeatMultiplier"), ViewVariables(VVAccess.ReadWrite)] [DataField("baseHeatMultiplier"), ViewVariables(VVAccess.ReadWrite)]
public float BaseHeatMultiplier = 100; public float BaseHeatMultiplier = 100;
[DataField("objectHeatMultiplier"), ViewVariables(VVAccess.ReadWrite)] [DataField("objectHeatMultiplier"), ViewVariables(VVAccess.ReadWrite)]
public float ObjectHeatMultiplier = 100; public float ObjectHeatMultiplier = 100;
@@ -23,10 +26,13 @@ namespace Content.Server.Kitchen.Components
#region audio #region audio
[DataField("beginCookingSound")] [DataField("beginCookingSound")]
public SoundSpecifier StartCookingSound = new SoundPathSpecifier("/Audio/Machines/microwave_start_beep.ogg"); public SoundSpecifier StartCookingSound = new SoundPathSpecifier("/Audio/Machines/microwave_start_beep.ogg");
[DataField("foodDoneSound")] [DataField("foodDoneSound")]
public SoundSpecifier FoodDoneSound = new SoundPathSpecifier("/Audio/Machines/microwave_done_beep.ogg"); public SoundSpecifier FoodDoneSound = new SoundPathSpecifier("/Audio/Machines/microwave_done_beep.ogg");
[DataField("clickSound")] [DataField("clickSound")]
public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg"); public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
[DataField("ItemBreakSound")] [DataField("ItemBreakSound")]
public SoundSpecifier ItemBreakSound = new SoundPathSpecifier("/Audio/Effects/clang.ogg"); public SoundSpecifier ItemBreakSound = new SoundPathSpecifier("/Audio/Effects/clang.ogg");
@@ -72,6 +78,23 @@ namespace Content.Server.Kitchen.Components
[DataField, ViewVariables(VVAccess.ReadWrite)] [DataField, ViewVariables(VVAccess.ReadWrite)]
public ProtoId<ItemSizePrototype> MaxItemSize = "Normal"; public ProtoId<ItemSizePrototype> MaxItemSize = "Normal";
/// <summary>
/// How frequently the microwave can malfunction.
/// </summary>
[DataField]
public float MalfunctionInterval = 1.0f;
/// <summary>
/// Chance of an explosion occurring when we microwave a metallic object
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float ExplosionChance = .1f;
/// <summary>
/// Chance of lightning occurring when we microwave a metallic object
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float LightningChance = .75f;
} }
public sealed class BeingMicrowavedEvent : HandledEntityEventArgs public sealed class BeingMicrowavedEvent : HandledEntityEventArgs

View File

@@ -1,6 +1,7 @@
using Content.Server.Body.Systems; using Content.Server.Body.Systems;
using Content.Server.Chemistry.Containers.EntitySystems; using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Construction; using Content.Server.Construction;
using Content.Server.Explosion.EntitySystems;
using Content.Server.DeviceLinking.Events; using Content.Server.DeviceLinking.Events;
using Content.Server.DeviceLinking.Systems; using Content.Server.DeviceLinking.Systems;
using Content.Server.Hands.Systems; using Content.Server.Hands.Systems;
@@ -18,33 +19,39 @@ using Content.Shared.Destructible;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Robust.Shared.Random;
using Robust.Shared.Audio;
using Content.Server.Lightning;
using Content.Shared.Item; using Content.Shared.Item;
using Content.Shared.Kitchen; using Content.Shared.Kitchen;
using Content.Shared.Kitchen.Components; using Content.Shared.Kitchen.Components;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Power; using Content.Shared.Power;
using Content.Shared.Tag; using Content.Shared.Tag;
using Robust.Server.Containers;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Player; using Robust.Shared.Player;
using System.Linq; using System.Linq;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Server.Kitchen.EntitySystems namespace Content.Server.Kitchen.EntitySystems
{ {
public sealed class MicrowaveSystem : EntitySystem public sealed class MicrowaveSystem : EntitySystem
{ {
[Dependency] private readonly BodySystem _bodySystem = default!; [Dependency] private readonly BodySystem _bodySystem = default!;
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly DeviceLinkSystem _deviceLink = default!; [Dependency] private readonly DeviceLinkSystem _deviceLink = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly PowerReceiverSystem _power = default!; [Dependency] private readonly PowerReceiverSystem _power = default!;
[Dependency] private readonly RecipeManager _recipeManager = default!; [Dependency] private readonly RecipeManager _recipeManager = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedContainerSystem _sharedContainer = default!; [Dependency] private readonly LightningSystem _lightning = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly ExplosionSystem _explosion = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly TemperatureSystem _temperature = default!; [Dependency] private readonly TemperatureSystem _temperature = default!;
@@ -52,6 +59,9 @@ namespace Content.Server.Kitchen.EntitySystems
[Dependency] private readonly HandsSystem _handsSystem = default!; [Dependency] private readonly HandsSystem _handsSystem = default!;
[Dependency] private readonly SharedItemSystem _item = default!; [Dependency] private readonly SharedItemSystem _item = default!;
[ValidatePrototypeId<EntityPrototype>]
private const string MalfunctionSpark = "Spark";
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -76,6 +86,7 @@ namespace Content.Server.Kitchen.EntitySystems
SubscribeLocalEvent<ActiveMicrowaveComponent, ComponentStartup>(OnCookStart); SubscribeLocalEvent<ActiveMicrowaveComponent, ComponentStartup>(OnCookStart);
SubscribeLocalEvent<ActiveMicrowaveComponent, ComponentShutdown>(OnCookStop); SubscribeLocalEvent<ActiveMicrowaveComponent, ComponentShutdown>(OnCookStop);
SubscribeLocalEvent<ActiveMicrowaveComponent, EntityUnpausedEvent>(OnEntityUnpaused);
SubscribeLocalEvent<ActiveMicrowaveComponent, EntInsertedIntoContainerMessage>(OnActiveMicrowaveInsert); SubscribeLocalEvent<ActiveMicrowaveComponent, EntInsertedIntoContainerMessage>(OnActiveMicrowaveInsert);
SubscribeLocalEvent<ActiveMicrowaveComponent, EntRemovedFromContainerMessage>(OnActiveMicrowaveRemove); SubscribeLocalEvent<ActiveMicrowaveComponent, EntRemovedFromContainerMessage>(OnActiveMicrowaveRemove);
@@ -96,9 +107,19 @@ namespace Content.Server.Kitchen.EntitySystems
{ {
if (!TryComp<MicrowaveComponent>(ent, out var microwaveComponent)) if (!TryComp<MicrowaveComponent>(ent, out var microwaveComponent))
return; return;
SetAppearance(ent.Owner, MicrowaveVisualState.Idle, microwaveComponent);
SetAppearance(ent.Owner, MicrowaveVisualState.Idle, microwaveComponent);
microwaveComponent.PlayingStream = _audio.Stop(microwaveComponent.PlayingStream); microwaveComponent.PlayingStream = _audio.Stop(microwaveComponent.PlayingStream);
foreach (var solid in microwaveComponent.Storage.ContainedEntities)
{
RemComp<ActivelyMicrowavedComponent>(solid);
}
}
private void OnEntityUnpaused(Entity<ActiveMicrowaveComponent> ent, ref EntityUnpausedEvent args)
{
ent.Comp.MalfunctionTime += args.PausedTime;
} }
private void OnActiveMicrowaveInsert(Entity<ActiveMicrowaveComponent> ent, ref EntInsertedIntoContainerMessage args) private void OnActiveMicrowaveInsert(Entity<ActiveMicrowaveComponent> ent, ref EntInsertedIntoContainerMessage args)
@@ -197,7 +218,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (metaData.EntityPrototype.ID == recipeSolid.Key) if (metaData.EntityPrototype.ID == recipeSolid.Key)
{ {
_sharedContainer.Remove(item, component.Storage); _container.Remove(item, component.Storage);
EntityManager.DeleteEntity(item); EntityManager.DeleteEntity(item);
break; break;
} }
@@ -312,7 +333,7 @@ namespace Content.Server.Kitchen.EntitySystems
ent.Comp.Broken = true; ent.Comp.Broken = true;
SetAppearance(ent, MicrowaveVisualState.Broken, ent.Comp); SetAppearance(ent, MicrowaveVisualState.Broken, ent.Comp);
RemComp<ActiveMicrowaveComponent>(ent); RemComp<ActiveMicrowaveComponent>(ent);
_sharedContainer.EmptyContainer(ent.Comp.Storage); _container.EmptyContainer(ent.Comp.Storage);
UpdateUserInterfaceState(ent, ent.Comp); UpdateUserInterfaceState(ent, ent.Comp);
} }
@@ -328,8 +349,8 @@ namespace Content.Server.Kitchen.EntitySystems
private void OnAnchorChanged(EntityUid uid, MicrowaveComponent component, ref AnchorStateChangedEvent args) private void OnAnchorChanged(EntityUid uid, MicrowaveComponent component, ref AnchorStateChangedEvent args)
{ {
if(!args.Anchored) if (!args.Anchored)
_sharedContainer.EmptyContainer(component.Storage); _container.EmptyContainer(component.Storage);
} }
private void OnSignalReceived(Entity<MicrowaveComponent> ent, ref SignalReceivedEvent args) private void OnSignalReceived(Entity<MicrowaveComponent> ent, ref SignalReceivedEvent args)
@@ -370,6 +391,31 @@ namespace Content.Server.Kitchen.EntitySystems
return component.Storage.ContainedEntities.Any(); return component.Storage.ContainedEntities.Any();
} }
/// <summary>
/// Handles the attempted cooking of unsafe objects
/// </summary>
/// <remarks>
/// Returns false if the microwave didn't explode, true if it exploded.
/// </remarks>
private void RollMalfunction(Entity<ActiveMicrowaveComponent, MicrowaveComponent> ent)
{
if (ent.Comp1.MalfunctionTime == TimeSpan.Zero)
return;
if (ent.Comp1.MalfunctionTime > _gameTiming.CurTime)
return;
ent.Comp1.MalfunctionTime = _gameTiming.CurTime + TimeSpan.FromSeconds(ent.Comp2.MalfunctionInterval);
if (_random.Prob(ent.Comp2.ExplosionChance))
{
_explosion.TriggerExplosive(ent);
return; // microwave is fucked, stop the cooking.
}
if (_random.Prob(ent.Comp2.LightningChance))
_lightning.ShootRandomLightnings(ent, 1.0f, 2, MalfunctionSpark, triggerLightningEvents: false);
}
/// <summary> /// <summary>
/// Starts Cooking /// Starts Cooking
/// </summary> /// </summary>
@@ -384,9 +430,9 @@ namespace Content.Server.Kitchen.EntitySystems
var solidsDict = new Dictionary<string, int>(); var solidsDict = new Dictionary<string, int>();
var reagentDict = new Dictionary<string, FixedPoint2>(); var reagentDict = new Dictionary<string, FixedPoint2>();
var malfunctioning = false;
// TODO use lists of Reagent quantities instead of reagent prototype ids. // TODO use lists of Reagent quantities instead of reagent prototype ids.
foreach (var item in component.Storage.ContainedEntities.ToArray())
foreach (var item in component.Storage.ContainedEntities)
{ {
// special behavior when being microwaved ;) // special behavior when being microwaved ;)
var ev = new BeingMicrowavedEvent(uid, user); var ev = new BeingMicrowavedEvent(uid, user);
@@ -398,20 +444,17 @@ namespace Content.Server.Kitchen.EntitySystems
return; return;
} }
// destroy microwave if (_tag.HasTag(item, "Metal"))
if (_tag.HasTag(item, "MicrowaveMachineUnsafe") || _tag.HasTag(item, "Metal"))
{ {
component.Broken = true; malfunctioning = true;
SetAppearance(uid, MicrowaveVisualState.Broken, component);
_audio.PlayPvs(component.ItemBreakSound, uid);
return;
} }
if (_tag.HasTag(item, "MicrowaveSelfUnsafe") || _tag.HasTag(item, "Plastic")) if (_tag.HasTag(item, "Plastic"))
{ {
var junk = Spawn(component.BadRecipeEntityId, Transform(uid).Coordinates); var junk = Spawn(component.BadRecipeEntityId, Transform(uid).Coordinates);
_container.Insert(junk, component.Storage); _container.Insert(junk, component.Storage);
QueueDel(item); Del(item);
continue;
} }
AddComp<ActivelyMicrowavedComponent>(item); AddComp<ActivelyMicrowavedComponent>(item);
@@ -454,6 +497,8 @@ namespace Content.Server.Kitchen.EntitySystems
activeComp.CookTimeRemaining = component.CurrentCookTimerTime * component.CookTimeMultiplier; activeComp.CookTimeRemaining = component.CurrentCookTimerTime * component.CookTimeMultiplier;
activeComp.TotalTime = component.CurrentCookTimerTime; //this doesn't scale so that we can have the "actual" time activeComp.TotalTime = component.CurrentCookTimerTime; //this doesn't scale so that we can have the "actual" time
activeComp.PortionedRecipe = portionedRecipe; activeComp.PortionedRecipe = portionedRecipe;
if (malfunctioning)
activeComp.MalfunctionTime = _gameTiming.CurTime + TimeSpan.FromSeconds(component.MalfunctionInterval);
UpdateUserInterfaceState(uid, component); UpdateUserInterfaceState(uid, component);
} }
@@ -505,8 +550,12 @@ namespace Content.Server.Kitchen.EntitySystems
var query = EntityQueryEnumerator<ActiveMicrowaveComponent, MicrowaveComponent>(); var query = EntityQueryEnumerator<ActiveMicrowaveComponent, MicrowaveComponent>();
while (query.MoveNext(out var uid, out var active, out var microwave)) while (query.MoveNext(out var uid, out var active, out var microwave))
{ {
//check if there's still cook time left
active.CookTimeRemaining -= frameTime; active.CookTimeRemaining -= frameTime;
RollMalfunction((uid, active,microwave));
//check if there's still cook time left
if (active.CookTimeRemaining > 0) if (active.CookTimeRemaining > 0)
{ {
AddTemperature(microwave, frameTime); AddTemperature(microwave, frameTime);
@@ -517,7 +566,9 @@ namespace Content.Server.Kitchen.EntitySystems
AddTemperature(microwave, Math.Max(frameTime + active.CookTimeRemaining, 0)); //Though there's still a little bit more heat to pump out AddTemperature(microwave, Math.Max(frameTime + active.CookTimeRemaining, 0)); //Though there's still a little bit more heat to pump out
foreach (var solid in microwave.Storage.ContainedEntities) foreach (var solid in microwave.Storage.ContainedEntities)
{
EntityManager.RemoveComponentDeferred<ActivelyMicrowavedComponent>(solid); EntityManager.RemoveComponentDeferred<ActivelyMicrowavedComponent>(solid);
}
if (active.PortionedRecipe.Item1 != null) if (active.PortionedRecipe.Item1 != null)
{ {
@@ -529,10 +580,10 @@ namespace Content.Server.Kitchen.EntitySystems
} }
} }
_sharedContainer.EmptyContainer(microwave.Storage); _container.EmptyContainer(microwave.Storage);
UpdateUserInterfaceState(uid, microwave); UpdateUserInterfaceState(uid, microwave);
EntityManager.RemoveComponentDeferred<ActiveMicrowaveComponent>(uid); EntityManager.RemoveComponentDeferred<ActiveMicrowaveComponent>(uid);
_audio.PlayPvs(microwave.FoodDoneSound, uid, AudioParams.Default.WithVolume(-1)); _audio.PlayPvs(microwave.FoodDoneSound, uid);
} }
} }
@@ -542,7 +593,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (!HasContents(ent.Comp) || HasComp<ActiveMicrowaveComponent>(ent)) if (!HasContents(ent.Comp) || HasComp<ActiveMicrowaveComponent>(ent))
return; return;
_sharedContainer.EmptyContainer(ent.Comp.Storage); _container.EmptyContainer(ent.Comp.Storage);
_audio.PlayPvs(ent.Comp.ClickSound, ent, AudioParams.Default.WithVolume(-2)); _audio.PlayPvs(ent.Comp.ClickSound, ent, AudioParams.Default.WithVolume(-2));
UpdateUserInterfaceState(ent, ent.Comp); UpdateUserInterfaceState(ent, ent.Comp);
} }
@@ -552,7 +603,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (!HasContents(ent.Comp) || HasComp<ActiveMicrowaveComponent>(ent)) if (!HasContents(ent.Comp) || HasComp<ActiveMicrowaveComponent>(ent))
return; return;
_sharedContainer.Remove(EntityManager.GetEntity(args.EntityID), ent.Comp.Storage); _container.Remove(EntityManager.GetEntity(args.EntityID), ent.Comp.Storage);
UpdateUserInterfaceState(ent, ent.Comp); UpdateUserInterfaceState(ent, ent.Comp);
} }

View File

@@ -3,7 +3,6 @@ using Content.Server.Beam;
using Content.Server.Beam.Components; using Content.Server.Beam.Components;
using Content.Server.Lightning.Components; using Content.Server.Lightning.Components;
using Content.Shared.Lightning; using Content.Shared.Lightning;
using Robust.Server.GameObjects;
using Robust.Shared.Random; using Robust.Shared.Random;
namespace Content.Server.Lightning; namespace Content.Server.Lightning;
@@ -22,9 +21,6 @@ public sealed class LightningSystem : SharedLightningSystem
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!;
private List<Entity<LightningTargetComponent>> _lookupTargetsList = new();
private HashSet<Entity<LightningTargetComponent>> _lookupTargets = new();
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -48,15 +44,20 @@ public sealed class LightningSystem : SharedLightningSystem
/// <param name="user">Where the lightning fires from</param> /// <param name="user">Where the lightning fires from</param>
/// <param name="target">Where the lightning fires to</param> /// <param name="target">Where the lightning fires to</param>
/// <param name="lightningPrototype">The prototype for the lightning to be created</param> /// <param name="lightningPrototype">The prototype for the lightning to be created</param>
public void ShootLightning(EntityUid user, EntityUid target, string lightningPrototype = "Lightning") /// <param name="triggerLightningEvents">if the lightnings being fired should trigger lightning events.</param>
public void ShootLightning(EntityUid user, EntityUid target, string lightningPrototype = "Lightning", bool triggerLightningEvents = true)
{ {
var spriteState = LightningRandomizer(); var spriteState = LightningRandomizer();
_beam.TryCreateBeam(user, target, lightningPrototype, spriteState); _beam.TryCreateBeam(user, target, lightningPrototype, spriteState);
var ev = new HitByLightningEvent(user, target); if (triggerLightningEvents) // we don't want certain prototypes to trigger lightning level events
RaiseLocalEvent(target, ref ev); {
var ev = new HitByLightningEvent(user, target);
RaiseLocalEvent(target, ref ev);
}
} }
/// <summary> /// <summary>
/// Looks for objects with a LightningTarget component in the radius, prioritizes them, and hits the highest priority targets with lightning. /// Looks for objects with a LightningTarget component in the radius, prioritizes them, and hits the highest priority targets with lightning.
/// </summary> /// </summary>
@@ -65,7 +66,8 @@ public sealed class LightningSystem : SharedLightningSystem
/// <param name="boltCount">Number of lightning bolts</param> /// <param name="boltCount">Number of lightning bolts</param>
/// <param name="lightningPrototype">The prototype for the lightning to be created</param> /// <param name="lightningPrototype">The prototype for the lightning to be created</param>
/// <param name="arcDepth">how many times to recursively fire lightning bolts from the target points of the first shot.</param> /// <param name="arcDepth">how many times to recursively fire lightning bolts from the target points of the first shot.</param>
public void ShootRandomLightnings(EntityUid user, float range, int boltCount, string lightningPrototype = "Lightning", int arcDepth = 0) /// <param name="triggerLightningEvents">if the lightnings being fired should trigger lightning events.</param>
public void ShootRandomLightnings(EntityUid user, float range, int boltCount, string lightningPrototype = "Lightning", int arcDepth = 0, bool triggerLightningEvents = true)
{ {
//To Do: add support to different priority target tablem for different lightning types //To Do: add support to different priority target tablem for different lightning types
//To Do: Remove Hardcode LightningTargetComponent (this should be a parameter of the SharedLightningComponent) //To Do: Remove Hardcode LightningTargetComponent (this should be a parameter of the SharedLightningComponent)
@@ -88,10 +90,10 @@ public sealed class LightningSystem : SharedLightningSystem
if (!_random.Prob(curTarget.HitProbability)) //Chance to ignore target if (!_random.Prob(curTarget.HitProbability)) //Chance to ignore target
continue; continue;
ShootLightning(user, targets[count].Owner, lightningPrototype); ShootLightning(user, targets[count].Owner, lightningPrototype, triggerLightningEvents);
if (arcDepth - targets[count].LightningResistance > 0) if (arcDepth - targets[count].LightningResistance > 0)
{ {
ShootRandomLightnings(targets[count].Owner, range, 1, lightningPrototype, arcDepth - targets[count].LightningResistance); ShootRandomLightnings(targets[count].Owner, range, 1, lightningPrototype, arcDepth - targets[count].LightningResistance, triggerLightningEvents);
} }
shootedCount++; shootedCount++;
} }

View File

@@ -14,7 +14,7 @@ public abstract class SharedDestructibleSystem : EntitySystem
} }
/// <summary> /// <summary>
/// Force entity to broke. /// Force entity to break.
/// </summary> /// </summary>
public void BreakEntity(EntityUid owner) public void BreakEntity(EntityUid owner)
{ {

View File

@@ -81,6 +81,33 @@
canArc: true canArc: true
lightningPrototype: ChargedLightning lightningPrototype: ChargedLightning
- type: entity
name: lightning
id: Spark
parent: BaseLightning
noSpawn: true
components:
- type: Sprite
sprite: /Textures/Effects/lightning.rsi
drawdepth: Effects
layers:
- state: "lightning_1"
shader: unshaded
- type: Electrified
shockDamage: 0
- type: Lightning
lightningPrototype: Spark
- type: PointLight
radius: 0.2
softness: .4
- type: Beam
sound: /Audio/Effects/sparks4.ogg
- type: TimedDespawn
lifetime: .3
- type: Tag
tags:
- HideContextMenu
- type: entity - type: entity
name: supercharged lightning name: supercharged lightning
id: SuperchargedLightning id: SuperchargedLightning

View File

@@ -83,6 +83,13 @@
behaviors: behaviors:
- !type:DoActsBehavior - !type:DoActsBehavior
acts: ["Breakage"] acts: ["Breakage"]
- type: Explosive
explosionType: Default
maxIntensity: 10
totalIntensity: 5
intensitySlope: 5
canCreateVacuum: false
deleteAfterExplosion: false
- type: ApcPowerReceiver - type: ApcPowerReceiver
powerLoad: 400 powerLoad: 400
- type: Machine - type: Machine

View File

@@ -565,10 +565,10 @@
- type: Tag - type: Tag
id: Goat id: Goat
- type: Tag - type: Tag
id: GPS id: GPS
- type: Tag - type: Tag
id: Grenade id: Grenade
@@ -797,7 +797,7 @@
id: Matchstick id: Matchstick
- type: Tag - type: Tag
id: Mayo id: Mayo
- type: Tag - type: Tag
id: Meat id: Meat
@@ -808,12 +808,6 @@
- type: Tag - type: Tag
id: Metal id: Metal
- type: Tag
id: MicrowaveMachineUnsafe
- type: Tag
id: MicrowaveSelfUnsafe
- type: Tag - type: Tag
id: MindShield id: MindShield