**TREEHOUSE UNDERGROUND SET 1**

**Surface.
inst
new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2350 1147
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va00 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

**Useless tunnel 1.

new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2350 1425
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va01 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

**Gomato room.

new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2350 1627
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va02 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

**Useless tunnel 2.

new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2350 1800
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va03 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

**Unidentifiable wide expanse.

new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2350 2027
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va04 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"


**Useless hole in the ground 1.

new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2350 2260
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va05 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"


**Link them to each other.

targ va00
seta ov05 va01

targ va01
seta ov00 va00
seta ov05 va02

targ va02
seta ov00 va01
seta ov05 va03

targ va03
seta ov00 va02
seta ov05 va04

targ va04
seta ov00 va03
seta ov05 va05

targ va05
seta ov00 va04


**TREEHOUSE ABOVE-GROUND SET

**Top of treehouse.
new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2989 300
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va00 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

**Upper middle.
new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2989 470
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va01 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

**Lower middle.
new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2989 647
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va02 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

**Bottom of treehouse.
new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2989 832
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va03 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

**Base of tree.
new: vhcl 3 1 1 "lifts" 5 0 0
mvto 2989 1160
pat: dull 1 "lifts" 0 0 0 5
attr 4
bhvr 3
part 0
seta va04 targ
sets ov01 "dr_o"
sets ov02 "0 1 2 3 4"
sets ov03 "excl"
sets ov04 "4 3 2 1 0"

targ va00
seta ov05 va01

targ va01
seta ov00 va00
seta ov05 va02

targ va02
seta ov00 va01
seta ov05 va03

targ va03
seta ov00 va02
seta ov05 va04

targ va04
seta ov00 va03





**Constructor: Create the CA links.
scrp 3 1 1 10
**If there's an up link, link to it.
	doif type ov00 ne 0
		setv va00 posl
		setv va01 post
		new: simp 1 1 3 "blnk" 0 0 0
		attr 16
		mvto va00 va01
		setv va02 grap posx posy

		targ ownr
		targ ov00

		setv va00 posl
		setv va01 post
		new: simp 1 1 3 "blnk" 0 0 0
		attr 16
		mvto va00 va01
		setv va03 grap posx posy

		link va02 va03 100
	endi

**Same with down link.
	doif type ov05 ne 0
		setv va00 posl
		setv va01 post
		new: simp 1 1 3 "blnk" 0 0 0
		attr 16
		mvto va00 va01
		setv va02 grap posx posy

		targ ownr
		targ ov05

		setv va00 posl
		setv va01 post
		new: simp 1 1 3 "blnk" 0 0 0
		attr 16
		mvto va00 va01
		setv va03 grap posx posy

		link va02 va03 100
	endi

endm

**Push script: Grab FROM and move it to the up link.
scrp 3 1 1 1
	doif type ov00 ne 0
**Lock it so it doesn't get messed up when thirty creatures try to use it at once.
		lock
		inst
		targ ownr
**If it was pushed by the Hand, grab all creatures touching it.
		doif from eq pntr
			gpas 4 0 0 0
			epas 4 0 0
				stim writ targ 94 1
			next
			targ ownr
**Else just grab FROM.
		else
			spas ownr from
			doif crea from eq 1
				stim writ from 94 1
			endi
		endi
**OWNR and up link close.
		part 1
		anms ov02
		snde ov01
		targ ov00
		part 1
		anms ov02
		snde ov01
		targ ownr
		slow
		over
**Teleport all held objects into up link cabin.
		inst
		targ ov00
		setv va00 posx
		setv va01 posy
		addv va01 30
		seta va02 targ
		targ ownr
		epas 0 0 0
			rpas ownr targ
			mvsf va00 va01
			spas va02 targ
		next
		targ va02
		part 1
		slow
**Both open, up link drops contents.
		anms ov04
		snde ov01
		targ ownr
		anms ov04
		snde ov01
		over
		targ ov00
		dpas 0 0 0
	else
		snde ov03
	endi
endm

**Pull script: Grab FROM and move it to the down link. Too lazy to change comments here, so it still says up link.
scrp 3 1 1 2
	doif type ov05 ne 0
**Lock it so it doesn't get messed up when thirty creatures try to use it at once.
		lock
		inst
		targ ownr
**If it was pushed by the Hand, grab all creatures touching it.
		doif from eq pntr
			gpas 4 0 0 0
			epas 4 0 0
				stim writ targ 94 1
			next
			targ ownr
**Else just grab FROM.
		else
			spas ownr from
			doif crea from eq 1
				stim writ from 94 1
			endi
		endi
**OWNR and up link close.
		part 1
		anms ov02
		snde ov01
		targ ov05
		part 1
		anms ov02
		snde ov01
		targ ownr
		slow
		over
**Teleport all held objects into up link cabin.
		inst
		targ ov05
		setv va00 posx
		setv va01 posy
		addv va01 30
		seta va02 targ
		targ ownr
		epas 0 0 0
			rpas ownr targ
			mvsf va00 va01
			spas va02 targ
		next
		targ va02
		part 1
		slow
**Both open, up link drops contents.
		anms ov04
		snde ov01
		targ ownr
		anms ov04
		snde ov01
		over
		targ ov05
		dpas 0 0 0
	else
		snde ov03
	endi
endm



rscr
enum 3 1 1
	kill targ
next
scrx 3 1 1 1