From 37e815bf95ec49baaabec5ccce7fc5f9dd48e33c Mon Sep 17 00:00:00 2001 From: dsc Date: Tue, 4 Jan 2011 13:02:27 -0800 Subject: [PATCH] I believe this fixes the periodic ghost-blocker bug. --- bin/deploy.sh | 9 +++++---- src/tanks/game.cjs | 3 ++- src/tanks/thing/thing.cjs | 2 +- src/tanks/ui/main.cjs | 14 +++----------- www/css/lttl.css | 2 ++ www/welcome.html | 10 +++++++++- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/bin/deploy.sh b/bin/deploy.sh index 7452616..11fd870 100755 --- a/bin/deploy.sh +++ b/bin/deploy.sh @@ -2,7 +2,7 @@ VERBOSE="" SRC="src/Y src/ezl src/tanks" -EXCLUDE="--exclude=$(join ' --exclude=' 'tmp' 'src' 'bin' $*)" +EXCLUDE="--exclude=$(join ' --exclude=' 'tmp' 'src' 'bin' 'assets' $*)" GIT_VERSION=$(git show --oneline . | head -n1 | cut -d ' ' -f 1) @@ -75,13 +75,14 @@ echo "hokay" if test "$CLEAN"; then printf "Cleaning and rebuilding...\t\t" - commonjs $SRC $CLEAN || fail "Error cleaning project!" + paver -q clean || fail "Error cleaning project!" echo "hokay" fi printf "Building and generating dep-graph...\t" -commonjs $SRC --script-tags > www/deps.html || fail "Error building modules!" -sed -E 's|src="build/([^"]+)"|src="build/'$GIT_VERSION'/\1"|' www/deps.html > www/versioned-deps.html +paver -q build || fail "Error building modules!" +echo "" > www/versioned-deps.html +sed -E 's|src="build/([^"]+)"|src="build/'$GIT_VERSION'/\1"|' www/deps.html >> www/versioned-deps.html echo "hokay" printf "Uploading files...\t\t\t" diff --git a/src/tanks/game.cjs b/src/tanks/game.cjs index 20d5e6e..d397fcd 100644 --- a/src/tanks/game.cjs +++ b/src/tanks/game.cjs @@ -165,7 +165,7 @@ Y.subclass('Game', { killThing : function killThing(unit){ if (unit instanceof Event) - unit = unit.trigger; + unit = unit.data.unit; delete this.byId[unit.__id__]; this.active.remove(unit); @@ -181,6 +181,7 @@ Y.subclass('Game', { moveThingTo : function moveThingTo(agent, x,y){ this.pathmap.removeBlocker(agent); + if (agent.dead) return agent; agent.position(x,y); this.pathmap.addBlocker(agent); return agent; diff --git a/src/tanks/thing/thing.cjs b/src/tanks/thing/thing.cjs index f8c2305..b04aa59 100644 --- a/src/tanks/thing/thing.cjs +++ b/src/tanks/thing/thing.cjs @@ -109,7 +109,7 @@ new evt.Class('Thing', { destroy : function destroy(){ if (this.dead) return this; this.dead = true; - return this.remove().fire('destroy', this); + return this.remove().fire('destroy', this, { 'unit':this }); }, remove : function remove(){ diff --git a/src/tanks/ui/main.cjs b/src/tanks/ui/main.cjs index 7f42c80..fdd5f41 100644 --- a/src/tanks/ui/main.cjs +++ b/src/tanks/ui/main.cjs @@ -23,7 +23,7 @@ qkv = Y(window.location.search.slice(1)).fromKV(); // Main method is only executed once, so we'll setup things // that don't change between games. function main(){ - $('#welcome').center().hide(); + $('#loading').center(); /// Debug /// if (qkv.ai) { @@ -56,16 +56,8 @@ function main(){ // Build and bind config configui.init(); - // Create #loading box - $('#welcome').clone() - .attr('id', 'loading') - // .hide() - // .css({ 'top':'1em', 'left':'1em', 'margin':0, 'width':'auto' }) - .appendTo( $('body') ) - .find('.box').html('

Loading...

'); - // Create #pause box - $('#welcome').clone() + $('#loading').clone() .attr('id', 'pause') .hide() .css({ 'top':'1em', 'left':'1em', 'margin':0, 'width':'auto' }) @@ -73,7 +65,7 @@ function main(){ .find('.box').html('

Paused!

'); // Create Victory/Defeat box - $('#welcome').clone() + $('#loading').clone() .attr('id', 'gameover') .hide() .appendTo( $('body') ) diff --git a/www/css/lttl.css b/www/css/lttl.css index beac57f..2d6d3b2 100644 --- a/www/css/lttl.css +++ b/www/css/lttl.css @@ -37,6 +37,8 @@ td { text-align:center; vertical-align:middle; } .countdown { position:fixed; overflow:hidden; z-index:2000; text-align:center; border:10px solid #fff; color:#fff; } +#loading h2 { text-align:center; } + #welcome .box { cursor:pointer; } #notes { /* position:fixed; top:4em; right:1em; color:#BFBFBF;*/ } #notes ul, #notes ol, #notes li { list-style:circle ! important; } diff --git a/www/welcome.html b/www/welcome.html index 819ffa9..d2c140a 100644 --- a/www/welcome.html +++ b/www/welcome.html @@ -1,4 +1,12 @@ -
+
+
+

The Littlest Battletank

+ +

Loading...

+
+
+ +