Changeset 3333
- Timestamp:
- 11/30/08 21:49:34 (5 weeks ago)
- Location:
- trunk/mods/ca/LuaRules/Gadgets
- Files:
-
- 3 modified
-
awards.lua (modified) (5 diffs)
-
unit_morph.lua (modified) (3 diffs)
-
unit_start_boost.lua (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/mods/ca/LuaRules/Gadgets/awards.lua
r3317 r3333 200 200 end 201 201 end 202 202 203 end 203 204 … … 437 438 ------------------------------------------------------------------------------------- 438 439 440 local hostName = nil --planetwars hostname 441 439 442 local spGetGameFrame = Spring.GetGameFrame 440 443 local spGetMouseState = Spring.GetMouseState 441 444 local spSendCommands = Spring.SendCommands 445 442 446 443 447 local glPushMatrix = gl.PushMatrix … … 480 484 local maxRow = 8 481 485 local fontHeight = 16 486 482 487 483 488 local awardDescs = … … 509 514 end 510 515 spSendCommands({'endgraph 0'}) 516 517 -- planetwars init 518 local modOptions = Spring.GetModOptions() 519 if (modOptions) and modOptions.planetwars then 520 hostName = modOptions.planetwars.hostname 521 end 511 522 end 512 523 … … 607 618 for awardType, record in spairs(awards) do 608 619 awardCount = awardCount + 1 609 if not sentToPlanetWars then610 local planetWarsData = 'award: '..teamNames[team] ..' '.. awardType ..' '.. awardDescs[awardType] ..', '.. record611 Spring.SendCommands("w PlanetWars Encoded mission report:".. planetWarsData)620 if not sentToPlanetWars and hostName ~= nil then 621 local planetWarsData = teamNames[team] ..' '.. awardType ..' '.. awardDescs[awardType] ..', '.. record 622 Spring.SendCommands("w "..hostName.." pwaward:".. planetWarsData) 612 623 Spring.Echo(planetWarsData) 613 624 end -
trunk/mods/ca/LuaRules/Gadgets/unit_morph.lua
r3331 r3333 107 107 local morphDefs = {} --// make it global in Initialize() 108 108 local extraUnitMorphDefs = {} -- stores mainly planetwars morphs 109 local hostName = nil -- planetwars hostname 109 110 local morphUnits = {} --// make it global in Initialize() 110 111 local reqDefIDs = {} --// all possible unitDefID's, which are used as a requirement for a morph … … 394 395 local newUnit = Spring.CreateUnit(defName, px, py, pz, 0, unitTeam) 395 396 396 if (extraUnitMorphDefs[unitID] ~= nil ) then -- send planetwars deployment message397 if (extraUnitMorphDefs[unitID] ~= nil and hostName ~= nil) then -- send planetwars deployment message 397 398 local data = unitTeam..","..defName..","..math.floor(px)..","..math.floor(pz)..",".."S" -- todo determine and apply smart orientation of the structure 398 Spring.SendCommands("w pwdeploy:"..data)399 Spring.SendCommands("w "..hostName.." pwdeploy:"..data) 399 400 extraUnitMorphDefs[unitID] = nil 400 401 end … … 489 490 end 490 491 491 -- self linking 492 -- self linking for planetwars 492 493 GG['morphHandler'] = {} 493 494 GG['morphHandler'].AddExtraUnitMorph = AddExtraUnitMorph 495 local modOptions = Spring.GetModOptions() 496 if (modOptions) and modOptions.planetwars then 497 hostName = modOptions.planetwars.hostname 498 end 499 494 500 495 501 if (type(GG.UnitRanked)~="table") then GG.UnitRanked = {} end -
trunk/mods/ca/LuaRules/Gadgets/unit_start_boost.lua
r3328 r3333 105 105 for _, teamID in pairs(Spring.GetTeamList()) do 106 106 local gaiaID = Spring.GetGaiaTeamID() 107 local teamLuaAI = Spring.GetTeamLuaAI(teamID) 107 local teamLuaAI = nil 108 pcall(function() teamLuaAI = Spring.GetTeamLuaAI(teamID) end) 108 109 if (teamID ~= gaiaID and (not teamLuaAI or teamLuaAI == "")) then 109 110 local metal = Spring.GetTeamResources(teamID, 'metal')