
inst
reps 20
	new: simp 2 3 5814 "palmplant2" 6 30 rand 400 1700
	attr 210
	bhvr 48
	elas 10
	fric 90
	perm rand 40 70
	accg 2
	aero 1
	velo rand -10 10 rand -10 0
	setv ov72 rand 40 80
	setv ov80 1
	setv ov82 1
	setv ov87 0.01
	setv va00 rand 1000 2200
	setv va01 2030
	doif tmvt va00 va01 eq 1
		mvto va00 va01
		tick rand 600 800
	else
		kill targ
	endi
repe
reps rand 15 30
	new: simp 2 8 5814 "palmplant2" 9 15 rand 700 1400
	attr 195
	bhvr 48
	elas 5
	fric 50
	accg 3
	aero 1
	perm 80
	pose 2
	mira rand 0 1
	setv ov00 0
	setv ov01 0
	setv ov72 rand 10 20
	setv va00 rand 1000 2200
	setv va01 2030

	doif tmvt va00 va01 eq 1
		mvto va00 va01
		tick rand 600 900
		velo rand -4 4 0
	else
		kill targ
		targ ownr
	endi
repe

scrp 2 3 5814 9
	lock
	rnge 50
	setv va66 0
	esee 2 4 4
		addv va66 1
	next
	targ ownr
	doif va66 ge 1
		kill ownr
	endi
	unlk
	doif fall eq 0 and carr eq null
		doif rtyp room targ eq 8 or rtyp room targ eq 9
			kill ownr
		endi
		gsub envi
		gsub dorm
	endi
	subr envi
		doif prop room targ 1 le ov80 and prop room targ 1 gt 0.1
			setv va00 1
		else
			setv va00 0
		endi
		doif prop room targ 2 le ov82 and prop room targ 2 gt 0.15
			setv va01 1
		else
			setv va01 0
		endi
		doif prop room targ 3 gt 0.15
			setv va02 1
		else
			setv va02 0
		endi
		doif prop room targ 4 ge ov87
			setv va03 1
		else
			setv va03 0
		endi
		doif va00 eq 1 and va01 eq 1 and va02 eq 1 and va03 eq 1
			gsub sprout
		endi

	retn
	subr sprout
		setv va00 posl
		setv va01 post
		new: simp 2 4 4 "palmplant" 15 0 rand 700 1400
		attr 192
		bhvr 0
		elas 0
		fric 100
		accg 5
		aero 0
		perm 99
		setv ov00 0
		setv ov01 0

		setv ov02 5
		seta ov16 null
		subv va00 45
		subv va01 66
		doif tmvt va00 va01 eq 1
			mvto va00 va01
			tick rand 450 600
		else
			kill targ
			kill ownr
		endi
		kill ownr
	retn
	subr dorm
		subv ov72 1
		doif ov72 le 0
			doif room targ ne -1
				altr room targ 3 0.005
				altr room targ 4 0.0075
				kill ownr
			else
				kill ownr
			endi
		endi
	retn
endm
scrp 2 3 5814 4
	pose rand 0 1
endm
scrp 2 3 5814 5
	pose rand 2 3
endm
scrp 2 3 5814 6
	pose rand 4 5
endm
scrp 2 3 5814 12
	stim writ from 77 0.3
	kill ownr
endm

scrp 2 4 4 9
	addv ov01 1
	subv ov02 1
	doif prop room targ 1 ge 0.08 and prop room targ 2 ge 0.1 and prop room targ 3 ge 0.05 and prop room targ 4 ge 0.001
		addv ov02 10
	endi
	doif ov02 le 0
		setv ov00 99
	endi
	doif ov00 eq 0
		gsub grow
	endi
	doif ov00 eq 1
		gsub bud
	endi
	doif ov00 eq 3 or ov00 eq 99
		gsub shrivel
	endi
	subr grow
		doif ov01 ge 3
			doif pose lt 14
				setv va00 pose
				addv va00 1
				pose va00
				setv ov01 0
			elif pose eq 14
				setv ov00 1

			endi
		endi
	retn
	subr bud
		setv va00 posl
		setv va01 post
		setv va02 plne
		addv va02 1
		new: simp 2 7 5814 "palmplant2" 14 1 va02
		attr 16
		bhvr 0
		addv va00 20
		addv va01 30
		setv ov01 0
		setv ov00 0
		setv ov99 0
		setv ov72 120
		doif tmvt va00 va01 eq 1
			mvto va00 va01
			tick rand 30 60
			seta ov50 ownr
			seta mv16 targ
			setv mv00 2
		else
			kill targ
			targ ownr
			setv ov00 99
		endi
	retn
	subr shrivel
		doif ov16 ne null
			kill ov16
		endi
		doif pose gt 0
			setv va00 pose
			subv va00 1
			pose va00
		elif pose eq 0
			doif ov00 eq 99
				doif room targ ne -1 and carr eq null
					altr room targ 3 0.3
					altr room targ 4 0.004
					kill ownr
				elif room targ eq -1 or carr ne null
					kill ownr
				endi
			elif ov00 eq 3
				setv ov00 0
			endi
		endi
	retn
