Upstream gp (#149)
* fix borg (#719) * Automatic changelog update * Переводы снаряжения и прочей мелочи в стартовом меню (#720) * Сумки, мешки и прочее * Перевод снаряжения * перевод черт персонажа * Добавлено ничего * Automatic changelog update * Фикс отображения потери мастера для импланта подчинения (#721) * фикс отображения * brain damage is real * я блять запустил райдер ради рефактора одного ифа * а лучше даже так * Automatic changelog update * add coderabbitai config (#722) * fix (#723) * Шприц теперь является оружием массового поражения (#724) * Automatic changelog update * Пиздец (#725) Я на это потратил 2 недели * Automatic changelog update * Honk FM (#136) (#726) * Fix Cosmic Temperance и новые песенки в jukebox * Новая музыка в jucebox x2 Co-authored-by: Vorge7 <vorge228@gmail.com> * Automatic changelog update * Флаф (fluff) мне (big_zi_348) (#727) * Заработал * brain damage * fuck (#729) * Automatic changelog update * FUCKERS (#732) * Удаление ненужных суффиксов (#731) * Перевод захардкукоженной строки (#728) * Пластырь поможет * очапятка * Перевод ревенанта * Карповый перекат * Create shakeable-component.ftl * Криогеника * Хранилища скафандров * Update autotranslate-14.ftl * Update Cyborgs.xml * Комоды * Кредиты * Удалил дубликат * Информация * Пластырь миму и клоуну * Переводы всего * Перевод аплинка * Удалил ненужные суффиксы * Revert "Удалил ненужные суффиксы" This reverts commit d82f05f30c37ec2c11e5736b91239fe9dd1a4d17. * Удаление ненужных суффиксов * Перевод реагентовых слизней * Перевод аномалий * Перевод маяков * Перевод различной мелочи * Automatic changelog update * Переводы и правки Гайдов (#730) * Automatic changelog update * aaaaa (#733) * Правка локализации (#737) * Update ThirstSystem.cs (#736) * AccessConfiguratorForBorgs (#735) * Automatic changelog update * Починил бесконечную сварку (#734) * Automatic changelog update * ShowManifestFeature (#738) * Automatic changelog update * I LOVE OPENSOURCE * Изменение размеров милишек (#739) * Фикс размеров * Заготовку биты тоже * Правка * Automatic changelog update * Время после взрыва нюки (#740) * More Fun * Автоформатирование * Подкрутка * Automatic changelog update * Скальпель в армейские ботинки (#741) * Automatic changelog update * DoHeavyAttack stamina check (#742) * Automatic changelog update * aaaaaaaaaaaaaaaaaaaaaaaaaaaaa (#743) * fix retarded code (#744) * Automatic changelog update --------- Co-authored-by: RavmorganButOnCocaine <valtos@nextmail.ru> Co-authored-by: BIGZi0348 <118811750+BIGZi0348@users.noreply.github.com> Co-authored-by: ThereDrD <88589686+ThereDrD0@users.noreply.github.com> Co-authored-by: Vorge7 <vorge228@gmail.com> Co-authored-by: Valtos <valtos@spaces.ru> Co-authored-by: haiwwkes <49613070+rhailrake@users.noreply.github.com>
This commit is contained in:
@@ -17,7 +17,7 @@ public sealed partial class WelderRefinableComponent : Component
|
||||
public float RefineTime = 2f;
|
||||
|
||||
[DataField]
|
||||
public float RefineFuel;
|
||||
public float RefineFuel = 3f; // WD ahead of wizden upstream
|
||||
|
||||
[DataField]
|
||||
public ProtoId<ToolQualityPrototype> QualityNeeded = "Welding";
|
||||
|
||||
@@ -80,14 +80,12 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
|
||||
return;
|
||||
|
||||
// same as store code, but message is only shown to yourself
|
||||
args.Handled = _store.TryAddCurrency(_store.GetCurrencyValue(args.Used, currency), uid, store);
|
||||
|
||||
if (!args.Handled)
|
||||
if (!_store.TryAddCurrency((args.Used, currency), (uid, store)))
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
var msg = Loc.GetString("store-currency-inserted-implant", ("used", args.Used));
|
||||
_popup.PopupEntity(msg, args.User, args.User);
|
||||
QueueDel(args.Used);
|
||||
}
|
||||
|
||||
private void OnFreedomImplant(EntityUid uid, SubdermalImplantComponent component, UseFreedomImplantEvent args)
|
||||
|
||||
@@ -23,6 +23,7 @@ using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Timing; // WD
|
||||
|
||||
namespace Content.Server.Nuke;
|
||||
|
||||
@@ -571,7 +572,7 @@ public sealed class NukeSystem : EntitySystem
|
||||
_sound.StopStationEventMusic(uid, StationEventMusicType.Nuke);
|
||||
Del(uid);
|
||||
|
||||
_roundEndSystem.EndRound(TimeSpan.FromSeconds(30)); //Giedi EDIT
|
||||
Timer.Spawn(TimeSpan.FromSeconds(60), () => _roundEndSystem.EndRound(TimeSpan.FromSeconds(60))); //Giedi EDIT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -91,19 +91,68 @@ namespace Content.Server.Stack
|
||||
/// </summary>
|
||||
public List<EntityUid> SpawnMultiple(string entityPrototype, int amount, EntityCoordinates spawnPosition)
|
||||
{
|
||||
var proto = _prototypeManager.Index<EntityPrototype>(entityPrototype);
|
||||
proto.TryGetComponent<StackComponent>(out var stack);
|
||||
var maxCountPerStack = GetMaxCount(stack);
|
||||
if (amount <= 0)
|
||||
{
|
||||
Log.Error(
|
||||
$"Attempted to spawn an invalid stack: {entityPrototype}, {amount}. Trace: {Environment.StackTrace}");
|
||||
return new();
|
||||
}
|
||||
|
||||
var spawns = CalculateSpawns(entityPrototype, amount);
|
||||
|
||||
var spawnedEnts = new List<EntityUid>();
|
||||
foreach (var count in spawns)
|
||||
{
|
||||
var entity = SpawnAtPosition(entityPrototype, spawnPosition);
|
||||
spawnedEnts.Add(entity);
|
||||
SetCount(entity, count);
|
||||
}
|
||||
|
||||
return spawnedEnts;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="SpawnMultiple(string,int,EntityCoordinates)"/>
|
||||
public List<EntityUid> SpawnMultiple(string entityPrototype, int amount, EntityUid target)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
Log.Error(
|
||||
$"Attempted to spawn an invalid stack: {entityPrototype}, {amount}. Trace: {Environment.StackTrace}");
|
||||
return new();
|
||||
}
|
||||
var spawns = CalculateSpawns(entityPrototype, amount);
|
||||
|
||||
var spawnedEnts = new List<EntityUid>();
|
||||
foreach (var count in spawns)
|
||||
{
|
||||
var entity = SpawnNextToOrDrop(entityPrototype, target);
|
||||
spawnedEnts.Add(entity);
|
||||
SetCount(entity, count);
|
||||
}
|
||||
|
||||
return spawnedEnts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates how many stacks to spawn that total up to <paramref name="amount"/>.
|
||||
/// </summary>
|
||||
/// <param name="entityPrototype">The stack to spawn.</param>
|
||||
/// <param name="amount">The amount of pieces across all stacks.</param>
|
||||
/// <returns>The list of stack counts per entity.</returns>
|
||||
private List<int> CalculateSpawns(string entityPrototype, int amount)
|
||||
{
|
||||
var proto = _prototypeManager.Index<EntityPrototype>(entityPrototype);
|
||||
proto.TryGetComponent<StackComponent>(out var stack, EntityManager.ComponentFactory);
|
||||
var maxCountPerStack = GetMaxCount(stack);
|
||||
var amounts = new List<int>();
|
||||
while (amount > 0)
|
||||
{
|
||||
var entity = Spawn(entityPrototype, spawnPosition);
|
||||
spawnedEnts.Add(entity);
|
||||
var countAmount = Math.Min(maxCountPerStack, amount);
|
||||
SetCount(entity, countAmount);
|
||||
amount -= countAmount;
|
||||
amounts.Add(countAmount);
|
||||
}
|
||||
return spawnedEnts;
|
||||
|
||||
return amounts;
|
||||
}
|
||||
|
||||
private void OnStackAlternativeInteract(EntityUid uid, StackComponent stack, GetVerbsEvent<AlternativeVerb> args)
|
||||
|
||||
@@ -297,6 +297,9 @@ public sealed partial class StoreSystem
|
||||
/// </remarks>
|
||||
private void OnRequestWithdraw(EntityUid uid, StoreComponent component, StoreRequestWithdrawMessage msg)
|
||||
{
|
||||
if (msg.Amount <= 0)
|
||||
return;
|
||||
|
||||
//make sure we have enough cash in the bank and we actually support this currency
|
||||
if (!component.Balance.TryGetValue(msg.Currency, out var currentAmount) || currentAmount < msg.Amount)
|
||||
return;
|
||||
@@ -320,7 +323,8 @@ public sealed partial class StoreSystem
|
||||
var cashId = proto.Cash[value];
|
||||
var amountToSpawn = (int) MathF.Floor((float) (amountRemaining / value));
|
||||
var ents = _stack.SpawnMultiple(cashId, amountToSpawn, coordinates);
|
||||
_hands.PickupOrDrop(buyer, ents.First());
|
||||
if (ents.FirstOrDefault() is {} ent)
|
||||
_hands.PickupOrDrop(buyer, ent);
|
||||
amountRemaining -= value * amountToSpawn;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,14 +94,12 @@ public sealed partial class StoreSystem : EntitySystem
|
||||
if (ev.Cancelled)
|
||||
return;
|
||||
|
||||
args.Handled = TryAddCurrency(GetCurrencyValue(uid, component), args.Target.Value, store);
|
||||
if (!TryAddCurrency((uid, component), (args.Target.Value, store)))
|
||||
return;
|
||||
|
||||
if (args.Handled)
|
||||
{
|
||||
var msg = Loc.GetString("store-currency-inserted", ("used", args.Used), ("target", args.Target));
|
||||
_popup.PopupEntity(msg, args.Target.Value, args.User);
|
||||
QueueDel(args.Used);
|
||||
}
|
||||
args.Handled = true;
|
||||
var msg = Loc.GetString("store-currency-inserted", ("used", args.Used), ("target", args.Target));
|
||||
_popup.PopupEntity(msg, args.Target.Value, args.User);
|
||||
}
|
||||
|
||||
private void OnImplantActivate(EntityUid uid, StoreComponent component, OpenUplinkImplantEvent args)
|
||||
@@ -123,19 +121,29 @@ public sealed partial class StoreSystem : EntitySystem
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to add a currency to a store's balance.
|
||||
/// Tries to add a currency to a store's balance. Note that if successful, this will consume the currency in the process.
|
||||
/// </summary>
|
||||
/// <param name="currencyEnt"></param>
|
||||
/// <param name="storeEnt"></param>
|
||||
/// <param name="currency">The currency to add</param>
|
||||
/// <param name="store">The store to add it to</param>
|
||||
/// <returns>Whether or not the currency was succesfully added</returns>
|
||||
[PublicAPI]
|
||||
public bool TryAddCurrency(EntityUid currencyEnt, EntityUid storeEnt, StoreComponent? store = null, CurrencyComponent? currency = null)
|
||||
public bool TryAddCurrency(Entity<CurrencyComponent?> currency, Entity<StoreComponent?> store)
|
||||
{
|
||||
if (!Resolve(currencyEnt, ref currency) || !Resolve(storeEnt, ref store))
|
||||
if (!Resolve(currency.Owner, ref currency.Comp))
|
||||
return false;
|
||||
return TryAddCurrency(GetCurrencyValue(currencyEnt, currency), storeEnt, store);
|
||||
if (!Resolve(store.Owner, ref store.Comp))
|
||||
return false;
|
||||
var value = currency.Comp.Price;
|
||||
if (TryComp(currency.Owner, out StackComponent? stack) && stack.Count != 1)
|
||||
{
|
||||
value = currency.Comp.Price
|
||||
.ToDictionary(v => v.Key, p => p.Value * stack.Count);
|
||||
}
|
||||
if (!TryAddCurrency(value, store, store.Comp))
|
||||
return false;
|
||||
// Avoid having the currency accidentally be re-used. E.g., if multiple clients try to use the currency in the
|
||||
// same tick
|
||||
currency.Comp.Price.Clear();
|
||||
if (stack != null)
|
||||
_stack.SetCount(currency.Owner, 0, stack);
|
||||
QueueDel(currency);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Content.Server.Chat.Managers;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -13,6 +12,7 @@ using Content.Server.Store.Systems;
|
||||
using Content.Server._White.Sponsors;
|
||||
using Content.Server.Antag;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Shared.FixedPoint;
|
||||
|
||||
Reference in New Issue
Block a user