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, 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);
|
||||
|
||||
Reference in New Issue
Block a user