inst
reps 6
	new: simp 2 3 5821 "swampstalk3" 1 0 rand 800 1200
	attr 195
	bhvr 48
	perm 5
	accg 3
	elas 5
	fric 95
	aero 0
	setv ov72 rand 40 80
	setv ov80 0.9
	setv ov82 0.8
	setv ov87 0.002
	setv va00 rand 250 900
	setv va01 2250
	doif tmvt va00 va01 eq 1
		mvto va00 va01
		tick rand 300 600
	else
		kill targ
	endi
repe
reps 6
	new: simp 2 3 5821 "swampstalk3" 1 0 rand 800 1200
	attr 195
	bhvr 48
	perm 5
	accg 3
	elas 5
	fric 95
	aero 0
	setv ov72 rand 40 80
	setv ov80 0.9
	setv ov82 0.8
	setv ov87 0.002
	setv va00 rand 2450 2800
	setv va01 2150
	doif tmvt va00 va01 eq 1
		mvto va00 va01
		tick rand 300 600
	else
		kill targ
	endi
repe
scrp 2 3 5821 9
	lock
	rnge 80
	setv va66 0
	esee 2 5 5821
		addv va66 1
	next
	targ ownr
	doif va66 ge 3
		doif room targ ne -1 and carr eq null
			altr room targ 3 0.01
			altr room targ 4 0.02
			kill ownr
		else

			kill ownr
		endi
	endi
	unlk
	doif fall eq 0 and carr eq null
		doif rtyp room targ eq 9
			kill ownr
		endi
		gsub envi
		gsub dorm
	endi
	subr envi
		doif prop room targ 1 lt ov80 and prop room targ 1 gt 0.01
			setv va00 1
		else
			setv va00 0
		endi
		doif prop room targ 2 lt ov82 and prop room targ 2 gt 0.075
			setv va01 1
		else
			setv va01 0
		endi
		doif prop room targ 3 ge 0.15
			setv va02 1
		else
			setv va02 0
		endi
		doif prop room targ 4 gt ov87
			setv va03 1
		else
			setv va03 0
		endi
		doif prop room targ 5 gt 0.1 or rtyp room targ eq 8
			setv va04 1
		else
			setv va04 0
		endi
		doif va00 eq 1 and va01 eq 1 and va02 eq 1 and va03 eq 1 and va04 eq 1
			gsub sprout
		endi
	retn
	subr sprout
		setv va00 posl
		setv va01 post
		new: simp 2 5 5821 "swampstalk3" 17 13 rand 800 2400
		attr 208
		accg 2
		perm 5
		elas 0
		fric 100
		aero 0
		setv ov00 0
		setv ov01 0
		setv ov02 5
		seta ov16 null
		subv va00 44
		subv va01 161
		doif tmvt va00 va01 eq 1
			mvto va00 va01
			tick rand 400 600
		else
			kill targ
			kill ownr
		endi
		kill ownr
	retn
	subr dorm
		subv ov72 1
		doif ov72 le 0
			doif room targ ne -1 and carr eq null
				altr room targ 3 0.1
				altr room targ 4 0.1
				kill ownr
			else
				kill ownr
			endi
		endi
	retn
endm
scrp 2 3 5821 12
	stim writ from 77 0.1
	kill ownr
