honeylisp/game/level5.fnl

64 lines
2.1 KiB
Plaintext
Raw Normal View History

2020-12-12 16:55:22 +00:00
(local {: deflevel : say : itile} (require :game.defs))
(local {: ev} (require :game.entity))
2020-12-17 03:59:55 +00:00
(local tile (require :game.tiles))
(local {: walkable : neutable : debris : sittable} tile.flag-to-bit)
2020-12-12 16:55:22 +00:00
(local level (deflevel "game/map5.json"))
(local vm level.vm)
2020-12-15 04:14:35 +00:00
(vm:var :doortimer 0)
(vm:word :start-doortimer 0x100 :doortimer :set)
(vm:word :doortimer-tick
:doortimer :get (vm:when
:doortimer :get 1 :- :dup :doortimer :set
:not (vm:when
:lit :timedswitch ev.deact :entity>do)))
(vm:word :do-timedswitch
; only gord is physically able to touch it
:dup ev.touch := (vm:when :start-doortimer :drop ev.act) :switch)
2020-12-17 03:59:55 +00:00
(vm:var :is-garbagerexx vm.false)
(vm:var :garbagerexx-yx 0x0710)
(vm:var :garbagerexx-introduced vm.false)
2020-12-17 03:59:55 +00:00
(vm:word :garbagerexx ; ev --
:is-rexx? :swap :rexx :is-rexx? := :not (vm:when
:is-rexx? (vm:if [
:garbagerexx-yx :get :get-responder :get := (vm:when
vm.true :is-garbagerexx :set
:garbagerexx-introduced :get :not (vm:when
(say :rexx "BO@*SS5S...,? ")
(say :rexx "I DON'T F3EL SO" "GOO00)OD...>?&**;")
vm.true :garbagerexx-introduced :set
))
2020-12-17 03:59:55 +00:00
] [
:is-garbagerexx :get (vm:when
:get-responder :get :garbagerexx-yx :set
vm.false :is-garbagerexx :set)
])))
(vm:word :not-picking-up? ; yxdest -- f
debris :flag-at? :not)
(vm:word :can-drop-rubble? ; yxdest -- f
:itile-at (itile :t-floor) :=
:rexx-yx :get :itile-at (itile :t-floor) := :&)
(vm:word :move-garbagerexx ; yx -- f
(vm:if-and [[:is-rexx?] [:is-garbagerexx :get]]
[:dup 0xff :& 0x0d := (vm:if [
(say :rexx "PARITY#ERPOR!*(!@$[") :drop vm.true :ret
2020-12-17 03:59:55 +00:00
] [
(vm:if-and [[:dup :not-picking-up?] [:dup :can-drop-rubble?]]
[:rexx-yx :get (itile :broken-table) :update-itile])
])])
:move-noop)
(vm:var :healthyrexx-introduced vm.false)
(vm:word :healthyrexx ; ev --
(vm:if-and [[:is-neut?] [:dup ev.touch :=] [:healthyrexx-introduced :get :not]]
[(say :neut "REXX UNIT" "PERFORM FULL DIAGNOSTIC SCAN")
(say :rexx "I'M IN TIP-TOP SHAPE, BOSS!")
(say :neut "ACTIVATING RELIEF SUBROUTINE")
vm.true :healthyrexx-introduced :set]) :rexx)
2020-12-12 16:55:22 +00:00
level