Felinids fit in duffelbags. (#515)

* - add: Felinids fit in duffelbags.

* - add: This is better.

* - add: Move to shared.
This commit is contained in:
Aviu00
2024-07-30 16:32:26 +00:00
committed by GitHub
parent 2b5838657d
commit 58574b8a70
13 changed files with 284 additions and 21 deletions

View File

@@ -207,9 +207,9 @@ public sealed class CarryingSystem : EntitySystem
args.Handled = true;
}
private void StartCarryDoAfter(EntityUid carrier, EntityUid carried, CarriableComponent component)
public void StartCarryDoAfter(EntityUid carrier, EntityUid carried, CarriableComponent component)
{
var length = TimeSpan.FromSeconds(6); // т.к. удалили систему разницы масс увеличу время с 3 до 6
var length = component.DoAfterLength; // т.к. удалили систему разницы масс увеличу время с 3 до 6
if (length >= TimeSpan.FromSeconds(9))
{
_popupSystem.PopupEntity(Loc.GetString("carry-too-heavy"), carried, carrier,
@@ -230,7 +230,11 @@ public sealed class CarryingSystem : EntitySystem
NeedHand = true
};
_doAfterSystem.TryStartDoAfter(args);
if(_doAfterSystem.TryStartDoAfter(args))
{
_popupSystem.PopupEntity(Loc.GetString("carry-start", ("carrier", carrier)), carried, carried,
Shared.Popups.PopupType.SmallCaution);
}
}
private void Carry(EntityUid carrier, EntityUid carried)
@@ -260,17 +264,22 @@ public sealed class CarryingSystem : EntitySystem
_actionBlockerSystem.UpdateCanMove(carried);
}
public void DropCarried(EntityUid carrier, EntityUid carried)
public void DropCarried(EntityUid carrier,
EntityUid carried,
bool attachToGridOrMap = true,
bool removeCanEscape = true)
{
RemComp<CarryingComponent>(carrier); // get rid of this first so we don't recusrively fire that event
RemComp<CarryingSlowdownComponent>(carrier);
RemComp<BeingCarriedComponent>(carried);
RemComp<KnockedDownComponent>(carried);
RemComp<CanEscapeInventoryComponent>(carried);
if (removeCanEscape)
RemComp<CanEscapeInventoryComponent>(carried);
_actionBlockerSystem.UpdateCanMove(carried);
_virtualItemSystem.DeleteInHandsMatching(carrier, carried);
_transform.AttachToGridOrMap(carried);
if (attachToGridOrMap)
_transform.AttachToGridOrMap(carried);
_movementSpeed.RefreshMovementSpeedModifiers(carrier);
}
@@ -302,4 +311,4 @@ public sealed class CarryingSystem : EntitySystem
return true;
}
}
}