-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.f
More file actions
73 lines (57 loc) · 1.55 KB
/
script.f
File metadata and controls
73 lines (57 loc) · 1.55 KB
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
256 constant max-prefabs
/OBJECT
getset objtype objtype!
to /OBJECT
/objslot 128 - constant /userfields
max-prefabs /objslot array prefab
max-prefabs 1024 array sdata \ static data such as actions
: lastword last @ ctrl>nfa count ;
: prefab: ( n - <name> ) ( - n )
dup constant dup prefab [[
dup >r lastword r> sdata place
dup objtype!
16 * s>f fdup xy! \ default positioning; can be changed using the prefabs.iol file
true en!
;
: ;prefab ]] ;
: ext: /userfields ;
: ;ext ;
32 \ name (1+31)
value /sdata
: (method!) create /sdata , does> @ objtype sdata + ! ;
: (method) create /sdata , does> @ objtype sdata + @ execute ;
: method (method) (method!) cell +to /sdata ;
: :: ( prefab - <name> )
prefab [[ :noname ' >body @ objtype sdata + ! ]] ;
method start start!
method think think!
: become ( n ) >r
x y
r> prefab me /objslot move
y! x! ;
: script ( n - <name> )
dup prefab 's en abort" Prefab # already taken"
false to warnings?
include
true to warnings?
;
create temp$ 256 allot
: hone ( - <name> ) me >r
false to warnings?
>in @ ' >body @ swap >in !
s" scripts/" temp$ place bl parse temp$ append temp$ count GetPathSpec included
true to warnings?
r> as
;
: load-prefabs
z" prefabs.iol" ?dup if ?exist if
r/o[ 0 prefab [ lenof prefab /objslot * ]# read ]file
then then
s" scripts.f" included
;
: like: ( - <name> )
objtype >r
' >body @ dup become
r> objtype!
( old ) sdata 32 + objtype sdata 32 + /sdata 32 - move ( preserve name )
;