mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-25 10:25:42 +07:00
Crashes fixed
This commit is contained in:
parent
6d7941fba4
commit
0f7799422e
@ -26,7 +26,7 @@ allprojects {
|
||||
appName = 'Mindustry'
|
||||
gdxVersion = '1.9.8'
|
||||
roboVMVersion = '2.3.0'
|
||||
uCoreVersion = 'c28462b127'
|
||||
uCoreVersion = '1d353d76e9'
|
||||
|
||||
getVersionString = {
|
||||
String buildVersion = getBuildVersion()
|
||||
|
@ -33,17 +33,11 @@ import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public abstract class Unit extends DestructibleEntity implements SaveTrait, TargetTrait, SyncTrait, DrawTrait, TeamTrait, CarriableTrait, InventoryTrait{
|
||||
/**
|
||||
* total duration of hit flash effect
|
||||
*/
|
||||
/**Total duration of hit flash effect*/
|
||||
public static final float hitDuration = 9f;
|
||||
/**
|
||||
* Percision divisor of velocity, used when writing. For example a value of '2' would mean the percision is 1/2 = 0.5-size chunks.
|
||||
*/
|
||||
/**Percision divisor of velocity, used when writing. For example a value of '2' would mean the percision is 1/2 = 0.5-size chunks.*/
|
||||
public static final float velocityPercision = 8f;
|
||||
/**
|
||||
* Maximum absolute value of a velocity vector component.
|
||||
*/
|
||||
/**Maximum absolute value of a velocity vector component.*/
|
||||
public static final float maxAbsVelocity = 127f / velocityPercision;
|
||||
|
||||
private static final Vector2 moveVector = new Vector2();
|
||||
|
@ -3,6 +3,7 @@ package io.anuke.mindustry.entities.units;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
@ -11,7 +12,7 @@ public class UnitDrops{
|
||||
private static Item[] dropTable;
|
||||
|
||||
public static void dropItems(BaseUnit unit){
|
||||
if(Vars.itemGroup.size() > maxItems){
|
||||
if(Vars.itemGroup.size() > maxItems || unit.getTeam() != Team.red){
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -217,6 +217,9 @@ public class BuildBlock extends Block{
|
||||
|
||||
if(recipe != null){
|
||||
ItemStack[] requirements = recipe.requirements;
|
||||
if(requirements.length != accumulator.length || totalAccumulator.length != requirements.length){
|
||||
setDeconstruct(previous);
|
||||
}
|
||||
|
||||
for(int i = 0; i < requirements.length; i++){
|
||||
accumulator[i] += Math.min(requirements[i].amount * amount / 2f, requirements[i].amount/2f - totalAccumulator[i]); //add scaled amount progressed to the accumulator
|
||||
|
@ -227,7 +227,7 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
|
||||
protected boolean shouldDistribute(Tile tile, Tile other){
|
||||
return other != null && other.getTeamID() == tile.getTeamID() && other.entity.power.amount / other.block().powerCapacity <= tile.entity.power.amount / powerCapacity &&
|
||||
return other != null && other.entity != null && other.block().hasPower && other.getTeamID() == tile.getTeamID() && other.entity.power.amount / other.block().powerCapacity <= tile.entity.power.amount / powerCapacity &&
|
||||
!(other.block() instanceof PowerGenerator); //do not distribute to power generators
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user