Replace AttachToGridOrMap with DropNextTo (#27950)
This commit is contained in:
parent
74eef92443
commit
d82acccaa8
|
|
@ -111,15 +111,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||
|
||||
// try putting the slice into the container if the food being sliced is in a container!
|
||||
// this lets you do things like slice a pizza up inside of a hot food cart without making a food-everywhere mess
|
||||
if (_containerSystem.TryGetContainingContainer(uid, out var container) && _containerSystem.CanInsert(sliceUid, container))
|
||||
{
|
||||
_containerSystem.Insert(sliceUid, container);
|
||||
}
|
||||
else // puts it down "right-side up"
|
||||
{
|
||||
_xformSystem.AttachToGridOrMap(sliceUid);
|
||||
_xformSystem.SetLocalRotation(sliceUid, 0);
|
||||
}
|
||||
_xformSystem.DropNextTo(sliceUid, (uid, transform));
|
||||
_xformSystem.SetLocalRotation(sliceUid, 0);
|
||||
|
||||
// DeltaV - Begin deep frier related code
|
||||
var sliceEvent = new SliceFoodEvent(user, uid, sliceUid);
|
||||
|
|
@ -149,15 +142,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||
var trashUid = Spawn(foodComp.Trash, _xformSystem.GetMapCoordinates(uid));
|
||||
|
||||
// try putting the trash in the food's container too, to be consistent with slice spawning?
|
||||
if (_containerSystem.TryGetContainingContainer(uid, out var container) && _containerSystem.CanInsert(trashUid, container))
|
||||
{
|
||||
_containerSystem.Insert(trashUid, container);
|
||||
}
|
||||
else // puts it down "right-side up"
|
||||
{
|
||||
_xformSystem.AttachToGridOrMap(trashUid);
|
||||
_xformSystem.SetLocalRotation(trashUid, 0);
|
||||
}
|
||||
_xformSystem.DropNextTo(trashUid, uid);
|
||||
_xformSystem.SetLocalRotation(trashUid, 0);
|
||||
|
||||
QueueDel(uid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,15 +322,17 @@ public partial class SharedBodySystem
|
|||
launchImpulseVariance:GibletLaunchImpulseVariance, launchCone: splatCone);
|
||||
}
|
||||
}
|
||||
|
||||
var bodyTransform = Transform(bodyId);
|
||||
if (TryComp<InventoryComponent>(bodyId, out var inventory))
|
||||
{
|
||||
foreach (var item in _inventory.GetHandOrInventoryEntities(bodyId))
|
||||
{
|
||||
SharedTransform.AttachToGridOrMap(item);
|
||||
SharedTransform.DropNextTo(item, (bodyId, bodyTransform));
|
||||
gibs.Add(item);
|
||||
}
|
||||
}
|
||||
_audioSystem.PlayPredicted(gibSoundOverride, Transform(bodyId).Coordinates, null);
|
||||
_audioSystem.PlayPredicted(gibSoundOverride, bodyTransform.Coordinates, null);
|
||||
return gibs;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,17 +120,12 @@ public abstract partial class SharedHandsSystem
|
|||
return true;
|
||||
|
||||
var userXform = Transform(uid);
|
||||
var isInContainer = ContainerSystem.IsEntityInContainer(uid);
|
||||
var isInContainer = ContainerSystem.IsEntityOrParentInContainer(uid, xform: userXform);
|
||||
|
||||
if (targetDropLocation == null || isInContainer)
|
||||
{
|
||||
// If user is in a container, drop item into that container. Otherwise, attach to grid or map.\
|
||||
// TODO recursively check upwards for containers
|
||||
|
||||
if (!isInContainer
|
||||
|| !ContainerSystem.TryGetContainingContainer(userXform.ParentUid, uid, out var container, skipExistCheck: true)
|
||||
|| !ContainerSystem.Insert((entity, itemXform), container))
|
||||
TransformSystem.AttachToGridOrMap(entity, itemXform);
|
||||
// If user is in a container, drop item into that container. Otherwise, attach to grid or map.
|
||||
TransformSystem.DropNextTo((entity, itemXform), (uid, userXform));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue