Add lava (#13438)
This commit is contained in:
@@ -10,6 +10,7 @@ using Content.Shared.Body.Part;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Climbing;
|
||||
using Content.Shared.Climbing.Events;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.GameTicking;
|
||||
@@ -280,6 +281,8 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
|
||||
climbing.IsClimbing = false;
|
||||
climbing.OwnerIsTransitioning = false;
|
||||
var ev = new EndClimbEvent();
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
Dirty(climbing);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Server.Damage.Systems
|
||||
SubscribeLocalEvent<DamageOnLandComponent, LandEvent>(DamageOnLand);
|
||||
}
|
||||
|
||||
private void DamageOnLand(EntityUid uid, DamageOnLandComponent component, LandEvent args)
|
||||
private void DamageOnLand(EntityUid uid, DamageOnLandComponent component, ref LandEvent args)
|
||||
{
|
||||
_damageableSystem.TryChangeDamage(uid, component.Damage, component.IgnoreResistances);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Server.Dice
|
||||
Roll(uid, component);
|
||||
}
|
||||
|
||||
private void OnLand(EntityUid uid, DiceComponent component, LandEvent args)
|
||||
private void OnLand(EntityUid uid, DiceComponent component, ref LandEvent args)
|
||||
{
|
||||
Roll(uid, component);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public sealed class SpillableSystem : EntitySystem
|
||||
: SpillAt(solution, transformComponent.Coordinates, prototype, sound: sound, combine: combine);
|
||||
}
|
||||
|
||||
private void SpillOnLand(EntityUid uid, SpillableComponent component, LandEvent args)
|
||||
private void SpillOnLand(EntityUid uid, SpillableComponent component, ref LandEvent args)
|
||||
{
|
||||
if (!_solutionContainerSystem.TryGetSolution(uid, component.SolutionName, out var solution)) return;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
SetState(uid, bulb.State, bulb);
|
||||
}
|
||||
|
||||
private void HandleLand(EntityUid uid, LightBulbComponent bulb, LandEvent args)
|
||||
private void HandleLand(EntityUid uid, LightBulbComponent bulb, ref LandEvent args)
|
||||
{
|
||||
PlayBreakSound(uid, bulb);
|
||||
SetState(uid, LightBulbState.Broken, bulb);
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
args.Handled = TryDrink(args.User, args.User, component);
|
||||
}
|
||||
|
||||
private void HandleLand(EntityUid uid, DrinkComponent component, LandEvent args)
|
||||
private void HandleLand(EntityUid uid, DrinkComponent component, ref LandEvent args)
|
||||
{
|
||||
if (component.Pressurized &&
|
||||
!component.Opened &&
|
||||
|
||||
23
Content.Server/Tiles/LavaComponent.cs
Normal file
23
Content.Server/Tiles/LavaComponent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Server.Tiles;
|
||||
|
||||
/// <summary>
|
||||
/// Applies flammable and damage while vaulting.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(LavaSystem))]
|
||||
public sealed class LavaComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Sound played if something disintegrates in lava.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("soundDisintegration")]
|
||||
public SoundSpecifier DisintegrationSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// How many fire stacks are applied per second.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("fireStacks")]
|
||||
public float FireStacks = 2f;
|
||||
}
|
||||
39
Content.Server/Tiles/LavaSystem.cs
Normal file
39
Content.Server/Tiles/LavaSystem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.StepTrigger.Systems;
|
||||
|
||||
namespace Content.Server.Tiles;
|
||||
|
||||
public sealed class LavaSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly FlammableSystem _flammable = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<LavaComponent, StepTriggeredEvent>(OnLavaStepTriggered);
|
||||
SubscribeLocalEvent<LavaComponent, StepTriggerAttemptEvent>(OnLavaStepTriggerAttempt);
|
||||
}
|
||||
|
||||
|
||||
private void OnLavaStepTriggerAttempt(EntityUid uid, LavaComponent component, ref StepTriggerAttemptEvent args)
|
||||
{
|
||||
if (!HasComp<FlammableComponent>(args.Tripper))
|
||||
return;
|
||||
|
||||
args.Continue = true;
|
||||
}
|
||||
|
||||
private void OnLavaStepTriggered(EntityUid uid, LavaComponent component, ref StepTriggeredEvent args)
|
||||
{
|
||||
var otherUid = args.Tripper;
|
||||
|
||||
if (TryComp<FlammableComponent>(otherUid, out var flammable))
|
||||
{
|
||||
// Apply the fury of a thousand suns
|
||||
var multiplier = flammable.FireStacks == 0f ? 5f : 1f;
|
||||
_flammable.AdjustFireStacks(otherUid, component.FireStacks * multiplier, flammable);
|
||||
_flammable.Ignite(otherUid, flammable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public sealed class ArtifactLandSystem : EntitySystem
|
||||
SubscribeLocalEvent<ArtifactLandTriggerComponent, LandEvent>(OnLand);
|
||||
}
|
||||
|
||||
private void OnLand(EntityUid uid, ArtifactLandTriggerComponent component, LandEvent args)
|
||||
private void OnLand(EntityUid uid, ArtifactLandTriggerComponent component, ref LandEvent args)
|
||||
{
|
||||
_artifact.TryActivateArtifact(uid, args.User);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user