Merge latest changes from branch lua-changes. patched
authorachurch
Wed, 19 Jan 2011 23:38:55 +0900
branchpatched
changeset 645 532436711b0e
parent 640 57445129408f (current diff)
parent 644 44bec246350f (diff)
child 646 ea845f99c211
child 649 7050a099c388
Merge latest changes from branch lua-changes.
game_scripts/scripts/entities/bigblaster.lua
game_scripts/scripts/entities/cc_sunkencity.lua
--- a/game_scripts/_mods/guert_mod/scripts/nautilusprime.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/_mods/guert_mod/scripts/nautilusprime.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -189,11 +189,11 @@
 					shot_setAimVector(s, velx, vely)
 					v.shotsFired = v.shotsFired + 1
 				end
-				v.maxShots = 3
+				local maxShots = 3
 				if v.beserk then
-					v.maxShots = 14
+					maxShots = 14
 				end
-				if v.shotsFired >= v.maxShots then
+				if v.shotsFired >= maxShots then
 					v.bigFireDelay = 4
 					v.shotsFired = 0
 				end
--- a/game_scripts/scripts/entities/bigblaster.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/bigblaster.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -32,6 +32,8 @@
 v.soundDelay = 0
 
 v.shotsFired = 0
+
+v.n = 0
  
 -- ================================================================================================
 -- FUNCTIONS
@@ -75,6 +77,7 @@
 end
 
 function postInit(me)
+	v.n = getNaija()
 	if isFlag(FLAG_PET_BLASTER, 1) then
 		entity_delete(me)
 	end
--- a/game_scripts/scripts/entities/cc_sunkencity.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/cc_sunkencity.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -129,9 +129,8 @@
 			--e = entity_getNearestEntity(me, "FinalTongue")
 			--entity_setState(e, STATE_OPEN)
 			
-			v.nd = getNode("CCLEADSTART")
-			
-			entity_setPosition(me, node_x(v.nd), node_y(v.nd))
+			local nd = getNode("CCLEADSTART")
+			entity_setPosition(me, node_x(nd), node_y(nd))
 			
 			entity_animate(me, "float", -1)
 			
@@ -638,9 +637,9 @@
 			entity_alpha(me, 0, 2)
 			entity_setPosition(me, 0, 0, 10)
 		end
-		v.statue = entity_getNearestEntity(me, "ClayStatue")
-		if v.statue ~= 0 then
-			entity_msg(v.statue, "p")
+		local statue = entity_getNearestEntity(me, "ClayStatue")
+		if statue ~= 0 then
+			entity_msg(statue, "p")
 		end
 		entity_setState(me, STATE_IDLE)
 	end
--- a/game_scripts/scripts/entities/crabboss.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/crabboss.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -76,8 +76,6 @@
 v.bone_rw = 0
 v.bone_squid = 0
 
-v.moveDir = 1
-
 v.inity = 0
 
 v.leave = 0
@@ -203,19 +201,20 @@
 	if v.naija ~= 0 then
 		if entity_isState(me, STATE_BASIC) then
 			--entity_rotateToSurfaceNormal(me, 0.1, 20)
-			v.moving = false
+			local moving = false
+			local moveDir
 			if entity_x(v.naija) > entity_x(me) + 256 and entity_x(me) < node_x(v.rightNode) then
-				v.moving = true
-				v.moveDir = 1
+				moving = true
+				moveDir = 1
 				--entity_switchSurfaceDirection(me, 0)
 				--entity_rotateToSurfaceNormal(me, 1)
 			elseif entity_x(v.naija) < entity_x(me) - 256 and entity_x(me) > node_x(v.leftNode) then
-				v.moving = true
-				v.moveDir = -1
+				moving = true
+				moveDir = -1
 				--entity_switchSurfaceDirection(me, 1)
 				--entity_rotateToSurfaceNormal(me, 1)
 			end
