Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into add-bind-to-selfs…
Browse files Browse the repository at this point in the history
…tewing
  • Loading branch information
Kirus59 committed Dec 29, 2024
2 parents c6b6f70 + 3eb85f2 commit a602d9a
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 32 deletions.
1 change: 1 addition & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(EngineKeyFunctions.Walk);
human.AddFunction(ContentKeyFunctions.SwapHands);
human.AddFunction(ContentKeyFunctions.Drop);
human.AddFunction(KeyFunctions220.ItemOffer); // SS220 ItemOffer bind
human.AddFunction(ContentKeyFunctions.UseItemInHand);
human.AddFunction(ContentKeyFunctions.AltUseItemInHand);
human.AddFunction(ContentKeyFunctions.OpenCharacterMenu);
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 @@ -180,6 +180,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(ContentKeyFunctions.ActivateItemInWorld);
AddButton(ContentKeyFunctions.AltActivateItemInWorld);
AddButton(ContentKeyFunctions.Drop);
AddButton(KeyFunctions220.ItemOffer); // SS220 ItemOffer bind
AddButton(ContentKeyFunctions.ExamineEntity);
AddButton(ContentKeyFunctions.SwapHands);
AddButton(ContentKeyFunctions.MoveStoredItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public sealed partial class CultYoggRuleComponent : Component
/// <summary>
/// Storages for an endgame screen title
/// </summary>
[DataField]
public Dictionary<string, string> InitialCultistsNames = [];//Who was cultist on the gamestart.

public readonly List<EntityUid> InitialCultistMinds = [];
public readonly List<EntityUid> InitialCultistMinds = []; //Who was cultist on the gamestart.

/// <summary>
/// Storage for a sacraficials
Expand Down
8 changes: 1 addition & 7 deletions Content.Server/SS220/GameTicking/Rules/CultYoggRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,6 @@ protected override void AppendRoundEndText(EntityUid uid, CultYoggRuleComponent
{
base.AppendRoundEndText(uid, component, gameRule, ref args);

//ToDo check for summoning

var query = EntityQueryEnumerator<NyarlathotepSearchTargetsComponent>();//ToDo maybe some altrenative
//if (query. != null)
// component.Summoned = true;

if (component.Summoned)
{
args.AddLine(Loc.GetString("cult-yogg-round-end-win"));
Expand All @@ -491,7 +485,7 @@ protected override void AppendRoundEndText(EntityUid uid, CultYoggRuleComponent
args.AddLine(Loc.GetString("cult-yogg-round-end-amount-high"));
}

args.AddLine(Loc.GetString("cult-yogg-round-end-initial-count", ("initialCount", component.InitialCultistsNames.Count)));
args.AddLine(Loc.GetString("cult-yogg-round-end-initial-count", ("initialCount", component.InitialCultistMinds.Count)));

var antags = _antag.GetAntagIdentifiers(uid);
//args.AddLine(Loc.GetString("zombie-round-end-initial-count", ("initialCount", antags.Count))); // ToDo Should we add this?
Expand Down
65 changes: 53 additions & 12 deletions Content.Server/SS220/ItemOfferVerb/Systems/ItemOfferSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using System.Linq;
using Content.Shared.Silicons.Borgs.Components;
using Content.Shared.Interaction.Components;
using Robust.Shared.Input.Binding;
using Content.Shared.SS220.Input;

namespace Content.Server.SS220.ItemOfferVerb.Systems
{
Expand All @@ -30,6 +32,23 @@ public override void Initialize()
base.Initialize();
SubscribeLocalEvent<HandsComponent, GetVerbsEvent<EquipmentVerb>>(AddOfferVerb);
SubscribeLocalEvent<ItemReceiverComponent, ItemOfferAlertEvent>(OnItemOffserAlertClicked);

CommandBinds.Builder
.Bind(KeyFunctions220.ItemOffer,
new PointerInputCmdHandler(HandleItemOfferKey))
.Register<ItemOfferSystem>();
}

private bool HandleItemOfferKey(in PointerInputCmdHandler.PointerInputCmdArgs args)
{
if (!args.EntityUid.IsValid() || !EntityManager.EntityExists(args.EntityUid))
return false;

if (args.Session?.AttachedEntity == null)
return false;

DoItemOffer(args.Session.AttachedEntity.Value, args.EntityUid);
return true;
}

private void OnItemOffserAlertClicked(Entity<ItemReceiverComponent> ent, ref ItemOfferAlertEvent args)
Expand Down Expand Up @@ -80,24 +99,15 @@ then when we checked the first hand we didn't find it and deleted the transfer r

private void AddOfferVerb(EntityUid uid, HandsComponent component, GetVerbsEvent<EquipmentVerb> args)
{
if (!args.CanInteract || !args.CanAccess || args.Hands == null || args.Hands.ActiveHandEntity == null
|| HasComp<UnremoveableComponent>(args.Hands.ActiveHandEntity) || args.Target == args.User || !FindFreeHand(component, out var freeHand))
return;

// (fix https://github.com/SerbiaStrong-220/space-station-14/issues/2054)
if (HasComp<BorgChassisComponent>(args.User))
if (!args.CanInteract || !args.CanAccess || args.Hands == null || args.Hands.ActiveHandEntity == null)
return;

EquipmentVerb verb = new EquipmentVerb()
{
Text = "Передать предмет",
Act = () =>
{
var itemReceiver = EnsureComp<ItemReceiverComponent>(uid);
itemReceiver.Giver = args.User;
itemReceiver.Item = args.Hands.ActiveHandEntity;
_alerts.ShowAlert(uid, ItemOfferAlert);
_popupSystem.PopupEntity($"{Name(args.User)} протягивает {Name(args.Hands.ActiveHandEntity!.Value)} {Name(uid)}", args.User, PopupType.Small);
DoItemOffer(args.User, uid);
},
};

Expand All @@ -110,7 +120,11 @@ public void TransferItemInHands(EntityUid receiver, ItemReceiverComponent? itemR
_hands.PickupOrDrop(itemReceiver.Giver, itemReceiver.Item!.Value);
if (_hands.TryPickupAnyHand(receiver, itemReceiver.Item!.Value))
{
_popupSystem.PopupEntity($"{Name(itemReceiver.Giver)} передал {Name(itemReceiver.Item!.Value)} {Name(receiver)}!", itemReceiver.Giver, PopupType.Medium);
var loc = Loc.GetString("loc-item-offer-transfer",
("user", itemReceiver.Giver),
("item", itemReceiver.Item),
("target", receiver));
_popupSystem.PopupEntity(loc, itemReceiver.Giver, PopupType.Medium);
_alerts.ClearAlert(receiver, ItemOfferAlert);
_entMan.RemoveComponent<ItemReceiverComponent>(receiver);
};
Expand All @@ -119,5 +133,32 @@ private bool FindFreeHand(HandsComponent component, [NotNullWhen(true)] out stri
{
return (freeHand = component.GetFreeHandNames().Any() ? component.GetFreeHandNames().First() : null) != null;
}

private void DoItemOffer(EntityUid user, EntityUid target)
{
if (!TryComp<HandsComponent>(target, out var handsComponent))
return;

// (fix https://github.com/SerbiaStrong-220/space-station-14/issues/2054)
if (HasComp<BorgChassisComponent>(user) || !FindFreeHand(handsComponent, out _) || target == user )
return;

if (!_hands.TryGetActiveItem(user, out var item))
return;

if (HasComp<UnremoveableComponent>(item))
return;

var itemReceiver = EnsureComp<ItemReceiverComponent>(target);
itemReceiver.Giver = user;
itemReceiver.Item = item;
_alerts.ShowAlert(target, ItemOfferAlert);

var loc = Loc.GetString("loc-item-offer-attempt",
("user", user),
("item", item),
("target", target));
_popupSystem.PopupEntity(loc, user);
}
}
}
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 ItemOffer = "ItemOffer";
public static readonly BoundKeyFunction ResistFire = "ResistFire";

public static void AddCalculatorKeys(IInputCmdContext context)
Expand Down
20 changes: 11 additions & 9 deletions Resources/Changelog/Changelog220.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
Entries:
- author: ReeZii
changes:
- message: "\u0426\u0432\u0435\u0442 \u0445\u0432\u043E\u0441\u0442\u0430 \u043F\
\u043E\u0441\u043B\u0435 \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F\
\ \u0432 \u0437\u043E\u043C\u0431\u0438"
type: Fix
id: 228
time: '2024-07-03T13:42:44.0000000+00:00'
url: https://github.com/SerbiaStrong-220/space-station-14/pull/1219
- author: AlwyAnri
changes:
- message: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D \u043E\u0441\u043E\u0431\
Expand Down Expand Up @@ -6061,3 +6052,14 @@
id: 731
time: '2024-12-29T00:58:58.0000000+00:00'
url: https://github.com/SerbiaStrong-220/space-station-14/pull/2421
- author: canvaswalker
changes:
- message: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D \u0431\u0438\u043D\u0434\
\ \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043D\u0430\
\ \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043F\u0440\u0435\u0434\u043C\
\u0435\u0442\u0430! (\u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\
\u0438\u044E Shift + R)"
type: Add
id: 732
time: '2024-12-29T16:49:14.0000000+00:00'
url: https://github.com/SerbiaStrong-220/space-station-14/pull/2423
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 = Потушить себя
2 changes: 2 additions & 0 deletions Resources/Locale/ru-RU/ss220/itemoffer/itemoffer.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
loc-item-offer-attempt = { $user } протягивает { $item } { $target }
loc-item-offer-transfer = { $user } передал { $item } { $target }
6 changes: 6 additions & 0 deletions Resources/keybinds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,12 @@ binds:
type: State
key: Delete
# SS220 Calculator end
# SS220 ItemOffer bind begin
- function: ItemOffer
type: State
key: R
mod1: Shift
# SS220 ItemOffer bind end
# SS220 resist fire bind begin
- function: ResistFire
type: State
Expand Down

0 comments on commit a602d9a

Please sign in to comment.