Crash fix
This commit is contained in:
@@ -398,6 +398,8 @@ public class CommandAI extends AIController{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commandPosition(Vec2 pos){
|
public void commandPosition(Vec2 pos){
|
||||||
|
if(pos == null) return;
|
||||||
|
|
||||||
commandPosition(pos, false);
|
commandPosition(pos, false);
|
||||||
if(commandController != null){
|
if(commandController != null){
|
||||||
commandController.commandPosition(pos);
|
commandController.commandPosition(pos);
|
||||||
@@ -405,6 +407,8 @@ public class CommandAI extends AIController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void commandPosition(Vec2 pos, boolean stopWhenInRange){
|
public void commandPosition(Vec2 pos, boolean stopWhenInRange){
|
||||||
|
if(pos == null) return;
|
||||||
|
|
||||||
//this is an allocation, but it's relatively rarely called anyway, and outside mutations must be prevented
|
//this is an allocation, but it's relatively rarely called anyway, and outside mutations must be prevented
|
||||||
targetPos = lastTargetPos = pos.cpy();
|
targetPos = lastTargetPos = pos.cpy();
|
||||||
attackTarget = null;
|
attackTarget = null;
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
|
|
||||||
if(!net.client()){
|
if(!net.client()){
|
||||||
var unit = plan.unit.create(team);
|
var unit = plan.unit.create(team);
|
||||||
if(unit != null && unit.isCommandable()){
|
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));
|
||||||
|
|||||||
Reference in New Issue
Block a user