-			if not v.moving then
+			if not moving then
 				if not v.leftArmAlive and not v.rightArmAlive then
 					if entity_x(v.naija) > entity_x(me)-256 and entity_x(v.naija) < entity_x(me)+256 then
 						if entity_y(v.naija) < entity_y(me)-512 then
@@ -229,17 +228,17 @@
 					end
 				end
 			end
-			if v.moving then
+			if moving then
 				--debugLog("Moving")
 				--entity_moveAlongSurface(me, dt, 300, 6, 200) --64 (32)
-				entity_setPosition(me, entity_x(me)+v.moveDir*300*dt, entity_y(me))
+				entity_setPosition(me, entity_x(me)+moveDir*300*dt, entity_y(me))
 			end
-			if v.moving and not v.wasMoving then
+			if moving and not v.wasMoving then
 				entity_animate(me, "walk", -1, LAYER_LEGSANDBODY)
-			elseif not v.moving and v.wasMoving then
+			elseif not moving and v.wasMoving then
 				entity_animate(me, "idle", -1, LAYER_LEGSANDBODY)
 			end
-			v.wasMoving = v.moving
+			v.wasMoving = moving
 			
 			v.fireDelay = v.fireDelay - dt
 			if v.fireDelay < 0 then
@@ -262,18 +261,18 @@
 			]]--
 		end
 		if entity_isState(me, STATE_BASIC) then
-			v.didArmAttack = false
+			local didArmAttack = false
 			
 			if v.leftArmHealth > 0 then
 				if entity_x(v.naija) < entity_x(me)-64 and entity_isEntityInRange(me, v.naija, 680) and entity_y(v.naija) > entity_y(me)-200 then
 					entity_setState(me, STATE_LEFTCLAWSWIPE)
-					v.didArmAttack = true
+					didArmAttack = true
 				end
 			end
-			if not v.didArmAttack and v.rightArmHealth > 0 then
+			if not didArmAttack and v.rightArmHealth > 0 then
 				if entity_x(v.naija) > entity_x(me)+64 and entity_isEntityInRange(me, v.naija, 680) and entity_y(v.naija) > entity_y(me)-200 then
 					entity_setState(me, STATE_RIGHTCLAWSWIPE)
-					v.didArmAttack = true
+					didArmAttack = true
 				end
 			end
 		end
@@ -281,8 +280,8 @@
 	
 	
 	entity_handleShotCollisionsSkeletal(me)
-	v.bone = entity_collideSkeletalVsCircle(me, v.naija)
-	if v.bone ~= 0 then
+	local bone = entity_collideSkeletalVsCircle(me, v.naija)
+	if bone ~= 0 then
 		avatar_fallOffWall()
 		if entity_x(v.naija) < entity_x(me) then
 			--entity_push(v.naija, -1200, -100, 0.5)
--- a/game_scripts/scripts/entities/creatorform5.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/creatorform5.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -126,15 +126,15 @@
 			entity_setState(me, STATE_SING) 
 		end
 	elseif entity_isState(me, STATE_WAIT) then
-		v.shots = 0
+		local shots = 0
 		local e = getFirstEntity()
 		while e ~= 0 do
 			if eisv(e, EV_TYPEID, EVT_DARKLISHOT) then
-				v.shots = v.shots + 1
+				shots = shots + 1
 			end
 			e = getNextEntity()
 		end
-		if v.shots == 0 then
+		if shots == 0 then
 			entity_setState(me, STATE_IDLE)
 		end
 	elseif entity_isState(me, STATE_PLAYSEG) then
--- a/game_scripts/scripts/entities/creatorform6.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/creatorform6.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -394,7 +394,7 @@
 		end
 	end
 	]]--
-	if v.damageType == DT_ENEMY_BEAM then
+	if damageType == DT_ENEMY_BEAM then
 		return false
 	end
 	if bone == v.eyeCover then
