Weight based AreaInsert and Dumpable delay, a janitor qol tweak (#24899)
Weight based delay, retuned average, fixed comments
This commit is contained in:
@@ -54,6 +54,8 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
[ValidatePrototypeId<ItemSizePrototype>]
|
||||
public const string DefaultStorageMaxItemSize = "Normal";
|
||||
|
||||
public const float AreaInsertDelayPerItem = 0.075f;
|
||||
|
||||
private ItemSizePrototype _defaultStorageMaxItemSize = default!;
|
||||
|
||||
public bool CheckingCanInsert;
|
||||
@@ -258,11 +260,14 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
if (storageComp.AreaInsert && (args.Target == null || !HasComp<ItemComponent>(args.Target.Value)))
|
||||
{
|
||||
var validStorables = new List<EntityUid>();
|
||||
var delay = 0f;
|
||||
|
||||
foreach (var entity in _entityLookupSystem.GetEntitiesInRange(args.ClickLocation, storageComp.AreaInsertRadius, LookupFlags.Dynamic | LookupFlags.Sundries))
|
||||
{
|
||||
if (entity == args.User
|
||||
|| !_itemQuery.HasComponent(entity)
|
||||
// || !_itemQuery.HasComponent(entity)
|
||||
|| !TryComp<ItemComponent>(entity, out var itemComp) // Need comp to get item size to get weight
|
||||
|| !_prototype.TryIndex(itemComp.Size, out var itemSize)
|
||||
|| !CanInsert(uid, entity, out _, storageComp)
|
||||
|| !_interactionSystem.InRangeUnobstructed(args.User, entity))
|
||||
{
|
||||
@@ -270,12 +275,13 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
}
|
||||
|
||||
validStorables.Add(entity);
|
||||
delay += itemSize.Weight * AreaInsertDelayPerItem;
|
||||
}
|
||||
|
||||
//If there's only one then let's be generous
|
||||
if (validStorables.Count > 1)
|
||||
{
|
||||
var doAfterArgs = new DoAfterArgs(EntityManager, args.User, 0.2f * validStorables.Count, new AreaPickupDoAfterEvent(GetNetEntityList(validStorables)), uid, target: uid)
|
||||
var doAfterArgs = new DoAfterArgs(EntityManager, args.User, delay, new AreaPickupDoAfterEvent(GetNetEntityList(validStorables)), uid, target: uid)
|
||||
{
|
||||
BreakOnDamage = true,
|
||||
BreakOnUserMove = true,
|
||||
|
||||
Reference in New Issue
Block a user