Skip to content
Merged
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ variables: powerProduction: n
- AccelTurret - turret which have acceleration
variables: speedUpPerShoot: n, maxAccel: n, cooldownSpeed: n
- DrawTeam - drawer class. Draws -team sprite

- ## NEW!
- ColliderCrafter - basic GenericCrafter but it outputs items/liquids with specific chance.
variables: produceChance: n (1=100%)
- OverHeatTurret - Turret which overheats after some shoots.
Expand All @@ -32,6 +30,9 @@ variables: effects: [], effectInterval: n, effectX: n, effectY: n
variables: tilingVariants: n, tilingSize: n
- AdjustableBeamNode - you can create infity nodes from beam node and change it angle
variables: beamDirections: [[n,n]]

- ## NEW!
- added cutscene thing world processor
check examples folder for more information


Expand Down
15 changes: 6 additions & 9 deletions mod.hjson
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
name: "hjsonpp"
displayName: "hjson++"
repo: "ItzCraft/hjsonpp"

version: "1.12"
minGameVersion: 154

author: "ItzCraft
helpers: Photon_gravity, Sputnuc"
main: "hjsonpp.HjsonPlusPlusMod"
java: true

author: "Main author: ItzCraft. \nHelpers: Photon_gravity, Sputnuc, AnDashik."
description: "Adds some new additional classes to help hjson modders. \nNote: this a library. Not a playable mod."
subtitle: "Goodluck with modding!"
description: "Adds some new additional classes to help hjson modders. \nNote: this a library. Not playable mod."
version: 1.14
subtitle: goodluck with modding!
minGameVersion: 157
12 changes: 12 additions & 0 deletions src/hjsonpp/HjsonPlusPlusMod.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package hjsonpp;

import hjsonpp.expand.wproc.*;
import mindustry.mod.*;

public class HjsonPlusPlusMod extends Mod{
Expand All @@ -21,4 +22,15 @@ public HjsonPlusPlusMod(){
ClassMap.classes.put("EffectWeapon", hjsonpp.expand.EffectWeapon.class);
ClassMap.classes.put("CustomEffects", hjsonpp.expand.CustomEffects.class);
}

@Override
public void init(){
super.init();
CustomStyles.load();
}

@Override
public void loadContent(){
HjsonppLogic.init();
}
}
16 changes: 16 additions & 0 deletions src/hjsonpp/expand/wproc/CustomStyles.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package hjsonpp.expand.wproc;

import arc.scene.style.Drawable;
import arc.scene.style.TextureRegionDrawable;
import mindustry.gen.Tex;

public class CustomStyles {
public static Drawable blackBackground;

public CustomStyles(){}

public static void load() {
final TextureRegionDrawable whiteui = (TextureRegionDrawable) Tex.whiteui;
blackBackground = whiteui.tint(0.0F, 0.0F, 0.0F, 1F);
}
}
84 changes: 84 additions & 0 deletions src/hjsonpp/expand/wproc/CustomUI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package hjsonpp.expand.wproc;
import arc.Core;
import arc.graphics.Color;
import arc.scene.ui.layout.Table;
import arc.scene.actions.*;
import arc.scene.event.Touchable;
import arc.math.*;
import mindustry.core.UI;
import mindustry.gen.Tex;
import mindustry.ui.Styles;

