Light Cigars when interacting with hot stuff (#5879)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
JustinTime 2021-12-24 04:59:14 -07:00 committed by GitHub
parent 105b38b7f4
commit 0fd0035581
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 2 deletions

View File

@ -13,6 +13,7 @@ namespace Content.Server.Nutrition.EntitySystems
SubscribeLocalEvent<CigarComponent, ActivateInWorldEvent>(OnCigarActivatedEvent);
SubscribeLocalEvent<CigarComponent, InteractUsingEvent>(OnCigarInteractUsingEvent);
SubscribeLocalEvent<CigarComponent, SmokableSolutionEmptyEvent>(OnCigarSolutionEmptyEvent);
SubscribeLocalEvent<CigarComponent, AfterInteractEvent>(OnCigarAfterInteract);
}
private void OnCigarActivatedEvent(EntityUid uid, CigarComponent component, ActivateInWorldEvent args)
@ -51,6 +52,24 @@ namespace Content.Server.Nutrition.EntitySystems
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)
{
SetSmokableState(uid, SmokableState.Burnt);

View File

@ -17,7 +17,7 @@ namespace Content.Server.Shuttles.Components
public override string Name => "Thruster";
/// <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>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("enabled")]

View File

@ -11,6 +11,7 @@ using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Maps;
using Content.Shared.Physics;
using Content.Shared.Temperature;
using Content.Shared.Shuttles.Components;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
@ -52,7 +53,7 @@ namespace Content.Server.Shuttles.EntitySystems
SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
SubscribeLocalEvent<ThrusterComponent, RotateEvent>(OnRotate);
SubscribeLocalEvent<ThrusterComponent, IsHotEvent>(OnIsHotEvent);
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
SubscribeLocalEvent<ThrusterComponent, EndCollideEvent>(OnEndCollide);
@ -95,6 +96,11 @@ namespace Content.Server.Shuttles.EntitySystems
_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)
{
// If the old tile was space but the new one isn't then disable all adjacent thrusters