Added more unit configuration options
This commit is contained in:
@@ -328,7 +328,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
team.data().updateCount(type, 1);
|
team.data().updateCount(type, 1);
|
||||||
|
|
||||||
//check if over unit cap
|
//check if over unit cap
|
||||||
if(count() > cap() && !spawnedByCore && !dead && !state.rules.editor){
|
if(type.useUnitCap && count() > cap() && !spawnedByCore && !dead && !state.rules.editor){
|
||||||
Call.unitCapDeath(self());
|
Call.unitCapDeath(self());
|
||||||
team.data().updateCount(type, -1);
|
team.data().updateCount(type, -1);
|
||||||
}
|
}
|
||||||
@@ -513,7 +513,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if this unit crash landed (was flying), damage stuff in a radius
|
//if this unit crash landed (was flying), damage stuff in a radius
|
||||||
if(type.flying && !spawnedByCore){
|
if(type.flying && !spawnedByCore && !type.createWreck){
|
||||||
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true);
|
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +577,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
dead = true;
|
dead = true;
|
||||||
|
|
||||||
//don't waste time when the unit is already on the ground, just destroy it
|
//don't waste time when the unit is already on the ground, just destroy it
|
||||||
if(!type.flying){
|
if(!type.flying || !type.createWreck){
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(unit == null){ //just clear the unit (is this used?)
|
if(unit == null){ //just clear the unit (is this used?)
|
||||||
player.clearUnit();
|
player.clearUnit();
|
||||||
//make sure it's AI controlled, so players can't overwrite each other
|
//make sure it's AI controlled, so players can't overwrite each other
|
||||||
}else if(unit.isAI() && unit.team == player.team() && !unit.dead){
|
}else if(unit.isAI() && unit.team == player.team() && !unit.dead && unit.type.playerControllable){
|
||||||
if(net.client() && player.isLocal()){
|
if(net.client() && player.isLocal()){
|
||||||
player.justSwitchFrom = player.unit();
|
player.justSwitchFrom = player.unit();
|
||||||
player.justSwitchTo = unit;
|
player.justSwitchTo = unit;
|
||||||
@@ -495,7 +495,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
controlledType = player.unit().type;
|
controlledType = player.unit().type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(controlledType != null && player.dead()){
|
if(controlledType != null && player.dead() && controlledType.playerControllable){
|
||||||
Unit unit = Units.closest(player.team(), player.x, player.y, u -> !u.isPlayer() && u.type == controlledType && !u.dead);
|
Unit unit = Units.closest(player.team(), player.x, player.y, u -> !u.isPlayer() && u.type == controlledType && !u.dead);
|
||||||
|
|
||||||
if(unit != null){
|
if(unit != null){
|
||||||
@@ -509,7 +509,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkUnit(){
|
public void checkUnit(){
|
||||||
if(controlledType != null){
|
if(controlledType != null && controlledType.playerControllable){
|
||||||
Unit unit = Units.closest(player.team(), player.x, player.y, u -> !u.isPlayer() && u.type == controlledType && !u.dead);
|
Unit unit = Units.closest(player.team(), player.x, player.y, u -> !u.isPlayer() && u.type == controlledType && !u.dead);
|
||||||
if(unit == null && controlledType == UnitTypes.block){
|
if(unit == null && controlledType == UnitTypes.block){
|
||||||
unit = world.buildWorld(player.x, player.y) instanceof ControlBlock cont && cont.canControl() ? cont.unit() : null;
|
unit = world.buildWorld(player.x, player.y) instanceof ControlBlock cont && cont.canControl() ? cont.unit() : null;
|
||||||
@@ -1101,7 +1101,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable Unit selectedUnit(){
|
public @Nullable Unit selectedUnit(){
|
||||||
Unit unit = Units.closest(player.team(), Core.input.mouseWorld().x, Core.input.mouseWorld().y, 40f, Unitc::isAI);
|
Unit unit = Units.closest(player.team(), Core.input.mouseWorld().x, Core.input.mouseWorld().y, 40f, u -> u.isAI() && u.type.playerControllable);
|
||||||
if(unit != null){
|
if(unit != null){
|
||||||
unit.hitbox(Tmp.r1);
|
unit.hitbox(Tmp.r1);
|
||||||
Tmp.r1.grow(6f);
|
Tmp.r1.grow(6f);
|
||||||
|
|||||||
@@ -65,7 +65,10 @@ public class UnitType extends UnlockableContent{
|
|||||||
public boolean faceTarget = true, rotateShooting = true, isCounted = true, lowAltitude = false, circleTarget = false;
|
public boolean faceTarget = true, rotateShooting = true, isCounted = true, lowAltitude = false, circleTarget = false;
|
||||||
public boolean canBoost = false;
|
public boolean canBoost = false;
|
||||||
public boolean logicControllable = true;
|
public boolean logicControllable = true;
|
||||||
|
public boolean playerControllable = true;
|
||||||
public boolean allowedInPayloads = true;
|
public boolean allowedInPayloads = true;
|
||||||
|
public boolean createWreck = true;
|
||||||
|
public boolean useUnitCap = true;
|
||||||
public boolean destructibleWreck = true;
|
public boolean destructibleWreck = true;
|
||||||
public float groundLayer = Layer.groundUnit;
|
public float groundLayer = Layer.groundUnit;
|
||||||
public float payloadCapacity = 8;
|
public float payloadCapacity = 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user