Butchered objects use MapPosition for spawning, spawn with small offsets. Objects cannot be butchered inside containers. (#11646)
Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
@@ -80,19 +80,27 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
sharp.Butchering.Remove(ev.Entity);
|
sharp.Butchering.Remove(ev.Entity);
|
||||||
|
|
||||||
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
|
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
|
||||||
var coords = Transform(ev.Entity).Coordinates;
|
var coords = Transform(ev.Entity).MapPosition;
|
||||||
EntityUid popupEnt = default;
|
EntityUid popupEnt = default;
|
||||||
foreach (var proto in spawnEntities)
|
foreach (var proto in spawnEntities)
|
||||||
{
|
{
|
||||||
popupEnt = Spawn(proto, coords);
|
// distribute the spawned items randomly in a small radius around the origin
|
||||||
|
popupEnt = Spawn(proto, coords.Offset(_robustRandom.NextVector2(0.25f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
_popupSystem.PopupEntity(Loc.GetString("butcherable-knife-butchered-success", ("target", ev.Entity), ("knife", ev.Sharp)),
|
var hasBody = TryComp<SharedBodyComponent>(ev.Entity, out var body);
|
||||||
popupEnt, Filter.Entities(ev.User), PopupType.LargeCaution);
|
|
||||||
|
|
||||||
if (TryComp<SharedBodyComponent>(ev.Entity, out var body))
|
// only show a big popup when butchering living things.
|
||||||
|
var popupType = PopupType.Small;
|
||||||
|
if (hasBody)
|
||||||
|
popupType = PopupType.LargeCaution;
|
||||||
|
|
||||||
|
_popupSystem.PopupEntity(Loc.GetString("butcherable-knife-butchered-success", ("target", ev.Entity), ("knife", ev.Sharp)),
|
||||||
|
popupEnt, Filter.Entities(ev.User), popupType);
|
||||||
|
|
||||||
|
if (hasBody)
|
||||||
{
|
{
|
||||||
body.Gib();
|
body!.Gib();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -125,7 +133,8 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
if (args.Using is null || !HasComp<SharpComponent>(args.Using))
|
if (args.Using is null || !HasComp<SharpComponent>(args.Using))
|
||||||
{
|
{
|
||||||
disabled = true;
|
disabled = true;
|
||||||
message = Loc.GetString("butcherable-need-knife");
|
message = Loc.GetString("butcherable-need-knife",
|
||||||
|
("target", uid));
|
||||||
}
|
}
|
||||||
|
|
||||||
InteractionVerb verb = new()
|
InteractionVerb verb = new()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
butcherable-knife-butchered-success = You butcher { THE($target) } with { THE($knife) }.
|
butcherable-knife-butchered-success = You butcher { THE($target) } with { THE($knife) }.
|
||||||
butcherable-need-knife = Use a sharp object to butcher this creature.
|
butcherable-need-knife = Use a sharp object to butcher { THE($target) }.
|
||||||
butcherable-mob-isnt-dead = Needs to be dead.
|
butcherable-mob-isnt-dead = Needs to be dead.
|
||||||
butcherable-verb-name = Butcher
|
butcherable-verb-name = Butcher
|
||||||
|
|||||||
Reference in New Issue
Block a user