Skip to content

Commit

Permalink
Resist fire bind (#2427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirus59 authored Dec 29, 2024
1 parent 3eb85f2 commit 02d4e0c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.RotateObjectClockwise);
human.AddFunction(ContentKeyFunctions.RotateObjectCounterclockwise);
human.AddFunction(ContentKeyFunctions.FlipObject);
human.AddFunction(KeyFunctions220.ResistFire); // SS220 resist fire bind
human.AddFunction(ContentKeyFunctions.ArcadeUp);
human.AddFunction(ContentKeyFunctions.ArcadeDown);
human.AddFunction(ContentKeyFunctions.ArcadeLeft);
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(ContentKeyFunctions.RotateObjectClockwise);
AddButton(ContentKeyFunctions.RotateObjectCounterclockwise);
AddButton(ContentKeyFunctions.FlipObject);
AddButton(KeyFunctions220.ResistFire); // SS220 resist fire bind

AddHeader("ui-options-header-ui");
AddButton(ContentKeyFunctions.FocusChat);
Expand Down
19 changes: 19 additions & 0 deletions Content.Server/Atmos/EntitySystems/FlammableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Random;
using Robust.Shared.Input.Binding;
using Content.Shared.SS220.Input;
using Robust.Shared.Player;

namespace Content.Server.Atmos.EntitySystems
{
Expand Down Expand Up @@ -82,6 +85,11 @@ public override void Initialize()
SubscribeLocalEvent<ExtinguishOnInteractComponent, ActivateInWorldEvent>(OnExtinguishActivateInWorld);

SubscribeLocalEvent<IgniteOnHeatDamageComponent, DamageChangedEvent>(OnDamageChanged);

// SS220 resist fire bind
CommandBinds.Builder
.Bind(KeyFunctions220.ResistFire, InputCmdHandler.FromDelegate(HandleResistFireKey, handle: false))
.Register<FlammableSystem>();
}

private void OnMeleeHit(EntityUid uid, IgniteOnMeleeHitComponent component, MeleeHitEvent args)
Expand Down Expand Up @@ -251,6 +259,17 @@ private void OnRejuvenate(EntityUid uid, FlammableComponent component, Rejuvenat
Extinguish(uid, component);
}

// SS220 resist fire bind begin
private void HandleResistFireKey(ICommonSession? session)
{
if (session?.AttachedEntity is not { } uid ||
!TryComp<FlammableComponent>(uid, out var comp))
return;

Resist(uid, comp);
}
// SS220 resist fire bind end

private void OnResistFireAlert(Entity<FlammableComponent> ent, ref ResistFireAlertEvent args)
{
if (args.Handled)
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/SS220/Input/KeyFunctions220.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static class KeyFunctions220
public static readonly BoundKeyFunction CalculatorEnter = "CalculatorEnter";
public static readonly BoundKeyFunction CalculatorClear = "CalculatorClear";
public static readonly BoundKeyFunction ItemOffer = "ItemOffer";
public static readonly BoundKeyFunction ResistFire = "ResistFire";

public static void AddCalculatorKeys(IInputCmdContext context)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ui-options-function-smart-equip-neck = Умная экипировка на шею
ui-options-function-item-offer = Передать предмет
ui-options-function-resist-fire = Потушить себя
5 changes: 5 additions & 0 deletions Resources/keybinds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -647,3 +647,8 @@ binds:
key: R
mod1: Shift
# SS220 ItemOffer bind end
# SS220 resist fire bind begin
- function: ResistFire
type: State
key: B
# SS220 resist fire bind end

0 comments on commit 02d4e0c

Please sign in to comment.