--- a/game_scripts/scripts/entities/deepjelly.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/deepjelly.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -131,13 +131,13 @@
 	
 	entity_setMaxSpeed(me, v.excitedSpeed)
 	v.revertTimer = 3
-	v.transTime = 0.5
+	transTime = 0.5
 	local r,g,b = getNoteColor(note)
-	bone_setColor(v.bulb, r,g,b, v.transTime)
+	bone_setColor(v.bulb, r,g,b, transTime)
 	r = (r+1.0)/2.0
 	g = (g+1.0)/2.0
 	b = (b+1.0)/2.0
-	bone_setColor(v.shell, r,g,b, v.transTime)
+	bone_setColor(v.shell, r,g,b, transTime)
 end
 
 function update(me, dt)
--- a/game_scripts/scripts/entities/eviljelly.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/eviljelly.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -103,9 +103,9 @@
 		entity_setMaxSpeedLerp(me, 6, 0.5, 1, 1)
 		v.burstTimer = 0
 	end
-	v.avoid = false
+	local avoid = false
 	if not avatar_isOnWall() and entity_isNearObstruction(getNaija(), 5) then
-		v.avoid = true
+		avoid = true
 	end
 	if entity_isState(me, STATE_IDLE) and not v.transition and not entity_isScaling(me) then
 		entity_scale(me, 0.75*v.sz, 1*v.sz, 0.2)
@@ -134,7 +134,7 @@
 	if not avatar_isBursting() then
 		entity_doEntityAvoidance(me, dt, 64, 0.8)
 	end
-	if entity_hasTarget(me) and not v.avoid then			
+	if entity_hasTarget(me) and not avoid then			
 		if entity_isTargetInRange(me, 1000) then
 			if not entity_isTargetInRange(me, 64) then				
 				entity_moveTowardsTarget(me, dt, 1000)
--- a/game_scripts/scripts/entities/grabbyarm.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/grabbyarm.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -117,13 +117,12 @@
 		if v.grabDelay > 0 then v.grabDelay = v.grabDelay - dt
 		elseif v.grabDelay <= 0 then
 			v.grabDelay = 0
-			
-			v.grabRange = 74
-			if entity_isEntityInRange(me, v.n, v.grabRange) then
+			local grabRange = 74
+			if entity_isEntityInRange(me, v.n, grabRange) then
 				v.grabbedEnt = v.n
 				entity_setState(me, STATE_TRAP)
 				
-			elseif entity_isEntityInRange(me, v.li, v.grabRange) then
+			elseif entity_isEntityInRange(me, v.li, grabRange) then
 				v.grabbedEnt = v.li
 				entity_setState(me, STATE_TRAP)
 				
@@ -132,8 +131,8 @@
 	elseif entity_isState(me, STATE_IN) then
 		if v.grabDelay > 0 then v.grabDelay = v.grabDelay - dt
 		elseif v.grabDelay <= 0 then
-			v.grabRange = 128
-			if entity_isEntityInRange(me, v.n, v.grabRange) then
+			grabRange = 128
+			if entity_isEntityInRange(me, v.n, grabRange) then
 				entity_setState(me, STATE_OUT)
 			end
 		end
--- a/game_scripts/scripts/entities/krotite-end.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/krotite-end.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -31,11 +31,11 @@
 	entity_setState(me, STATE_IDLE)
 	
 		
-	v.glow = entity_getBoneByName(me, "Glow")
-	v.noteBone = entity_getBoneByName(me, "Note")
+	local glow = entity_getBoneByName(me, "Glow")
+	local noteBone = entity_getBoneByName(me, "Note")
 	
-	bone_setVisible(v.glow, 0)
-	bone_setVisible(v.noteBone, 0)
+	bone_setVisible(glow, 0)
+	bone_setVisible(noteBone, 0)
 end
 
 function postInit(me)
--- a/game_scripts/scripts/entities/krotiteontheway.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/krotiteontheway.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -28,11 +28,11 @@
 	entity_scale(me, 0.7, 0.7)
 	
 	
