Remove orphan effects and add headless smoke hooks
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
import ui
|
||||
import uiScriptLocale
|
||||
import net
|
||||
@@ -35,6 +37,25 @@ import uiOption
|
||||
import uiRestart
|
||||
####################################
|
||||
|
||||
|
||||
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 LoadingWindow(ui.ScriptWindow):
|
||||
def __init__(self, stream):
|
||||
print("NEW LOADING WINDOW -------------------------------------------------------------------------------")
|
||||
@@ -218,6 +239,7 @@ class LoadingWindow(ui.ScriptWindow):
|
||||
try:
|
||||
runFunc()
|
||||
except:
|
||||
_WriteHeadlessTrace("LoadData failure step=%d" % progress)
|
||||
self.errMsg.Show()
|
||||
self.loadStepList=[]
|
||||
|
||||
@@ -302,7 +324,9 @@ class LoadingWindow(ui.ScriptWindow):
|
||||
emotion.RegisterEmotionIcons()
|
||||
|
||||
def __LoadMap(self):
|
||||
_WriteHeadlessTrace("LoadMap begin global_x=%d global_y=%d" % (self.playerX, self.playerY))
|
||||
net.Warp(self.playerX, self.playerY)
|
||||
_WriteHeadlessTrace("LoadMap current_map=%s" % background.GetCurrentMapName())
|
||||
|
||||
def __LoadSound(self):
|
||||
playerSettingModule.LoadGameData("SOUND")
|
||||
@@ -337,6 +361,7 @@ class LoadingWindow(ui.ScriptWindow):
|
||||
# END_OF_GUILD_BUILDING
|
||||
|
||||
def __StartGame(self):
|
||||
_WriteHeadlessTrace("StartGame begin current_map=%s" % background.GetCurrentMapName())
|
||||
background.SetViewDistanceSet(background.DISTANCE0, 25600)
|
||||
"""
|
||||
background.SetViewDistanceSet(background.DISTANCE1, 19200)
|
||||
@@ -349,6 +374,7 @@ class LoadingWindow(ui.ScriptWindow):
|
||||
app.SetGlobalCenterPosition(self.playerX, self.playerY)
|
||||
|
||||
net.StartGame()
|
||||
_WriteHeadlessTrace("StartGame queued current_map=%s" % background.GetCurrentMapName())
|
||||
|
||||
def _ReloadTitleNames():
|
||||
for i in range(len(localeInfo.TITLE_NAME_LIST)):
|
||||
|
||||
Reference in New Issue
Block a user