Skip to content

Commit e558c84

Browse files
authored
[editor] Fix editor_gui test panel (#540)
* [editor] Fix editor_gui test panel Fixes: After testing a certain map with a gamemode, you are unable to test that map with the <None> option anymore. * reset lastGamemode on map open / new map * reset gui lastGamemode on map open / new map felt like it needed
1 parent 576bbdc commit e558c84

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

[editor]/editor_gui/client/test.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function quickTest()
3232
if tutorialVars.blockQuickTest then return end
3333
if lastTestGamemode == "<None>" then lastTestGamemode = false end
3434
editor_main.dropElement()
35-
triggerServerEvent ( "testResource",localPlayer, text )
35+
triggerServerEvent ( "testResource",localPlayer, lastTestGamemode )
3636
unbindControl ( "toggle_test", "down", quickTest )
3737
if tutorialVars.test then tutorialNext() end
3838
end
@@ -251,3 +251,11 @@ end
251251
function noDamageInBasicTest()
252252
cancelEvent()
253253
end
254+
255+
addEventHandler ( "saveloadtest_return", root,
256+
function ( command )
257+
if command == "new" or command == "open" then
258+
lastTestGamemode = nil
259+
end
260+
end
261+
)

[editor]/editor_main/server/saveloadtest_server.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ addEventHandler("newResource", root,
120120

121121
actionList = {}
122122
currentActionIndex = 0
123+
124+
lastTestGamemodeName = nil
123125
end
124126
)
125127

@@ -154,6 +156,8 @@ function handleOpenResource()
154156
actionList = {}
155157
currentActionIndex = 0
156158

159+
lastTestGamemodeName = nil
160+
157161
triggerEvent("onMapOpened", mapContainer, openingResource)
158162
flattenTreeRuns = 0
159163
triggerClientEvent(root, "saveLoadProgressBar", root, true)
@@ -753,7 +757,11 @@ function beginTest(client,gamemodeName)
753757
resetMapInfo()
754758
setupMapSettings()
755759
disablePickups(false)
756-
gamemodeName = gamemodeName or lastTestGamemodeName
760+
761+
if gamemodeName == nil then
762+
gamemodeName = lastTestGamemodeName
763+
end
764+
757765
if ( gamemodeName ) then
758766
lastTestGamemodeName = gamemodeName
759767
set ( "*freeroam.spawnmapondeath", "false" )
@@ -785,6 +793,9 @@ function beginTest(client,gamemodeName)
785793
end
786794
g_in_test = "gamemode"
787795
else
796+
if gamemodeName == false then
797+
lastTestGamemodeName = gamemodeName
798+
end
788799
if getResourceState(freeroamRes) ~= "running" and not startResource ( freeroamRes, true ) then
789800
restoreSettings()
790801
triggerClientEvent ( root, "saveloadtest_return", client, "test", false, false,

0 commit comments

Comments
 (0)