Skip to content

Commit 7391122

Browse files
committed
4.0.3
1 parent d2fcfa0 commit 7391122

File tree

7 files changed

+63
-70
lines changed

7 files changed

+63
-70
lines changed

changelog.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Version 4.0.3
2+
3+
- Opening the console now describes a few of the common keybinds in the default chat log.
4+
- Opening the console no longer interupts the current campaign music.
5+
- Opening the console no longer hides the campaign UI in the background.
6+
- Fixed the console not correctly re-pausing the game in the campaign.
7+
8+
9+
110
Version 4.0.2
211

312
- Goto, Jump and OpenMarket now use ID suggestions instead of name ones.

console.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"modVersion": {
66
"major": 4,
77
"minor": 0,
8-
"patch": 2
8+
"patch": 3
99
},
1010

1111
#Link towards a direct download, fetched from the online version file

jars/lw_Console.jar

-1.35 KB
Binary file not shown.

mod_info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Console Commands",
44
"author": "LazyWizard, Lukas04",
55
"utility": "true",
6-
"version": "4.0.2",
6+
"version": "4.0.3",
77
"description": "An in-game developer's console, by default summoned with control+backspace.\n\nFor a complete list of commands enter 'help'. For more information on a specific command enter 'help <command>'. Enter 'settings' to customize the console's appearance and behavior, including the key used to summon it.\n\nThis should be compatible with all mods and doesn't require a new game.",
88
"gameVersion": "0.98a-RC5",
99
"jars": [

src/org/lazywizard/console/ConsoleModPlugin.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,22 @@ public void onApplicationLoad() throws Exception
8080
// Load console settings - implementing it in ReloadConsole ensures the command will work identically
8181
ReloadConsole.reloadConsole();
8282

83-
Console.showMessage("Console loaded, summon with " + Console.getSettings().getConsoleSummonKey() + ".", Level.DEBUG);
84-
85-
if (needsSetup())
86-
{
87-
Console.showMessage("Use the Settings command to configure the console.", Level.DEBUG);
83+
if (Console.isUseLegacyConsole()) {
84+
Console.showMessage("Console loaded, summon with " + Console.getSettings().getConsoleSummonKey() + ".", Level.DEBUG);
85+
if (needsSetup())
86+
{
87+
Console.showMessage("Use the Settings command to configure the console.", Level.DEBUG);
88+
}
89+
} else {
90+
Console.showMessage("Console loaded", Level.DEBUG);
91+
//Console.showMessage("Controls: ", Level.DEBUG);
92+
Console.showMessage(" - Enter: confirm command", Level.DEBUG);
93+
Console.showMessage(" - Tab: autocomplete command/argument", Level.DEBUG);
94+
Console.showMessage(" - Left/Right: move cursor", Level.DEBUG);
95+
Console.showMessage(" - Up/Down: scroll command history/autocomplete suggestions", Level.DEBUG);
8896
}
97+
98+
8999
}
90100

91101
@Override

src/org/lazywizard/console/overlay/v2/panels/ConsoleOverlayPanel.kt

Lines changed: 36 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package org.lazywizard.console.overlay.v2.panels
22

33
import com.fs.graphics.util.Fader
4+
import com.fs.starfarer.api.EveryFrameScript
45
import com.fs.starfarer.api.GameState
56
import com.fs.starfarer.api.Global
67
import com.fs.starfarer.api.campaign.BaseCustomUIPanelPlugin
78
import com.fs.starfarer.api.campaign.InteractionDialogAPI
89
import com.fs.starfarer.api.campaign.InteractionDialogPlugin
910
import com.fs.starfarer.api.campaign.rules.MemoryAPI
1011
import com.fs.starfarer.api.combat.EngagementResultAPI
12+
import com.fs.starfarer.api.impl.MusicPlayerPluginImpl
13+
import com.fs.starfarer.api.impl.campaign.ids.Factions
1114
import com.fs.starfarer.api.input.InputEventAPI
1215
import com.fs.starfarer.api.ui.CustomPanelAPI
1316
import com.fs.starfarer.api.ui.TooltipMakerAPI
@@ -35,6 +38,7 @@ import org.lazywizard.console.overlay.v2.elements.ConsoleTextfield
3538
import org.lazywizard.console.overlay.v2.font.ConsoleFont
3639
import org.lazywizard.console.overlay.v2.misc.ReflectionUtils
3740
import org.lazywizard.console.overlay.v2.misc.clearChildren
41+
import org.lazywizard.console.overlay.v2.misc.getChildrenCopy
3842
import org.lazywizard.console.overlay.v2.misc.getParent
3943
import org.lazywizard.console.overlay.v2.settings.ConsoleV2Settings
4044
import org.lazywizard.lazylib.JSONUtils
@@ -141,7 +145,7 @@ class ConsoleOverlayPanel(private val context: CommandContext) : BaseCustomUIPan
141145

142146
var requiresRecreation = false
143147

144-
var placeHolderDialog: InteractionDialogAPI? = null
148+
var placeHolderDialog: UIPanelAPI? = null
145149

146150
var compileScope = CoroutineScope(Dispatchers.Default)
147151
var compileJob: Job? = null
@@ -165,11 +169,32 @@ class ConsoleOverlayPanel(private val context: CommandContext) : BaseCustomUIPan
165169

166170
instance = this
167171

172+
if (Global.getCurrentState() == GameState.COMBAT) {
173+
wasPaused = Global.getCombatEngine().isPaused
174+
//Global.getCombatEngine().viewport.isExternalControl = true //Prevent moving screen with dragging
175+
Global.getCombatEngine().isPaused = true
176+
}
177+
178+
if (Global.getCurrentState() == GameState.CAMPAIGN) {
179+
wasPaused = Global.getSector().isPaused
180+
Global.getSector().isPaused = true;
181+
}
182+
168183
//Open a dialog to prevent input from most other mods
169184
if (context.isInCampaign) {
170185
if (!Global.getSector().campaignUI.isShowingDialog) {
171-
Global.getSector().campaignUI.showInteractionDialog(PlaceholderDialog(), Global.getSector().playerFleet)
172-
placeHolderDialog = Global.getSector().campaignUI.currentInteractionDialog
186+
var ui = Global.getSector().campaignUI
187+
188+
//Use message dialog instead of InteractionDialog, as it doesnt hide campaign UI and doesnt mess with pause behaviour
189+
ui.showMessageDialog("")
190+
val screenPanel = ReflectionUtils.get("screenPanel", ui) as UIPanelAPI
191+
placeHolderDialog = screenPanel.getChildrenCopy().find { ReflectionUtils.hasMethodOfName("getOptionMap", it) } as? UIPanelAPI
192+
if (placeHolderDialog != null) {
193+
ReflectionUtils.invoke("setOpacity", placeHolderDialog!!, 0f)
194+
ReflectionUtils.invoke("setBackgroundDimAmount", placeHolderDialog!!, 0f)
195+
ReflectionUtils.invoke("setAbsorbOutsideEvents", placeHolderDialog!!, false)
196+
ReflectionUtils.invoke("makeOptionInstant", placeHolderDialog!!, 0f)
197+
}
173198
}
174199
}
175200

@@ -186,18 +211,6 @@ class ConsoleOverlayPanel(private val context: CommandContext) : BaseCustomUIPan
186211
var state = AppDriver.getInstance().currentState
187212
var screenPanel = ReflectionUtils.invoke("getScreenPanel", state) as UIPanelAPI
188213

189-
if (Global.getCurrentState() == GameState.COMBAT) {
190-
wasPaused = Global.getCombatEngine().isPaused
191-
//Global.getCombatEngine().viewport.isExternalControl = true //Prevent moving screen with dragging
192-
Global.getCombatEngine().isPaused = true
193-
}
194-
195-
if (Global.getCurrentState() == GameState.CAMPAIGN) {
196-
wasPaused = Global.getSector().isPaused
197-
Global.getSector().isPaused = true;
198-
}
199-
200-
201214

202215
parent = Global.getSettings().createCustom(screenPanel.position.width, screenPanel.position.height, null)
203216
screenPanel.addComponent(parent)
@@ -1292,7 +1305,13 @@ class ConsoleOverlayPanel(private val context: CommandContext) : BaseCustomUIPan
12921305

12931306
compileScope.cancel()
12941307

1295-
var state = AppDriver.getInstance().currentState
1308+
/* placeHolderDialog?.dismiss()
1309+
placeHolderDialog = null*/
1310+
1311+
if (placeHolderDialog != null) {
1312+
ReflectionUtils.invoke("dismiss", placeHolderDialog!!, 0)
1313+
placeHolderDialog = null
1314+
}
12961315

12971316
if (Global.getCurrentState() == GameState.COMBAT) {
12981317
if (!wasPaused) Global.getCombatEngine().isPaused = false
@@ -1301,12 +1320,9 @@ class ConsoleOverlayPanel(private val context: CommandContext) : BaseCustomUIPan
13011320
}
13021321

13031322
if (Global.getCurrentState() == GameState.CAMPAIGN) {
1304-
if (!wasPaused) Global.getSector().isPaused = false;
1323+
Global.getSector().isPaused = wasPaused;
13051324
}
13061325

1307-
placeHolderDialog?.dismiss()
1308-
placeHolderDialog = null
1309-
13101326
instance = null
13111327
parent.getParent()?.removeComponent(parent)
13121328
}
@@ -1353,47 +1369,4 @@ class ConsoleOverlayPanel(private val context: CommandContext) : BaseCustomUIPan
13531369
val percent = DecimalFormat.getPercentInstance().format(used / Math.max(max, committed).toDouble())
13541370
"$percent (${asString(used)}/${asString(Math.max(max, committed))})"
13551371
}
1356-
1357-
class PlaceholderDialog() : InteractionDialogPlugin {
1358-
1359-
var dialog: InteractionDialogAPI? = null
1360-
1361-
override fun init(dialog: InteractionDialogAPI?) {
1362-
this.dialog = dialog
1363-
1364-
dialog!!.promptText = "Test"
1365-
/*if (dialog is UIPanelAPI) {
1366-
dialog.opacity = 0f
1367-
//var fader =ReflectionUtils.invoke("getFader", dialog) as Fader
1368-
}*/
1369-
}
1370-
1371-
override fun optionSelected(optionText: String?, optionData: Any?) {
1372-
1373-
}
1374-
1375-
override fun optionMousedOver(optionText: String?, optionData: Any?) {
1376-
1377-
}
1378-
1379-
override fun advance(amount: Float) {
1380-
//ReflectionUtils.invoke("setOpacity", dialog!!, 0f)
1381-
var fader = ReflectionUtils.invoke("getFader", dialog!!.visualPanel) as Fader
1382-
fader.brightness = 0f
1383-
}
1384-
1385-
override fun backFromEngagement(battleResult: EngagementResultAPI?) {
1386-
1387-
}
1388-
1389-
override fun getContext(): Any? {
1390-
return null
1391-
}
1392-
1393-
override fun getMemoryMap(): MutableMap<String, MemoryAPI> {
1394-
return hashMapOf()
1395-
}
1396-
1397-
}
1398-
13991372
}

src/org/lazywizard/console/overlay/v2/settings/ConsoleV2Settings.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ object ConsoleV2Settings {
1616
var needsHoldShift = false
1717
var needsHoldAlt = false*/
1818

19+
@JvmStatic
1920
var consoleKeybind = ConsoleSettings.Keystroke(Keyboard.KEY_BACK, true, false, false)
2021

2122
var enableBackgroundBlur = true

0 commit comments

Comments
 (0)