Remove orphan effects and add headless smoke hooks
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
###################################################################################################
|
||||
# Network
|
||||
|
||||
import os
|
||||
|
||||
import app
|
||||
import chr
|
||||
import dbg
|
||||
@@ -18,6 +20,25 @@ import uiPhaseCurtain
|
||||
|
||||
import localeInfo
|
||||
|
||||
|
||||
def _GetHeadlessScenario():
|
||||
return os.environ.get("M2_HEADLESS_SCENARIO", "").strip().lower()
|
||||
|
||||
|
||||
def _WriteHeadlessTrace(message):
|
||||
scenario = _GetHeadlessScenario()
|
||||
if scenario == "map_load":
|
||||
tracePath = "log/headless_map_load_trace.txt"
|
||||
elif scenario == "gm_teleport":
|
||||
tracePath = "log/headless_gm_teleport_trace.txt"
|
||||
else:
|
||||
return
|
||||
|
||||
try:
|
||||
open(tracePath, "a").write("%s\n" % message)
|
||||
except:
|
||||
pass
|
||||
|
||||
class PopupDialog(ui.ScriptWindow):
|
||||
# MR-15: Multiline dialog messages
|
||||
BASE_HEIGHT = 105
|
||||
@@ -167,6 +188,7 @@ class MainStream(object):
|
||||
|
||||
if newPhaseWindow:
|
||||
newPhaseWindow.Open()
|
||||
_WriteHeadlessTrace("MainStream.ChangePhase opened=%s" % newPhaseWindow.__class__.__name__)
|
||||
|
||||
self.curPhaseWindow=newPhaseWindow
|
||||
|
||||
@@ -237,7 +259,7 @@ class MainStream(object):
|
||||
try:
|
||||
import introLoading
|
||||
loadingPhaseWindow=introLoading.LoadingWindow(self)
|
||||
loadingPhaseWindow.LoadData(x, y)
|
||||
loadingPhaseWindow.DEBUG_LoadData(x, y)
|
||||
self.SetPhaseWindow(loadingPhaseWindow)
|
||||
except:
|
||||
import exception
|
||||
@@ -256,8 +278,10 @@ class MainStream(object):
|
||||
def SetGamePhase(self):
|
||||
try:
|
||||
import game
|
||||
_WriteHeadlessTrace("MainStream.SetGamePhase begin current_map=%s" % background.GetCurrentMapName())
|
||||
self.popupWindow.Close()
|
||||
self.SetPhaseWindow(game.GameWindow(self))
|
||||
_WriteHeadlessTrace("MainStream.SetGamePhase queued current_map=%s" % background.GetCurrentMapName())
|
||||
except:
|
||||
raise
|
||||
import exception
|
||||
|
||||
Reference in New Issue
Block a user