From 3cacc3c8c67c9f92320979739e0a4f0682768d8d Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 10 Jul 2025 14:49:12 -0400 Subject: [PATCH] Closes Anuken/Mindustry-Suggestions/issues/5712 --- .../world/blocks/units/UnitAssembler.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/world/blocks/units/UnitAssembler.java b/core/src/mindustry/world/blocks/units/UnitAssembler.java index c165cfb609..18ecf45979 100644 --- a/core/src/mindustry/world/blocks/units/UnitAssembler.java +++ b/core/src/mindustry/world/blocks/units/UnitAssembler.java @@ -509,13 +509,18 @@ public class UnitAssembler extends PayloadBlock{ Vec2 spawn = getUnitSpawn(); consume(); - if(!net.client()){ - var unit = plan.unit.create(team); - if(unit != null && unit.isCommandable() && commandPos != null){ - unit.command().commandPosition(commandPos); - } - unit.set(spawn.x + Mathf.range(0.001f), spawn.y + Mathf.range(0.001f)); - unit.rotation = rotdeg(); + var unit = plan.unit.create(team); + if(unit.isCommandable() && commandPos != null){ + unit.command().commandPosition(commandPos); + } + unit.set(spawn.x + Mathf.range(0.001f), spawn.y + Mathf.range(0.001f)); + unit.rotation = rotdeg(); + var targetBuild = unit.buildOn(); + //'source' is the target build instead of this building; this is because some blocks only accept things from certain angles, and this is a non-standard payload + var payload = new UnitPayload(unit); + if(targetBuild != null && targetBuild.team == team && targetBuild.acceptPayload(targetBuild, payload)){ + targetBuild.handlePayload(targetBuild, payload); + }else if(!net.client()){ unit.add(); Units.notifyUnitSpawn(unit); }