One recurring complaint is that nobody talks about code on /prog/. So everyone write go and write some code, any code, that does something, anything, and post it. A small explanation wouldn't go amiss either.
Name:
Anonymous2011-04-01 21:35
doHarvest u -> a:u."act" d:a."dst"
-> d.{[p@_] -> r:a."res"
-> r.{no? -> r=:(canHarvest p a."harvests") -> u."act"."res"=:r}
-> if u.r>=100
then {-> o:unitTypes."store"
-> order [@o "back"=d "res"=r "depot"=a."depot"] u}
;id -> [[id u."id"] @!hideUnits]
-> o:unitTypes."harvest_inside"
-> u."act"=:[@o "dst"=d "depot"=a."depot" "range"=1
"res"=(canHarvest id a."harvests")]}
-> u
fixHarvest u -> a:u."act" d:a."dst" r:a."res" hs:a."harvests"
-> cnd{u.r>=100
-> order [@unitTypes."store" "back"=d "res"=r "depot"=a."depot"] u
;t:(findTile u."tile" (pointInRect wr ?) (canHarvest ? hs) (abs xy-?) l=6).rhd
-> [@!u."act" "dst"=[t [1 1]] "r"=no]
;ye -> u."act"=:no}
-> u
doHarvestInside u -> r:u."act"."res"
-> if u.r<100 then [[u."id" 5]@!nqs.(u."parent")."harvest"]
else {-> a:u."act" [u."id"@!showUnits]
-> o:unitTypes."store"
-> order [@o "back"=a."dst" "res"=r "depot"=a."depot"] u}
-> u
doStore u
-> a:u."act" r:a."res" depot:a."depot" t:(if depot units,depot)
-> t.{dead? -> depot.{no? -> depot=:(findDepot r u)}
-> depot.{ye? -> u."act"."depot"=:depot
;_ -> notify "Nowhere to store $r" -> u."act"=:no}
; _ -> if x:u."anims".r u."anims"."move"=:x
-> if a."near"
then {-> [[u."id" r u.r]@!nqs.(u."owner")."+"] -> u.r=:0
-> u."anims"."move" =: unitTypes.(u."type")."anims"."move"
-> o:unitTypes."harvest"
-> order [@o "dst"=a."back" "depot"=a."depot"] u}
else {-> u."act"."near"=:ye -> u."act"."dst"=:depot}}
-> u