endm
scrp 2 5 5821 9
	addv ov01 1
	subv ov02 1
	doif prop room targ 1 ge 0.005 and prop room targ 2 ge 0.07 and prop room targ 3 ge 0.05 and prop room targ 4 ge 0.002

		addv ov02 10
	endi
	doif ov02 le 0
		setv ov00 99
	endi
	doif ov00 eq 0
		gsub grow
	endi
	doif ov00 eq 1
		gsub flower
	endi
	doif ov00 eq 99
		gsub die
	endi
	subr grow
		doif ov01 ge 3
			doif pose lt 8
				setv va00 pose
				addv va00 1
				pose va00
				setv ov01 0
			else
				setv ov00 1
			endi
		endi
	retn
	subr flower
		setv va00 posl
		setv va01 post
		subv va01 15
		setv va02 plne
		addv va02 1
		new: simp 2 7 5821 "swampstalk3" 8 1 va02
		attr 16
		setv ov00 0
		setv ov01 0
		seta ov50 ownr
		doif tmvt va00 va01 eq 1
			mvto va00 va01
			tick rand 600 900
		else
			kill targ
			targ ownr
			setv ov00 99
		endi
		seta mv16 targ
		targ ownr
		setv ov00 2
	retn
	subr die
		doif ov16 ne null
			kill ov16
		endi
		doif pose lt 16
			setv va00 pose
			addv va00 1
			pose va00
		elif pose eq 16
			doif room targ ne -1
				altr room targ 3 0.2
				altr room targ 4 0.2
				kill ownr
			else
				kill ownr
			endi
		endi
	retn
endm
scrp 2 7 5821 9
	addv ov01 1
	doif ov00 eq 0
		gsub bloom
	endi
	doif ov00 eq 1
		gsub fruit
	endi
	subr bloom
		doif pose lt 7
			setv va00 pose
			addv va00 1
			pose va00
		else
			setv ov00 1
		endi
	retn
	subr fruit
		inst
		setv va50 posx
		setv va51 posy
		new: simp 2 8 5821 "swampstalk3" 4 9 rand 1200 1500
		attr 195
		bhvr 48
		elas 5
		fric 50
		perm 80
		aero 0
		accg 3
		pose rand 0 1
		seta ov50 mv50
		setv ov72 rand 50 80
		doif tmvt va50 va51 eq 1
			mvto va50 va51
			tick rand 200 300
		else
			mvsf va50 va51
		endi
		doif ov50 ne null
			targ ov50
			setv ov00 99
		endi
		targ ownr
		kill ownr
		slow
	retn
endm
scrp 2 8 5821 9
	subv ov72 1
	doif ov72 le 0
		doif room targ ne -1
			altr room targ 3 0.1
			altr room targ 4 0.08
			kill ownr
		else
			kill ownr
		endi
	endi
endm
scrp 2 8 5821 12
	stim writ from 78 1
	targ from
	chem 3 0.2
	chem 33 0.2
	chem 99 0.2
	chem 100 0.2
	targ ownr
	setv va50 posx
	setv va51 posy
	reps rand 2 4
		new: simp 2 3 5821 "swampstalk3" 1 0 rand 800 1200
		attr 195
		bhvr 48
		perm 5
		accg 3
		elas 5
		fric 95
		aero 1
		setv ov72 rand 40 80
		setv ov80 0.9
		setv ov82 0.8
		setv ov87 0.02
		doif tmvt va50 va51 eq 1
			mvto va50 va51
			velo rand -5 5 0
			tick rand 300 600
		else
			kill targ
		endi
	repe
	targ ownr
	doif pose eq 0
		pose 2
	elif pose eq 1
		pose 3
	else
		kill ownr
	endi
endm
scrp 2 8 5821 4
	doif pose lt 2
		setv va00 rand 0 1
	else
		setv va00 rand 2 3
	endi
	pose va00
endm
scrp 2 8 5821 5
	doif pose lt 2
		setv va00 rand 0 1
	else
		setv va00 rand 2 3
	endi
	pose va00
endm

rscr
enum 2 3 5821
	kill targ
next
enum 2 5 5821
	kill targ
next
enum 2 7 5821
	kill targ
next
enum 2 8 5821
	kill targ
next
scrx 2 3 5821 9
scrx 2 3 5821 12
scrx 2 5 5821 9
scrx 2 7 5821 9
scrx 2 8 5821 4
scrx 2 8 5821 5
scrx 2 8 5821 9
scrx 2 8 5821 12