Files

125 lines
4.8 KiB
C#
Raw Permalink Normal View History

Черри пики и всякое (#598) * Mining tweaks (#18686) So we have pickaxe, drill, crusher, and PKA (projectiles). The tier list in terms of mining speed should go: - PKA - Crusher - Pickaxe - Drill As a result: - Nerfed PKA firerate to 0.5 and bumped damage (slight DPS nerf due to meta). - Crusher bumped to 1 hit per second as PKA is still more common and also to make it better at mining. - Pickaxe is 1 hit per second and also gets structural (fireaxe should still beat it by a little bit) so it's better to break stuff than crusher but worse in combat. - Drill is 1.5 hits per second but otherwise weak. * pickaxe inhand resprite + wielded sprites (#18735) * pickaxe inhand resprite * wtf piece of shit * make pickaxe cost 5x more (and make it bigger) (#19007) * Nerf pickaxe + drill slightly (#19056) I already nerfed its damage from before (at least non-structural) but this nerfs it slightly more. * Add mining drill inhand sprites (#22494) * move advanced laser gun into t3 lasers tech (#19875) * move advanced laser gun into t2 lasers tech * t3 and troll --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * Microreactor power cell research (#21473) * buff microreactor cell and tweak a little * add portable fission research --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * add glaive to salv weapons (#22514) * refactor ops * add recipe --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * Remove tasers from arsenal tech (#22361) * Reduce uplink combat medipen cost (#19556) * Stealth rebalance (#20314) * reduce c4 and c4 bundle price (#21102) c4 is reduced to 2 from 4 and the bundle to 12 from 20 * Increase expedition timer * No emp shock * Nerf licoxide * Reword eshield part 2 * No drill and pickaxe stamina cost * No flashable mobs * remove slowdown from parent (#21872) * Revert protection increase * Increase egun crate price * No unfun stuff in presents * ContentEye for SimpleMob --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Co-authored-by: CrigCrag <137215465+CrigCrag@users.noreply.github.com> Co-authored-by: themias <89101928+themias@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: Brayden H <35241666+hord-brayden@users.noreply.github.com> Co-authored-by: HerCoyote23 <131214189+HerCoyote23@users.noreply.github.com> Co-authored-by: ninruB <38016303+asperger-sind@users.noreply.github.com>
2024-01-04 04:10:23 +09:00
using System.Linq;
using System.Runtime.InteropServices.JavaScript;
using System.Text.RegularExpressions;
using Content.Server.Administration.Logs;
using Content.Server.Hands.Systems;
using Content.Server._White.Other;
using Content.Shared.Database;
using Content.Shared.Examine;
using Content.Shared.Interaction.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.Holiday.Christmas;
/// <summary>
/// This handles granting players their gift.
/// </summary>
public sealed class RandomGiftSystem : EntitySystem
{
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly HandsSystem _hands = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
private readonly List<string> _possibleGiftsSafe = new();
private readonly List<string> _possibleGiftsUnsafe = new();
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypesReloaded);
SubscribeLocalEvent<RandomGiftComponent, MapInitEvent>(OnGiftMapInit);
SubscribeLocalEvent<RandomGiftComponent, UseInHandEvent>(OnUseInHand);
SubscribeLocalEvent<RandomGiftComponent, ExaminedEvent>(OnExamined);
BuildIndex();
}
private void OnExamined(EntityUid uid, RandomGiftComponent component, ExaminedEvent args)
{
if (!component.ContentsViewers.IsValid(args.Examiner, EntityManager) || component.SelectedEntity is null)
return;
var name = _prototype.Index<EntityPrototype>(component.SelectedEntity).Name;
args.PushText(Loc.GetString("gift-packin-contains", ("name", name)));
}
private void OnUseInHand(EntityUid uid, RandomGiftComponent component, UseInHandEvent args)
{
if (args.Handled)
return;
if (component.SelectedEntity is null)
return;
var coords = Transform(args.User).Coordinates;
var handsEnt = Spawn(component.SelectedEntity, coords);
_adminLogger.Add(LogType.EntitySpawn, LogImpact.Low, $"{ToPrettyString(args.User)} used {ToPrettyString(uid)} which spawned {ToPrettyString(handsEnt)}");
EnsureComp<ItemComponent>(handsEnt); // For insane mode.
if (component.Wrapper is not null)
Spawn(component.Wrapper, coords);
args.Handled = true;
_audio.PlayPvs(component.Sound, args.User);
Del(uid);
_hands.PickupOrDrop(args.User, handsEnt);
}
private void OnGiftMapInit(EntityUid uid, RandomGiftComponent component, MapInitEvent args)
{
if (component.InsaneMode)
component.SelectedEntity = _random.Pick(_possibleGiftsUnsafe);
else
component.SelectedEntity = _random.Pick(_possibleGiftsSafe);
}
private void OnPrototypesReloaded(PrototypesReloadedEventArgs obj)
{
if (obj.WasModified<EntityPrototype>())
BuildIndex();
}
private void BuildIndex()
{
_possibleGiftsSafe.Clear();
_possibleGiftsUnsafe.Clear();
var itemCompName = _componentFactory.GetComponentName(typeof(ItemComponent));
var mapGridCompName = _componentFactory.GetComponentName(typeof(MapGridComponent));
var physicsCompName = _componentFactory.GetComponentName(typeof(PhysicsComponent));
var giftIgnoreCompName = _componentFactory.GetComponentName(typeof(GiftIgnoreComponent)); // WD
var unremovableCompName = _componentFactory.GetComponentName(typeof(UnremoveableComponent)); // WD
foreach (var proto in _prototype.EnumeratePrototypes<EntityPrototype>())
{
if (proto.Abstract || proto.NoSpawn || proto.Components.ContainsKey(mapGridCompName) || !proto.Components.ContainsKey(physicsCompName))
continue;
_possibleGiftsUnsafe.Add(proto.ID);
if (!proto.Components.ContainsKey(itemCompName) || proto.Components.ContainsKey(giftIgnoreCompName) ||
proto.Components.ContainsKey(unremovableCompName) || proto.SetSuffix != null &&
Черри пики и всякое (#598) * Mining tweaks (#18686) So we have pickaxe, drill, crusher, and PKA (projectiles). The tier list in terms of mining speed should go: - PKA - Crusher - Pickaxe - Drill As a result: - Nerfed PKA firerate to 0.5 and bumped damage (slight DPS nerf due to meta). - Crusher bumped to 1 hit per second as PKA is still more common and also to make it better at mining. - Pickaxe is 1 hit per second and also gets structural (fireaxe should still beat it by a little bit) so it's better to break stuff than crusher but worse in combat. - Drill is 1.5 hits per second but otherwise weak. * pickaxe inhand resprite + wielded sprites (#18735) * pickaxe inhand resprite * wtf piece of shit * make pickaxe cost 5x more (and make it bigger) (#19007) * Nerf pickaxe + drill slightly (#19056) I already nerfed its damage from before (at least non-structural) but this nerfs it slightly more. * Add mining drill inhand sprites (#22494) * move advanced laser gun into t3 lasers tech (#19875) * move advanced laser gun into t2 lasers tech * t3 and troll --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * Microreactor power cell research (#21473) * buff microreactor cell and tweak a little * add portable fission research --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * add glaive to salv weapons (#22514) * refactor ops * add recipe --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * Remove tasers from arsenal tech (#22361) * Reduce uplink combat medipen cost (#19556) * Stealth rebalance (#20314) * reduce c4 and c4 bundle price (#21102) c4 is reduced to 2 from 4 and the bundle to 12 from 20 * Increase expedition timer * No emp shock * Nerf licoxide * Reword eshield part 2 * No drill and pickaxe stamina cost * No flashable mobs * remove slowdown from parent (#21872) * Revert protection increase * Increase egun crate price * No unfun stuff in presents * ContentEye for SimpleMob --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Co-authored-by: CrigCrag <137215465+CrigCrag@users.noreply.github.com> Co-authored-by: themias <89101928+themias@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: Brayden H <35241666+hord-brayden@users.noreply.github.com> Co-authored-by: HerCoyote23 <131214189+HerCoyote23@users.noreply.github.com> Co-authored-by: ninruB <38016303+asperger-sind@users.noreply.github.com>
2024-01-04 04:10:23 +09:00
new[] {"Debug, Admeme, Admin"}.Any(x =>
proto.SetSuffix.Contains(x, StringComparison.OrdinalIgnoreCase))) // WD EDIT
continue;
_possibleGiftsSafe.Add(proto.ID);
}
}
// WD START
public string? PickRandomItem()
{
return _possibleGiftsSafe.Count == 0 ? null : _random.Pick(_possibleGiftsSafe);
}
// WD END
}