Skip to content

Commit

Permalink
t2 payload blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sk7725 committed Dec 27, 2020
1 parent cad9230 commit 09ef4c4
Show file tree
Hide file tree
Showing 16 changed files with 448 additions and 20 deletions.
16 changes: 13 additions & 3 deletions assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod.betamindy.name = [accent]Beta[]Mindy
mod.betamindy.name = [accent]Beta[][white]Mindy[]
mod.betamindy.short = [#b59e72]Demo of Chaos Itself[]
mod.betamindy.description = My first [accent]Java[] mod, has the same amount of chaotic energy of [cyan]sk7725/Commandblocks[].\n\n[green]Contributors[]: GlennFolker, EyeofDarkness, younggam, Voz-Duh
mod.betamindy.description = My first [accent]Java[] mod, has the same amount of chaotic energy of [cyan]sk7725/Commandblocks[].\n\n[green]Contributors[]: GlennFolker, EyeofDarkness, younggam, Voz-Duh, Rayforce

# Pistons
block.betamindy-piston.name = Piston [scarlet](WIP)[]
Expand All @@ -21,6 +21,16 @@ block.betamindy-payload-cannon.name = Payload Cannon
block.betamindy-payload-cannon.description = Can launch payloads. The higher the health of the payload, and the more blocks it travels, the more damage it deals, but consequently, the more damage the payload itself takes. The payload can be launched safely without damage in the [#98ffa9]inner range[].
block.betamindy-payload-catapult.name = Payload Catapult
block.betamindy-payload-catapult.description = Can launch bigger payloads in higher velocities. Devastating news for the enemy.
block.betamindy-block-workshop.name = Block Workshop
block.block-forge.description = Forges block payloads. Use with the payload cannon to remotely place down blocks.
block.block-forge.details = The forbidden block, revealed by BetaMindy(tm).
block.betamindy-block-workshop.description = Forges bigger blocks. Needs coolant to forge blocks.
block.betamindy-block-packer.name = Block Packer
block.block-loader.description = Loads the inventories of block payloads.
block.betamindy-block-packer.description = Bigger version of the block loader. Loads the inventories of bigger blocks.
block.betamindy-block-unpacker.name = Block Unpacker
block.block-unloader.description = Unloads the inventories of block payloads.
block.betamindy-block-unpacker.description = Bigger version of the block unloader. Unloads the inventories of bigger blocks.

# Environment
block.betamindy-radiation.name = Radiation
Expand All @@ -30,7 +40,7 @@ block.betamindy-present.description = A holly jolly block. Click to unwrap, you
block.betamindy-present.details = [scarlet]Merry[] [lime]Christmas[] [scarlet]and[] [lime]Happy[] [scarlet]New[] [lime]Year[][scarlet]![]

# Stats
stat.dphealth = {0} /(payload healthxblocks)
stat.dphealth = {0}*payload health*distance(blocks)

# Settings
setting.slimeeffect.name = Animated Slime [lightgray](requires animated shields)[]
Expand Down
17 changes: 14 additions & 3 deletions assets/bundles/bundle_ko.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod.betamindy.name = [accent]Beta[]Mindy [lightgray]베타민디[]
mod.betamindy.name = [accent]Beta[][white]Mindy[] [lightgray]베타민디[]
mod.betamindy.short = [#b59e72]혼돈의 데모[]
mod.betamindy.description = 첫 [accent]Java[] 모드 신작! [cyan]sk7725/Commandblocks[]과 비견될 만한 혼돈!\n\n[green]기여자[]: 영감, GlennFolker, EyeofDarkness, Voz-Duh
mod.betamindy.description = 첫 [accent]Java[] 모드 신작! [cyan]sk7725/Commandblocks[]과 비견될 만한 혼돈!\n\n[green]기여자[]: 영감, 레이포스, GlennFolker, EyeofDarkness, Voz-Duh

# Pistons
block.betamindy-piston.name = 피스톤 [scarlet](미완성)[]
Expand All @@ -21,6 +21,17 @@ block.betamindy-payload-cannon.name = ȭ
block.betamindy-payload-cannon.description = 화물을 발사합니다. 화물의 체력이 높고 비거리가 멀수록 더 많은 피해를 입히지만, 동시에 더 많은 피해를 화물이 입습니다. [#98ffa9]내부 사거리[] 내에서는 화물이 피해를 입지 않습니다.
block.betamindy-payload-catapult.name = 화물 투석기
block.betamindy-payload-catapult.description = 더 빠른 속력으로 더 큰 화물을 날릴 수 있습니다. 적들에게는 나쁜 소식입니다.
block.block-forge.name = 블록 제작대
block.block-forge.description = 블록 화물을 제작합니다. 화물 대포를 활용해서 원격으로 블록을 설치하세요.
block.block-forge.details = 아누크의 금지된 블록, 개봉박두!
block.betamindy-block-workshop.name = 블록 공장
block.betamindy-block-workshop.description = 더 큰 블록 화물을 제작합니다. 냉각수가 필요합니다.
block.betamindy-block-packer.name = 블록 패커
block.block-loader.description = 블록 화물에 자원을 넣습니다.
block.betamindy-block-packer.description = 더 큰 블록 로더입니다. 큰 블록 화물에 자원을 넣습니다.
block.betamindy-block-unpacker.name = 블록 언패커
block.block-unloader.description = 블록 화물에서 자원을 빼냅니다.
block.betamindy-block-unpacker.description = 더 큰 블록 언로더입니다. 큰 블록 화물에서 자원을 빼냅니다.

# Environment
block.betamindy-radiation.name = 방사능
Expand All @@ -30,7 +41,7 @@ block.betamindy-present.description =
block.betamindy-present.details = [scarlet]메리[] [lime]크리스마스[][scarlet],[] [lime]해피[] [scarlet]뉴[][lime]이어[][scarlet]![]

# Stats
stat.dphealth = {0} /(화물 체력x블록)
stat.dphealth = {0}x화물 체력x비거리(블록)

# Settings
setting.slimeeffect.name = 슬라임 애니메이션 효과 [lightgray](보호막 애니메이션 필요)[]
Expand Down
Binary file added assets/sprites/production/block-packer-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/production/block-packer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/production/block-unpacker-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/production/block-unpacker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/production/block-workshop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/turrets/payload-catapult-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/turrets/payload-catapult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ task dexify doLast {
workingDir jar.archiveFile.get().asFile.parent

if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine "cmd", "/c", "dx", "--dex", "--min-sdk-version=26", "--output=dexed-$buildFilename", buildFilename
commandLine "cmd", "/c", "dx", "--dex", "--min-sdk-version=26", "--output=dexed-$buildFilename", "--no-optimize", buildFilename
} else {
commandLine "dx", "--dex", "--min-sdk-version=26", "--output=dexed-$buildFilename", buildFilename
commandLine "dx", "--dex", "--min-sdk-version=26", "--output=dexed-$buildFilename", "--no-optimize", buildFilename
}
}
}
Expand Down
42 changes: 35 additions & 7 deletions src/betamindy/content/MindyBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import betamindy.world.blocks.defense.turrets.PayloadTurret;
import betamindy.world.blocks.distribution.*;
import betamindy.world.blocks.environment.*;
import betamindy.world.blocks.power.AccelBlock;
import betamindy.world.blocks.power.*;
import betamindy.world.blocks.temporary.*;
import mindustry.content.*;
import mindustry.ctype.*;
import mindustry.game.Team;
Expand All @@ -20,8 +21,8 @@ public class MindyBlocks implements ContentList {
public static Block radiation, exoticMatter, present,
//pistons
piston, stickyPiston, sporeSlime, sporeSlimeSided, accel,
//defense
payCannon, payCatapult;
//payloads
payCannon, payCatapult, blockWorkshop, blockPacker, blockUnpacker;

@Override
public void load() {
Expand Down Expand Up @@ -87,7 +88,7 @@ public void load() {
shootEffect = MindyFx.cannonShoot;
smokeEffect = Fx.shootBigSmoke2;
safeRange = 140f;
reloadTime = 90f;
reloadTime = 120f;
rotateSpeed = 1.8f;
payloadOffset = 7f;
payloadShootOffset = 8f;
Expand All @@ -107,15 +108,42 @@ public void load() {
damage = 2.3f;
maxDamagePercent = 0.75f;
safeRange = 190f;
reloadTime = 150f;
reloadTime = 250f;
rotateSpeed = 1.3f;
payloadOffset = 12f;
payloadShootOffset = 13f;
payloadOffset = 7.5f;
payloadShootOffset = 7f;
payloadScale = 0.85f;
maxPaySize = 14.5f; //I'm not adding a T3. ...definitely. ...definitely? ...definitely.
consumes.power(7.25f);
shootType = MindyBullets.payBulletBig;
requirements(Category.turret, with(Items.copper, 1500, Items.titanium, 900, Items.silicon, 650, Items.plastanium, 390, Items.phaseFabric, 180, Items.surgeAlloy, 165));
}};

blockWorkshop = new BetterBlockForge("block-workshop"){{
health = 80;
size = 5;
minBlockSize = 3;
maxBlockSize = 4;
buildSpeed = 0.2f;
consumes.power(3.25f);
consumes.liquid(Liquids.cryofluid, 1f);
requirements(Category.production, with(Items.thorium, 160, Items.phaseFabric, 60, Items.surgeAlloy, 45));
}};

blockPacker = new BetterBlockLoader("block-packer"){{
health = 80;
size = 5;
maxBlockSize = 4;
consumes.power(3.25f);
requirements(Category.production, with(Items.thorium, 160, Items.plastanium, 65, Items.phaseFabric, 30));
}};

blockUnpacker = new BetterBlockUnloader("block-unpacker"){{
health = 80;
size = 5;
maxBlockSize = 4;
consumes.power(3.25f);
requirements(Category.production, with(Items.thorium, 160, Items.plastanium, 30, Items.phaseFabric, 65));
}};
}
}
4 changes: 2 additions & 2 deletions src/betamindy/content/MindyBullets.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class MindyBullets implements ContentList {
public static BulletType payBullet, payBulletBig;
@Override
public void load(){
payBullet = new PayloadBullet(){{
payBullet = new PayloadBullet(1.6f){{
hitEffect = Fx.mineBig;
despawnEffect = Fx.none;
hitColor = Pal.engine;
Expand All @@ -20,7 +20,7 @@ public void load(){
splashDamageRadius = 30f;
}};

payBulletBig = new PayloadBullet(2.6f){{
payBulletBig = new PayloadBullet(3.2f){{
hitEffect = Fx.mineHuge;
despawnEffect = MindyFx.payShock;
hitColor = Pal.lancerLaser;
Expand Down
10 changes: 7 additions & 3 deletions src/betamindy/world/blocks/defense/turrets/PayloadTurret.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class PayloadTurret extends Turret {
/** Payload fire offset*/
public float payloadShootOffset = 15f;
/** Maximum accepted payload size */
public float maxPaySize = 5.5f;
public float maxPaySize = 4.5f;

public Effect acceptEffect = MindyFx.cannonAccept;

Expand Down Expand Up @@ -87,14 +87,18 @@ else if(payload instanceof UnitPayload){
return Core.atlas.find("error");
}

public float rotationOffset(){
return (payload instanceof BuildPayload) && ((BuildPayload)payload).block().rotate ? 0f : -90f;
}

@Override
public void draw(){
super.draw();
if(payload != null) {
TextureRegion payIcon = payloadIcon();
tr2.trns(rotation, -recoil + payloadOffset);
Draw.color(team.color, Color.white, payheat);
Draw.rect(payIcon, x + tr2.x, y + tr2.y, payIcon.width * Draw.scl * Draw.xscl * payloadScale * payheat, payIcon.height * Draw.scl * Draw.yscl * payloadScale * payheat, rotation - 90);
Draw.mixcol(team.color, 1f - payheat);
Draw.rect(payIcon, x + tr2.x, y + tr2.y, payIcon.width * Draw.scl * Draw.xscl * payloadScale * payheat, payIcon.height * Draw.scl * Draw.yscl * payloadScale * payheat, rotation + rotationOffset());
Draw.reset();
}
}
Expand Down
160 changes: 160 additions & 0 deletions src/betamindy/world/blocks/temporary/BetterBlockForge.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
package betamindy.world.blocks.temporary;

import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.payloads.*;
import mindustry.world.blocks.production.*;
import mindustry.world.consumers.*;

import static mindustry.Vars.*;

//TODO: Will be removed when Anuke publishes next release(current: v122)
public class BetterBlockForge extends PayloadAcceptor{
public float buildSpeed = 0.4f;
public int minBlockSize = 1, maxBlockSize = 2;

public BetterBlockForge(String name){
super(name);

size = 3;
update = true;
outputsPayload = true;
hasItems = true;
configurable = true;
hasPower = true;
rotate = true;

config(Block.class, (BlockForgeBuild tile, Block block) -> tile.recipe = block);

consumes.add(new ConsumeItemDynamic((BlockForgeBuild e) -> e.recipe != null ? e.recipe.requirements : ItemStack.empty));
}

@Override
public TextureRegion[] icons(){
return new TextureRegion[]{region, outRegion};
}

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

bars.add("progress", (BlockForgeBuild entity) -> new Bar("bar.progress", Pal.ammo, () -> entity.recipe == null ? 0f : (entity.progress / entity.recipe.buildCost)));
}

@Override
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
Draw.rect(region, req.drawx(), req.drawy());
Draw.rect(outRegion, req.drawx(), req.drawy(), req.rotation * 90);
}

public class BlockForgeBuild extends PayloadAcceptorBuild<BuildPayload>{
public @Nullable Block recipe;
public float progress, time, heat;

@Override
public boolean acceptItem(Building source, Item item){
return items.get(item) < getMaximumAccepted(item);
}

@Override
public int getMaximumAccepted(Item item){
if(recipe == null) return 0;
for(ItemStack stack : recipe.requirements){
if(stack.item == item) return stack.amount * 2;
}
return 0;
}

@Override
public boolean acceptPayload(Building source, Payload payload){
return false;
}

@Override
public void updateTile(){
boolean produce = recipe != null && consValid() && payload == null;

if(produce){
progress += buildSpeed * edelta();

if(progress >= recipe.buildCost){
consume();
payload = new BuildPayload(recipe, team);
payVector.setZero();
progress = 0f;
}
}else{
progress = 0;
}

heat = Mathf.lerpDelta(heat, Mathf.num(produce), 0.3f);
time += heat * delta();

moveOutPayload();
}

@Override
public void buildConfiguration(Table table){
Seq<Block> blocks = Vars.content.blocks().select(b -> b.isVisible() && b.size >= minBlockSize && b.size <= maxBlockSize);

ItemSelection.buildTable(table, blocks, () -> recipe, this::configure);
}

@Override
public Object config(){
return recipe;
}

@Override
public void draw(){
Draw.rect(region, x, y);
Draw.rect(outRegion, x, y, rotdeg());

if(recipe != null){
Draw.draw(Layer.blockOver, () -> Drawf.construct(this, recipe, 0, progress / recipe.buildCost, heat, time));
}

drawPayload();
}

@Override
public void drawSelect(){
if(recipe != null){
float dx = x - size * tilesize/2f, dy = y + size * tilesize/2f;
TextureRegion icon = recipe.icon(Cicon.medium);
Draw.mixcol(Color.darkGray, 1f);
//Fixes size because modded content icons are not scaled
Draw.rect(icon, dx - 0.7f, dy - 1f, Draw.scl * Draw.xscl * 24f, Draw.scl * Draw.yscl * 24f);
Draw.reset();
Draw.rect(icon, dx, dy, Draw.scl * Draw.xscl * 24f, Draw.scl * Draw.yscl * 24f);
}
}

@Override
public void write(Writes write){
super.write(write);
write.s(recipe == null ? -1 : recipe.id);
write.f(progress);
}

@Override
public void read(Reads read, byte revision){
super.read(read, revision);
recipe = Vars.content.block(read.s());
progress = read.f();
}
}
}
Loading

0 comments on commit 09ef4c4

Please sign in to comment.