Prevent crates, pet carriers and other things from going into disposals (#35557)
* Initial commit * Solve underlying bug, readd to disposals * Apply suggestions from code review --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -301,8 +301,20 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
if (!ResolveStorage(container, ref component))
|
||||
return false;
|
||||
|
||||
RemComp<InsideEntityStorageComponent>(toRemove);
|
||||
_container.Remove(toRemove, component.Contents);
|
||||
|
||||
if (_container.IsEntityInContainer(container))
|
||||
{
|
||||
if (_container.TryGetOuterContainer(container, Transform(container), out var outerContainer) &&
|
||||
!HasComp<HandsComponent>(outerContainer.Owner))
|
||||
{
|
||||
_container.Insert(toRemove, outerContainer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
RemComp<InsideEntityStorageComponent>(toRemove);
|
||||
|
||||
var pos = TransformSystem.GetWorldPosition(xform) + TransformSystem.GetWorldRotation(xform).RotateVec(component.EnteringOffset);
|
||||
TransformSystem.SetWorldPosition(toRemove, pos);
|
||||
return true;
|
||||
@@ -366,17 +378,6 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_container.IsEntityInContainer(target))
|
||||
{
|
||||
if (_container.TryGetOuterContainer(target,Transform(target) ,out var container) &&
|
||||
!HasComp<HandsComponent>(container.Owner))
|
||||
{
|
||||
Popup.PopupClient(Loc.GetString("entity-storage-component-already-contains-user-message"), user, user);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Checks to see if the opening position, if offset, is inside of a wall.
|
||||
if (component.EnteringOffset != new Vector2(0, 0) && !HasComp<WallMountComponent>(target)) //if the entering position is offset
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user