Light Cigars when interacting with hot stuff (#5879)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
SubscribeLocalEvent<CigarComponent, ActivateInWorldEvent>(OnCigarActivatedEvent);
|
SubscribeLocalEvent<CigarComponent, ActivateInWorldEvent>(OnCigarActivatedEvent);
|
||||||
SubscribeLocalEvent<CigarComponent, InteractUsingEvent>(OnCigarInteractUsingEvent);
|
SubscribeLocalEvent<CigarComponent, InteractUsingEvent>(OnCigarInteractUsingEvent);
|
||||||
SubscribeLocalEvent<CigarComponent, SmokableSolutionEmptyEvent>(OnCigarSolutionEmptyEvent);
|
SubscribeLocalEvent<CigarComponent, SmokableSolutionEmptyEvent>(OnCigarSolutionEmptyEvent);
|
||||||
|
SubscribeLocalEvent<CigarComponent, AfterInteractEvent>(OnCigarAfterInteract);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCigarActivatedEvent(EntityUid uid, CigarComponent component, ActivateInWorldEvent args)
|
private void OnCigarActivatedEvent(EntityUid uid, CigarComponent component, ActivateInWorldEvent args)
|
||||||
@@ -51,6 +52,24 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnCigarAfterInteract(EntityUid uid, CigarComponent component, AfterInteractEvent args)
|
||||||
|
{
|
||||||
|
var targetEntity = args.Target;
|
||||||
|
if (targetEntity == null ||
|
||||||
|
!EntityManager.TryGetComponent(uid, out SmokableComponent? smokable) ||
|
||||||
|
smokable.State == SmokableState.Lit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var isHotEvent = new IsHotEvent();
|
||||||
|
RaiseLocalEvent(targetEntity.Value, isHotEvent);
|
||||||
|
|
||||||
|
if (!isHotEvent.IsHot)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SetSmokableState(uid, SmokableState.Lit, smokable);
|
||||||
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnCigarSolutionEmptyEvent(EntityUid uid, CigarComponent component, SmokableSolutionEmptyEvent args)
|
private void OnCigarSolutionEmptyEvent(EntityUid uid, CigarComponent component, SmokableSolutionEmptyEvent args)
|
||||||
{
|
{
|
||||||
SetSmokableState(uid, SmokableState.Burnt);
|
SetSmokableState(uid, SmokableState.Burnt);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.Server.Shuttles.Components
|
|||||||
public override string Name => "Thruster";
|
public override string Name => "Thruster";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the thruster has been force to be enabled / disable (e.g. VV, interaction, etc.)
|
/// Whether the thruster has been force to be enabled / disabled (e.g. VV, interaction, etc.)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField("enabled")]
|
[DataField("enabled")]
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Content.Shared.Examine;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
|
using Content.Shared.Temperature;
|
||||||
using Content.Shared.Shuttles.Components;
|
using Content.Shared.Shuttles.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -52,7 +53,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
|||||||
SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
|
SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
|
||||||
SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
|
SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
|
||||||
SubscribeLocalEvent<ThrusterComponent, RotateEvent>(OnRotate);
|
SubscribeLocalEvent<ThrusterComponent, RotateEvent>(OnRotate);
|
||||||
|
SubscribeLocalEvent<ThrusterComponent, IsHotEvent>(OnIsHotEvent);
|
||||||
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
|
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
|
||||||
SubscribeLocalEvent<ThrusterComponent, EndCollideEvent>(OnEndCollide);
|
SubscribeLocalEvent<ThrusterComponent, EndCollideEvent>(OnEndCollide);
|
||||||
|
|
||||||
@@ -95,6 +96,11 @@ namespace Content.Server.Shuttles.EntitySystems
|
|||||||
_mapManager.TileChanged -= OnTileChange;
|
_mapManager.TileChanged -= OnTileChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnIsHotEvent(EntityUid uid, ThrusterComponent component, IsHotEvent args)
|
||||||
|
{
|
||||||
|
args.IsHot = component.Type != ThrusterType.Angular && component.IsOn;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnTileChange(object? sender, TileChangedEventArgs e)
|
private void OnTileChange(object? sender, TileChangedEventArgs e)
|
||||||
{
|
{
|
||||||
// If the old tile was space but the new one isn't then disable all adjacent thrusters
|
// If the old tile was space but the new one isn't then disable all adjacent thrusters
|
||||||
|
|||||||
Reference in New Issue
Block a user