-
Notifications
You must be signed in to change notification settings - Fork 1
/
36463_critter.cos
155 lines (143 loc) · 2.31 KB
/
36463_critter.cos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
**
** Critter script
**
**
** Creation script
**
** Critter creation
scrp 2 15 36463 1000
* Attr: mouseable 2 + collide 64 + physics 128 = 194
attr 194
* Bhvr: act1 1 + hit 8 + eat 16 + pick up 32 = 57
bhvr 57
* Set physics attributes
accg 2
aero 3
* Set collision attributes
perm 60
fric 60
elas 30
* Move to the spot if possible
doif tmvt _p1_ _p2_ ne 0
mvto _p1_ _p2_
else
kill targ
endi
tick 8
endm
**
** Activate 1 (push) script
**
** Critter play
scrp 2 15 36463 1
* stim played with animal
stim writ from 86 1
* move critter around a bit
setv va00 velx
mulv va00 3
velo va00 -3
endm
**
** Hit script
**
** Critter hit
scrp 2 15 36463 3
* stim hit animal
stim writ from 87 1
* move the critter around a bit
velo rand -3 3 rand -6 -3
endm
**
** Eat script
**
** Critter eat
scrp 2 15 36463 12
* stim eaten animal
stim writ from 80 2
kill ownr
endm
**
** Timer script
**
** Critter
scrp 2 15 36463 9
* if not being carried
doif carr eq null
* set direction
setv va00 rand 1 8
doif va00 le 4
setv va00 rand -8 -5
pose 1
elif va00 gt 4
setv va00 rand 5 8
pose 0
endi
* move the critter
reps rand 4 12
* if not falling
doif fall ne 1
setv va20 grap posx posy
* if critter in water, set accg
doif rtyp va20 eq 8 or rtyp va20 eq 9
accg 0.8
* if critter in invalid spot, kill it
elif rtyp va20 eq -1
kill targ
stop
* if critter on land, set accg
else
accg 2
endi
* move!
velo va00 -8
endi
wait 15
repe
* randomly make kids
doif rand 0 5 eq 0
rnge 1000
* set random variable to get dynamic population
setv va00 rand 0 3
esee 2 15 36463
addv va00 1
next
* if not many critters around
doif va00 lt 4
* Create new critters
targ ownr
setv va01 posx
setv va02 post
subv va02 5
inst
reps 2
new: simp 2 15 36463 "betaship_agents" 2 4 rand 1200 4000
mesg wrt+ targ 1000 va01 va02 0
repe
slow
* if too many critters around, kill this one
elif va00 gt 7
gsub detritus
endi
endi
endi
* set tick
tick rand 50 85
subr detritus
slow
targ ownr
setv va00 posl
setv va01 post
subv va01 10
new: simp 2 10 36463 "betaship_dead" 1 1 rand 1000 3000
mesg wrt+ targ 1000 va00 va01 0
targ ownr
attr 16
show 0
wait 20
kill ownr
retn
endm
rscr
enum 2 15 36463
kill targ
next