-	v.noteBone = entity_getBoneByName(me, "Note")
-	v.glow = entity_getBoneByName(me, "Glow")
+	local noteBone = entity_getBoneByName(me, "Note")
+	local glow = entity_getBoneByName(me, "Glow")
 	
-	bone_setVisible(v.noteBone, false)
-	bone_setVisible(v.glow, false)
+	bone_setVisible(noteBone, false)
+	bone_setVisible(glow, false)
 	
 	entity_setState(me, STATE_IDLE)
 	
--- a/game_scripts/scripts/entities/krotiteworshipper.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/entities/krotiteworshipper.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -28,11 +28,11 @@
 	entity_scale(me, 0.7, 0.7)
 	
 	
-	v.noteBone = entity_getBoneByName(me, "Note")
-	v.glow = entity_getBoneByName(me, "Glow")
+	local noteBone = entity_getBoneByName(me, "Note")
+	local glow = entity_getBoneByName(me, "Glow")
 	
-	bone_setVisible(v.noteBone, false)
-	bone_setVisible(v.glow, false)
+	bone_setVisible(noteBone, false)
+	bone_setVisible(glow, false)
 	
 	entity_setState(me, STATE_IDLE)
 end
--- a/game_scripts/scripts/include/nodecollectibletemplate.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/include/nodecollectibletemplate.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -23,9 +23,9 @@
 	if isFlag(flag, 1) then
 		debugLog("CollectibleNode: Creating object")
 		debugLog(object)
-		v.collectible = createEntity(object, "", node_x(me), node_y(me))
+		local collectible = createEntity(object, "", node_x(me), node_y(me))
 		debugLog("seting state to inhouse")
-		entity_setState(v.collectible, STATE_COLLECTEDINHOUSE)
+		entity_setState(collectible, STATE_COLLECTEDINHOUSE)
 	else
 		debugLog("CollectibleNode: Flag not set")
 	end
--- a/game_scripts/scripts/maps/node_sit.lua	Fri Jan 07 02:36:54 2011 +0900
+++ b/game_scripts/scripts/maps/node_sit.lua	Wed Jan 19 23:38:55 2011 +0900
@@ -24,15 +24,15 @@
 end
 	
 function activate(me)
-	v.n = getNaija()
+	local n = getNaija()
 	avatar_fallOffWall()
-	entity_idle(v.n)
-	entity_setInvincible(v.n, true)
-	entity_swimToNode(v.n, me)
-	entity_watchForPath(v.n)
+	entity_idle(n)
+	entity_setInvincible(n, true)
+	entity_swimToNode(n, me)
+	entity_watchForPath(n)
 	--avatar_toggleCape(false)
-	entity_animate(v.n, "sitBack", LOOP_INF)
-	--entity_animate(v.n, "trailerIntroAnim2", LOOP_INF)
+	entity_animate(n, "sitBack", LOOP_INF)
+	--entity_animate(n, "trailerIntroAnim2", LOOP_INF)
 	overrideZoom(0.5, 2)
 	watch(2)
 	
@@ -42,14 +42,14 @@
 	while (not isLeftMouse()) and (not isRightMouse()) do
 		watch(FRAME_TIME)		
 	end
-	entity_idle(v.n)
-	entity_addVel(v.n, 0, -200)
+	entity_idle(n)
+	entity_addVel(n, 0, -200)
 	overrideZoom(1, 1)
-	esetv(v.n, EV_NOINPUTNOVEL, 0)
+	esetv(n, EV_NOINPUTNOVEL, 0)
 	watch(1)
-	esetv(v.n, EV_NOINPUTNOVEL, 1)
+	esetv(n, EV_NOINPUTNOVEL, 1)
 	overrideZoom(0)
-	entity_setInvincible(v.n, false)
+	entity_setInvincible(n, false)
 	
 	--avatar_toggleCape(true)
 end