Skip to content

Commit 29e1ae0

Browse files
authored
editor_main: Fix version warning (#408)
* Update dumpxml.lua * Fetch version from editor meta.xml instead * Move get/set ver. into separate method.
1 parent f64d657 commit 29e1ae0

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

[editor]/editor_main/meta.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<meta>
22
<info author="erorr404,jbeta,Talidan" description="Map editor's main component" edf:definition="editor_main.edf" />
33

4-
<min_mta_version server="1.3.0-9.04584" />
4+
<min_mta_version server="1.5.8-9.20957" />
55

66
<!-- Script to shutdown the running gamemode and maps, because otherwise you get trouble -->
77
<script src="gamemodestopper.lua" type="server" />

[editor]/editor_main/server/dumpxml.lua

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,49 @@ function dumpNodes ( xmlNode, elementTable, elementChildren )
7575
end
7676
end
7777

78+
local function syncMapMinVersion(mapXml)
79+
local metaFile = xmlLoadFile("meta.xml")
80+
81+
if not metaFile then
82+
return false
83+
end
84+
85+
local editorMinVer = xmlFindChild(metaFile, "min_mta_version", 0)
86+
87+
if editorMinVer then
88+
local mapVersionNode = xmlFindChild(mapXml, "min_mta_version", 0) or xmlCreateChild(mapXml, "min_mta_version")
89+
90+
if mapVersionNode then
91+
local clientMinVer = xmlNodeGetAttribute(editorMinVer, "client")
92+
local serverMinVer = xmlNodeGetAttribute(editorMinVer, "server")
93+
94+
if clientMinVer then
95+
xmlNodeSetAttribute(mapVersionNode, "client", clientMinVer)
96+
end
97+
98+
if serverMinVer then
99+
xmlNodeSetAttribute(mapVersionNode, "server", serverMinVer)
100+
end
101+
end
102+
end
103+
104+
xmlUnloadFile(metaFile)
105+
106+
return true
107+
end
108+
78109
function dumpMeta ( xml, extraNodes, resource, filename, test )
79-
if not resource then return false end
110+
if not resource then
111+
return false
112+
end
113+
80114
dimension = dimension or 0
81115
extraNodes = extraNodes or {}
82116

117+
-- Fetch min_mta_version from editor_main meta.xml
118+
119+
syncMapMinVersion(xml)
120+
83121
--Add OOP support
84122
--[[local oopNode = xmlCreateChild(xml, "oop")
85123
xmlNodeSetValue(oopNode, "true")]]

0 commit comments

Comments
 (0)