Thread: [Graphics] Mania/S3K's Elemental Shields
View Single Post
Old 12-05-2016   #8
K.S.
Formerly Inuyasha
Retired Staff
 
K.S.'s Avatar
Default

If you're going to accept some lag anyway, then at least take this as a replacement to LUA_ATRT.

Code:
local p_list = {}
local p_time = -1

function A_AttractChase(actor, var1, var2)
	if leveltime != p_time
		p_time = leveltime
		p_list = {}
		for pl in players.iterate()
			if (pl.powers[pw_shield] & SH_NOSTACK) == SH_THUNDERCOIN
				table.insert(p_list, pl)
			end
		end
	end

	for _,pl in pairs(p_list)
		pl.powers[pw_shield] = ($1 & SH_STACK) | SH_ATTRACT
	end
	super(actor, var1, var2)
	for _,pl in pairs(p_list)
		pl.powers[pw_shield] = ($1 & SH_STACK) | SH_THUNDERCOIN
	end
end
CEZ2 is a lost cause with any Lua replacement of A_AttractChase (even replacing it with a blank function would lag), but everything else is comparatively better.

Last edited by K.S.; 12-05-2016 at 04:29 AM.
K.S. is offline   Reply With Quote