diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 1bc5333d6d..eebc3632d6 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -515,6 +515,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Items content.liquid.name = Liquids diff --git a/core/assets/bundles/bundle_cs.properties b/core/assets/bundles/bundle_cs.properties index 7275d3dfc4..b7ae8df2f3 100644 --- a/core/assets/bundles/bundle_cs.properties +++ b/core/assets/bundles/bundle_cs.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Předměty content.liquid.name = Tekutiny content.unit.name = jednotky diff --git a/core/assets/bundles/bundle_de.properties b/core/assets/bundles/bundle_de.properties index 52ebb55ef8..c842cb6ac2 100644 --- a/core/assets/bundles/bundle_de.properties +++ b/core/assets/bundles/bundle_de.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Materialien content.liquid.name = Flüssigkeiten content.unit.name = Einheiten diff --git a/core/assets/bundles/bundle_es.properties b/core/assets/bundles/bundle_es.properties index 3e93c1bfda..05cca99013 100644 --- a/core/assets/bundles/bundle_es.properties +++ b/core/assets/bundles/bundle_es.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Objetos content.liquid.name = Líquidos content.unit.name = Unidades diff --git a/core/assets/bundles/bundle_fr.properties b/core/assets/bundles/bundle_fr.properties index c088ee00b3..fcbaa97fbc 100644 --- a/core/assets/bundles/bundle_fr.properties +++ b/core/assets/bundles/bundle_fr.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Objets content.liquid.name = Liquides content.unit.name = Unités diff --git a/core/assets/bundles/bundle_fr_BE.properties b/core/assets/bundles/bundle_fr_BE.properties index 6e81cb74b3..9024da1edc 100644 --- a/core/assets/bundles/bundle_fr_BE.properties +++ b/core/assets/bundles/bundle_fr_BE.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Objets content.liquid.name = Liquides content.unit.name = Unités diff --git a/core/assets/bundles/bundle_in_ID.properties b/core/assets/bundles/bundle_in_ID.properties index e24a065b32..73dc5c0e0e 100644 --- a/core/assets/bundles/bundle_in_ID.properties +++ b/core/assets/bundles/bundle_in_ID.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Items content.liquid.name = Liquids content.unit.name = Units diff --git a/core/assets/bundles/bundle_it.properties b/core/assets/bundles/bundle_it.properties index 44176a7194..fd8fd15239 100644 --- a/core/assets/bundles/bundle_it.properties +++ b/core/assets/bundles/bundle_it.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Oggetti content.liquid.name = Liquidi content.unit.name = Units diff --git a/core/assets/bundles/bundle_ja.properties b/core/assets/bundles/bundle_ja.properties index 63b21d297d..83b98c50fc 100644 --- a/core/assets/bundles/bundle_ja.properties +++ b/core/assets/bundles/bundle_ja.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = アイテム content.liquid.name = 液体 content.unit.name = ユニット diff --git a/core/assets/bundles/bundle_ko.properties b/core/assets/bundles/bundle_ko.properties index 716fb6b962..6616717803 100644 --- a/core/assets/bundles/bundle_ko.properties +++ b/core/assets/bundles/bundle_ko.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = 아이템 content.liquid.name = 액체 content.unit.name = 유닛 diff --git a/core/assets/bundles/bundle_nl.properties b/core/assets/bundles/bundle_nl.properties index 0d6c07e8db..92503f89b9 100644 --- a/core/assets/bundles/bundle_nl.properties +++ b/core/assets/bundles/bundle_nl.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Items content.liquid.name = Liquids content.unit.name = Units diff --git a/core/assets/bundles/bundle_pl.properties b/core/assets/bundles/bundle_pl.properties index e332d979aa..b6d78a23c3 100644 --- a/core/assets/bundles/bundle_pl.properties +++ b/core/assets/bundles/bundle_pl.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Przedmioty content.liquid.name = Płyny content.unit.name = Jednostki diff --git a/core/assets/bundles/bundle_pt_BR.properties b/core/assets/bundles/bundle_pt_BR.properties index 399a0cda93..ff94b15d05 100644 --- a/core/assets/bundles/bundle_pt_BR.properties +++ b/core/assets/bundles/bundle_pt_BR.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Itens content.liquid.name = Liquidos content.unit.name = Units diff --git a/core/assets/bundles/bundle_ru.properties b/core/assets/bundles/bundle_ru.properties index 4e765b757a..ae029fd786 100644 --- a/core/assets/bundles/bundle_ru.properties +++ b/core/assets/bundles/bundle_ru.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Предметы content.liquid.name = Жидкости content.unit.name = Боевые единицы diff --git a/core/assets/bundles/bundle_tk.properties b/core/assets/bundles/bundle_tk.properties index 5c6437de01..ad5e837852 100644 --- a/core/assets/bundles/bundle_tk.properties +++ b/core/assets/bundles/bundle_tk.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Esyalar content.liquid.name = Sivilar content.unit.name = Units diff --git a/core/assets/bundles/bundle_tr.properties b/core/assets/bundles/bundle_tr.properties index 5dd7bd41ff..0f9d5bbb1f 100644 --- a/core/assets/bundles/bundle_tr.properties +++ b/core/assets/bundles/bundle_tr.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Items content.liquid.name = Liquids content.unit.name = Units diff --git a/core/assets/bundles/bundle_uk_UA.properties b/core/assets/bundles/bundle_uk_UA.properties index aba4909bc6..4b30542d65 100644 --- a/core/assets/bundles/bundle_uk_UA.properties +++ b/core/assets/bundles/bundle_uk_UA.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = Предмети content.liquid.name = Рідини content.unit.name = Бойові одиниці diff --git a/core/assets/bundles/bundle_zh_CN.properties b/core/assets/bundles/bundle_zh_CN.properties index 0613fd089f..401680fb2a 100644 --- a/core/assets/bundles/bundle_zh_CN.properties +++ b/core/assets/bundles/bundle_zh_CN.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = 物品 content.liquid.name = 液体 content.unit.name = 部队 diff --git a/core/assets/bundles/bundle_zh_TW.properties b/core/assets/bundles/bundle_zh_TW.properties index 7780b53c09..a1e753c667 100644 --- a/core/assets/bundles/bundle_zh_TW.properties +++ b/core/assets/bundles/bundle_zh_TW.properties @@ -505,6 +505,8 @@ rules.unitdrops = Unit Drops rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.respawntime = Respawn Time:[LIGHT_GRAY] (sec) rules.wavespacing = Wave Spacing:[LIGHT_GRAY] (sec) +rules.buildcostmultiplier = Build Cost Multiplier +rules.buildspeedmultiplier = Build Speed Multiplier content.item.name = 物品 content.liquid.name = 液體 content.unit.name = 機組 diff --git a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java index 98096ecc3b..e4c436d084 100644 --- a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java @@ -234,9 +234,9 @@ public interface BuilderTrait extends Entity, TeamTrait{ if(!Net.client()){ //deconstructing is 2x as fast if(current.breaking){ - entity.deconstruct(unit, core, 2f / entity.buildCost * Time.delta() * getBuildPower(tile)); + entity.deconstruct(unit, core, 2f / entity.buildCost * Time.delta() * getBuildPower(tile) * state.rules.buildSpeedMultiplier); }else{ - entity.construct(unit, core, 1f / entity.buildCost * Time.delta() * getBuildPower(tile)); + entity.construct(unit, core, 1f / entity.buildCost * Time.delta() * getBuildPower(tile) * state.rules.buildSpeedMultiplier); } current.progress = entity.progress(); diff --git a/core/src/io/anuke/mindustry/game/RulePreset.java b/core/src/io/anuke/mindustry/game/RulePreset.java index 2fb2fbe504..10bbcf00d0 100644 --- a/core/src/io/anuke/mindustry/game/RulePreset.java +++ b/core/src/io/anuke/mindustry/game/RulePreset.java @@ -25,6 +25,8 @@ public enum RulePreset{ pvp = true; enemyCoreBuildRadius = 600f; respawnTime = 60 * 10; + buildCostMultiplier = 0.5f; + buildSpeedMultiplier = 2f; }}); private final Supplier rules; diff --git a/core/src/io/anuke/mindustry/game/Rules.java b/core/src/io/anuke/mindustry/game/Rules.java index cf31cce7e0..0338e51b88 100644 --- a/core/src/io/anuke/mindustry/game/Rules.java +++ b/core/src/io/anuke/mindustry/game/Rules.java @@ -19,6 +19,10 @@ public class Rules{ public boolean pvp; /**Whether enemy units drop random items on death.*/ public boolean unitDrops; + /**Multiplier for buildings for the player.*/ + public float buildCostMultiplier = 1f; + /**Multiplier for building speed.*/ + public float buildSpeedMultiplier = 1f; /**No-build zone around enemy core radius.*/ public float enemyCoreBuildRadius = 400f; /**Player respawn time in ticks.*/ diff --git a/core/src/io/anuke/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/CustomRulesDialog.java index 2f1c10663b..2048f88b99 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/CustomRulesDialog.java @@ -15,6 +15,10 @@ public class CustomRulesDialog extends FloatingDialog{ public CustomRulesDialog(){ super("$mode.custom"); + + rules.waves = true; + rules.waveTimer = true; + setFillParent(true); shown(this::setup); addCloseButton(); @@ -31,12 +35,14 @@ public class CustomRulesDialog extends FloatingDialog{ main.row(); main.addCheck("$rules.wavetimer", b -> rules.waveTimer = b).checked(b -> rules.waveTimer); main.row(); - main.addCheck("$rules.waves", b -> rules.waves = b).checked(b -> rules.waves); + main.addCheck("$rules.waves", b -> rules.waves = b).checked(b -> rules.waves).disabled(b -> rules.pvp); main.row(); - main.addCheck("$rules.pvp", b -> rules.pvp = b).checked(b -> rules.pvp); + main.addCheck("$rules.pvp", b -> rules.pvp = b).checked(b -> rules.pvp).disabled(b -> rules.waves); main.row(); main.addCheck("$rules.unitdrops", b -> rules.unitDrops = b).checked(b -> rules.unitDrops); main.row(); + number("$rules.buildcostmultiplier", f -> rules.buildCostMultiplier = f, () -> rules.buildCostMultiplier); + number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier); number("$rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f*tilesize, () -> Math.min(rules.enemyCoreBuildRadius/tilesize, 200)); number("$rules.respawntime", f -> rules.respawnTime = f*60f, () -> rules.respawnTime/60f); number("$rules.wavespacing", f -> rules.waveSpacing = f*60f, () -> rules.waveSpacing/60f); @@ -46,7 +52,7 @@ public class CustomRulesDialog extends FloatingDialog{ main.table(t -> { t.left(); t.add(text).left().padRight(5); - Platform.instance.addDialog(t.addField((int)prov.get() + "", s -> cons.accept(Strings.parseFloat(s))) + Platform.instance.addDialog(t.addField(prov.get() + "", s -> cons.accept(Strings.parseFloat(s))) .valid(Strings::canParsePositiveFloat).width(120f).left().get()); }); diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index a627a248b1..116d9435d0 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -215,9 +215,10 @@ public class PlacementFragment extends Fragment{ if(core == null || state.rules.infiniteResources) return "*/*"; int amount = core.items.get(stack.item); - String color = (amount < stack.amount / 2f ? "[red]" : amount < stack.amount ? "[accent]" : "[white]"); + int stackamount = Math.round(stack.amount * state.rules.buildCostMultiplier); + String color = (amount < stackamount / 2f ? "[red]" : amount < stackamount ? "[accent]" : "[white]"); - return color + ui.formatAmount(amount) + "[white]/" + stack.amount; + return color + ui.formatAmount(amount) + "[white]/" + stackamount; }).padLeft(5); }).left(); req.row(); diff --git a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java index 897ae23a44..b4de5b5c2d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java @@ -197,8 +197,9 @@ public class BuildBlock extends Block{ float maxProgress = checkRequired(core.items, amount, false); for(int i = 0; i < block.buildRequirements.length; i++){ - accumulator[i] += Math.min(block.buildRequirements[i].amount * maxProgress, block.buildRequirements[i].amount - totalAccumulator[i] + 0.00001f); //add min amount progressed to the accumulator - totalAccumulator[i] = Math.min(totalAccumulator[i] + block.buildRequirements[i].amount * maxProgress, block.buildRequirements[i].amount); + int reqamount = Math.round(state.rules.buildCostMultiplier * block.buildRequirements[i].amount); + accumulator[i] += Math.min(reqamount * maxProgress, reqamount - totalAccumulator[i] + 0.00001f); //add min amount progressed to the accumulator + totalAccumulator[i] = Math.min(totalAccumulator[i] + reqamount * maxProgress, reqamount); } maxProgress = checkRequired(core.items, maxProgress, true); @@ -215,6 +216,7 @@ public class BuildBlock extends Block{ } public void deconstruct(Unit builder, TileEntity core, float amount){ + float deconstructMultiplier = 0.5f; if(block != null){ ItemStack[] requirements = block.buildRequirements; @@ -223,8 +225,9 @@ public class BuildBlock extends Block{ } for(int i = 0; i < requirements.length; i++){ - accumulator[i] += Math.min(requirements[i].amount * amount / 2f, requirements[i].amount / 2f - totalAccumulator[i]); //add scaled amount progressed to the accumulator - totalAccumulator[i] = Math.min(totalAccumulator[i] + requirements[i].amount * amount / 2f, requirements[i].amount); + int reqamount = Math.round(state.rules.buildCostMultiplier * requirements[i].amount); + accumulator[i] += Math.min(amount * deconstructMultiplier * reqamount, deconstructMultiplier * reqamount - totalAccumulator[i]); //add scaled amount progressed to the accumulator + totalAccumulator[i] = Math.min(totalAccumulator[i] + reqamount * amount * deconstructMultiplier, reqamount); int accumulated = (int)(accumulator[i]); //get amount @@ -248,9 +251,10 @@ public class BuildBlock extends Block{ float maxProgress = amount; for(int i = 0; i < block.buildRequirements.length; i++){ + int sclamount = Math.round(state.rules.buildCostMultiplier * block.buildRequirements[i].amount); int required = (int) (accumulator[i]); //calculate items that are required now - if(inventory.get(block.buildRequirements[i].item) == 0){ + if(inventory.get(block.buildRequirements[i].item) == 0 && sclamount != 0){ maxProgress = 0f; }else if(required > 0){ //if this amount is positive... //calculate how many items it can actually use