… | |
… | |
9 | |
9 | |
10 | return unless $ns->extcmd; |
10 | return unless $ns->extcmd; |
11 | |
11 | |
12 | $ns->ext_msg (capabilities => |
12 | $ns->ext_msg (capabilities => |
13 | # id, name, flags (1 == 2d), edge length |
13 | # id, name, flags (1 == 2d), edge length |
14 | tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32]], |
14 | tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32], [2, "default text faceset", 2, 1]], |
15 | ); |
15 | ); |
16 | } |
16 | } |
17 | |
17 | |
18 | cf::client->attach (on_setup => sub { |
18 | cf::client->attach (on_setup => sub { |
19 | my ($ns, $args) = @_; |
19 | my ($ns, $args) = @_; |
… | |
… | |
53 | } elsif ($k eq "extcmd") { |
53 | } elsif ($k eq "extcmd") { |
54 | $ns->extcmd (min 2, $v); |
54 | $ns->extcmd (min 2, $v); |
55 | send_capabilities $ns; |
55 | send_capabilities $ns; |
56 | |
56 | |
57 | } elsif ($k eq "extmap") { |
57 | } elsif ($k eq "extmap") { |
58 | $ns->extmap ($v); |
58 | $setup{$k} = 1; |
59 | |
59 | |
60 | } elsif ($k eq "facecache") { |
60 | } elsif ($k eq "facecache") { |
61 | $setup{$k} = 1; |
61 | $setup{$k} = 1; |
62 | |
62 | |
63 | } elsif ($k eq "faceset") { |
63 | } elsif ($k eq "faceset") { |
64 | $ns->faceset (0); |
64 | $ns->faceset (0); |
65 | $setup{$k} = 0; |
65 | $setup{$k} = 0; |
66 | # $ns->image2 (1) |
66 | # $ns->image2 (1) |
67 | |
67 | |
68 | } elsif ($k eq "tileset") { |
68 | } elsif ($k eq "tileset") { |
69 | $setup{$k} = $ns->faceset ($v & 1); |
69 | $setup{$k} = $ns->faceset (int cf::clamp $v, 0, 2); |
70 | |
70 | |
71 | } elsif ($k eq "itemcmd") { |
71 | } elsif ($k eq "itemcmd") { |
72 | # Version of the item protocol command to use. Currently, |
72 | # Version of the item protocol command to use. Currently, |
73 | # only supported versions are 1 and 2. Using a numeric |
73 | # only supported versions are 1 and 2. Using a numeric |
74 | # value will make it very easy to extend this in the future. |
74 | # value will make it very easy to extend this in the future. |
… | |
… | |
94 | |
94 | |
95 | } elsif ($k eq "fxix") { |
95 | } elsif ($k eq "fxix") { |
96 | $setup{$k} = 3; |
96 | $setup{$k} = 3; |
97 | |
97 | |
98 | } elsif ($k eq "msg") { |
98 | } elsif ($k eq "msg") { |
99 | $ns->can_msg ($setup{$k} = min 2, $v); |
99 | $setup{$k} = 1; |
100 | |
100 | |
101 | } elsif ($k eq "widget") { |
101 | } elsif ($k eq "widget") { |
102 | # server-side widgets |
102 | # server-side widgets |
103 | $v = $v > 1; |
103 | $v = $v > 1; |
104 | $ns->{can_widget} = $v; |
104 | $ns->{can_widget} = $v; |
… | |
… | |
129 | $ns->send_packet (join " ", setup => %setup); |
129 | $ns->send_packet (join " ", setup => %setup); |
130 | |
130 | |
131 | cf::datalog setup => |
131 | cf::datalog setup => |
132 | request => $args, |
132 | request => $args, |
133 | reply => \%setup, |
133 | reply => \%setup, |
134 | client => $ns->version, |
|
|
135 | ; |
134 | ; |
136 | }); |
135 | }); |
137 | |
136 | |
138 | |
|
|