Skip to content

Commit

Permalink
Add bind to resist fire
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirus59 committed Dec 29, 2024
1 parent 68d9d79 commit c6b6f70
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Input;
using Content.Shared.SS220.Input;
using Robust.Shared.Input;

namespace Content.Client.Input
Expand Down Expand Up @@ -78,6 +79,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
2 changes: 2 additions & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Client.Stylesheets;
using Content.Shared.CCVar;
using Content.Shared.Input;
using Content.Shared.SS220.Input;
using Robust.Client.AutoGenerated;
using Robust.Client.Input;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -199,6 +200,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 @@ -23,6 +23,7 @@ public static class KeyFunctions220
public static readonly BoundKeyFunction CalculatorTypeDivide = "CalculatorTypeDivide";
public static readonly BoundKeyFunction CalculatorEnter = "CalculatorEnter";
public static readonly BoundKeyFunction CalculatorClear = "CalculatorClear";
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 +1,2 @@
ui-options-function-smart-equip-neck = Умная экипировка на шею
ui-options-function-resist-fire = Потушить себя
7 changes: 6 additions & 1 deletion Resources/keybinds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -640,4 +640,9 @@ binds:
- function: CalculatorClear
type: State
key: Delete
# SS220 Calculator end
# SS220 Calculator end
# SS220 resist fire bind begin
- function: ResistFire
type: State
key: B
# SS220 resist fire bind end

0 comments on commit c6b6f70

Please sign in to comment.