Time.delta cleanup / Basic mobile input
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:plans,type:arc.struct.Queue<mindustry.entities.units.BuildPlan>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:plans,type:arc.struct.Queue<mindustry.entities.units.BuildPlan>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:plans,type:arc.struct.Queue<mindustry.entities.units.BuildPlan>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:payloads,type:arc.struct.Seq<mindustry.world.blocks.payloads.Payload>,size:-1},{name:plans,type:arc.struct.Queue<mindustry.entities.units.BuildPlan>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:plans,type:arc.struct.Queue<mindustry.entities.units.BuildPlan>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:plans,type:arc.struct.Queue<mindustry.entities.units.BuildPlan>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
1
annotations/src/main/resources/revisions/LegsUnit/1.json
Normal file
1
annotations/src/main/resources/revisions/LegsUnit/1.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
1
annotations/src/main/resources/revisions/MechUnit/1.json
Normal file
1
annotations/src/main/resources/revisions/MechUnit/1.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:ammo,type:float,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -181,7 +181,7 @@ public class BlockIndexer{
|
|||||||
for(int y = -tileRange + ty; y <= tileRange + ty; y++){
|
for(int y = -tileRange + ty; y <= tileRange + ty; y++){
|
||||||
if(!Mathf.within(x * tilesize, y * tilesize, wx, wy, range)) continue;
|
if(!Mathf.within(x * tilesize, y * tilesize, wx, wy, range)) continue;
|
||||||
|
|
||||||
Building other = world.ent(x, y);
|
Building other = world.build(x, y);
|
||||||
|
|
||||||
if(other == null) continue;
|
if(other == null) continue;
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ public class BlockIndexer{
|
|||||||
|
|
||||||
for(int tx = rx * quadrantSize; tx < (rx + 1) * quadrantSize && tx < world.width(); tx++){
|
for(int tx = rx * quadrantSize; tx < (rx + 1) * quadrantSize && tx < world.width(); tx++){
|
||||||
for(int ty = ry * quadrantSize; ty < (ry + 1) * quadrantSize && ty < world.height(); ty++){
|
for(int ty = ry * quadrantSize; ty < (ry + 1) * quadrantSize && ty < world.height(); ty++){
|
||||||
Building e = world.ent(tx, ty);
|
Building e = world.build(tx, ty);
|
||||||
|
|
||||||
if(e == null) continue;
|
if(e == null) continue;
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ public class BlockIndexer{
|
|||||||
outer:
|
outer:
|
||||||
for(int x = quadrantX * quadrantSize; x < world.width() && x < (quadrantX + 1) * quadrantSize; x++){
|
for(int x = quadrantX * quadrantSize; x < world.width() && x < (quadrantX + 1) * quadrantSize; x++){
|
||||||
for(int y = quadrantY * quadrantSize; y < world.height() && y < (quadrantY + 1) * quadrantSize; y++){
|
for(int y = quadrantY * quadrantSize; y < world.height() && y < (quadrantY + 1) * quadrantSize; y++){
|
||||||
Building result = world.ent(x, y);
|
Building result = world.build(x, y);
|
||||||
//when a targetable block is found, mark this quadrant as occupied and stop searching
|
//when a targetable block is found, mark this quadrant as occupied and stop searching
|
||||||
if(result != null && result.team() == team){
|
if(result != null && result.team() == team){
|
||||||
bits.set(quadrantX, quadrantY);
|
bits.set(quadrantX, quadrantY);
|
||||||
|
|||||||
@@ -167,12 +167,12 @@ public class Pathfinder implements Runnable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tile getTargetTile(Tile tile, Team team, Position target){
|
public @Nullable Tile getTargetTile(Tile tile, Team team, Position target){
|
||||||
return getTargetTile(tile, team, getTarget(target));
|
return getTargetTile(tile, team, getTarget(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets next tile to travel to. Main thread only. */
|
/** Gets next tile to travel to. Main thread only. */
|
||||||
public Tile getTargetTile(Tile tile, Team team, PathTarget target){
|
public @Nullable Tile getTargetTile(Tile tile, Team team, PathTarget target){
|
||||||
if(tile == null) return null;
|
if(tile == null) return null;
|
||||||
|
|
||||||
if(fieldMap[team.id] == null){
|
if(fieldMap[team.id] == null){
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class BuilderAI extends AIController{
|
|||||||
|
|
||||||
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / 100f, -1f, 1f);
|
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / 100f, -1f, 1f);
|
||||||
|
|
||||||
vec.setLength(unit.type().speed * Time.delta() * length);
|
vec.setLength(unit.type().speed * Time.delta * length);
|
||||||
if(length < -0.5f){
|
if(length < -0.5f){
|
||||||
vec.rotate(180f);
|
vec.rotate(180f);
|
||||||
}else if(length < 0){
|
}else if(length < 0){
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class FlyingAI extends AIController{
|
|||||||
vec.rotate((circleLength - vec.len()) / circleLength * 180f);
|
vec.rotate((circleLength - vec.len()) / circleLength * 180f);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec.setLength(speed * Time.delta());
|
vec.setLength(speed * Time.delta);
|
||||||
|
|
||||||
unit.moveAt(vec);
|
unit.moveAt(vec);
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ public class FlyingAI extends AIController{
|
|||||||
|
|
||||||
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / 100f, -1f, 1f);
|
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / 100f, -1f, 1f);
|
||||||
|
|
||||||
vec.setLength(unit.type().speed * Time.delta() * length);
|
vec.setLength(unit.type().speed * Time.delta * length);
|
||||||
if(length < -0.5f){
|
if(length < -0.5f){
|
||||||
vec.rotate(180f);
|
vec.rotate(180f);
|
||||||
}else if(length < 0){
|
}else if(length < 0){
|
||||||
@@ -95,7 +95,7 @@ public class FlyingAI extends AIController{
|
|||||||
vec.setAngle(Mathf.slerpDelta(unit.vel().angle(), vec.angle(), 0.6f));
|
vec.setAngle(Mathf.slerpDelta(unit.vel().angle(), vec.angle(), 0.6f));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec.setLength(unit.type().speed * Time.delta());
|
vec.setLength(unit.type().speed * Time.delta);
|
||||||
|
|
||||||
unit.moveAt(vec);
|
unit.moveAt(vec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,10 +136,10 @@ public class MusicControl{
|
|||||||
silenced = false;
|
silenced = false;
|
||||||
}else if(current == music && music != null){
|
}else if(current == music && music != null){
|
||||||
//fade in the playing track
|
//fade in the playing track
|
||||||
fade = Mathf.clamp(fade + Time.delta()/finTime);
|
fade = Mathf.clamp(fade + Time.delta /finTime);
|
||||||
}else if(current != null){
|
}else if(current != null){
|
||||||
//fade out the current track
|
//fade out the current track
|
||||||
fade = Mathf.clamp(fade - Time.delta()/foutTime);
|
fade = Mathf.clamp(fade - Time.delta /foutTime);
|
||||||
|
|
||||||
if(fade <= 0.01f){
|
if(fade <= 0.01f){
|
||||||
//stop current track when it hits 0 volume
|
//stop current track when it hits 0 volume
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ public class SoundLoop{
|
|||||||
}else{
|
}else{
|
||||||
//fade the sound in or out
|
//fade the sound in or out
|
||||||
if(play){
|
if(play){
|
||||||
volume = Mathf.clamp(volume + fadeSpeed * Time.delta());
|
volume = Mathf.clamp(volume + fadeSpeed * Time.delta);
|
||||||
}else{
|
}else{
|
||||||
volume = Mathf.clamp(volume - fadeSpeed * Time.delta());
|
volume = Mathf.clamp(volume - fadeSpeed * Time.delta);
|
||||||
if(volume <= 0.001f){
|
if(volume <= 0.001f){
|
||||||
sound.stop(id);
|
sound.stop(id);
|
||||||
id = -1;
|
id = -1;
|
||||||
|
|||||||
@@ -416,18 +416,18 @@ public class Bullets implements ContentList{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Bullet b){
|
public void update(Bullet b){
|
||||||
if(Mathf.chance(0.04 * Time.delta())){
|
if(Mathf.chance(0.04 * Time.delta)){
|
||||||
Tile tile = world.tileWorld(b.x, b.y);
|
Tile tile = world.tileWorld(b.x, b.y);
|
||||||
if(tile != null){
|
if(tile != null){
|
||||||
Fires.create(tile);
|
Fires.create(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Mathf.chance(0.1 * Time.delta())){
|
if(Mathf.chance(0.1 * Time.delta)){
|
||||||
Fx.fireballsmoke.at(b.x, b.y);
|
Fx.fireballsmoke.at(b.x, b.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Mathf.chance(0.1 * Time.delta())){
|
if(Mathf.chance(0.1 * Time.delta)){
|
||||||
Fx.ballfire.at(b.x, b.y);
|
Fx.ballfire.at(b.x, b.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,14 +416,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
//just a regular reminder
|
//just a regular reminder
|
||||||
if(!OS.prop("user.name").equals("anuke") && !OS.hasEnv("iknowwhatimdoing")){
|
if(!OS.prop("user.name").equals("anuke") && !OS.hasEnv("iknowwhatimdoing")){
|
||||||
if(mobile){
|
ui.showInfo("[scarlet]6.0 is not supposed to be played.[] Go do something else.");
|
||||||
Runnable[] run = {null};
|
|
||||||
run[0] = () -> {
|
|
||||||
ui.showInfo("[scarlet]6.0 doesn't work on mobile.[] Don't play it.", run[0]);
|
|
||||||
};
|
|
||||||
}else{
|
|
||||||
ui.showInfo("[scarlet]6.0 is not supposed to be played.[] Go do something else.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//play tutorial on stop
|
//play tutorial on stop
|
||||||
@@ -449,7 +442,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
if(countdown[0] <= 0){
|
if(countdown[0] <= 0){
|
||||||
exit.run();
|
exit.run();
|
||||||
}
|
}
|
||||||
return Core.bundle.format("uiscale.reset", (int)((countdown[0] -= Time.delta()) / 60f));
|
return Core.bundle.format("uiscale.reset", (int)((countdown[0] -= Time.delta) / 60f));
|
||||||
}).pad(10f).expand().center();
|
}).pad(10f).expand().center();
|
||||||
|
|
||||||
dialog.buttons.defaults().size(200f, 60f);
|
dialog.buttons.defaults().size(200f, 60f);
|
||||||
@@ -486,7 +479,6 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
music.update();
|
music.update();
|
||||||
loops.update();
|
loops.update();
|
||||||
Time.updateGlobal();
|
|
||||||
|
|
||||||
if(Core.input.keyTap(Binding.fullscreen)){
|
if(Core.input.keyTap(Binding.fullscreen)){
|
||||||
boolean full = settings.getBool("fullscreen");
|
boolean full = settings.getBool("fullscreen");
|
||||||
@@ -528,6 +520,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
//this runs in the menu
|
||||||
if(!state.isPaused()){
|
if(!state.isPaused()){
|
||||||
Time.update();
|
Time.update();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public class Logic implements ApplicationListener{
|
|||||||
|
|
||||||
for(WeatherEntry entry : state.rules.weather){
|
for(WeatherEntry entry : state.rules.weather){
|
||||||
//update cooldown
|
//update cooldown
|
||||||
entry.cooldown -= Time.delta();
|
entry.cooldown -= Time.delta;
|
||||||
|
|
||||||
//create new event when not active
|
//create new event when not active
|
||||||
if(entry.cooldown < 0 && !entry.weather.isActive()){
|
if(entry.cooldown < 0 && !entry.weather.isActive()){
|
||||||
@@ -356,7 +356,7 @@ public class Logic implements ApplicationListener{
|
|||||||
|
|
||||||
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
|
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
|
||||||
if(!isWaitingWave()){
|
if(!isWaitingWave()){
|
||||||
state.wavetime = Math.max(state.wavetime - Time.delta(), 0);
|
state.wavetime = Math.max(state.wavetime - Time.delta, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
}else if(!connecting){
|
}else if(!connecting){
|
||||||
net.disconnect();
|
net.disconnect();
|
||||||
}else{ //...must be connecting
|
}else{ //...must be connecting
|
||||||
timeoutTime += Time.delta();
|
timeoutTime += Time.delta;
|
||||||
if(timeoutTime > dataTimeout){
|
if(timeoutTime > dataTimeout){
|
||||||
Log.err("Failed to load data!");
|
Log.err("Failed to load data!");
|
||||||
ui.loadfrag.hide();
|
ui.loadfrag.hide();
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
camerascale = Mathf.lerpDelta(camerascale, targetscale, 0.1f);
|
camerascale = Mathf.lerpDelta(camerascale, targetscale, 0.1f);
|
||||||
|
|
||||||
if(landTime > 0){
|
if(landTime > 0){
|
||||||
landTime -= Time.delta();
|
landTime -= Time.delta;
|
||||||
landscale = Interp.pow5In.apply(minZoomScl, Scl.scl(4f), 1f - landTime / Fx.coreLand.lifetime);
|
landscale = Interp.pow5In.apply(minZoomScl, Scl.scl(4f), 1f - landTime / Fx.coreLand.lifetime);
|
||||||
camerascale = landscale;
|
camerascale = landscale;
|
||||||
weatherAlpha = 0f;
|
weatherAlpha = 0f;
|
||||||
@@ -172,8 +172,8 @@ public class Renderer implements ApplicationListener{
|
|||||||
if(shaketime > 0){
|
if(shaketime > 0){
|
||||||
float intensity = shakeIntensity * (settings.getInt("screenshake", 4) / 4f) * scale;
|
float intensity = shakeIntensity * (settings.getInt("screenshake", 4) / 4f) * scale;
|
||||||
camera.position.add(Mathf.range(intensity), Mathf.range(intensity));
|
camera.position.add(Mathf.range(intensity), Mathf.range(intensity));
|
||||||
shakeIntensity -= 0.25f * Time.delta();
|
shakeIntensity -= 0.25f * Time.delta;
|
||||||
shaketime -= Time.delta();
|
shaketime -= Time.delta;
|
||||||
shakeIntensity = Mathf.clamp(shakeIntensity, 0f, 100f);
|
shakeIntensity = Mathf.clamp(shakeIntensity, 0f, 100f);
|
||||||
}else{
|
}else{
|
||||||
shakeIntensity = 0f;
|
shakeIntensity = 0f;
|
||||||
|
|||||||
@@ -110,14 +110,14 @@ public class World{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Building ent(int x, int y){
|
public Building build(int x, int y){
|
||||||
Tile tile = tile(x, y);
|
Tile tile = tile(x, y);
|
||||||
if(tile == null) return null;
|
if(tile == null) return null;
|
||||||
return tile.build;
|
return tile.build;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Building ent(int pos){
|
public Building build(int pos){
|
||||||
Tile tile = tile(pos);
|
Tile tile = tile(pos);
|
||||||
if(tile == null) return null;
|
if(tile == null) return null;
|
||||||
return tile.build;
|
return tile.build;
|
||||||
@@ -134,8 +134,8 @@ public class World{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Building entWorld(float x, float y){
|
public Building buildWorld(float x, float y){
|
||||||
return ent(Math.round(x / tilesize), Math.round(y / tilesize));
|
return build(Math.round(x / tilesize), Math.round(y / tilesize));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int toTile(float coord){
|
public int toTile(float coord){
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
m.button("-", () -> {
|
m.button("-", () -> {
|
||||||
}).update(t -> {
|
}).update(t -> {
|
||||||
if(t.getClickListener().isPressed()){
|
if(t.getClickListener().isPressed()){
|
||||||
updateTimer += Time.delta();
|
updateTimer += Time.delta;
|
||||||
if(updateTimer >= updatePeriod){
|
if(updateTimer >= updatePeriod){
|
||||||
start = Math.max(start - 1, 0);
|
start = Math.max(start - 1, 0);
|
||||||
updateTimer = 0f;
|
updateTimer = 0f;
|
||||||
@@ -118,7 +118,7 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
m.button("+", () -> {
|
m.button("+", () -> {
|
||||||
}).update(t -> {
|
}).update(t -> {
|
||||||
if(t.getClickListener().isPressed()){
|
if(t.getClickListener().isPressed()){
|
||||||
updateTimer += Time.delta();
|
updateTimer += Time.delta;
|
||||||
if(updateTimer >= updatePeriod){
|
if(updateTimer >= updatePeriod){
|
||||||
start++;
|
start++;
|
||||||
updateTimer = 0f;
|
updateTimer = 0f;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class Damage{
|
|||||||
collidedBlocks.clear();
|
collidedBlocks.clear();
|
||||||
tr.trns(angle, length);
|
tr.trns(angle, length);
|
||||||
Intc2 collider = (cx, cy) -> {
|
Intc2 collider = (cx, cy) -> {
|
||||||
Building tile = world.ent(cx, cy);
|
Building tile = world.build(cx, cy);
|
||||||
if(tile != null && !collidedBlocks.contains(tile.pos()) && tile.team() != team && tile.collide(hitter)){
|
if(tile != null && !collidedBlocks.contains(tile.pos()) && tile.team() != team && tile.collide(hitter)){
|
||||||
tile.collision(hitter);
|
tile.collision(hitter);
|
||||||
collidedBlocks.add(tile.pos());
|
collidedBlocks.add(tile.pos());
|
||||||
@@ -159,7 +159,7 @@ public class Damage{
|
|||||||
tmpBuilding = null;
|
tmpBuilding = null;
|
||||||
|
|
||||||
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
|
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
|
||||||
Building tile = world.ent(cx, cy);
|
Building tile = world.build(cx, cy);
|
||||||
if(tile != null && tile.team != hitter.team){
|
if(tile != null && tile.team != hitter.team){
|
||||||
tmpBuilding = tile;
|
tmpBuilding = tile;
|
||||||
//TODO return tile
|
//TODO return tile
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ public class Fires{
|
|||||||
public static void extinguish(Tile tile, float intensity){
|
public static void extinguish(Tile tile, float intensity){
|
||||||
if(tile != null && map.containsKey(tile.pos())){
|
if(tile != null && map.containsKey(tile.pos())){
|
||||||
Fire fire = map.get(tile.pos());
|
Fire fire = map.get(tile.pos());
|
||||||
fire.time(fire.time() + intensity * Time.delta());
|
fire.time(fire.time + intensity * Time.delta);
|
||||||
Fx.steam.at(fire);
|
Fx.steam.at(fire);
|
||||||
if(fire.time() >= fire.lifetime()){
|
if(fire.time >= fire.lifetime){
|
||||||
Events.fire(Trigger.fireExtinguish);
|
Events.fire(Trigger.fireExtinguish);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public class Predict{
|
|||||||
* @return the intercept location
|
* @return the intercept location
|
||||||
*/
|
*/
|
||||||
public static Vec2 intercept(float srcx, float srcy, float dstx, float dsty, float dstvx, float dstvy, float v){
|
public static Vec2 intercept(float srcx, float srcy, float dstx, float dsty, float dstvx, float dstvy, float v){
|
||||||
dstvx /= Time.delta();
|
dstvx /= Time.delta;
|
||||||
dstvy /= Time.delta();
|
dstvy /= Time.delta;
|
||||||
float tx = dstx - srcx,
|
float tx = dstx - srcx,
|
||||||
ty = dsty - srcy;
|
ty = dsty - srcy;
|
||||||
|
|
||||||
@@ -58,8 +58,8 @@ public class Predict{
|
|||||||
ddy += ((Hitboxc)dst).deltaY();
|
ddy += ((Hitboxc)dst).deltaY();
|
||||||
}
|
}
|
||||||
if(src instanceof Hitboxc){
|
if(src instanceof Hitboxc){
|
||||||
ddx -= ((Hitboxc)src).deltaX()/(Time.delta());
|
ddx -= ((Hitboxc)src).deltaX()/(Time.delta);
|
||||||
ddy -= ((Hitboxc)src).deltaY()/(Time.delta());
|
ddy -= ((Hitboxc)src).deltaY()/(Time.delta);
|
||||||
}
|
}
|
||||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), ddx, ddy, v);
|
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), ddx, ddy, v);
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ public class Predict{
|
|||||||
* See {@link #intercept(float, float, float, float, float, float, float)}.
|
* See {@link #intercept(float, float, float, float, float, float, float)}.
|
||||||
*/
|
*/
|
||||||
public static Vec2 intercept(Hitboxc src, Hitboxc dst, float v){
|
public static Vec2 intercept(Hitboxc src, Hitboxc dst, float v){
|
||||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), dst.deltaX() - src.deltaX()/(2f*Time.delta()), dst.deltaY() - src.deltaX()/(2f*Time.delta()), v);
|
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), dst.deltaX() - src.deltaX()/(2f* Time.delta), dst.deltaY() - src.deltaX()/(2f* Time.delta), v);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vec2 quad(float a, float b, float c){
|
private static Vec2 quad(float a, float b, float c){
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class ForceFieldAbility implements Ability{
|
|||||||
@Override
|
@Override
|
||||||
public void update(Unit unit){
|
public void update(Unit unit){
|
||||||
if(unit.shield < max){
|
if(unit.shield < max){
|
||||||
unit.shield += Time.delta() * regen;
|
unit.shield += Time.delta * regen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(unit.shield > 0){
|
if(unit.shield > 0){
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class HealFieldAbility implements Ability{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Unit unit){
|
public void update(Unit unit){
|
||||||
unit.timer1 += Time.delta();
|
unit.timer1 += Time.delta;
|
||||||
|
|
||||||
if(unit.timer1 >= reload){
|
if(unit.timer1 >= reload){
|
||||||
wasHealed = false;
|
wasHealed = false;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class ShieldFieldAbility implements Ability{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Unit unit){
|
public void update(Unit unit){
|
||||||
unit.timer1 += Time.delta();
|
unit.timer1 += Time.delta;
|
||||||
|
|
||||||
if(unit.timer1 >= reload){
|
if(unit.timer1 >= reload){
|
||||||
applied = false;
|
applied = false;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class StatusFieldAbility implements Ability{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Unit unit){
|
public void update(Unit unit){
|
||||||
unit.timer2 += Time.delta();
|
unit.timer2 += Time.delta;
|
||||||
|
|
||||||
if(unit.timer2 >= reload){
|
if(unit.timer2 >= reload){
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public abstract class BulletType extends Content{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(weaveMag > 0){
|
if(weaveMag > 0){
|
||||||
b.vel.rotate(Mathf.sin(Mathf.randomSeed(b.id, 10f) + b.time, weaveScale, weaveMag) * Time.delta());
|
b.vel.rotate(Mathf.sin(Mathf.randomSeed(b.id, 10f) + b.time, weaveScale, weaveMag) * Time.delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trailChance > 0){
|
if(trailChance > 0){
|
||||||
@@ -241,7 +241,7 @@ public abstract class BulletType extends Content{
|
|||||||
bullet.owner = owner;
|
bullet.owner = owner;
|
||||||
bullet.team = team;
|
bullet.team = team;
|
||||||
bullet.vel.trns(angle, speed * velocityScl);
|
bullet.vel.trns(angle, speed * velocityScl);
|
||||||
bullet.set(x - bullet.vel.x * Time.delta(), y - bullet.vel.y * Time.delta());
|
bullet.set(x - bullet.vel.x * Time.delta, y - bullet.vel.y * Time.delta);
|
||||||
bullet.lifetime = lifetime * lifetimeScl;
|
bullet.lifetime = lifetime * lifetimeScl;
|
||||||
bullet.data = data;
|
bullet.data = data;
|
||||||
bullet.drag = drag;
|
bullet.drag = drag;
|
||||||
|
|||||||
@@ -114,9 +114,9 @@ abstract class BuilderComp implements Unitc{
|
|||||||
BuildEntity entity = tile.bc();
|
BuildEntity entity = tile.bc();
|
||||||
|
|
||||||
if(current.breaking){
|
if(current.breaking){
|
||||||
entity.deconstruct(base(), core, 1f / entity.buildCost * Time.delta() * type().buildSpeed * state.rules.buildSpeedMultiplier);
|
entity.deconstruct(base(), core, 1f / entity.buildCost * Time.delta * type().buildSpeed * state.rules.buildSpeedMultiplier);
|
||||||
}else{
|
}else{
|
||||||
if(entity.construct(base(), core, 1f / entity.buildCost * Time.delta() * type().buildSpeed * state.rules.buildSpeedMultiplier, current.hasConfig)){
|
if(entity.construct(base(), core, 1f / entity.buildCost * Time.delta * type().buildSpeed * state.rules.buildSpeedMultiplier, current.hasConfig)){
|
||||||
if(current.hasConfig){
|
if(current.hasConfig){
|
||||||
Call.tileConfig(null, tile.build, current.config);
|
Call.tileConfig(null, tile.build, current.config);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,14 +201,14 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Building nearby(int dx, int dy){
|
public Building nearby(int dx, int dy){
|
||||||
return world.ent(tile.x + dx, tile.y + dy);
|
return world.build(tile.x + dx, tile.y + dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Building nearby(int rotation){
|
public Building nearby(int rotation){
|
||||||
if(rotation == 0) return world.ent(tile.x + 1, tile.y);
|
if(rotation == 0) return world.build(tile.x + 1, tile.y);
|
||||||
if(rotation == 1) return world.ent(tile.x, tile.y + 1);
|
if(rotation == 1) return world.build(tile.x, tile.y + 1);
|
||||||
if(rotation == 2) return world.ent(tile.x - 1, tile.y);
|
if(rotation == 2) return world.build(tile.x - 1, tile.y);
|
||||||
if(rotation == 3) return world.ent(tile.x, tile.y - 1);
|
if(rotation == 3) return world.build(tile.x, tile.y - 1);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
|
|
||||||
/** Scaled delta. */
|
/** Scaled delta. */
|
||||||
public float delta(){
|
public float delta(){
|
||||||
return Time.delta() * timeScale;
|
return Time.delta * timeScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Efficiency * delta. */
|
/** Efficiency * delta. */
|
||||||
@@ -305,7 +305,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
|
|
||||||
/** Call when nothing is happening to the entity. This increments the internal sleep timer. */
|
/** Call when nothing is happening to the entity. This increments the internal sleep timer. */
|
||||||
public void sleep(){
|
public void sleep(){
|
||||||
sleepTime += Time.delta();
|
sleepTime += Time.delta;
|
||||||
if(!sleeping && sleepTime >= timeToSleep){
|
if(!sleeping && sleepTime >= timeToSleep){
|
||||||
remove();
|
remove();
|
||||||
sleeping = true;
|
sleeping = true;
|
||||||
@@ -518,14 +518,14 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
|
|
||||||
Liquid other = next.liquids().current();
|
Liquid other = next.liquids().current();
|
||||||
if((other.flammability > 0.3f && liquid.temperature > 0.7f) || (liquid.flammability > 0.3f && other.temperature > 0.7f)){
|
if((other.flammability > 0.3f && liquid.temperature > 0.7f) || (liquid.flammability > 0.3f && other.temperature > 0.7f)){
|
||||||
damage(1 * Time.delta());
|
damage(1 * Time.delta);
|
||||||
next.damage(1 * Time.delta());
|
next.damage(1 * Time.delta);
|
||||||
if(Mathf.chance(0.1 * Time.delta())){
|
if(Mathf.chance(0.1 * Time.delta)){
|
||||||
Fx.fire.at(fx, fy);
|
Fx.fire.at(fx, fy);
|
||||||
}
|
}
|
||||||
}else if((liquid.temperature > 0.7f && other.temperature < 0.55f) || (other.temperature > 0.7f && liquid.temperature < 0.55f)){
|
}else if((liquid.temperature > 0.7f && other.temperature < 0.55f) || (other.temperature > 0.7f && liquid.temperature < 0.55f)){
|
||||||
liquids.remove(liquid, Math.min(liquids.get(liquid), 0.7f * Time.delta()));
|
liquids.remove(liquid, Math.min(liquids.get(liquid), 0.7f * Time.delta));
|
||||||
if(Mathf.chance(0.2f * Time.delta())){
|
if(Mathf.chance(0.2f * Time.delta)){
|
||||||
Fx.steam.at(fx, fy);
|
Fx.steam.at(fx, fy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -797,7 +797,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
int range = 10;
|
int range = 10;
|
||||||
tempTiles.clear();
|
tempTiles.clear();
|
||||||
Geometry.circle(tileX(), tileY(), range, (x, y) -> {
|
Geometry.circle(tileX(), tileY(), range, (x, y) -> {
|
||||||
Building other = world.ent(x, y);
|
Building other = world.build(x, y);
|
||||||
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, base()) && !PowerNode.insulated(other, base())
|
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, base()) && !PowerNode.insulated(other, base())
|
||||||
&& !other.proximity().contains(this.<Building>base()) &&
|
&& !other.proximity().contains(this.<Building>base()) &&
|
||||||
!(block.outputsPower && proximity.contains(p -> p.power() != null && p.power().graph == other.power().graph))){
|
!(block.outputsPower && proximity.contains(p -> p.power() != null && p.power().graph == other.power().graph))){
|
||||||
@@ -926,60 +926,63 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
|
|
||||||
table.row();
|
table.row();
|
||||||
|
|
||||||
table.table(bars -> {
|
//only display everything else if the team is the same
|
||||||
bars.defaults().growX().height(18f).pad(4);
|
if(team == player.team()){
|
||||||
|
table.table(bars -> {
|
||||||
|
bars.defaults().growX().height(18f).pad(4);
|
||||||
|
|
||||||
displayBars(bars);
|
displayBars(bars);
|
||||||
}).growX();
|
}).growX();
|
||||||
table.row();
|
table.row();
|
||||||
table.table(this::displayConsumption).growX();
|
table.table(this::displayConsumption).growX();
|
||||||
|
|
||||||
boolean displayFlow = (block.category == Category.distribution || block.category == Category.liquid) && Core.settings.getBool("flow");
|
boolean displayFlow = (block.category == Category.distribution || block.category == Category.liquid) && Core.settings.getBool("flow");
|
||||||
|
|
||||||
if(displayFlow){
|
if(displayFlow){
|
||||||
String ps = " " + StatUnit.perSecond.localized();
|
String ps = " " + StatUnit.perSecond.localized();
|
||||||
|
|
||||||
if(items != null){
|
if(items != null){
|
||||||
table.row();
|
table.row();
|
||||||
table.left();
|
table.left();
|
||||||
table.table(l -> {
|
table.table(l -> {
|
||||||
Bits current = new Bits();
|
Bits current = new Bits();
|
||||||
|
|
||||||
Runnable rebuild = () -> {
|
Runnable rebuild = () -> {
|
||||||
l.clearChildren();
|
l.clearChildren();
|
||||||
|
l.left();
|
||||||
|
for(Item item : content.items()){
|
||||||
|
if(items.hasFlowItem(item)){
|
||||||
|
l.image(item.icon(Cicon.small)).padRight(3f);
|
||||||
|
l.label(() -> items.getFlowRate(item) < 0 ? "..." : Strings.fixed(items.getFlowRate(item), 1) + ps).color(Color.lightGray);
|
||||||
|
l.row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
rebuild.run();
|
||||||
|
l.update(() -> {
|
||||||
|
for(Item item : content.items()){
|
||||||
|
if(items.hasFlowItem(item) && !current.get(item.id)){
|
||||||
|
current.set(item.id);
|
||||||
|
rebuild.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).left();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(liquids != null){
|
||||||
|
table.row();
|
||||||
|
table.table(l -> {
|
||||||
l.left();
|
l.left();
|
||||||
for(Item item : content.items()){
|
l.image(() -> liquids.current().icon(Cicon.small)).padRight(3f);
|
||||||
if(items.hasFlowItem(item)){
|
l.label(() -> liquids.getFlowRate() < 0 ? "..." : Strings.fixed(liquids.getFlowRate(), 2) + ps).color(Color.lightGray);
|
||||||
l.image(item.icon(Cicon.small)).padRight(3f);
|
|
||||||
l.label(() -> items.getFlowRate(item) < 0 ? "..." : Strings.fixed(items.getFlowRate(item), 1) + ps).color(Color.lightGray);
|
|
||||||
l.row();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
rebuild.run();
|
|
||||||
l.update(() -> {
|
|
||||||
for(Item item : content.items()){
|
|
||||||
if(items.hasFlowItem(item) && !current.get(item.id)){
|
|
||||||
current.set(item.id);
|
|
||||||
rebuild.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}).left();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(liquids != null){
|
table.marginBottom(-5);
|
||||||
table.row();
|
|
||||||
table.table(l -> {
|
|
||||||
l.left();
|
|
||||||
l.image(() -> liquids.current().icon(Cicon.small)).padRight(3f);
|
|
||||||
l.label(() -> liquids.getFlowRate() < 0 ? "..." : Strings.fixed(liquids.getFlowRate(), 2) + ps).color(Color.lightGray);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
table.marginBottom(-5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayConsumption(Table table){
|
public void displayConsumption(Table table){
|
||||||
@@ -1065,7 +1068,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
|
|
||||||
Point2[] nearby = Edges.getEdges(block.size);
|
Point2[] nearby = Edges.getEdges(block.size);
|
||||||
for(Point2 point : nearby){
|
for(Point2 point : nearby){
|
||||||
Building other = world.ent(tile.x + point.x, tile.y + point.y);
|
Building other = world.build(tile.x + point.x, tile.y + point.y);
|
||||||
//remove this tile from all nearby tile's proximities
|
//remove this tile from all nearby tile's proximities
|
||||||
if(other != null){
|
if(other != null){
|
||||||
tmpTiles.add(other);
|
tmpTiles.add(other);
|
||||||
@@ -1084,7 +1087,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
|
|
||||||
Point2[] nearby = Edges.getEdges(block.size);
|
Point2[] nearby = Edges.getEdges(block.size);
|
||||||
for(Point2 point : nearby){
|
for(Point2 point : nearby){
|
||||||
Building other = world.ent(tile.x + point.x, tile.y + point.y);
|
Building other = world.build(tile.x + point.x, tile.y + point.y);
|
||||||
|
|
||||||
if(other == null || !(other.tile.interactable(team))) continue;
|
if(other == null || !(other.tile.interactable(team))) continue;
|
||||||
|
|
||||||
@@ -1175,7 +1178,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
@Final
|
@Final
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
timeScaleDuration -= Time.delta();
|
timeScaleDuration -= Time.delta;
|
||||||
if(timeScaleDuration <= 0f || !block.canOverdrive){
|
if(timeScaleDuration <= 0f || !block.canOverdrive){
|
||||||
timeScale = 1f;
|
timeScale = 1f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
|||||||
if(type.collidesTiles && type.collides && type.collidesGround){
|
if(type.collidesTiles && type.collides && type.collidesGround){
|
||||||
world.raycastEach(world.toTile(lastX()), world.toTile(lastY()), tileX(), tileY(), (x, y) -> {
|
world.raycastEach(world.toTile(lastX()), world.toTile(lastY()), tileX(), tileY(), (x, y) -> {
|
||||||
|
|
||||||
Building tile = world.ent(x, y);
|
Building tile = world.build(x, y);
|
||||||
if(tile == null) return false;
|
if(tile == null) return false;
|
||||||
|
|
||||||
if(tile.collide(base()) && type.collides(base(), tile) && !tile.dead() && (type.collidesTeam || tile.team != team)){
|
if(tile.collide(base()) && type.collides(base(), tile) && !tile.dead() && (type.collidesTeam || tile.team != team)){
|
||||||
|
|||||||
@@ -26,19 +26,19 @@ abstract class FireComp implements Timedc, Posc, Firec{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
if(Mathf.chance(0.1 * Time.delta())){
|
if(Mathf.chance(0.1 * Time.delta)){
|
||||||
Fx.fire.at(x + Mathf.range(4f), y + Mathf.range(4f));
|
Fx.fire.at(x + Mathf.range(4f), y + Mathf.range(4f));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Mathf.chance(0.05 * Time.delta())){
|
if(Mathf.chance(0.05 * Time.delta)){
|
||||||
Fx.fireSmoke.at(x + Mathf.range(4f), y + Mathf.range(4f));
|
Fx.fireSmoke.at(x + Mathf.range(4f), y + Mathf.range(4f));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Mathf.chance(0.001 * Time.delta())){
|
if(Mathf.chance(0.001 * Time.delta)){
|
||||||
Sounds.fire.at(this);
|
Sounds.fire.at(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
time = Mathf.clamp(time + Time.delta(), 0, lifetime());
|
time = Mathf.clamp(time + Time.delta, 0, lifetime());
|
||||||
|
|
||||||
if(Vars.net.client()){
|
if(Vars.net.client()){
|
||||||
return;
|
return;
|
||||||
@@ -55,7 +55,7 @@ abstract class FireComp implements Timedc, Posc, Firec{
|
|||||||
float flammability = baseFlammability + puddleFlammability;
|
float flammability = baseFlammability + puddleFlammability;
|
||||||
|
|
||||||
if(!damage && flammability <= 0){
|
if(!damage && flammability <= 0){
|
||||||
time += Time.delta() * 8;
|
time += Time.delta * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(baseFlammability < 0 || block != tile.block()){
|
if(baseFlammability < 0 || block != tile.block()){
|
||||||
@@ -64,20 +64,20 @@ abstract class FireComp implements Timedc, Posc, Firec{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(damage){
|
if(damage){
|
||||||
lifetime += Mathf.clamp(flammability / 8f, 0f, 0.6f) * Time.delta();
|
lifetime += Mathf.clamp(flammability / 8f, 0f, 0.6f) * Time.delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flammability > 1f && Mathf.chance(spreadChance * Time.delta() * Mathf.clamp(flammability / 5f, 0.3f, 2f))){
|
if(flammability > 1f && Mathf.chance(spreadChance * Time.delta * Mathf.clamp(flammability / 5f, 0.3f, 2f))){
|
||||||
Point2 p = Geometry.d4[Mathf.random(3)];
|
Point2 p = Geometry.d4[Mathf.random(3)];
|
||||||
Tile other = world.tile(tile.x + p.x, tile.y + p.y);
|
Tile other = world.tile(tile.x + p.x, tile.y + p.y);
|
||||||
Fires.create(other);
|
Fires.create(other);
|
||||||
|
|
||||||
if(Mathf.chance(fireballChance * Time.delta() * Mathf.clamp(flammability / 10f))){
|
if(Mathf.chance(fireballChance * Time.delta * Mathf.clamp(flammability / 10f))){
|
||||||
Bullets.fireball.createNet(Team.derelict, x, y, Mathf.random(360f), -1f, 1, 1);
|
Bullets.fireball.createNet(Team.derelict, x, y, Mathf.random(360f), -1f, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Mathf.chance(0.1 * Time.delta())){
|
if(Mathf.chance(0.1 * Time.delta)){
|
||||||
Puddlec p = Puddles.get(tile);
|
Puddlec p = Puddles.get(tile);
|
||||||
puddleFlammability = p != null ? p.getFlammability() / 3f : 0;
|
puddleFlammability = p != null ? p.getFlammability() / 3f : 0;
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wobble(){
|
void wobble(){
|
||||||
x += Mathf.sin(Time.time() + id() * 99, 25f, 0.05f) * Time.delta() * elevation;
|
x += Mathf.sin(Time.time() + id() * 99, 25f, 0.05f) * Time.delta * elevation;
|
||||||
y += Mathf.cos(Time.time() + id() * 99, 25f, 0.05f) * Time.delta() * elevation;
|
y += Mathf.cos(Time.time() + id() * 99, 25f, 0.05f) * Time.delta * elevation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveAt(Vec2 vector, float acceleration){
|
void moveAt(Vec2 vector, float acceleration){
|
||||||
@@ -81,7 +81,7 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(canDrown() && floor.isLiquid && floor.drownTime > 0){
|
if(canDrown() && floor.isLiquid && floor.drownTime > 0){
|
||||||
drownTime += Time.delta() * 1f / floor.drownTime;
|
drownTime += Time.delta * 1f / floor.drownTime;
|
||||||
drownTime = Mathf.clamp(drownTime);
|
drownTime = Mathf.clamp(drownTime);
|
||||||
if(Mathf.chanceDelta(0.05f)){
|
if(Mathf.chanceDelta(0.05f)){
|
||||||
floor.drownUpdateEffect.at(x, y, 1f, floor.mapColor);
|
floor.drownUpdateEffect.at(x, y, 1f, floor.mapColor);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ abstract class HealthComp implements Entityc{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
hitTime -= Time.delta() / hitDuration;
|
hitTime -= Time.delta / hitDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void killed(){
|
void killed(){
|
||||||
@@ -82,11 +82,11 @@ abstract class HealthComp implements Entityc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void damageContinuous(float amount){
|
void damageContinuous(float amount){
|
||||||
damage(amount * Time.delta(), hitTime <= -10 + hitDuration);
|
damage(amount * Time.delta, hitTime <= -10 + hitDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void damageContinuousPierce(float amount){
|
void damageContinuousPierce(float amount){
|
||||||
damagePierce(amount * Time.delta(), hitTime <= -20 + hitDuration);
|
damagePierce(amount * Time.delta, hitTime <= -20 + hitDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clampHealth(){
|
void clampHealth(){
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ abstract class MechComp implements Posc, Flyingc, Hitboxc, Unitc, Mechc, Elevati
|
|||||||
public void update(){
|
public void update(){
|
||||||
float len = deltaLen();
|
float len = deltaLen();
|
||||||
baseRotation = Angles.moveToward(baseRotation, deltaAngle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed));
|
baseRotation = Angles.moveToward(baseRotation, deltaAngle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed));
|
||||||
walkTime += Time.delta()*len;
|
walkTime += Time.delta *len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
|
|||||||
}else{
|
}else{
|
||||||
Item item = mineTile.drop();
|
Item item = mineTile.drop();
|
||||||
rotation(Mathf.slerpDelta(rotation(), angleTo(mineTile.worldx(), mineTile.worldy()), 0.4f));
|
rotation(Mathf.slerpDelta(rotation(), angleTo(mineTile.worldx(), mineTile.worldy()), 0.4f));
|
||||||
mineTimer += Time.delta()*type.mineSpeed;
|
mineTimer += Time.delta *type.mineSpeed;
|
||||||
|
|
||||||
if(mineTimer >= 50f + item.hardness*10f){
|
if(mineTimer >= 50f + item.hardness*10f){
|
||||||
mineTimer = 0;
|
mineTimer = 0;
|
||||||
@@ -76,7 +76,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Mathf.chance(0.06 * Time.delta())){
|
if(Mathf.chance(0.06 * Time.delta)){
|
||||||
Fx.pulverizeSmall.at(mineTile.worldx() + Mathf.range(tilesize / 2f), mineTile.worldy() + Mathf.range(tilesize / 2f), 0f, item.color);
|
Fx.pulverizeSmall.at(mineTile.worldx() + Mathf.range(tilesize / 2f), mineTile.worldy() + Mathf.range(tilesize / 2f), 0f, item.color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
|||||||
}else if(core != null){
|
}else if(core != null){
|
||||||
//have a small delay before death to prevent the camera from jumping around too quickly
|
//have a small delay before death to prevent the camera from jumping around too quickly
|
||||||
//(this is not for balance)
|
//(this is not for balance)
|
||||||
deathTimer += Time.delta();
|
deathTimer += Time.delta;
|
||||||
if(deathTimer >= deathDelay){
|
if(deathTimer >= deathDelay){
|
||||||
//request spawn - this happens serverside only
|
//request spawn - this happens serverside only
|
||||||
core.requestSpawn(base());
|
core.requestSpawn(base());
|
||||||
@@ -127,7 +127,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textFadeTime -= Time.delta() / (60 * 5);
|
textFadeTime -= Time.delta / (60 * 5);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
|
|||||||
//update code
|
//update code
|
||||||
float addSpeed = accepting > 0 ? 3f : 0f;
|
float addSpeed = accepting > 0 ? 3f : 0f;
|
||||||
|
|
||||||
amount -= Time.delta() * (1f - liquid.viscosity) / (5f + addSpeed);
|
amount -= Time.delta * (1f - liquid.viscosity) / (5f + addSpeed);
|
||||||
|
|
||||||
amount += accepting;
|
amount += accepting;
|
||||||
accepting = 0f;
|
accepting = 0f;
|
||||||
|
|
||||||
if(amount >= maxLiquid / 1.5f && generation < maxGeneration){
|
if(amount >= maxLiquid / 1.5f && generation < maxGeneration){
|
||||||
float deposited = Math.min((amount - maxLiquid / 1.5f) / 4f, 0.3f) * Time.delta();
|
float deposited = Math.min((amount - maxLiquid / 1.5f) / 4f, 0.3f) * Time.delta;
|
||||||
for(Point2 point : Geometry.d4){
|
for(Point2 point : Geometry.d4){
|
||||||
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
|
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
|
||||||
if(other != null && other.block() == Blocks.air){
|
if(other != null && other.block() == Blocks.air){
|
||||||
@@ -87,7 +87,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
|
|||||||
updateTime = 40f;
|
updateTime = 40f;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTime -= Time.delta();
|
updateTime -= Time.delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
shieldAlpha -= Time.delta() / 15f;
|
shieldAlpha -= Time.delta / 15f;
|
||||||
if(shieldAlpha < 0) shieldAlpha = 0f;
|
if(shieldAlpha < 0) shieldAlpha = 0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ abstract class StatusComp implements Posc, Flyingc{
|
|||||||
while(index < statuses.size){
|
while(index < statuses.size){
|
||||||
StatusEntry entry = statuses.get(index++);
|
StatusEntry entry = statuses.get(index++);
|
||||||
|
|
||||||
entry.time = Math.max(entry.time - Time.delta(), 0);
|
entry.time = Math.max(entry.time - Time.delta, 0);
|
||||||
applied.set(entry.effect.id);
|
applied.set(entry.effect.id);
|
||||||
|
|
||||||
if(entry.time <= 0 && !entry.effect.permanent){
|
if(entry.time <= 0 && !entry.effect.permanent){
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ abstract class TimedComp implements Entityc, Scaled{
|
|||||||
@MethodPriority(100)
|
@MethodPriority(100)
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
time = Math.min(time + Time.delta(), lifetime);
|
time = Math.min(time + Time.delta, lifetime);
|
||||||
|
|
||||||
if(time >= lifetime){
|
if(time >= lifetime){
|
||||||
remove();
|
remove();
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void lookAt(float angle){
|
public void lookAt(float angle){
|
||||||
rotation = Angles.moveToward(rotation, angle, type.rotateSpeed * Time.delta());
|
rotation = Angles.moveToward(rotation, angle, type.rotateSpeed * Time.delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lookAt(Position pos){
|
public void lookAt(Position pos){
|
||||||
@@ -176,7 +176,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
float relativeSize = state.rules.dropZoneRadius + bounds()/2f + 1f;
|
float relativeSize = state.rules.dropZoneRadius + bounds()/2f + 1f;
|
||||||
for(Tile spawn : spawner.getSpawns()){
|
for(Tile spawn : spawner.getSpawns()){
|
||||||
if(within(spawn.worldx(), spawn.worldy(), relativeSize)){
|
if(within(spawn.worldx(), spawn.worldy(), relativeSize)){
|
||||||
vel().add(Tmp.v1.set(this).sub(spawn.worldx(), spawn.worldy()).setLength(0.1f + 1f - dst(spawn) / relativeSize).scl(0.45f * Time.delta()));
|
vel().add(Tmp.v1.set(this).sub(spawn.worldx(), spawn.worldy()).setLength(0.1f + 1f - dst(spawn) / relativeSize).scl(0.45f * Time.delta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
//move down
|
//move down
|
||||||
elevation -= type.fallSpeed * Time.delta();
|
elevation -= type.fallSpeed * Time.delta;
|
||||||
|
|
||||||
if(isGrounded()){
|
if(isGrounded()){
|
||||||
destroy();
|
destroy();
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ abstract class VelComp implements Posc{
|
|||||||
@MethodPriority(-1)
|
@MethodPriority(-1)
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
move(vel.x * Time.delta(), vel.y * Time.delta());
|
move(vel.x * Time.delta, vel.y * Time.delta);
|
||||||
vel.scl(1f - drag * Time.delta());
|
vel.scl(1f - drag * Time.delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean moving(){
|
boolean moving(){
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ abstract class WaterMoveComp implements Posc, Velc, Hitboxc, Flyingc, Unitc{
|
|||||||
|
|
||||||
Floor floor = floorOn();
|
Floor floor = floorOn();
|
||||||
Color color = Tmp.c1.set(floor.mapColor).mul(1.5f);
|
Color color = Tmp.c1.set(floor.mapColor).mul(1.5f);
|
||||||
trailColor.lerp(color, Mathf.clamp(Time.delta() * 0.04f));
|
trailColor.lerp(color, Mathf.clamp(Time.delta * 0.04f));
|
||||||
|
|
||||||
tleft.draw(trailColor, type.trailScl);
|
tleft.draw(trailColor, type.trailScl);
|
||||||
tright.draw(trailColor, type.trailScl);
|
tright.draw(trailColor, type.trailScl);
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void controlWeapons(boolean rotateShoot){
|
||||||
|
controlWeapons(rotateShoot, rotateShoot);
|
||||||
|
}
|
||||||
|
|
||||||
void controlWeapons(boolean rotate, boolean shoot){
|
void controlWeapons(boolean rotate, boolean shoot){
|
||||||
for(WeaponMount mount : mounts){
|
for(WeaponMount mount : mounts){
|
||||||
mount.rotate = rotate;
|
mount.rotate = rotate;
|
||||||
@@ -82,11 +86,11 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
|
|||||||
public void update(){
|
public void update(){
|
||||||
for(WeaponMount mount : mounts){
|
for(WeaponMount mount : mounts){
|
||||||
Weapon weapon = mount.weapon;
|
Weapon weapon = mount.weapon;
|
||||||
mount.reload = Math.max(mount.reload - Time.delta() * reloadMultiplier, 0);
|
mount.reload = Math.max(mount.reload - Time.delta * reloadMultiplier, 0);
|
||||||
|
|
||||||
//flip weapon shoot side for alternating weapons at half reload
|
//flip weapon shoot side for alternating weapons at half reload
|
||||||
if(weapon.otherSide != -1 && weapon.alternate && mount.side == weapon.flipSprite &&
|
if(weapon.otherSide != -1 && weapon.alternate && mount.side == weapon.flipSprite &&
|
||||||
mount.reload + Time.delta() > weapon.reload/2f && mount.reload <= weapon.reload/2f){
|
mount.reload + Time.delta > weapon.reload/2f && mount.reload <= weapon.reload/2f){
|
||||||
mounts[weapon.otherSide].side = !mounts[weapon.otherSide].side;
|
mounts[weapon.otherSide].side = !mounts[weapon.otherSide].side;
|
||||||
mount.side = !mount.side;
|
mount.side = !mount.side;
|
||||||
}
|
}
|
||||||
@@ -97,7 +101,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
|
|||||||
axisY = this.y + Angles.trnsy(rotation - 90, weapon.x, weapon.y);
|
axisY = this.y + Angles.trnsy(rotation - 90, weapon.x, weapon.y);
|
||||||
|
|
||||||
mount.targetRotation = Angles.angle(axisX, axisY, mount.aimX, mount.aimY) - rotation;
|
mount.targetRotation = Angles.angle(axisX, axisY, mount.aimX, mount.aimY) - rotation;
|
||||||
mount.rotation = Angles.moveToward(mount.rotation, mount.targetRotation, weapon.rotateSpeed * Time.delta());
|
mount.rotation = Angles.moveToward(mount.rotation, mount.targetRotation, weapon.rotateSpeed * Time.delta);
|
||||||
}else{
|
}else{
|
||||||
mount.rotation = 0;
|
mount.rotation = 0;
|
||||||
mount.targetRotation = angleTo(mount.aimX, mount.aimY);
|
mount.targetRotation = angleTo(mount.aimX, mount.aimY);
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class Saves{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(state.isGame() && !state.gameOver && current != null && current.isAutosave() && !state.rules.tutorial){
|
if(state.isGame() && !state.gameOver && current != null && current.isAutosave() && !state.rules.tutorial){
|
||||||
time += Time.delta();
|
time += Time.delta;
|
||||||
if(time > Core.settings.getInt("saveinterval") * 60){
|
if(time > Core.settings.getInt("saveinterval") * 60){
|
||||||
saving = true;
|
saving = true;
|
||||||
|
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ public class Schematics implements Loadable{
|
|||||||
boolean found = false;
|
boolean found = false;
|
||||||
for(int cx = x; cx <= x2; cx++){
|
for(int cx = x; cx <= x2; cx++){
|
||||||
for(int cy = y; cy <= y2; cy++){
|
for(int cy = y; cy <= y2; cy++){
|
||||||
Building linked = world.ent(cx, cy);
|
Building linked = world.build(cx, cy);
|
||||||
|
|
||||||
if(linked != null &&linked.block().isVisible() && !(linked.block() instanceof BuildBlock)){
|
if(linked != null &&linked.block().isVisible() && !(linked.block() instanceof BuildBlock)){
|
||||||
int top = linked.block().size/2;
|
int top = linked.block().size/2;
|
||||||
@@ -373,7 +373,7 @@ public class Schematics implements Loadable{
|
|||||||
IntSet counted = new IntSet();
|
IntSet counted = new IntSet();
|
||||||
for(int cx = ox; cx <= ox2; cx++){
|
for(int cx = ox; cx <= ox2; cx++){
|
||||||
for(int cy = oy; cy <= oy2; cy++){
|
for(int cy = oy; cy <= oy2; cy++){
|
||||||
Building tile = world.ent(cx, cy);
|
Building tile = world.build(cx, cy);
|
||||||
|
|
||||||
if(tile != null && !counted.contains(tile.pos()) && !(tile.block() instanceof BuildBlock)
|
if(tile != null && !counted.contains(tile.pos()) && !(tile.block() instanceof BuildBlock)
|
||||||
&& (tile.block().isVisible() || (tile.block() instanceof CoreBlock))){
|
&& (tile.block().isVisible() || (tile.block() instanceof CoreBlock))){
|
||||||
|
|||||||
@@ -84,10 +84,10 @@ public class SectorInfo{
|
|||||||
/** Update averages of various stats.
|
/** Update averages of various stats.
|
||||||
* Called every frame. */
|
* Called every frame. */
|
||||||
public void update(){
|
public void update(){
|
||||||
internalTimeSpent += Time.delta();
|
internalTimeSpent += Time.delta;
|
||||||
|
|
||||||
//time spent exceeds turn duration!
|
//time spent exceeds turn duration!
|
||||||
if(internalTimeSpent >= turnDuration && internalTimeSpent - Time.delta() < turnDuration){
|
if(internalTimeSpent >= turnDuration && internalTimeSpent - Time.delta < turnDuration){
|
||||||
universe.displayTimeEnd();
|
universe.displayTimeEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class Universe{
|
|||||||
|
|
||||||
/** Update planet rotations, global time and relevant state. */
|
/** Update planet rotations, global time and relevant state. */
|
||||||
public void update(){
|
public void update(){
|
||||||
secondCounter += Time.delta() / 60f;
|
secondCounter += Time.delta / 60f;
|
||||||
|
|
||||||
if(secondCounter >= 1){
|
if(secondCounter >= 1){
|
||||||
seconds += (int)secondCounter;
|
seconds += (int)secondCounter;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class LoadRenderer implements Disposable{
|
|||||||
|
|
||||||
//preview : no frametime
|
//preview : no frametime
|
||||||
if(preview){
|
if(preview){
|
||||||
testprogress += Time.delta() / (60f * 3);
|
testprogress += Time.delta / (60f * 3);
|
||||||
progress = testprogress;
|
progress = testprogress;
|
||||||
if(input.keyTap(KeyCode.space)){
|
if(input.keyTap(KeyCode.space)){
|
||||||
testprogress = 0;
|
testprogress = 0;
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class MenuRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void render(){
|
public void render(){
|
||||||
time += Time.delta();
|
time += Time.delta;
|
||||||
float scaling = Math.max(Scl.scl(4f), Math.max(Core.graphics.getWidth() / ((width - 1f) * tilesize), Core.graphics.getHeight() / ((height - 1f) * tilesize)));
|
float scaling = Math.max(Scl.scl(4f), Math.max(Core.graphics.getWidth() / ((width - 1f) * tilesize), Core.graphics.getHeight() / ((height - 1f) * tilesize)));
|
||||||
camera.position.set(width * tilesize / 2f, height * tilesize / 2f);
|
camera.position.set(width * tilesize / 2f, height * tilesize / 2f);
|
||||||
camera.resize(Core.graphics.getWidth() / scaling,
|
camera.resize(Core.graphics.getWidth() / scaling,
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class OverlayRenderer{
|
|||||||
//draw selected block
|
//draw selected block
|
||||||
if(input.block == null && !Core.scene.hasMouse()){
|
if(input.block == null && !Core.scene.hasMouse()){
|
||||||
Vec2 vec = Core.input.mouseWorld(input.getMouseX(), input.getMouseY());
|
Vec2 vec = Core.input.mouseWorld(input.getMouseX(), input.getMouseY());
|
||||||
Building tile = world.entWorld(vec.x, vec.y);
|
Building tile = world.buildWorld(vec.x, vec.y);
|
||||||
|
|
||||||
if(tile != null && tile.team() == player.team()){
|
if(tile != null && tile.team() == player.team()){
|
||||||
tile.drawSelect();
|
tile.drawSelect();
|
||||||
@@ -152,7 +152,7 @@ public class OverlayRenderer{
|
|||||||
Lines.circle(v.x, v.y, 6 + Mathf.absin(Time.time(), 5f, 1f));
|
Lines.circle(v.x, v.y, 6 + Mathf.absin(Time.time(), 5f, 1f));
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
Building tile = world.entWorld(v.x, v.y);
|
Building tile = world.buildWorld(v.x, v.y);
|
||||||
if(tile != null && tile.interactable(player.team()) && tile.acceptStack(player.unit().item(), player.unit().stack.amount, player.unit()) > 0){
|
if(tile != null && tile.interactable(player.team()) && tile.acceptStack(player.unit().item(), player.unit().stack.amount, player.unit()) > 0){
|
||||||
Lines.stroke(3f, Pal.gray);
|
Lines.stroke(3f, Pal.gray);
|
||||||
Lines.square(tile.x, tile.y, tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));
|
Lines.square(tile.x, tile.y, tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
if(!(scene.getKeyboardFocus() instanceof TextField) && !scene.hasDialog()){
|
if(!(scene.getKeyboardFocus() instanceof TextField) && !scene.hasDialog()){
|
||||||
//move camera around
|
//move camera around
|
||||||
float camSpeed = !Core.input.keyDown(Binding.boost) ? 3f : 8f;
|
float camSpeed = !Core.input.keyDown(Binding.boost) ? 3f : 8f;
|
||||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
|
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta * camSpeed));
|
||||||
|
|
||||||
if(Core.input.keyDown(Binding.mouse_move)){
|
if(Core.input.keyDown(Binding.mouse_move)){
|
||||||
Core.camera.position.x += Mathf.clamp((Core.input.mouseX() - Core.graphics.getWidth() / 2f) * 0.005f, -1, 1) * camSpeed;
|
Core.camera.position.x += Mathf.clamp((Core.input.mouseX() - Core.graphics.getWidth() / 2f) * 0.005f, -1, 1) * camSpeed;
|
||||||
@@ -592,17 +592,18 @@ public class DesktopInput extends InputHandler{
|
|||||||
}else{
|
}else{
|
||||||
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
||||||
if(!movement.isZero() && legs){
|
if(!movement.isZero() && legs){
|
||||||
unit.vel().rotateTo(movement.angle(), unit.type().rotateSpeed * Time.delta());
|
unit.vel.rotateTo(movement.angle(), unit.type().rotateSpeed * Time.delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unit.aim(unit.type().faceTarget ? Core.input.mouseWorld() : Tmp.v1.trns(unit.rotation(), Core.input.mouseWorld().dst(unit)).add(unit.x(), unit.y()));
|
unit.aim(unit.type().faceTarget ? Core.input.mouseWorld() : Tmp.v1.trns(unit.rotation, Core.input.mouseWorld().dst(unit)).add(unit.x, unit.y));
|
||||||
unit.controlWeapons(true, player.shooting && !boosted);
|
unit.controlWeapons(true, player.shooting && !boosted);
|
||||||
|
|
||||||
player.boosting = Core.input.keyDown(Binding.boost) && !movement.isZero();
|
player.boosting = Core.input.keyDown(Binding.boost) && !movement.isZero();
|
||||||
player.mouseX = unit.aimX();
|
player.mouseX = unit.aimX();
|
||||||
player.mouseY = unit.aimY();
|
player.mouseY = unit.aimY();
|
||||||
|
|
||||||
|
//update payload input
|
||||||
if(unit instanceof Payloadc){
|
if(unit instanceof Payloadc){
|
||||||
Payloadc pay = (Payloadc)unit;
|
Payloadc pay = (Payloadc)unit;
|
||||||
|
|
||||||
@@ -611,7 +612,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
if(target != null){
|
if(target != null){
|
||||||
Call.pickupUnitPayload(player, target);
|
Call.pickupUnitPayload(player, target);
|
||||||
}else if(!pay.hasPayload()){
|
}else if(!pay.hasPayload()){
|
||||||
Building tile = world.entWorld(pay.x(), pay.y());
|
Building tile = world.buildWorld(pay.x(), pay.y());
|
||||||
|
|
||||||
if(tile != null && tile.team() == unit.team){
|
if(tile != null && tile.team() == unit.team){
|
||||||
Call.pickupBlockPayload(player, tile);
|
Call.pickupBlockPayload(player, tile);
|
||||||
@@ -625,6 +626,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//update commander inut
|
||||||
if(unit instanceof Commanderc){
|
if(unit instanceof Commanderc){
|
||||||
if(Core.input.keyTap(Binding.command)){
|
if(Core.input.keyTap(Binding.command)){
|
||||||
Call.unitCommand(player);
|
Call.unitCommand(player);
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(controlledType != null){
|
if(controlledType != null){
|
||||||
Unit unit = Units.closest(player.team(), player.x, player.y, u -> !u.isPlayer() && u.type() == controlledType);
|
Unit unit = Units.closest(player.team(), player.x, player.y, u -> !u.isPlayer() && u.type() == controlledType);
|
||||||
if(unit == null && controlledType == UnitTypes.block){
|
if(unit == null && controlledType == UnitTypes.block){
|
||||||
unit = world.entWorld(player.x, player.y) instanceof ControlBlock ? ((ControlBlock)world.entWorld(player.x, player.y)).unit() : null;
|
unit = world.buildWorld(player.x, player.y) instanceof ControlBlock ? ((ControlBlock)world.buildWorld(player.x, player.y)).unit() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(unit != null){
|
if(unit != null){
|
||||||
@@ -798,7 +798,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Building entAt(float x, float y){
|
Building entAt(float x, float y){
|
||||||
return world.ent(tileX(x), tileY(y));
|
return world.build(tileX(x), tileY(y));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the tile at the specified MOUSE coordinates. */
|
/** Returns the tile at the specified MOUSE coordinates. */
|
||||||
@@ -856,7 +856,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Building tile = world.entWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
Building tile = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||||
if(tile instanceof ControlBlock && tile.team() == player.team()){
|
if(tile instanceof ControlBlock && tile.team() == player.team()){
|
||||||
return ((ControlBlock)tile).unit();
|
return ((ControlBlock)tile).unit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package mindustry.input;
|
package mindustry.input;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.input.GestureDetector.*;
|
import arc.input.GestureDetector.*;
|
||||||
@@ -11,15 +10,17 @@ import arc.math.geom.*;
|
|||||||
import arc.scene.*;
|
import arc.scene.*;
|
||||||
import arc.scene.ui.ImageButton.*;
|
import arc.scene.ui.ImageButton.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.gen.*;
|
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
private final float edgePan = Scl.scl(60f);
|
private final float edgePan = Scl.scl(60f);
|
||||||
|
|
||||||
//gesture data
|
//gesture data
|
||||||
private Vec2 vector = new Vec2();
|
private Vec2 vector = new Vec2(), movement = new Vec2(), targetPos = new Vec2();
|
||||||
private float lastZoom = -1;
|
private float lastZoom = -1;
|
||||||
|
|
||||||
/** Position where the player started dragging a line. */
|
/** Position where the player started dragging a line. */
|
||||||
@@ -62,7 +63,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
/** Down tracking for panning.*/
|
/** Down tracking for panning.*/
|
||||||
private boolean down = false;
|
private boolean down = false;
|
||||||
|
|
||||||
private Teamc target;
|
private Teamc target, moveTarget;
|
||||||
|
|
||||||
//region utility methods
|
//region utility methods
|
||||||
|
|
||||||
@@ -74,16 +75,15 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
player.miner().mineTile(null);
|
player.miner().mineTile(null);
|
||||||
target = unit;
|
target = unit;
|
||||||
}else{
|
}else{
|
||||||
Building tile = world.entWorld(x, y);
|
Building tile = world.buildWorld(x, y);
|
||||||
|
|
||||||
if(tile != null && player.team().isEnemy(tile.team())){
|
if(tile != null && player.team().isEnemy(tile.team())){
|
||||||
player.miner().mineTile(null);
|
player.miner().mineTile(null);
|
||||||
target = tile;
|
target = tile;
|
||||||
//TODO implement healing
|
}else if(tile != null && player.unit().type().canHeal && tile.team == player.team() && tile.damaged()){
|
||||||
}//else if(tile != null && player.unit().canHeal && tile.entity != null && tile.team() == player.team() && tile.entity.damaged()){
|
player.miner().mineTile(null);
|
||||||
/// player.miner().mineTile(null);
|
target = tile;
|
||||||
// target = tile.entity;
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,27 +505,40 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(float x, float y){
|
public boolean longPress(float x, float y){
|
||||||
if(state.isMenu() || mode == none || player.dead()) return false;
|
if(state.isMenu()|| player.dead()) return false;
|
||||||
|
|
||||||
//get tile on cursor
|
//get tile on cursor
|
||||||
Tile cursor = tileAt(x, y);
|
Tile cursor = tileAt(x, y);
|
||||||
|
|
||||||
//ignore off-screen taps
|
if(Core.scene.hasMouse(x, y) || schematicMode) return false;
|
||||||
if(cursor == null || Core.scene.hasMouse(x, y) || schematicMode) return false;
|
|
||||||
|
|
||||||
//remove request if it's there
|
//handle long tap when player isn't building
|
||||||
//long pressing enables line mode otherwise
|
if(mode == none){
|
||||||
lineStartX = cursor.x;
|
|
||||||
lineStartY = cursor.y;
|
|
||||||
lastLineX = cursor.x;
|
|
||||||
lastLineY = cursor.y;
|
|
||||||
lineMode = true;
|
|
||||||
|
|
||||||
if(mode == breaking){
|
//control a unit/block
|
||||||
Fx.tapBlock.at(cursor.worldx(), cursor.worldy(), 1f);
|
Unit on = selectedUnit();
|
||||||
}else if(block != null){
|
if(on != null){
|
||||||
updateLine(lineStartX, lineStartY, cursor.x, cursor.y);
|
Call.unitControl(player, on);
|
||||||
Fx.tapBlock.at(cursor.worldx() + block.offset(), cursor.worldy() + block.offset(), block.size);
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
//ignore off-screen taps
|
||||||
|
if(cursor == null) return false;
|
||||||
|
|
||||||
|
//remove request if it's there
|
||||||
|
//long pressing enables line mode otherwise
|
||||||
|
lineStartX = cursor.x;
|
||||||
|
lineStartY = cursor.y;
|
||||||
|
lastLineX = cursor.x;
|
||||||
|
lastLineY = cursor.y;
|
||||||
|
lineMode = true;
|
||||||
|
|
||||||
|
if(mode == breaking){
|
||||||
|
Fx.tapBlock.at(cursor.worldx(), cursor.worldy(), 1f);
|
||||||
|
}else if(block != null){
|
||||||
|
updateLine(lineStartX, lineStartY, cursor.x, cursor.y);
|
||||||
|
Fx.tapBlock.at(cursor.worldx() + block.offset(), cursor.worldy() + block.offset(), block.size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -584,7 +597,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
if(!Core.settings.getBool("keyboard")){
|
if(!Core.settings.getBool("keyboard")){
|
||||||
//move camera around
|
//move camera around
|
||||||
float camSpeed = 6f;
|
float camSpeed = 6f;
|
||||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
|
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta * camSpeed));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Core.settings.getBool("keyboard")){
|
if(Core.settings.getBool("keyboard")){
|
||||||
@@ -597,6 +610,10 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!player.dead() && !state.isPaused()){
|
||||||
|
updateMovement(player.unit());
|
||||||
|
}
|
||||||
|
|
||||||
//reset state when not placing
|
//reset state when not placing
|
||||||
if(mode == none){
|
if(mode == none){
|
||||||
lineMode = false;
|
lineMode = false;
|
||||||
@@ -755,5 +772,137 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
//region movement
|
||||||
|
|
||||||
|
protected void updateMovement(Unit unit){
|
||||||
|
Rect rect = Tmp.r3;
|
||||||
|
|
||||||
|
UnitType type = unit.type();
|
||||||
|
boolean flying = type.flying;
|
||||||
|
boolean omni = !(unit instanceof WaterMovec);
|
||||||
|
boolean legs = unit.isGrounded();
|
||||||
|
boolean allowHealing = type.canHeal;
|
||||||
|
boolean validHealTarget = allowHealing && target instanceof Building && ((Building)target).isValid() && target.team() == unit.team &&
|
||||||
|
((Building)target).damaged() && target.within(unit, type.range);
|
||||||
|
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||||
|
|
||||||
|
//reset target if:
|
||||||
|
// - in the editor, or...
|
||||||
|
// - it's both an invalid standard target and an invalid heal target
|
||||||
|
if((Units.invalidateTarget(target, unit, type.range) && !validHealTarget) || state.isEditor()){
|
||||||
|
target = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetPos.set(Core.camera.position);
|
||||||
|
float attractDst = 15f;
|
||||||
|
float strafePenalty = legs ? 1f : Mathf.lerp(1f, type.strafePenalty, Angles.angleDist(unit.vel.angle(), unit.rotation) / 180f);
|
||||||
|
float speed = type.speed * Mathf.lerp(1f, type.canBoost ? type.boostMultiplier : 1f, unit.elevation()) * strafePenalty;
|
||||||
|
float range = unit.hasWeapons() ? unit.range() : 0f;
|
||||||
|
float bulletSpeed = unit.hasWeapons() ? type.weapons.first().bullet.speed : 0f;
|
||||||
|
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());
|
||||||
|
boolean aimCursor = omni && player.shooting && type.hasWeapons() && type.faceTarget && !boosted && type.rotateShooting;
|
||||||
|
|
||||||
|
if(aimCursor){
|
||||||
|
unit.lookAt(mouseAngle);
|
||||||
|
}else{
|
||||||
|
if(unit.moving()){
|
||||||
|
unit.lookAt(unit.vel.angle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(moveTarget != null){
|
||||||
|
targetPos.set(moveTarget);
|
||||||
|
attractDst = 0f;
|
||||||
|
|
||||||
|
if(unit.within(moveTarget, 2f * Time.delta)){
|
||||||
|
handleTapTarget(moveTarget);
|
||||||
|
moveTarget = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
movement.set(targetPos).sub(player).limit(speed);
|
||||||
|
movement.setAngle(Mathf.slerp(movement.angle(), unit.vel.angle(), 0.05f));
|
||||||
|
|
||||||
|
//pathfind for ground units
|
||||||
|
if(!flying && !type.canBoost && !(unit instanceof WaterMovec)){
|
||||||
|
Tile on = unit.tileOn();
|
||||||
|
if(on != null && !on.solid()){
|
||||||
|
Tile to = pathfinder.getTargetTile(unit.tileOn(), unit.team, targetPos);
|
||||||
|
if(to != null){
|
||||||
|
movement.set(to).sub(unit).setLength(speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.within(targetPos, attractDst)){
|
||||||
|
movement.setZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
float expansion = 3f;
|
||||||
|
|
||||||
|
unit.hitbox(rect);
|
||||||
|
rect.x -= expansion;
|
||||||
|
rect.y -= expansion;
|
||||||
|
rect.width += expansion * 2f;
|
||||||
|
rect.height += expansion * 2f;
|
||||||
|
|
||||||
|
player.boosting = collisions.overlapsTile(rect) || !unit.within(targetPos, 85f);
|
||||||
|
|
||||||
|
if(omni){
|
||||||
|
unit.moveAt(movement);
|
||||||
|
}else{
|
||||||
|
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
||||||
|
if(!movement.isZero() && legs){
|
||||||
|
unit.vel.rotateTo(movement.angle(), type.rotateSpeed * Time.delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(flying){
|
||||||
|
//hovering effect
|
||||||
|
unit.x += Mathf.sin(Time.time(), 25f, 0.08f);
|
||||||
|
unit.y += Mathf.cos(Time.time(), 25f, 0.08f);
|
||||||
|
}
|
||||||
|
|
||||||
|
//update shooting if not building + not mining
|
||||||
|
if(!player.builder().isBuilding() && player.miner().mineTile() == null){
|
||||||
|
|
||||||
|
//autofire
|
||||||
|
if(target == null){
|
||||||
|
player.shooting = false;
|
||||||
|
if(Core.settings.getBool("autotarget")){
|
||||||
|
target = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.team != Team.derelict, u -> u.team != Team.derelict);
|
||||||
|
|
||||||
|
if(allowHealing && target == null){
|
||||||
|
target = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(Team.sharded));
|
||||||
|
if(target != null && !unit.within(target, range)){
|
||||||
|
target = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(target != null && player.isMiner()){
|
||||||
|
player.miner().mineTile(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Vec2 intercept = Predict.intercept(unit, target, bulletSpeed);
|
||||||
|
|
||||||
|
player.mouseX = intercept.x;
|
||||||
|
player.mouseY = intercept.y;
|
||||||
|
player.shooting = true;
|
||||||
|
|
||||||
|
unit.aim(player.mouseX, player.mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
unit.controlWeapons(player.shooting && !boosted);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void handleTapTarget(Teamc target){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class TypeIO{
|
|||||||
Unit unit = Groups.unit.getByID(id);
|
Unit unit = Groups.unit.getByID(id);
|
||||||
return unit == null ? Nulls.unit : unit;
|
return unit == null ? Nulls.unit : unit;
|
||||||
}else if(type == 1){ //block
|
}else if(type == 1){ //block
|
||||||
Building tile = world.ent(id);
|
Building tile = world.build(id);
|
||||||
return tile instanceof ControlBlock ? ((ControlBlock)tile).unit() : Nulls.unit;
|
return tile instanceof ControlBlock ? ((ControlBlock)tile).unit() : Nulls.unit;
|
||||||
}
|
}
|
||||||
return Nulls.unit;
|
return Nulls.unit;
|
||||||
@@ -178,7 +178,7 @@ public class TypeIO{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Building readBuilding(Reads read){
|
public static Building readBuilding(Reads read){
|
||||||
return world.ent(read.i());
|
return world.build(read.i());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeTile(Writes write, Tile tile){
|
public static void writeTile(Writes write, Tile tile){
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class StatusEffect extends MappableContent{
|
|||||||
if(damage > 0){
|
if(damage > 0){
|
||||||
unit.damageContinuousPierce(damage);
|
unit.damageContinuousPierce(damage);
|
||||||
}else if(damage < 0){ //heal unit
|
}else if(damage < 0){ //heal unit
|
||||||
unit.heal(damage * Time.delta());
|
unit.heal(damage * Time.delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(effect != Fx.none && Mathf.chanceDelta(effectChance)){
|
if(effect != Fx.none && Mathf.chanceDelta(effectChance)){
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import mindustry.content.*;
|
|||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.abilities.*;
|
import mindustry.entities.abilities.*;
|
||||||
|
import mindustry.entities.bullet.*;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -32,7 +33,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
|
public static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
|
||||||
private static final Vec2 legOffset = new Vec2();
|
private static final Vec2 legOffset = new Vec2();
|
||||||
|
|
||||||
//TODO document
|
/** If true, the unit is always at elevation 1. */
|
||||||
public boolean flying;
|
public boolean flying;
|
||||||
public @NonNull Prov<? extends Unit> constructor;
|
public @NonNull Prov<? extends Unit> constructor;
|
||||||
public @NonNull Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
|
public @NonNull Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
|
||||||
@@ -75,6 +76,8 @@ public class UnitType extends UnlockableContent{
|
|||||||
public int parts = 0;
|
public int parts = 0;
|
||||||
public int trailLength = 3;
|
public int trailLength = 3;
|
||||||
public float trailX = 4f, trailY = -3f, trailScl = 1f;
|
public float trailX = 4f, trailY = -3f, trailScl = 1f;
|
||||||
|
/** Whether the unit can heal blocks. Initialized in init() */
|
||||||
|
public boolean canHeal = false;
|
||||||
|
|
||||||
public ObjectSet<StatusEffect> immunities = new ObjectSet<>();
|
public ObjectSet<StatusEffect> immunities = new ObjectSet<>();
|
||||||
public Sound deathSound = Sounds.bang;
|
public Sound deathSound = Sounds.bang;
|
||||||
@@ -155,6 +158,8 @@ public class UnitType extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canHeal = weapons.contains(w -> w.bullet instanceof HealBulletType);
|
||||||
|
|
||||||
//add mirrored weapon variants
|
//add mirrored weapon variants
|
||||||
Seq<Weapon> mapped = new Seq<>();
|
Seq<Weapon> mapped = new Seq<>();
|
||||||
for(Weapon w : weapons){
|
for(Weapon w : weapons){
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public abstract class Weather extends MappableContent{
|
|||||||
opacity = Mathf.lerpDelta(opacity, 1f, 0.004f);
|
opacity = Mathf.lerpDelta(opacity, 1f, 0.004f);
|
||||||
}
|
}
|
||||||
|
|
||||||
life -= Time.delta();
|
life -= Time.delta;
|
||||||
|
|
||||||
weather.update(base());
|
weather.update(base());
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class MultiReqImage extends Stack{
|
|||||||
public void act(float delta){
|
public void act(float delta){
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
|
|
||||||
time += Time.delta() / 60f;
|
time += Time.delta / 60f;
|
||||||
|
|
||||||
displays.each(req -> req.visible(false));
|
displays.each(req -> req.visible(false));
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class DatabaseDialog extends BaseDialog{
|
|||||||
image.addListener(listener);
|
image.addListener(listener);
|
||||||
if(!Vars.mobile && unlocked(unlock)){
|
if(!Vars.mobile && unlocked(unlock)){
|
||||||
image.addListener(new HandCursorListener());
|
image.addListener(new HandCursorListener());
|
||||||
image.update(() -> image.getColor().lerp(!listener.isOver() ? Color.lightGray : Color.white, 0.4f * Time.delta()));
|
image.update(() -> image.getColor().lerp(!listener.isOver() ? Color.lightGray : Color.white, 0.4f * Time.delta));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(unlocked(unlock)){
|
if(unlocked(unlock)){
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
stable.update(() -> {
|
stable.update(() -> {
|
||||||
if(selected != null){
|
if(selected != null){
|
||||||
if(launching){
|
if(launching){
|
||||||
stable.getColor().sub(0, 0, 0, 0.05f * Time.delta());
|
stable.getColor().sub(0, 0, 0, 0.05f * Time.delta);
|
||||||
}else{
|
}else{
|
||||||
//fade out UI when not facing selected sector
|
//fade out UI when not facing selected sector
|
||||||
Tmp.v31.set(selected.tile.v).rotate(Vec3.Y, -planets.planet.getRotation()).scl(-1f).nor();
|
Tmp.v31.set(selected.tile.v).rotate(Vec3.Y, -planets.planet.getRotation()).scl(-1f).nor();
|
||||||
|
|||||||
@@ -110,13 +110,13 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
hide();
|
hide();
|
||||||
}else{
|
}else{
|
||||||
if(tile.items.total() == 0){
|
if(tile.items.total() == 0){
|
||||||
emptyTime += Time.delta();
|
emptyTime += Time.delta;
|
||||||
}else{
|
}else{
|
||||||
emptyTime = 0f;
|
emptyTime = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(holding && lastItem != null){
|
if(holding && lastItem != null){
|
||||||
holdTime += Time.delta();
|
holdTime += Time.delta;
|
||||||
|
|
||||||
if(holdTime >= holdWithdraw){
|
if(holdTime >= holdWithdraw){
|
||||||
int amount = Math.min(tile.items.get(lastItem), player.unit().maxAccepted(lastItem));
|
int amount = Math.min(tile.items.get(lastItem), player.unit().maxAccepted(lastItem));
|
||||||
@@ -140,7 +140,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
shrinkHoldTimes[i] = 0f;
|
shrinkHoldTimes[i] = 0f;
|
||||||
dirty |= !had;
|
dirty |= !had;
|
||||||
}else if(had){
|
}else if(had){
|
||||||
shrinkHoldTimes[i] += Time.delta();
|
shrinkHoldTimes[i] += Time.delta;
|
||||||
dirty |= shrinkHoldTimes[i] >= holdShrink;
|
dirty |= shrinkHoldTimes[i] >= holdShrink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ public class ChatFragment extends Table{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
if(fadetime > 0 && !shown)
|
if(fadetime > 0 && !shown)
|
||||||
fadetime -= Time.delta() / 180f;
|
fadetime -= Time.delta / 180f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage(){
|
private void sendMessage(){
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ public class HudFragment extends Fragment{
|
|||||||
coreAttackOpacity[0] = Mathf.lerpDelta(coreAttackOpacity[0], 0f, 0.1f);
|
coreAttackOpacity[0] = Mathf.lerpDelta(coreAttackOpacity[0], 0f, 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
coreAttackTime[0] -= Time.delta();
|
coreAttackTime[0] -= Time.delta;
|
||||||
|
|
||||||
return coreAttackOpacity[0] > 0;
|
return coreAttackOpacity[0] > 0;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
scrollPositions.put(currentCategory, blockPane.getScrollY());
|
scrollPositions.put(currentCategory, blockPane.getScrollY());
|
||||||
|
|
||||||
if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select
|
if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select
|
||||||
Building tile = world.entWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
Building tile = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||||
Block tryRecipe = tile == null ? null : tile.block();
|
Block tryRecipe = tile == null ? null : tile.block();
|
||||||
Object tryConfig = tile == null ? null : tile.config();
|
Object tryConfig = tile == null ? null : tile.config();
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
//check tile being hovered over
|
//check tile being hovered over
|
||||||
Tile hoverTile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
Tile hoverTile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||||
if(hoverTile != null){
|
if(hoverTile != null){
|
||||||
//if the tile has an entity, display it
|
//if the tile has a building, display it
|
||||||
if(hoverTile.build != null){
|
if(hoverTile.build != null){
|
||||||
hoverTile.build.updateFlow(true);
|
hoverTile.build.updateFlow(true);
|
||||||
return hoverTile.build;
|
return hoverTile.build;
|
||||||
|
|||||||
@@ -436,10 +436,10 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Building getNearbyEntity(int rotation){
|
public Building getNearbyEntity(int rotation){
|
||||||
if(rotation == 0) return world.ent(x + 1, y);
|
if(rotation == 0) return world.build(x + 1, y);
|
||||||
if(rotation == 1) return world.ent(x, y + 1);
|
if(rotation == 1) return world.build(x, y + 1);
|
||||||
if(rotation == 2) return world.ent(x - 1, y);
|
if(rotation == 2) return world.build(x - 1, y);
|
||||||
if(rotation == 3) return world.ent(x, y - 1);
|
if(rotation == 3) return world.build(x, y - 1);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +558,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
tileSet.clear();
|
tileSet.clear();
|
||||||
|
|
||||||
for(Point2 edge : Edges.getEdges(size)){
|
for(Point2 edge : Edges.getEdges(size)){
|
||||||
Building other = world.ent(x + edge.x, y + edge.y);
|
Building other = world.build(x + edge.x, y + edge.y);
|
||||||
if(other != null){
|
if(other != null){
|
||||||
tileSet.add(other);
|
tileSet.add(other);
|
||||||
}
|
}
|
||||||
@@ -582,7 +582,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
}else{
|
}else{
|
||||||
//since the entity won't update proximity for us, update proximity for all nearby tiles manually
|
//since the entity won't update proximity for us, update proximity for all nearby tiles manually
|
||||||
for(Point2 p : Geometry.d4){
|
for(Point2 p : Geometry.d4){
|
||||||
Building tile = world.ent(x + p.x, y + p.y);
|
Building tile = world.build(x + p.x, y + p.y);
|
||||||
if(tile != null && !tile.tile().changing){
|
if(tile != null && !tile.tile().changing){
|
||||||
tile.onProximityUpdate();
|
tile.onProximityUpdate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public class ForceProjector extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(hit > 0f){
|
if(hit > 0f){
|
||||||
hit -= 1f / 5f * Time.delta();
|
hit -= 1f / 5f * Time.delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
float realRadius = realRadius();
|
float realRadius = realRadius();
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class OverdriveProjector extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
heat = Mathf.lerpDelta(heat, consValid() ? 1f : 0f, 0.08f);
|
heat = Mathf.lerpDelta(heat, consValid() ? 1f : 0f, 0.08f);
|
||||||
charge += heat * Time.delta();
|
charge += heat * Time.delta;
|
||||||
|
|
||||||
if(hasBoost){
|
if(hasBoost){
|
||||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(cons().optionalValid()), 0.1f);
|
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(cons().optionalValid()), 0.1f);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class Wall extends Block{
|
|||||||
Draw.blend();
|
Draw.blend();
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
hit = Mathf.clamp(hit - Time.delta() / 10f);
|
hit = Mathf.clamp(hit - Time.delta / 10f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class LaserTurret extends PowerTurret{
|
|||||||
bullet.time(0f);
|
bullet.time(0f);
|
||||||
heat = 1f;
|
heat = 1f;
|
||||||
recoil = recoilAmount;
|
recoil = recoilAmount;
|
||||||
bulletLife -= Time.delta() / Math.max(efficiency(), 0.00001f);
|
bulletLife -= Time.delta / Math.max(efficiency(), 0.00001f);
|
||||||
if(bulletLife <= 0f){
|
if(bulletLife <= 0f){
|
||||||
bullet = null;
|
bullet = null;
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ public class LaserTurret extends PowerTurret{
|
|||||||
Liquid liquid = liquids().current();
|
Liquid liquid = liquids().current();
|
||||||
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
|
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
|
||||||
|
|
||||||
float used = (cheating() ? maxUsed * Time.delta() : Math.min(liquids.get(liquid), maxUsed * Time.delta())) * liquid.heatCapacity * coolantMultiplier;
|
float used = (cheating() ? maxUsed * Time.delta : Math.min(liquids.get(liquid), maxUsed * Time.delta)) * liquid.heatCapacity * coolantMultiplier;
|
||||||
reload -= used;
|
reload -= used;
|
||||||
liquids.remove(liquid, used);
|
liquids.remove(liquid, used);
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ public abstract class Turret extends Block{
|
|||||||
|
|
||||||
Liquid liquid = liquids.current();
|
Liquid liquid = liquids.current();
|
||||||
|
|
||||||
float used = Math.min(Math.min(liquids.get(liquid), maxUsed * Time.delta()), Math.max(0, ((reloadTime - reload) / coolantMultiplier) / liquid.heatCapacity)) * baseReloadSpeed();
|
float used = Math.min(Math.min(liquids.get(liquid), maxUsed * Time.delta), Math.max(0, ((reloadTime - reload) / coolantMultiplier) / liquid.heatCapacity)) * baseReloadSpeed();
|
||||||
reload += used * liquid.heatCapacity * coolantMultiplier;
|
reload += used * liquid.heatCapacity * coolantMultiplier;
|
||||||
liquids.remove(liquid, used);
|
liquids.remove(liquid, used);
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class MassDriver extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
Building link = world.ent(this.link);
|
Building link = world.build(this.link);
|
||||||
boolean hasLink = linkValid();
|
boolean hasLink = linkValid();
|
||||||
|
|
||||||
//reload regardless of state
|
//reload regardless of state
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class OverflowGate extends Block{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
time += 1f / speed * Time.delta();
|
time += 1f / speed * Time.delta;
|
||||||
Building target = getTileTarget(lastItem, lastInput, false);
|
Building target = getTileTarget(lastItem, lastInput, false);
|
||||||
|
|
||||||
if(target != null && (time >= 1f)){
|
if(target != null && (time >= 1f)){
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class PayloadConveyor extends Block{
|
|||||||
super.drawPlace(x, y, rotation, valid);
|
super.drawPlace(x, y, rotation, valid);
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++){
|
for(int i = 0; i < 4; i++){
|
||||||
Building other = world.ent(x + Geometry.d4x[i] * size, y + Geometry.d4y[i] * size);
|
Building other = world.build(x + Geometry.d4x[i] * size, y + Geometry.d4y[i] * size);
|
||||||
if(other != null && other.block().outputsPayload && other.block().size == size){
|
if(other != null && other.block().outputsPayload && other.block().size == size){
|
||||||
Drawf.selected(other.tileX(), other.tileY(), other.block(), Pal.accent);
|
Drawf.selected(other.tileX(), other.tileY(), other.block(), Pal.accent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class StackConveyor extends Block implements Autotiler{
|
|||||||
return (otherblock.hasItems || otherblock.outputsItems() || otherblock.acceptsItems) &&
|
return (otherblock.hasItems || otherblock.outputsItems() || otherblock.acceptsItems) &&
|
||||||
(notLookingAt(tile, rotation, otherx, othery, otherrot, otherblock) ||
|
(notLookingAt(tile, rotation, otherx, othery, otherrot, otherblock) ||
|
||||||
(otherblock instanceof StackConveyor && facing(otherx, othery, otherrot, tile.x, tile.y))) &&
|
(otherblock instanceof StackConveyor && facing(otherx, othery, otherrot, tile.x, tile.y))) &&
|
||||||
!(world.ent(otherx, othery) instanceof StackConveyorEntity && ((StackConveyorEntity)world.ent(otherx, othery)).state == stateUnload);
|
!(world.build(otherx, othery) instanceof StackConveyorEntity && ((StackConveyorEntity)world.build(otherx, othery)).state == stateUnload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return otherblock.outputsItems() && blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock) && otherblock instanceof StackConveyor;
|
return otherblock.outputsItems() && blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock) && otherblock instanceof StackConveyor;
|
||||||
@@ -84,7 +84,7 @@ public class StackConveyor extends Block implements Autotiler{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean rotatedOutput(int x, int y){
|
public boolean rotatedOutput(int x, int y){
|
||||||
Building tile = world.ent(x, y);
|
Building tile = world.build(x, y);
|
||||||
if(tile instanceof StackConveyorEntity){
|
if(tile instanceof StackConveyorEntity){
|
||||||
return ((StackConveyorEntity)tile).state != stateUnload;
|
return ((StackConveyorEntity)tile).state != stateUnload;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class LiquidBridge extends ItemBridge{
|
|||||||
|
|
||||||
checkIncoming();
|
checkIncoming();
|
||||||
|
|
||||||
Building other = world.ent(link);
|
Building other = world.build(link);
|
||||||
if(other == null || !linkValid(tile, other.tile())){
|
if(other == null || !linkValid(tile, other.tile())){
|
||||||
dumpLiquid(liquids.current());
|
dumpLiquid(liquids.current());
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
|||||||
|
|
||||||
checkIncoming();
|
checkIncoming();
|
||||||
|
|
||||||
Building other = world.ent(link);
|
Building other = world.build(link);
|
||||||
if(other == null || !linkValid(tile, other.tile())){
|
if(other == null || !linkValid(tile, other.tile())){
|
||||||
dumpLiquid(liquids.current());
|
dumpLiquid(liquids.current());
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
|
|
||||||
if(heat > flashThreshold){
|
if(heat > flashThreshold){
|
||||||
float flash = 1f + ((heat - flashThreshold) / (1f - flashThreshold)) * 5.4f;
|
float flash = 1f + ((heat - flashThreshold) / (1f - flashThreshold)) * 5.4f;
|
||||||
flash += flash * Time.delta();
|
flash += flash * Time.delta;
|
||||||
Draw.color(Color.red, Color.yellow, Mathf.absin(flash, 9f, 1f));
|
Draw.color(Color.red, Color.yellow, Mathf.absin(flash, 9f, 1f));
|
||||||
Draw.alpha(0.6f);
|
Draw.alpha(0.6f);
|
||||||
Draw.rect(lightsRegion, x, y);
|
Draw.rect(lightsRegion, x, y);
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public class PowerGraph{
|
|||||||
lastPowerNeeded = powerNeeded;
|
lastPowerNeeded = powerNeeded;
|
||||||
lastPowerProduced = powerProduced;
|
lastPowerProduced = powerProduced;
|
||||||
|
|
||||||
powerBalance.add((lastPowerProduced - lastPowerNeeded) / Time.delta());
|
powerBalance.add((lastPowerProduced - lastPowerNeeded) / Time.delta);
|
||||||
|
|
||||||
if(!(consumers.size == 0 && producers.size == 0 && batteries.size == 0)){
|
if(!(consumers.size == 0 && producers.size == 0 && batteries.size == 0)){
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
outputsPower = false;
|
outputsPower = false;
|
||||||
config(Integer.class, (entity, value) -> {
|
config(Integer.class, (entity, value) -> {
|
||||||
PowerModule power = entity.power;
|
PowerModule power = entity.power;
|
||||||
Building other = world.ent(value);
|
Building other = world.build(value);
|
||||||
boolean contains = power.links.contains(value), valid = other != null && other.power() != null;
|
boolean contains = power.links.contains(value), valid = other != null && other.power() != null;
|
||||||
|
|
||||||
if(contains){
|
if(contains){
|
||||||
@@ -183,7 +183,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Geometry.circle(tile.x, tile.y, (int)(laserRange + 2), (x, y) -> {
|
Geometry.circle(tile.x, tile.y, (int)(laserRange + 2), (x, y) -> {
|
||||||
Building other = world.ent(x, y);
|
Building other = world.build(x, y);
|
||||||
if(valid.get(other) && !tempTileEnts.contains(other)){
|
if(valid.get(other) && !tempTileEnts.contains(other)){
|
||||||
tempTileEnts.add(other);
|
tempTileEnts.add(other);
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
public static void insulators(int x, int y, int x2, int y2, Cons<Building> iterator){
|
public static void insulators(int x, int y, int x2, int y2, Cons<Building> iterator){
|
||||||
world.raycastEach(x, y, x2, y2, (wx, wy) -> {
|
world.raycastEach(x, y, x2, y2, (wx, wy) -> {
|
||||||
|
|
||||||
Building tile = world.ent(wx, wy);
|
Building tile = world.build(wx, wy);
|
||||||
if(tile != null && tile.block().insulated){
|
if(tile != null && tile.block().insulated){
|
||||||
iterator.get(tile);
|
iterator.get(tile);
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
tempTileEnts.clear();
|
tempTileEnts.clear();
|
||||||
Geometry.circle(tile.x, tile.y, (int)(laserRange + 2), (x, y) -> {
|
Geometry.circle(tile.x, tile.y, (int)(laserRange + 2), (x, y) -> {
|
||||||
Building other = world.ent(x, y);
|
Building other = world.build(x, y);
|
||||||
if(valid.get(other)){
|
if(valid.get(other)){
|
||||||
if(!insulated(this, other)){
|
if(!insulated(this, other)){
|
||||||
tempTileEnts.add(other);
|
tempTileEnts.add(other);
|
||||||
@@ -346,7 +346,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
for(int x = (int)(tile.x - laserRange - 2); x <= tile.x + laserRange + 2; x++){
|
for(int x = (int)(tile.x - laserRange - 2); x <= tile.x + laserRange + 2; x++){
|
||||||
for(int y = (int)(tile.y - laserRange - 2); y <= tile.y + laserRange + 2; y++){
|
for(int y = (int)(tile.y - laserRange - 2); y <= tile.y + laserRange + 2; y++){
|
||||||
Building link = world.ent(x, y);
|
Building link = world.build(x, y);
|
||||||
|
|
||||||
if(link != this && linkValid(this, link, false)){
|
if(link != this && linkValid(this, link, false)){
|
||||||
boolean linked = linked(link);
|
boolean linked = linked(link);
|
||||||
@@ -370,7 +370,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
Draw.z(Layer.power);
|
Draw.z(Layer.power);
|
||||||
|
|
||||||
for(int i = 0; i < power.links.size; i++){
|
for(int i = 0; i < power.links.size; i++){
|
||||||
Building link = world.ent(power.links.get(i));
|
Building link = world.build(power.links.get(i));
|
||||||
|
|
||||||
if(!linkValid(this, link)) continue;
|
if(!linkValid(this, link)) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,8 @@ public class SolidPump extends Pump{
|
|||||||
@Override
|
@Override
|
||||||
public void setBars(){
|
public void setBars(){
|
||||||
super.setBars();
|
super.setBars();
|
||||||
bars.add("efficiency", (SolidPumpEntity entity) -> new Bar(() ->
|
bars.add("efficiency", (SolidPumpEntity entity) -> new Bar(() -> Core.bundle.formatFloat("bar.pumpspeed",
|
||||||
Core.bundle.formatFloat("bar.pumpspeed",
|
entity.lastPump / Time.delta * 60, 1),
|
||||||
entity.lastPump / Time.delta() * 60, 1),
|
|
||||||
() -> Pal.ammo,
|
() -> Pal.ammo,
|
||||||
() -> entity.warmup));
|
() -> entity.warmup));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,15 +96,15 @@ public class RepairPoint extends Block{
|
|||||||
if(target != null && (target.dead() || target.dst(tile) > repairRadius || target.health() >= target.maxHealth())){
|
if(target != null && (target.dead() || target.dst(tile) > repairRadius || target.health() >= target.maxHealth())){
|
||||||
target = null;
|
target = null;
|
||||||
}else if(target != null && consValid()){
|
}else if(target != null && consValid()){
|
||||||
target.heal(repairSpeed * Time.delta() * strength * efficiency());
|
target.heal(repairSpeed * Time.delta * strength * efficiency());
|
||||||
rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.5f);
|
rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.5f);
|
||||||
targetIsBeingRepaired = true;
|
targetIsBeingRepaired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target != null && targetIsBeingRepaired){
|
if(target != null && targetIsBeingRepaired){
|
||||||
strength = Mathf.lerpDelta(strength, 1f, 0.08f * Time.delta());
|
strength = Mathf.lerpDelta(strength, 1f, 0.08f * Time.delta);
|
||||||
}else{
|
}else{
|
||||||
strength = Mathf.lerpDelta(strength, 0f, 0.07f * Time.delta());
|
strength = Mathf.lerpDelta(strength, 0f, 0.07f * Time.delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(timer(timerTarget, 20)){
|
if(timer(timerTarget, 20)){
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
protected static String[] tags = {"&lc&fb[D]", "&lg&fb[I]", "&ly&fb[W]", "&lr&fb[E]", ""};
|
protected static String[] tags = {"&lc&fb[D]", "&lg&fb[I]", "&ly&fb[W]", "&lr&fb[E]", ""};
|
||||||
protected static DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm:ss"),
|
protected static DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm:ss"),
|
||||||
autosaveDate = DateTimeFormatter.ofPattern("MM_dd_yyyy_HH_mm_ss");
|
autosaveDate = DateTimeFormatter.ofPattern("MM-dd-yyyy_HH-mm-ss");
|
||||||
|
|
||||||
private final CommandHandler handler = new CommandHandler("");
|
private final CommandHandler handler = new CommandHandler("");
|
||||||
private final Fi logFolder = Core.settings.getDataDirectory().child("logs/");
|
private final Fi logFolder = Core.settings.getDataDirectory().child("logs/");
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||||||
final float baseEfficiency = liquid.flammability;
|
final float baseEfficiency = liquid.flammability;
|
||||||
final float expectedEfficiency = Math.min(1.0f, availableLiquidAmount / maximumLiquidUsage) * baseEfficiency;
|
final float expectedEfficiency = Math.min(1.0f, availableLiquidAmount / maximumLiquidUsage) * baseEfficiency;
|
||||||
final float expectedConsumptionPerTick = Math.min(maximumLiquidUsage, availableLiquidAmount);
|
final float expectedConsumptionPerTick = Math.min(maximumLiquidUsage, availableLiquidAmount);
|
||||||
final float expectedRemainingLiquidAmount = Math.max(0.0f, availableLiquidAmount - expectedConsumptionPerTick * Time.delta());
|
final float expectedRemainingLiquidAmount = Math.max(0.0f, availableLiquidAmount - expectedConsumptionPerTick * Time.delta);
|
||||||
|
|
||||||
createGenerator(inputType);
|
createGenerator(inputType);
|
||||||
assertTrue(entity.acceptLiquid(null, liquid, availableLiquidAmount), inputType + " | " + parameterDescription + ": Liquids which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
assertTrue(entity.acceptLiquid(null, liquid, availableLiquidAmount), inputType + " | " + parameterDescription + ": Liquids which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
||||||
@@ -170,7 +170,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||||||
float expectedEfficiency = entity.productionEfficiency;
|
float expectedEfficiency = entity.productionEfficiency;
|
||||||
|
|
||||||
float currentDuration = 0.0f;
|
float currentDuration = 0.0f;
|
||||||
while((currentDuration += Time.delta()) <= fakeItemDuration){
|
while((currentDuration += Time.delta) <= fakeItemDuration){
|
||||||
entity.updateTile();
|
entity.updateTile();
|
||||||
assertEquals(expectedEfficiency, entity.productionEfficiency, "Duration: " + currentDuration);
|
assertEquals(expectedEfficiency, entity.productionEfficiency, "Duration: " + currentDuration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ public class PowerTests extends PowerTestFixture{
|
|||||||
powerGraph.add(producerTile.build);
|
powerGraph.add(producerTile.build);
|
||||||
powerGraph.add(directConsumerTile.build);
|
powerGraph.add(directConsumerTile.build);
|
||||||
|
|
||||||
assertEquals(producedPower * Time.delta(), powerGraph.getPowerProduced(), Mathf.FLOAT_ROUNDING_ERROR);
|
assertEquals(producedPower * Time.delta, powerGraph.getPowerProduced(), Mathf.FLOAT_ROUNDING_ERROR);
|
||||||
assertEquals(requiredPower * Time.delta(), powerGraph.getPowerNeeded(), Mathf.FLOAT_ROUNDING_ERROR);
|
assertEquals(requiredPower * Time.delta, powerGraph.getPowerNeeded(), Mathf.FLOAT_ROUNDING_ERROR);
|
||||||
|
|
||||||
// Update and check for the expected power status of the consumer
|
// Update and check for the expected power status of the consumer
|
||||||
powerGraph.update();
|
powerGraph.update();
|
||||||
|
|||||||
Reference in New Issue
Block a user