Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resist fire bind #2427

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading