Merge branch 'master' of https://github.com/Anuken/Mindustry into crux-floor

This commit is contained in:
Anuken
2025-07-10 16:45:45 -04:00

View File

@@ -509,13 +509,18 @@ public class UnitAssembler extends PayloadBlock{
Vec2 spawn = getUnitSpawn(); Vec2 spawn = getUnitSpawn();
consume(); consume();
if(!net.client()){ var unit = plan.unit.create(team);
var unit = plan.unit.create(team); if(unit.isCommandable() && commandPos != null){
if(unit != null && unit.isCommandable() && commandPos != null){ unit.command().commandPosition(commandPos);
unit.command().commandPosition(commandPos); }
} unit.set(spawn.x + Mathf.range(0.001f), spawn.y + Mathf.range(0.001f));
unit.set(spawn.x + Mathf.range(0.001f), spawn.y + Mathf.range(0.001f)); unit.rotation = rotdeg();
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(); unit.add();
Units.notifyUnitSpawn(unit); Units.notifyUnitSpawn(unit);
} }