public class CustomUI extends UI{
protected static void bordlessTextDialog(String text, String unitIcon, float duration, boolean useBundle){
Table table = new Table();
table.touchable = Touchable.disabled;
table.setFillParent(true);
table.actions(Actions.delay(duration * 0.8f), Actions.fadeOut(duration * 0.3f, Interp.fade), Actions.remove());
table.bottom().table(Styles.black5, t -> t.margin(1).image(Core.atlas.find(unitIcon)).style(Styles.outlineLabel)).padLeft(-15f).padBottom(70f).size(65f, 80f);
if(useBundle){
table.bottom().table(Styles.black5, t -> t.margin(10f).add(Core.bundle.get(text)).style(Styles.outlineLabel)).padRight(65f).padBottom(70f).size(Core.bundle.get(text).length() * 11.5f, 60f);
}
else{
table.bottom().table(Styles.black5, t -> t.margin(10f).add(text).style(Styles.outlineLabel)).padRight(65f).padBottom(70f).size(text.length() * 11.5f, 60f);
}
Core.scene.add(table);
}
protected static void borderTextDialog(String text, String unitIcon, float duration, boolean useBundle){
Table table = new Table();
table.touchable = Touchable.disabled;
table.setFillParent(true);
table.actions(
Actions.delay(duration * 0.8f),
Actions.fadeOut(duration * 0.3f, Interp.fade),
Actions.remove()
);
table.bottom().table(t -> {
t.background(Tex.whiteui);
t.setColor(Color.gray);
t.margin(1f);

t.table(Styles.grayPanel, inner -> {
inner.margin(1f);
inner.image(Core.atlas.find(unitIcon))
.style(Styles.outlineLabel);
}).size(63f, 78f);
})
.padLeft(-15f)
.padBottom(70f);
String displayText = useBundle ? Core.bundle.get(text) : text;
float width = displayText.length() * 11.5f;

table.bottom().table(t -> {
t.background(Tex.whiteui);
t.setColor(Color.gray);
t.margin(1f);

t.table(Styles.grayPanel, inner -> {
inner.margin(10f);
inner.add(displayText).style(Styles.outlineLabel);
}).size(width - 2f, 58f);
})
.padRight(65f)
.padBottom(70f);

Core.scene.add(table);
}
public static void textDialog(String text, String unitIcon, float duration, boolean useBundle, String uiStyle, String nametag){
switch (uiStyle){
case "bordless" -> bordlessTextDialog(text, unitIcon, duration, useBundle);

case "border" -> borderTextDialog(text, unitIcon, duration, useBundle);

//case "nametag" -> nametagTextDialog(text, unitIcon, duration, useBundle, nametag);
};
}
public static void blackScreen(float duration){
Table table = new Table();
table.touchable = Touchable.disabled;
table.setFillParent(true);
table.actions(Actions.delay(duration * 0.8f), Actions.fadeOut(duration * 0.3f, Interp.fade), Actions.remove());
table.bottom().table(CustomStyles.blackBackground, t -> t.margin(1).image(Core.atlas.find("epsilon-black-screen")).style(Styles.outlineLabel)).size(2500f, 2500f);
Core.scene.add(table);
}
}
21 changes: 21 additions & 0 deletions src/hjsonpp/expand/wproc/DialogueStyles.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package hjsonpp.expand.wproc;

import arc.struct.ObjectMap;

public enum DialogueStyles{
bordless,
border;
//nametag
//unitless

public static ObjectMap<DialogueStyles, String> stylesMap = new ObjectMap<>();

static{
stylesMap.put(bordless,"bordless");
stylesMap.put(border, "border");
/*stylesMap.put(nametag, "nametag");
stylesMap.put(unitless, "unitless");*/
}

public static final DialogueStyles[] all = values();
}
17 changes: 17 additions & 0 deletions src/hjsonpp/expand/wproc/HjsonppLogic.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package hjsonpp.expand.wproc;

import arc.graphics.Color;
import hjsonpp.expand.wproc.statements.*;
import mindustry.gen.LogicIO;
import mindustry.logic.*;

public class HjsonppLogic {
public static LCategory Hjsonpp;

public static void init(){
Hjsonpp = new LCategory("hjsonpp-category", Color.valueOf("5edb80"));

LAssembler.customParsers.put("textdialog", TextDialog::new);
LogicIO.allStatements.addUnique(TextDialog::new);
}
}
30 changes: 30 additions & 0 deletions src/hjsonpp/expand/wproc/instructions/TextDialogI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package hjsonpp.expand.wproc.instructions;

import arc.util.Log;
import hjsonpp.expand.wproc.CustomUI;
import hjsonpp.expand.wproc.DialogueStyles;
import mindustry.logic.*;
import mindustry.type.UnitType;

public class TextDialogI implements LExecutor.LInstruction{
public LVar text, unitIconName, duration, useBundle, uiTemplate, nametag;

public TextDialogI(LVar text, LVar unitIconName, LVar duration, LVar useBundle, LVar uiTemplate, LVar nametag){
this.text = text;
this.unitIconName = unitIconName;
this.duration = duration;
this.useBundle = useBundle;
this.uiTemplate = uiTemplate;
this.nametag = nametag;
}

public TextDialogI(){}

@Override
public void run(LExecutor exec){
Log.info(uiTemplate.obj());
if(unitIconName.obj() instanceof UnitType icon && text.obj() instanceof String t){
CustomUI.textDialog(t, icon.name, duration.numf(), useBundle.bool(), uiTemplate.obj().toString(), nametag.obj().toString());
}
}
}
Loading
Loading