Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions core/assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ stat.reload = Firing Rate
stat.ammo = Ammo
stat.shieldhealth = Shield Health
stat.cooldowntime = Cooldown Time
stat.activationtime = Activation Time
stat.explosiveness = Explosiveness
stat.basedeflectchance = Base Deflect Chance
stat.lightningchance = Lightning Chance
Expand Down Expand Up @@ -1165,6 +1166,8 @@ bar.launchcooldown = Launch Cooldown
bar.input = Input
bar.output = Output
bar.strength = [stat]{0}[lightgray]x strength
bar.activationtimer = Activates in {0}
bar.activated = Activated

units.processorcontrol = [lightgray]Processor Controlled

Expand Down Expand Up @@ -2301,8 +2304,8 @@ block.scatter.description = Fires clumps of lead, scrap or metaglass flak at ene
block.scorch.description = Burns any ground enemies close to it. Highly effective at close range.
block.hail.description = Fires small shells at ground enemies over long distances.
block.wave.description = Fires streams of liquid at enemies. Automatically extinguishes fires when supplied with water.
block.lancer.description = Charges and fires powerful beams of energy at ground targets.
block.arc.description = Fires arcs of electricity at ground targets.
block.lancer.description = Charges and fires powerful beams of energy at ground targets. Activates after a certain period of time.
block.arc.description = Fires arcs of electricity at ground targets. Activates after a certain period of time.
block.swarmer.description = Fires homing missiles at enemies.
block.salvo.description = Fires quick salvos of bullets at enemies.
block.fuse.description = Fires three close-range piercing blasts at nearby enemies.
Expand Down
12 changes: 12 additions & 0 deletions core/src/mindustry/content/Blocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3301,6 +3301,7 @@ Items.silicon, new BasicBulletType(3f, 12){{
rotateSpeed = 10f;
coolant = consumeCoolant(0.1f);
researchCostMultiplier = 0.05f;
depositCooldown = 1.5f;

limitRange(5f);
}};
Expand Down Expand Up @@ -3432,6 +3433,7 @@ Items.pyratite, new BulletType(4f, 60f){{
health = 400;
shootSound = Sounds.flame;
coolant = consumeCoolant(0.1f);
depositCooldown = 0.5f;
}};

