Processor mission set instruction
This commit is contained in:
@@ -130,6 +130,8 @@ public class Rules{
|
||||
public Color cloudColor = new Color(0f, 0f, 0f, 0f);
|
||||
/** name of the custom mode that this ruleset describes, or null. */
|
||||
public @Nullable String modeName;
|
||||
/** Mission string displayed instead of wave/core counter. Null to disable. */
|
||||
public @Nullable String mission;
|
||||
/** Whether cores incinerate items when full, just like in the campaign. */
|
||||
public boolean coreIncinerates = false;
|
||||
/** If false, borders fade out into darkness. Only use with custom backgrounds!*/
|
||||
|
||||
@@ -1365,7 +1365,7 @@ public class LExecutor{
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
if(headless) return;
|
||||
if(headless && type != MessageType.mission) return;
|
||||
|
||||
//skip back to self until possible
|
||||
//TODO this is guaranteed desync on servers - I don't see a good solution
|
||||
@@ -1383,6 +1383,8 @@ public class LExecutor{
|
||||
case notify -> ui.hudfrag.showToast(Icon.info, text);
|
||||
case announce -> ui.announce(text, exec.numf(duration));
|
||||
case toast -> ui.showInfoToast(text, exec.numf(duration));
|
||||
//TODO desync?
|
||||
case mission -> state.rules.mission = text;
|
||||
}
|
||||
|
||||
exec.textBuffer.setLength(0);
|
||||
|
||||
@@ -3,7 +3,8 @@ package mindustry.logic;
|
||||
public enum MessageType{
|
||||
notify,
|
||||
announce,
|
||||
toast;
|
||||
toast,
|
||||
mission;
|
||||
|
||||
public static final MessageType[] all = values();
|
||||
}
|
||||
|
||||
@@ -596,13 +596,14 @@ public class HudFragment extends Fragment{
|
||||
|
||||
StringBuilder ibuild = new StringBuilder();
|
||||
|
||||
IntFormat wavef = new IntFormat("wave");
|
||||
IntFormat wavefc = new IntFormat("wave.cap");
|
||||
IntFormat enemyf = new IntFormat("wave.enemy");
|
||||
IntFormat enemiesf = new IntFormat("wave.enemies");
|
||||
IntFormat enemycf = new IntFormat("wave.enemycore");
|
||||
IntFormat enemycsf = new IntFormat("wave.enemycores");
|
||||
IntFormat waitingf = new IntFormat("wave.waiting", i -> {
|
||||
IntFormat
|
||||
wavef = new IntFormat("wave"),
|
||||
wavefc = new IntFormat("wave.cap"),
|
||||
enemyf = new IntFormat("wave.enemy"),
|
||||
enemiesf = new IntFormat("wave.enemies"),
|
||||
enemycf = new IntFormat("wave.enemycore"),
|
||||
enemycsf = new IntFormat("wave.enemycores"),
|
||||
waitingf = new IntFormat("wave.waiting", i -> {
|
||||
ibuild.setLength(0);
|
||||
int m = i/60;
|
||||
int s = i % 60;
|
||||
@@ -737,6 +738,12 @@ public class HudFragment extends Fragment{
|
||||
table.labelWrap(() -> {
|
||||
builder.setLength(0);
|
||||
|
||||
//mission overrides everything
|
||||
if(state.rules.mission != null){
|
||||
builder.append(state.rules.mission);
|
||||
return builder;
|
||||
}
|
||||
|
||||
if(!state.rules.waves && state.rules.attackMode){
|
||||
int sum = Math.max(state.teams.present.sum(t -> t.team != player.team() ? t.cores.size : 0), 1);
|
||||
builder.append(sum > 1 ? enemycsf.get(sum) : enemycf.get(sum));
|
||||
|
||||
Reference in New Issue
Block a user