… | |
… | |
78 | system "cd \Q$PLAYERDIR\E " |
78 | system "cd \Q$PLAYERDIR\E " |
79 | . "&& mv \Q$user\E ~\Q$Coro::current\E~deleting~ 2>/dev/null " |
79 | . "&& mv \Q$user\E ~\Q$Coro::current\E~deleting~ 2>/dev/null " |
80 | . "&& (rm -rf ~\Q$Coro::current\E~deleting~ &)"; |
80 | . "&& (rm -rf ~\Q$Coro::current\E~deleting~ &)"; |
81 | } |
81 | } |
82 | |
82 | |
|
|
83 | sub send_capabilities { |
|
|
84 | my ($ns) = @_; |
|
|
85 | |
|
|
86 | return unless $ns->extcmd; |
|
|
87 | |
|
|
88 | $ns->ext_event (capabilities => |
|
|
89 | # id, name, flags (1 == 2d), edge length |
|
|
90 | tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32]], |
|
|
91 | ); |
|
|
92 | } |
|
|
93 | |
83 | sub setup { |
94 | sub setup { |
84 | my ($ns, $args) = @_; |
95 | my ($ns, $args) = @_; |
85 | |
96 | |
86 | # run through the cmds of setup |
97 | # run through the cmds of setup |
87 | # syntax is setup <cmdname1> <parameter> <cmdname2> <parameter> ... |
98 | # syntax is setup <cmdname1> <parameter> <cmdname2> <parameter> ... |
… | |
… | |
89 | # we send the status of the cmd back, or a FALSE is the cmd is the server unknown |
100 | # we send the status of the cmd back, or a FALSE is the cmd is the server unknown |
90 | # The client then must sort this out |
101 | # The client then must sort this out |
91 | |
102 | |
92 | my %setup = split / +/, $args; |
103 | my %setup = split / +/, $args; |
93 | while (my ($k, $v) = each %setup) { |
104 | while (my ($k, $v) = each %setup) { |
94 | |
|
|
95 | if ($k eq "sound") { |
105 | if ($k eq "sound") { |
96 | $ns->sound ($v); |
106 | $ns->sound ($v); |
97 | |
107 | |
98 | } elsif ($k eq "exp64") { |
108 | } elsif ($k eq "exp64") { |
99 | $setup{$k} = 1; |
109 | $setup{$k} = 1; |
… | |
… | |
121 | } elsif ($k eq "mapinfocmd") { |
131 | } elsif ($k eq "mapinfocmd") { |
122 | $ns->mapinfocmd ($v); |
132 | $ns->mapinfocmd ($v); |
123 | |
133 | |
124 | } elsif ($k eq "extcmd") { |
134 | } elsif ($k eq "extcmd") { |
125 | $ns->extcmd ($v > 0); |
135 | $ns->extcmd ($v > 0); |
|
|
136 | send_capabilities $ns; |
126 | |
137 | |
127 | } elsif ($k eq "extmap") { |
138 | } elsif ($k eq "extmap") { |
128 | $ns->extmap ($v); |
139 | $ns->extmap ($v); |
129 | |
140 | |
130 | } elsif ($k eq "facecache") { |
141 | } elsif ($k eq "facecache") { |
… | |
… | |
132 | |
143 | |
133 | } elsif ($k eq "faceset") { |
144 | } elsif ($k eq "faceset") { |
134 | $ns->faceset (0); |
145 | $ns->faceset (0); |
135 | $setup{$k} = 0; |
146 | $setup{$k} = 0; |
136 | # $ns->image2 (1) |
147 | # $ns->image2 (1) |
|
|
148 | |
|
|
149 | } elsif ($k eq "tileset") { |
|
|
150 | $setup{$k} = $ns->faceset ($v & 1); |
137 | |
151 | |
138 | } elsif ($k eq "itemcmd") { |
152 | } elsif ($k eq "itemcmd") { |
139 | # Version of the item protocol command to use. Currently, |
153 | # Version of the item protocol command to use. Currently, |
140 | # only supported versions are 1 and 2. Using a numeric |
154 | # only supported versions are 1 and 2. Using a numeric |
141 | # value will make it very easy to extend this in the future. |
155 | # value will make it very easy to extend this in the future. |
… | |
… | |
154 | } elsif ($k eq "extendedMapInfos") { |
168 | } elsif ($k eq "extendedMapInfos") { |
155 | $ns->ext_mapinfos ($v); |
169 | $ns->ext_mapinfos ($v); |
156 | |
170 | |
157 | } elsif ($k eq "extendedTextInfos") { |
171 | } elsif ($k eq "extendedTextInfos") { |
158 | $ns->has_readable_type ($v); |
172 | $ns->has_readable_type ($v); |
|
|
173 | |
|
|
174 | } elsif ($k eq "fxix") { |
|
|
175 | $ns->fxix ($v); |
159 | |
176 | |
160 | } else { |
177 | } else { |
161 | # other commands: |
178 | # other commands: |
162 | # sexp: no idea, probably for oudated servers |
179 | # sexp: no idea, probably for oudated servers |
163 | # tick: more stupidity, server should sned a tick per tick |
180 | # tick: more stupidity, server should sned a tick per tick |