hail = new ItemTurret("hail"){{
Expand Down Expand Up @@ -3495,6 +3497,7 @@ Items.pyratite, new ArtilleryBulletType(3f, 25){{
health = 260;
shootSound = Sounds.bang;
coolant = consumeCoolant(0.1f);
depositCooldown = 1.5f;
limitRange(0f);
}};

Expand Down Expand Up @@ -3548,6 +3551,7 @@ Liquids.oil, new LiquidBulletType(Liquids.oil){{
targetAir = false;
moveWhileCharging = false;
accurateDelay = false;
activationTime = 5.15f * 60f;
shootSound = Sounds.laser;
coolant = consumeCoolant(0.2f);

Expand Down Expand Up @@ -3603,6 +3607,7 @@ Liquids.oil, new LiquidBulletType(Liquids.oil){{
recoil = 1f;
size = 1;
health = 260;
activationTime = 2.8f * 60f;
shootSound = Sounds.spark;
consumePower(3.3f);
coolant = consumeCoolant(0.1f);
Expand Down Expand Up @@ -3695,6 +3700,7 @@ Items.surgeAlloy, new MissileBulletType(3.7f, 18){{

limitRange(5f);
coolant = consumeCoolant(0.3f);
depositCooldown = 1.5f;
}};

salvo = new ItemTurret("salvo"){{
Expand Down Expand Up @@ -3796,6 +3802,7 @@ Items.thorium, new BasicBulletType(4f, 29, "bullet"){{

limitRange();
coolant = consumeCoolant(0.2f);
depositCooldown = 1.5f;
}};

segment = new PointDefenseTurret("segment"){{
Expand Down Expand Up @@ -3912,6 +3919,7 @@ Items.thorium, new ShrapnelBulletType(){{
shootEffect = smokeEffect = Fx.thoriumShoot;
}}
);
depositCooldown = 0.5f;
}};

ripple = new ItemTurret("ripple"){{
Expand Down Expand Up @@ -4023,6 +4031,7 @@ Items.plastanium, new ArtilleryBulletType(3.4f, 20, "shell"){{

scaledHealth = 130;
shootSound = Sounds.artillery;
depositCooldown = 1.5f;
}};

cyclone = new ItemTurret("cyclone"){{
Expand Down Expand Up @@ -4139,6 +4148,7 @@ Items.surgeAlloy, new FlakBulletType(4.5f, 13){{
coolant = consumeCoolant(0.3f);

scaledHealth = 145;
depositCooldown = 1.5f;
limitRange();
}};

Expand Down Expand Up @@ -4183,6 +4193,7 @@ Items.surgeAlloy, new RailBulletType(){{
scaledHealth = 150;

coolant = consumeCoolant(1f);
depositCooldown = 1.5f;
consumePower(10f);
}};

Expand Down Expand Up @@ -4248,6 +4259,7 @@ Items.pyratite, new BasicBulletType(7f, 70){{
scaledHealth = 160;
coolant = consumeCoolant(1f);

depositCooldown = 1.5f;
limitRange();
}};

Expand Down
2 changes: 2 additions & 0 deletions core/src/mindustry/game/Rules.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public class Rules{
public boolean onlyDepositCore = false;
/** Cooldown, in seconds, of item depositing for players. */
public float itemDepositCooldown = 0.5f;
/** If true, certain turrets add aditional cooldown similar to itemDepositCooldown. */
public boolean enableTurretDepositCooldown = false;
/** If true, every enemy block in the radius of the (enemy) core is destroyed upon death. Used for campaign maps. */
public boolean coreDestroyClear = false;
/** If true, banned blocks are hidden from the build menu. */
Expand Down
2 changes: 1 addition & 1 deletion core/src/mindustry/graphics/OverlayRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void drawTop(){

Building build = world.buildWorld(v.x, v.y);
if(input.canDropItem() && build != null && build.interactable(player.team()) && build.acceptStack(player.unit().item(), player.unit().stack.amount, player.unit()) > 0 && player.within(build, itemTransferRange) &&
input.itemDepositCooldown <= 0f){
input.canDepositItem(build)){

boolean invalid = (state.rules.onlyDepositCore && !(build instanceof CoreBuild));

Expand Down
8 changes: 7 additions & 1 deletion core/src/mindustry/input/InputHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import mindustry.world.*;
import mindustry.world.blocks.ConstructBlock.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.defense.turrets.*;
import mindustry.world.blocks.distribution.*;
import mindustry.world.blocks.payloads.*;
import mindustry.world.blocks.storage.*;
Expand Down Expand Up @@ -2089,7 +2090,7 @@ public void tryDropItems(@Nullable Building build, float x, float y){
if(build != null && build.acceptStack(stack.item, stack.amount, player.unit()) > 0 && build.interactable(player.team()) &&
build.block.hasItems && player.unit().stack().amount > 0 && build.interactable(player.team())){

if(!(state.rules.onlyDepositCore && !(build instanceof CoreBuild)) && itemDepositCooldown <= 0f){
if(!(state.rules.onlyDepositCore && !(build instanceof CoreBuild)) && canDepositItem(build)){
Call.transferInventory(player, build);
itemDepositCooldown = state.rules.itemDepositCooldown;
}
Expand All @@ -2098,6 +2099,11 @@ public void tryDropItems(@Nullable Building build, float x, float y){
}
}

public boolean canDepositItem(@Nullable Building build){
float depositCooldown = itemDepositCooldown + ((build.block instanceof Turret && state.rules.enableTurretDepositCooldown)? ((Turret)build.block).depositCooldown : 0);
return depositCooldown <= 0;
}

public void rebuildArea(int x1, int y1, int x2, int y2){
NormalizeResult result = Placement.normalizeArea(x1, y1, x2, y2, rotation, false, 999999999);
Tmp.r1.set(result.x * tilesize, result.y * tilesize, (result.x2 - result.x) * tilesize, (result.y2 - result.y) * tilesize);
Expand Down
27 changes: 27 additions & 0 deletions core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package mindustry.world.blocks.defense.turrets;

import arc.*;
import arc.graphics.*;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
Expand All @@ -8,6 +10,7 @@
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.consumers.*;
Expand All @@ -21,6 +24,10 @@ public class BaseTurret extends Block{
public float rotateSpeed = 5;
public float fogRadiusMultiplier = 1f;
public boolean disableOverlapCheck = false;
/** How much time to start shooting after placement. */
public float activationTime = 0f;
/** Color of inactive region drawn on top (if found) */
public Color inactiveColor = Color.white;

/** Effect displayed when coolant is used. */
public Effect coolEffect = Fx.fuelburn;
Expand Down Expand Up @@ -81,10 +88,25 @@ public void setStats(){
super.setStats();

stats.add(Stat.shootRange, range / tilesize, StatUnit.blocks);
if(activationTime > 0) stats.add(Stat.activationTime, activationTime / 60f, StatUnit.seconds);
}

@Override
public void setBars(){
super.setBars();

if(activationTime > 0){
addBar("activationtimer", (BaseTurretBuild entity) ->
new Bar(() ->
(entity.activationTimer > 0)? Core.bundle.format("bar.activationtimer", Mathf.ceil(entity.activationTimer / 60f)) : Core.bundle.get("bar.activated"),
() -> (entity.activationTimer > 0)? Pal.lightOrange : Pal.techBlue,
() -> 1 - entity.activationTimer / activationTime));
}
}

public class BaseTurretBuild extends Building implements Ranged, RotBlock{
public float rotation = 90;
public float activationTimer = activationTime;

@Override
public float range(){
Expand All @@ -104,5 +126,10 @@ public void drawSelect(){
public float estimateDps(){
return 0f;
}

@Override
public BlockStatus status() {
return (activationTimer <= 0)? super.status() : BlockStatus.inactive;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public float activeSoundVolume(){

@Override
public byte version(){
return 3;
return 6;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public boolean acceptItem(Building source, Item item){

@Override
public byte version(){
return 2;
return 5;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ReloadTurretBuild extends BaseTurretBuild{
public float reloadCounter;

protected void updateCooling(){
if(reloadCounter < reload && coolant != null && coolant.efficiency(this) > 0 && efficiency > 0){
if(canReload() && coolant != null && coolant.efficiency(this) > 0 && efficiency > 0){
float capacity = coolant instanceof ConsumeLiquidFilter filter ? filter.getConsumed(this).heatCapacity : (coolant.consumes(liquids.current()) ? liquids.current().heatCapacity : 0.4f);
float amount = coolant.amount * coolant.efficiency(this);
coolant.update(this);
Expand All @@ -45,5 +45,9 @@ protected float ammoReloadMultiplier(){
protected float baseReloadSpeed(){
return efficiency;
}

protected boolean canReload(){
return reloadCounter < reload;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public class TractorBeamBuild extends BaseTurretBuild{

@Override
public void updateTile(){
if(activationTimer > 0){
activationTimer -= Time.delta;
return;
}

float eff = efficiency * coolantMultiplier, edelta = eff * delta();

//retarget
Expand Down Expand Up @@ -169,13 +174,23 @@ public void write(Writes write){
super.write(write);

write.f(rotation);
write.f(activationTimer);
}

@Override
public void read(Reads read, byte revision){
super.read(read, revision);

rotation = read.f();

if(revision >= 1){
activationTimer = read.f();
}
}

@Override
public byte version(){
return 1;
}
}
}
Loading
Loading