share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua
changeset 14459 35d47e99f5e2
parent 13279 9ac674499985
equal deleted inserted replaced
14458:99117df5a3d3 14459:35d47e99f5e2
     1 HedgewarsScriptLoad("/Scripts/Params.lua")
     1 HedgewarsScriptLoad("/Scripts/Params.lua")
     2 
     2 local overrideFeatureSize = true
       
     3 local paramPadding = 0
     3 local ObjectList = {}
     4 local ObjectList = {}
     4 
     5 
     5 -- Overall padding for roping freedom
     6 -- Overall padding for roping freedom
     6 local Padding = 430
     7 local Padding = 430
     7 -- If true, rope assumes team color
     8 -- If true, rope assumes team color
     9 
    10 
    10 function onParameters()
    11 function onParameters()
    11     parseParams()
    12     parseParams()
    12     if params["teamrope"] ~= nil then
    13     if params["teamrope"] ~= nil then
    13         TeamRope = true
    14         TeamRope = true
       
    15     end
       
    16     if params["scalemap"] ~= nil then 
       
    17         overrideFeatureSize = false 
       
    18     end
       
    19     if params["padding"] ~= nil then
       
    20         paramPadding = tonumber(params["padding"])
    14     end
    21     end
    15 end
    22 end
    16 
    23 
    17 function onGearAdd(gear)
    24 function onGearAdd(gear)
    18     if GetGearType(gear) == gtRope and TeamRope then
    25     if GetGearType(gear) == gtRope and TeamRope then
   326     onGameInit()
   333     onGameInit()
   327 end
   334 end
   328 
   335 
   329 function onGameInit()
   336 function onGameInit()
   330     -- Calculate padding, determined  by map feature size
   337     -- Calculate padding, determined  by map feature size
   331     if MapFeatureSize <= 20 then
   338 	if paramPadding > 0 then
       
   339 		Padding = paramPadding
       
   340 	elseif MapFeatureSize <= 20 then
   332         -- 10 .. 710. Step size=35
   341         -- 10 .. 710. Step size=35
   333         Padding = 10 + MapFeatureSize * 35
   342         Padding = 10 + MapFeatureSize * 35
   334     else
   343     else
   335         -- 780 .. 1060. Step size=70
   344         -- 780 .. 1060. Step size=70
   336         Padding = 710 + (MapFeatureSize-20) * 70
   345         Padding = 710 + (MapFeatureSize-20) * 70
   337     end
   346     end
       
   347     -- reset feature size after use, to disable scaling
       
   348     if overrideFeatureSize then MapFeatureSize = 12 end
   338 
   349 
   339     MapGen = mgDrawn
   350     MapGen = mgDrawn
   340     TemplateFilter = 0
   351     TemplateFilter = 0
   341     local TotGen = 0
   352     local TotGen = 0
   342     local Tries = 0
   353     local Tries = 0