From 292f771eb1bbd4596df0dcc683744e183b1773f1 Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Sun, 7 Feb 2021 19:27:09 +0100 Subject: [PATCH] Draws team regions during schematic placement (#4588) * Draw team regions during schematic placement * Fall back to sharded for headless * Only draw team regions if the schematic is in-world This seems better than `player != null && req.worldContext` since it wouldn't really result in any visual changes but saves some draw operations. * This seems cleaner Although the order of the 1st and 2nd if argument is debatable for performance reasons. --- core/src/mindustry/world/Block.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 22cb4772ee..3b97a9d0e2 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -428,6 +428,12 @@ public class Block extends UnlockableContent{ TextureRegion reg = getRequestRegion(req, list); Draw.rect(reg, req.drawx(), req.drawy(), !rotate ? 0 : req.rotation * 90); + if(req.worldContext && player != null && teamRegion.found()){ + if(teamRegions[player.team().id] == teamRegion) Draw.color(player.team().color); + Draw.rect(teamRegions[player.team().id], req.drawx(), req.drawy()); + Draw.color(); + } + drawRequestConfig(req, list); }