Changeset 3345
- Timestamp:
- 12/02/08 00:03:50 (5 weeks ago)
- Location:
- trunk/mods/ca
- Files:
-
- 8 modified
-
LuaRules/Gadgets/unit_mex_overdrive.lua (modified) (2 diffs)
-
LuaUI/Configs/lupsFXs.lua (modified) (1 diff)
-
LuaUI/Widgets/gfx_lups_manager.lua (modified) (7 diffs)
-
bitmaps/GPL/groundflash.tga (modified) (previous)
-
lups/ParticleClasses/StaticParticles.lua (modified) (1 diff)
-
lups/headers/mathenv.lua (modified) (4 diffs)
-
units/armmex.lua (modified) (1 diff)
-
units/cormex.lua (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/mods/ca/LuaRules/Gadgets/unit_mex_overdrive.lua
r3286 r3345 57 57 -- local functions 58 58 59 60 local function round(num, idp) 61 return ("%." .. (((num==0) and 0) or idp or 0) .. "f"):format(num) 62 end 59 63 60 64 … … 124 128 Spring.SetUnitResourcing(unitID, "cue", mexE * 2) 125 129 local metalMult = energyToExtraM(mexE) 126 Spring.SetUnitRulesParam(unitID, "overdrive", 1+mexE/5) 127 Spring.SetUnitResourcing(unitID, "cmm", orgMetal * metalMult*2) 130 Spring.SetUnitRulesParam(unitID, "overdrive", 1+mexE/5) 131 Spring.SetUnitResourcing(unitID, "cmm", orgMetal * metalMult*2) 132 unitDef = UnitDefs[Spring.GetUnitDefID(unitID)] 133 Spring.SetUnitTooltip(unitID, 134 unitDef.humanName .. " - " .. unitDef.tooltip .. 135 " (Overdrive: " .. round(metalMult,2) .. "x)" 136 ) 128 137 end 129 138 end -
trunk/mods/ca/LuaUI/Configs/lupsFXs.lua
r3171 r3345 235 235 count = 1, 236 236 } 237 238 239 ---------------------------------------------------------------------------- 240 -- OverDrive FXs ----------------------------------------------------------- 241 ---------------------------------------------------------------------------- 242 243 armmexJet = { 244 color={0,0,0}, 245 emitVector={0,-1,0}, 246 width=7, 247 length=100, 248 animSpeed=0.5, 249 distortion=0.01, 250 jitterWidthScale=1.7, 251 jitterLengthScale=1.5, 252 piece="exhaust", 253 onActive=true 254 } 255 256 257 cormexGlow = { 258 layer = -5, 259 delay = 0, 260 pos = {0,0,0}, 261 piece = "tamper", 262 263 partpos = "x,y,z|".. 264 "y=((i>3) and 59) or 50,".. 265 "local i=i%4,".. 266 "x=((i>1) and -5) or 5,".. 267 "z=(((i==0)or(i==3)) and -5) or 5", 268 269 life = math.huge, 270 lifeSpread = 0, 271 sizeGrowth = 0, 272 273 size = 15, 274 size1 = 15, 275 size2 = 25, 276 277 colormap = { {0.001, 0.3, 0.3, 0.001}, }, 278 color1 = {0.001, 0.3, 0.3, 0.001}, 279 color2 = {0.05, 0.5, 0.7, 0.005}, 280 281 texture = 'bitmaps/GPL/groundflash.tga', 282 count = 8, 283 repeatEffect= true, 284 onActive = true, 285 } 286 237 287 238 288 ---------------------------------------------------------------------------- -
trunk/mods/ca/LuaUI/Widgets/gfx_lups_manager.lua
r3288 r3345 59 59 c1[1]*mixInv + c2[1]*mix, 60 60 c1[2]*mixInv + c2[2]*mix, 61 c1[3]*mixInv + c2[3]*mix 61 c1[3]*mixInv + c2[3]*mix, 62 (c1[4] or 1)*mixInv + (c2[4] or 1)*mix 62 63 } 63 64 end … … 296 297 local armmexDefID = UnitDefNames["armmex"].id 297 298 local armmexes = {} 298 local armmexFX = {color={0,0,0}, emitVector={0,-1,0}, width=7, length=100, animSpeed=0.5, distortion=0.01, jitterWidthScale=1.7, jitterLengthScale=1.5, piece="exhaust", onActive=true} 299 local armmexFX = armmexJet 300 301 --// cormex overdrive FX 302 local cormexDefID = UnitDefNames["cormex"].id 303 local cormexes = {} 304 local cormexFX = cormexGlow 299 305 300 306 -------------------------------------------------------------------------------- … … 302 308 303 309 local abs = math.abs 310 local min = math.min 311 local max = math.max 304 312 local spGetSpectatingState = Spring.GetSpectatingState 305 313 local spGetUnitDefID = Spring.GetUnitDefID … … 357 365 local function UnitFinished(_,unitID,unitDefID) 358 366 if (unitDefID == armmexDefID) then 359 armmexes[unitID] = 1367 armmexes[unitID] = 0 360 368 armmexFX.unit = unitID 361 369 particleIDs[unitID] = {} 362 370 AddFxs( unitID, LupsAddFX("airjet",armmexFX) ) 371 end 372 373 if (unitDefID == cormexDefID) then 374 cormexes[unitID] = 0 375 cormexFX.unit = unitID 376 particleIDs[unitID] = {} 377 AddFxs( unitID, LupsAddFX("StaticParticles",cormexFX) ) 363 378 end 364 379 … … 394 409 particleIDs[unitID] = {} 395 410 AddFxs( unitID, LupsAddFX("airjet",armmexFX) ) 411 end 412 413 if (unitDefID == cormexDefID) then 414 cormexes[unitID] = 1 415 cormexFX.unit = unitID 416 particleIDs[unitID] = {} 417 AddFxs( unitID, LupsAddFX("StaticParticles",cormexFX) ) 396 418 end 397 419 … … 428 450 429 451 local function GameFrame(_,n) 430 if (((n+48)%60)<1 and next(armmexes)) then 452 if (((n+48)%60)<1 and (next(armmexes) or next(cormexes))) then 453 --//Update Overdrive Fx 431 454 for unitID,strength in pairs(armmexes) do 432 455 local cur_strength = spGetUnitRulesParam(unitID,"overdrive") or 1 … … 446 469 armmexFX.color = color1 447 470 armmexFX.length = 140 471 472 for unitID,strength in pairs(cormexes) do 473 local cur_strength = spGetUnitRulesParam(unitID,"overdrive") or 1 474 local diff = abs(cur_strength - strength) 475 if (diff>0.1) then 476 -- limit the maximum change per update (else the fx would jump like hell) 477 cur_strength = (strength) + ((cur_strength>strength and 1) or -1)*0.3 478 479 local a = min(1,max(0,(cur_strength-1)*0.35)); 480 ClearFxs(unitID) 481 cormexFX.unit = unitID 482 cormexFX.colormap = {blendColor(cormexFX.color1,cormexFX.color2, a)} 483 484 cormexFX.size = blend(cormexFX.size1,cormexFX.size2, a) 485 AddFxs( unitID, LupsAddFX("StaticParticles",cormexFX) ) 486 cormexes[unitID] = cur_strength 487 end 488 end 489 cormexFX.colormap = {cormexFX.color1} 490 cormexFX.size = cormexFX.size1 448 491 end 449 492 end -
trunk/mods/ca/lups/ParticleClasses/StaticParticles.lua
r3171 r3345 95 95 life = self.life + rand()*self.lifeSpread 96 96 97 local part = {size=s ize,life=life,i=n}97 local part = {size=self.size+size,life=life,i=n} 98 98 pos = { ProcessParamCode(partpos, part) } 99 99 -
trunk/mods/ca/lups/headers/mathenv.lua
r3171 r3345 16 16 17 17 local MathG = {math = math, rand = math.random, random = math.random, sin = math.sin, cos = math.cos, pi = math.pi, 18 deg = math.deg, loadstring = loadstring, assert = assert };18 deg = math.deg, loadstring = loadstring, assert = assert, echo = Spring.Echo}; 19 19 20 20 --local cachedParsedFunctions = {} … … 54 54 --end 55 55 56 local luaCode = " "56 local luaCode = "return function() " 57 57 local vec_defs,math_defs = {},{} 58 58 … … 79 79 luaCode = luaCode .. " __" .. char(64+i) .. "," 80 80 end 81 luaCode = luaCode .. "nil "81 luaCode = luaCode .. "nil end" 82 82 83 local luaFunc = loadstring(luaCode) 83 local status, luaFunc = pcall(loadstring(luaCode)) 84 85 if (not status) then 86 print(PRIO_MAJOR,'LUPS: Failed to parse custom param code: ' .. luaFunc); 87 return function() return 1,2,3,4 end 88 end; 84 89 85 90 --cachedParsedFunctions[strfunc] = luaFunc … … 97 102 meta.__index = locals 98 103 setmetatable( MathG, meta ); 104 99 105 setfenv(func, MathG); 100 106 -
trunk/mods/ca/units/armmex.lua
r3178 r3345 3 3 unitname = "armmex", 4 4 name = "Metal Extractor", 5 description = "Extracts Metal (Excess Energy Increases Extraction)",5 description = "Extracts Metal", 6 6 acceleration = 0, 7 7 activateWhenBuilt = true, -
trunk/mods/ca/units/cormex.lua
r3178 r3345 3 3 unitname = "cormex", 4 4 name = "Metal Extractor", 5 description = "Extracts Metal (Excess Energy Increases Extraction)",5 description = "Extracts Metal", 6 6 acceleration = 0, 7 7 activateWhenBuilt = true,