Clean up more inappropriate changes to scripts. lua-changes
authorachurch
Sun, 30 Jan 2011 01:10:42 +0900
branchlua-changes
changeset 648 8596fb699647
parent 644 44bec246350f
child 649 7050a099c388
Clean up more inappropriate changes to scripts. This changeset is a continuation of r644 (44bec246350f), correcting various changes introduced in the course of updating scripts for the new script execution model. All of these changes are minor and should have no impact on gameplay. The full list of changes is as follows: game_scripts/scripts/entities/deepjelly.lua: Fixed a missing "local" on the declaration of transTime. game_scripts/scripts/entities/finalspiritcommon.lua: Changed v.a to a local variable. game_scripts/scripts/include/energyslottemplate.lua: Changed v.chargeIDOffset, v.id, and v.charged to local variables.
game_scripts/scripts/entities/deepjelly.lua
game_scripts/scripts/entities/finalspiritcommon.lua
game_scripts/scripts/include/energyslottemplate.lua
--- a/game_scripts/scripts/entities/deepjelly.lua	Wed Jan 19 23:33:18 2011 +0900
+++ b/game_scripts/scripts/entities/deepjelly.lua	Sun Jan 30 01:10:42 2011 +0900
@@ -131,7 +131,7 @@
 	
 	entity_setMaxSpeed(me, v.excitedSpeed)
 	v.revertTimer = 3
-	transTime = 0.5
+	local transTime = 0.5
 	local r,g,b = getNoteColor(note)
 	bone_setColor(v.bulb, r,g,b, transTime)
 	r = (r+1.0)/2.0
--- a/game_scripts/scripts/entities/finalspiritcommon.lua	Wed Jan 19 23:33:18 2011 +0900
+++ b/game_scripts/scripts/entities/finalspiritcommon.lua	Sun Jan 30 01:10:42 2011 +0900
@@ -21,7 +21,6 @@
 
 v.n = 0
 
-v.a = 0
 v.off = 0
 v.glow = 0
 v.flag = 0
@@ -184,9 +183,9 @@
 		end
 		]]--
 		
-		v.a = t + v.off
-		x = x + math.sin(v.a)*dist
-		y = y + math.cos(v.a)*dist
+		local a = t + v.off
+		x = x + math.sin(a)*dist
+		y = y + math.cos(a)*dist
 		entity_setPosition(me, entity_x(v.n)+x, entity_y(v.n)+y, 0.2)
 		
 		--[[
--- a/game_scripts/scripts/include/energyslottemplate.lua	Wed Jan 19 23:33:18 2011 +0900
+++ b/game_scripts/scripts/include/energyslottemplate.lua	Sun Jan 30 01:10:42 2011 +0900
@@ -19,32 +19,33 @@
 
 v = getVars()
 
-v.chargeIDOffset = 5000
+local chargeIDOffset = 5000
+
 function init(me)
 	node_setCursorActivation(me, false)
 	if getFlag(v.flag) > 0 then
-		v.charged = true
-		v.id = getFlag(v.flag)
-		if v.id > v.chargeIDOffset then
-			v.charged = false
-			v.id = v.id - v.chargeIDOffset
+		local charged = true
+		local id = getFlag(v.flag)
+		if id > chargeIDOffset then
+			charged = false
+			id = id - chargeIDOffset
 		end
 		--[[
 		if getFlag(chargeFlag) == 0 then
-			v.charged = false
+			charged = false
 		end
 		]]--
 		
 		v.orbHolder = getEntityByID(v.holderID)		
-		v.energyOrb = getEntityByID(v.id)
+		v.energyOrb = getEntityByID(id)
 		if v.energyOrb ~= 0 and v.orbHolder ~= 0 then
 			--debugLog(string.format("%s : setting orb to %d, %d", node_getName(me), entity_x(v.orbHolder), entity_y(v.orbHolder)))
 			entity_setPosition(v.energyOrb, entity_x(v.orbHolder), entity_y(v.orbHolder))
-			if v.charged then
+			if charged then
 				entity_setState(v.energyOrb, STATE_CHARGED)
 			end
 		end
-		if v.charged then
+		if charged then
 			v.door = getEntityByID(v.doorID)
 			if v.door ~= 0 then
 				entity_setState(v.door, STATE_OPENED)
@@ -54,7 +55,7 @@
 end
 
 function activate(me)
-	if getFlag(v.flag) == 0 or getFlag(v.flag) >= v.chargeIDOffset then
+	if getFlag(v.flag) == 0 or getFlag(v.flag) >= chargeIDOffset then
 		v.energyOrb = node_getNearestEntity(me, "EnergyOrb")
 		if v.energyOrb ~= 0 then
 			if entity_isState(v.energyOrb, STATE_CHARGED) then
@@ -68,7 +69,7 @@
 				end
 			else
 				debugLog("Saving orb in slot, not charged")
-				setFlag(v.flag, entity_getID(v.energyOrb)+v.chargeIDOffset)				
+				setFlag(v.flag, entity_getID(v.energyOrb)+chargeIDOffset)				
 			end
 		else
 			debugLog("Could not find orb")