Generate config for 'world edge' and 'script param' scheme options
authorunc0rr
Fri, 02 Jan 2015 22:07:31 +0300
changeset 10740 c9db53de9c3b
parent 10738 62659c427e5d
child 10742 34c1afbda24a
Generate config for 'world edge' and 'script param' scheme options
gameServer/EngineInteraction.hs
--- a/gameServer/EngineInteraction.hs	Fri Jan 02 01:13:22 2015 +0300
+++ b/gameServer/EngineInteraction.hs	Fri Jan 02 22:07:31 2015 +0300
@@ -102,6 +102,7 @@
         , [eml ["eseed ", mParams Map.! "SEED"]]
         , [eml ["e$gmflags ", showB gameFlags]]
         , schemeFlags
+        , schemeAdditional
         , [eml ["e$template_filter ", mParams Map.! "TEMPLATE"]]
         , [eml ["e$mapgen ", mapgen]]
         , mapgenSpecific
@@ -115,7 +116,7 @@
         keys2 = Set.fromList ["AMMO", "SCHEME", "SCRIPT", "THEME"]
         sane = Set.null (keys1 Set.\\ Map.keysSet mParams)
             && Set.null (keys2 Set.\\ Map.keysSet prms)
-            && (not . null . drop 27 $ scheme)
+            && (not . null . drop 40 $ scheme)
             && (not . null . tail $ prms Map.! "AMMO")
         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
         maybeScript = let s = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
@@ -131,6 +132,7 @@
         schemeFlags = map (\(v, (n, m)) -> eml [n, " ", showB $ (readInt_ v) * m])
             $ filter (\(_, (n, _)) -> not $ B.null n)
             $ zip (drop (length gameFlagConsts) scheme) schemeParams
+        schemeAdditional = let scriptParam = B.tail $ scheme !! 41 in [eml ["e$scriptparam ", scriptParam] | not $ B.null scriptParam]
         ammoStr :: B.ByteString
         ammoStr = head . tail $ prms Map.! "AMMO"
         ammo = let l = B.length ammoStr `div` 4; ((a, b), (c, d)) = (B.splitAt l . fst &&& B.splitAt l . snd) . B.splitAt (l * 2) $ ammoStr in
@@ -184,6 +186,7 @@
     , ("e$healthdec", 1)
     , ("e$ropepct", 1)
     , ("e$getawaytime", 1)
+    , ("e$worldedge", 1)
     ]