endm
scrp 2 7 5814 9
	addv ov01 1
	doif ov50 eq null
		kill ownr
	endi
	doif ov00 eq 0
		gsub bloom
	endi
	doif ov00 eq 1
		gsub pollen
		gsub open
	endi
	doif ov00 eq 2
		gsub fruit
	endi
	doif ov00 eq 3
		gsub wither
	endi
	subr bloom
		doif ov01 ge 20
			doif pose lt 5
				setv va00 pose
				addv va00 1
				pose va00
				setv ov01 0
			else
				setv ov00 1
			endi
		endi
	retn
	subr pollen
		inst
		etch 2 14 0
			doif targ ne null
				setv va66 1
			endi
		next
		targ ownr
		doif va66 eq 1 and ov72 ge 1
			setv ov70 1
		else
			setv va66 0
		endi
		slow
	retn
	subr open
		subv ov72 1
		doif ov72 le 0 and ov70 eq 0
			setv ov00 3
		elif ov70 eq 1 and ov72 ge 1
			pose 10
			setv ov00 2
		endi
	retn
	subr fruit
		doif ov01 ge 20
			doif pose lt 13
				setv va00 pose
				addv va00 1
				pose va00
				setv ov01 0
			else
				setv va98 rand 1 2
				doif va98 eq 1
					setv va99 3
				else
					setv va99 99
				endi
				setv va50 posx
				setv va51 posy
				reps rand 10 25
					new: simp 2 8 5814 "palmplant2" 9 15 rand 700 1400
					attr 195
					bhvr 48
					elas 5
					fric 50
					accg 3
					aero 1
					perm 80
					mira rand 0 1
					setv ov00 0
					setv ov01 0
					seta ov50 mv50
					setv ov72 rand 10 20
					doif tmvt va50 va51 eq 1
						tick rand 600 900
						mvto va50 va51
						velo rand -4 4 0
					else
						kill targ
						targ ownr
					endi
				repe
				targ ov50
				setv ov00 va99
				targ ownr
				kill ownr
			endi
		endi
	retn
	subr wither
		doif pose lt 9
			setv va00 pose
			addv va00 1
			pose va00
		elif pose eq 9
			setv va98 rand 1 2
			doif va98 eq 1
				setv va99 3
			else
				setv va99 99
			endi
			doif rtyp room targ ne -1 and carr eq null
				altr room targ 3 0.1
				altr room targ 4 0.1
				targ ov50
				setv ov00 va99
				targ ownr
				kill ownr

			else

				targ ov50
				setv ov00 va99
				targ ownr
				kill ownr
			endi
		endi
	retn
endm
scrp 2 8 5814 9
	subv ov72 1
	doif pose eq 2 or pose eq 7 or pose eq 8
		emit 6 0.3
	endi
	doif ov72 le 0
		doif pose lt 2
			setv va00 pose
			addv va00 1
			pose va00
			setv ov72 rand 10 20
		elif pose gt 2 and pose lt 7
			setv va00 pose
			addv va00 2
			pose va00
			setv ov72 rand 5 10
		else
			doif pose eq 2
				setv va01 0
			elif pose eq 7
				setv va01 1
			elif pose eq 8
				setv va01 2
			endi
			setv va50 posl
			setv va51 post
			setv va02 plne
			addv va02 1
			new: simp 2 10 5814 "palmplant2" 6 24 va02
			attr 195
			bhvr 48
			accg 3
			perm 60
			aero 1
			fric 30
			elas 15
			pose va01
			setv ov72 rand 10 20
			doif tmvt va50 va51 eq 1
				mvto va50 va51
				tick rand 500 1000
			else
				kill targ
				kill ownr
			endi

			kill ownr
		endi
	endi
