Browse Source

Slightly nicer debug output

master
Ben Kurtovic 13 years ago
parent
commit
42269dc718
4 changed files with 8 additions and 7 deletions
  1. +3
    -1
      base.nls
  2. +0
    -1
      explosion.nls
  3. +2
    -2
      lobo.nlogo
  4. +3
    -3
      tank.nls

+ 3
- 1
base.nls View File

@@ -62,6 +62,7 @@ to do-base-logic
end

to claim-base [claimer]
debug who "BASE-CLAIM" (word "by " ([who] of claimer) ": " team " -> " [team] of claimer)
set team [team] of claimer
set color get-base-color
end
@@ -107,12 +108,13 @@ to regenerate
end

to base-shot-at
debug "BASE-SHOT" (word who " by " ([shooter] of myself))
set armor armor - 1
ifelse armor > 0 [
debug who "BASE-SHOT" (word "by " ([shooter] of myself))
explode "decay"
play-sound "shot"
] [
debug who "BASE-KILL" (word "by " ([shooter] of myself))
explode "shot"
play-sound "kill"
]


+ 0
- 1
explosion.nls View File

@@ -31,7 +31,6 @@ to make-explosions-table
end

to explode [name]
debug "EXPLODE" name
let data table:get explodes name
foreach data [
create-explosion ?


+ 2
- 2
lobo.nlogo View File

@@ -82,10 +82,10 @@ end
;; Other procedures
;; ================

to debug [action msg]
to debug [agent action msg]
; Comment this and remove the output box
; to turn off debugging info:
output-print (word (round timer) ": " action ": " msg)
output-print (word (round timer) ": " agent ": " action " (" msg ")")
end

to setup-defaults


+ 3
- 3
tank.nls View File

@@ -95,7 +95,7 @@ end
to fire
if fire-cool-down = 0 [
ifelse ammunition > 0 [
debug "FIRE" (word who " (" ammunition " left)")
debug who "TANK-FIRE" (word ammunition " left")
set ammunition ammunition - 1
fire-bullet
play-sound "fire"
@@ -107,7 +107,7 @@ to fire
end

to tank-shot-at
debug "SHOT" (word who " by " ([shooter] of myself))
debug who "TANK-SHOT" (word "by " ([shooter] of myself))
set armor armor - 1
ifelse armor = 0 [
explode "kill"
@@ -120,7 +120,7 @@ to tank-shot-at
end

to kill-tank
debug "KILL" (word who " by " ([shooter] of myself))
debug who "TANK-KILL" (word "by " ([shooter] of myself))
if is-player? [
set player-deaths player-deaths + 1
]


Loading…
Cancel
Save