[aquaria] [PATCH] Fix global references in scripts

Andrew Church achurch+aquaria at achurch.org
Thu May 5 16:29:32 EDT 2011


Found a couple of global variable references I overlooked during the
script updates, so here's a fix.

FWIW, I wrote a little "lint"-like script to report improper accesses to
global variables from scripts, but I'm not sure if there's a good place
for it in the repository -- Ryan, any thoughts?  I could always just
post it to the list, I guess.

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/

# HG changeset patch
# User Andrew Church <achurch at achurch.org>
# Date 1304580204 -32400
# Node ID d2ac8e4e1f027d351b9593850c3e88f1c46796a9
# Parent  e2563b6541101fa7bbbb3d4a67472f76d0f16594
Fix overlooked uses of global variables in scripts.

diff -r e2563b654110 -r d2ac8e4e1f02 game_scripts/scripts/entities/gateway.lua
--- a/game_scripts/scripts/entities/gateway.lua	Wed Apr 27 16:30:32 2011 +0200
+++ b/game_scripts/scripts/entities/gateway.lua	Thu May 05 16:23:24 2011 +0900
@@ -120,7 +120,7 @@
 			e = getNextEntity()
 		end
 		if c < toomany then
-			e = createEntity("final-mutant", "", entity_x(me), entity_y(me))
+			local e = createEntity("final-mutant", "", entity_x(me), entity_y(me))
 			spawnParticleEffect("tinyredexplode", entity_x(e), entity_y(e))
 			entity_alpha(e, 0)
 			entity_alpha(e, 1, 0.5)
diff -r e2563b654110 -r d2ac8e4e1f02 game_scripts/scripts/entities/grabbyarm.lua
--- a/game_scripts/scripts/entities/grabbyarm.lua	Wed Apr 27 16:30:32 2011 +0200
+++ b/game_scripts/scripts/entities/grabbyarm.lua	Thu May 05 16:23:24 2011 +0900
@@ -132,7 +132,7 @@
 	elseif entity_isState(me, STATE_IN) then
 		if v.grabDelay > 0 then v.grabDelay = v.grabDelay - dt
 		elseif v.grabDelay <= 0 then
-			grabRange = 128
+			local grabRange = 128
 			if entity_isEntityInRange(me, v.n, grabRange) then
 				entity_setState(me, STATE_OUT)
 			end


More information about the aquaria mailing list