endm
scrp 2 8 5814 12
	doif pose eq 0 or pose eq 3 or pose eq 4
		stim writ from 78 0.25
		doif pose eq 0
			pose rand 3 4
		else
			kill ownr
		endi
	elif pose eq 1 or pose eq 5 or pose eq 6
		stim writ from 78 0.5
		doif pose eq 1
			pose rand 5 6
		else
			kill ownr
		endi
	elif pose eq 2 or pose eq 7 or pose eq 8
		inst
		stim writ from 78 1
		targ from
		chem 98 0.1
		setv va24 rand 1 2
		doif va24 eq 2
			seta va19 targ
			setv va50 posx
			setv va51 posy
			setv va52 posb
			subv va52 va51
			divv va52 2
			addv va52 va51
			new: simp 1 1 5814 "palmplant2" 1 0 5500
			attr 48
			bhvr 0
			frel va19
			seta ov16 va19
			setv ov72 rand 15 20
			doif tmvt va50 va52 eq 1
				mvto va50 va51
				tick rand 100 150
			else
				kill targ
				targ ownr
			endi
		endi
		setv va50 posx
		setv va01 post
		setv va51 posy
		subv va51 va01
		divv va51 3
		addv va01 va51
		reps rand 1 3
			new: simp 2 3 5814 "palmplant2" 6 30 rand 400 1700
			attr 210
			bhvr 48
			elas 10
			fric 90
			perm rand 40 70
			accg 2
			aero 1
			setv ov72 rand 20 40
			setv ov80 1
			setv ov82 1
			setv ov87 0.01
			doif tmvt va50 va01 eq 1
				mvto va50 va01
				tick rand 600 800
				velo rand -5 5 0
			else
				kill targ
				targ ownr
			endi
		repe
		targ ownr
		doif pose eq 2
			pose rand 7 8
		else
			kill ownr
		endi
		slow
	endi
endm
scrp 2 10 5814 9
	subv ov72 1
	doif ov72 le 0
		doif pose eq 0
			pose 1
			setv ov72 rand 10 20
		elif pose eq 2 or pose eq 3
			setv va00 pose
			addv va00 2
			pose va00
			setv ov72 rand 5 10
		else
			setv va99 rand 1 50
			doif va99 eq 25
				setv va50 posx
				setv va50 posy
				new: simp 2 3 5814 "palmplant2" 6 30 rand 400 1700
				attr 210
				bhvr 48
				elas 10
				fric 90
				perm rand 40 70
				accg 2
				aero 1
				setv ov72 rand 20 40
				setv ov80 1
				setv ov82 1
				setv ov87 0.01
				doif tmvt va50 va51 eq 1
					mvto va50 va51
					tick rand 600 800
				else
					kill targ
					targ ownr
					altr room targ 3 0.1
					altr room targ 4 0.2
					kill ownr
				endi
			else
				altr room targ 3 0.1
				altr room targ 4 0.2
				kill ownr
			endi
		endi
	endi
endm
scrp 2 10 5814 12
	stim writ from 81 1
	doif pose eq 0
		pose rand 2 3
	elif pose eq 1
		pose rand 4 5
	else
		kill ownr
	endi
endm
scrp 1 1 5814 9
	doif ov16 ne null
		subv ov72 1
		doif ov72 le 0
			gsub disperse

		endi
	else
		gsub disperse
	endi
	subr disperse
		setv va50 posx
		setv va51 posy
		reps rand 1 3
			new: simp 2 3 5814 "palmplant2" 6 30 rand 400 1700
			attr 210
			bhvr 48
			elas 10
			fric 90
			perm rand 40 70
			accg 2
			aero 1
			setv ov72 rand 20 40
			setv ov80 1
			setv ov82 1
			setv ov87 0.01
			doif tmvt va50 va51 eq 1
				mvto va50 va51
				tick rand 600 800
			else
				kill targ
				kill ownr
			endi
		repe
		kill ownr
	retn
endm
rscr
enum 2 4 4
	kill targ
next
enum 2 3 5814
	kill targ
next
enum 2 8 5814
	kill targ
next
enum 2 10 5814
	kill targ
next
enum 1 1 5814
	kill targ
next

scrx 2 4 4 9
scrx 2 3 5814 4
scrx 2 3 5814 5
scrx 2 3 5814 6
scrx 2 3 5814 9
scrx 2 3 5814 12
scrx 2 8 5814 9
scrx 2 8 5814 12
scrx 2 10 5814 9
scrx 2 10 5814 12