104 begin |
104 begin |
105 if (not isDeveloperMode) or (CurrentTeam = nil) then exit; |
105 if (not isDeveloperMode) or (CurrentTeam = nil) then exit; |
106 with CurrentTeam^ do |
106 with CurrentTeam^ do |
107 begin |
107 begin |
108 SplitBySpace(id, s); |
108 SplitBySpace(id, s); |
109 val(id, Hedgehogs[HedgehogsNumber].BotLevel); |
109 CurrentHedgehog:= @Hedgehogs[HedgehogsNumber]; |
|
110 val(id, CurrentHedgehog^.BotLevel); |
110 Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0); |
111 Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0); |
111 Gear^.Hedgehog:= @Hedgehogs[HedgehogsNumber]; |
|
112 val(s, Gear^.Health); |
112 val(s, Gear^.Health); |
113 TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true); |
113 TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true); |
114 PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam; |
114 PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam; |
115 Hedgehogs[HedgehogsNumber].AmmoStore:= TeamsCount - 1; |
115 Hedgehogs[HedgehogsNumber].AmmoStore:= TeamsCount - 1; |
116 Hedgehogs[HedgehogsNumber].Gear:= Gear; |
116 Hedgehogs[HedgehogsNumber].Gear:= Gear; |
139 procedure chLeft_p(var s: shortstring); |
139 procedure chLeft_p(var s: shortstring); |
140 begin |
140 begin |
141 if CheckNoTeamOrHH then exit; |
141 if CheckNoTeamOrHH then exit; |
142 bShowFinger:= false; |
142 bShowFinger:= false; |
143 if not CurrentTeam^.ExtDriven then SendIPC('L'); |
143 if not CurrentTeam^.ExtDriven then SendIPC('L'); |
144 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
144 with CurrentHedgehog^.Gear^ do |
145 Message:= Message or gm_Left |
145 Message:= Message or gm_Left |
146 end; |
146 end; |
147 |
147 |
148 procedure chLeft_m(var s: shortstring); |
148 procedure chLeft_m(var s: shortstring); |
149 begin |
149 begin |
150 if CheckNoTeamOrHH then exit; |
150 if CheckNoTeamOrHH then exit; |
151 if not CurrentTeam^.ExtDriven then SendIPC('l'); |
151 if not CurrentTeam^.ExtDriven then SendIPC('l'); |
152 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
152 with CurrentHedgehog^.Gear^ do |
153 Message:= Message and not gm_Left |
153 Message:= Message and not gm_Left |
154 end; |
154 end; |
155 |
155 |
156 procedure chRight_p(var s: shortstring); |
156 procedure chRight_p(var s: shortstring); |
157 begin |
157 begin |
158 if CheckNoTeamOrHH then exit; |
158 if CheckNoTeamOrHH then exit; |
159 bShowFinger:= false; |
159 bShowFinger:= false; |
160 if not CurrentTeam^.ExtDriven then SendIPC('R'); |
160 if not CurrentTeam^.ExtDriven then SendIPC('R'); |
161 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
161 with CurrentHedgehog^.Gear^ do |
162 Message:= Message or gm_Right |
162 Message:= Message or gm_Right |
163 end; |
163 end; |
164 |
164 |
165 procedure chRight_m(var s: shortstring); |
165 procedure chRight_m(var s: shortstring); |
166 begin |
166 begin |
167 if CheckNoTeamOrHH then exit; |
167 if CheckNoTeamOrHH then exit; |
168 if not CurrentTeam^.ExtDriven then SendIPC('r'); |
168 if not CurrentTeam^.ExtDriven then SendIPC('r'); |
169 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
169 with CurrentHedgehog^.Gear^ do |
170 Message:= Message and not gm_Right |
170 Message:= Message and not gm_Right |
171 end; |
171 end; |
172 |
172 |
173 procedure chUp_p(var s: shortstring); |
173 procedure chUp_p(var s: shortstring); |
174 begin |
174 begin |
175 if CheckNoTeamOrHH then exit; |
175 if CheckNoTeamOrHH then exit; |
176 bShowFinger:= false; |
176 bShowFinger:= false; |
177 if not CurrentTeam^.ExtDriven then SendIPC('U'); |
177 if not CurrentTeam^.ExtDriven then SendIPC('U'); |
178 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
178 with CurrentHedgehog^.Gear^ do |
179 Message:= Message or gm_Up |
179 Message:= Message or gm_Up |
180 end; |
180 end; |
181 |
181 |
182 procedure chUp_m(var s: shortstring); |
182 procedure chUp_m(var s: shortstring); |
183 begin |
183 begin |
184 if CheckNoTeamOrHH then exit; |
184 if CheckNoTeamOrHH then exit; |
185 if not CurrentTeam^.ExtDriven then SendIPC('u'); |
185 if not CurrentTeam^.ExtDriven then SendIPC('u'); |
186 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
186 with CurrentHedgehog^.Gear^ do |
187 Message:= Message and not gm_Up |
187 Message:= Message and not gm_Up |
188 end; |
188 end; |
189 |
189 |
190 procedure chDown_p(var s: shortstring); |
190 procedure chDown_p(var s: shortstring); |
191 begin |
191 begin |
192 if CheckNoTeamOrHH then exit; |
192 if CheckNoTeamOrHH then exit; |
193 bShowFinger:= false; |
193 bShowFinger:= false; |
194 if not CurrentTeam^.ExtDriven then SendIPC('D'); |
194 if not CurrentTeam^.ExtDriven then SendIPC('D'); |
195 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
195 with CurrentHedgehog^.Gear^ do |
196 Message:= Message or gm_Down |
196 Message:= Message or gm_Down |
197 end; |
197 end; |
198 |
198 |
199 procedure chDown_m(var s: shortstring); |
199 procedure chDown_m(var s: shortstring); |
200 begin |
200 begin |
201 if CheckNoTeamOrHH then exit; |
201 if CheckNoTeamOrHH then exit; |
202 if not CurrentTeam^.ExtDriven then SendIPC('d'); |
202 if not CurrentTeam^.ExtDriven then SendIPC('d'); |
203 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
203 with CurrentHedgehog^.Gear^ do |
204 Message:= Message and not gm_Down |
204 Message:= Message and not gm_Down |
205 end; |
205 end; |
206 |
206 |
207 procedure chLJump(var s: shortstring); |
207 procedure chLJump(var s: shortstring); |
208 begin |
208 begin |
209 if CheckNoTeamOrHH then exit; |
209 if CheckNoTeamOrHH then exit; |
210 bShowFinger:= false; |
210 bShowFinger:= false; |
211 if not CurrentTeam^.ExtDriven then SendIPC('j'); |
211 if not CurrentTeam^.ExtDriven then SendIPC('j'); |
212 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
212 with CurrentHedgehog^.Gear^ do |
213 Message:= Message or gm_LJump |
213 Message:= Message or gm_LJump |
214 end; |
214 end; |
215 |
215 |
216 procedure chHJump(var s: shortstring); |
216 procedure chHJump(var s: shortstring); |
217 begin |
217 begin |
218 if CheckNoTeamOrHH then exit; |
218 if CheckNoTeamOrHH then exit; |
219 bShowFinger:= false; |
219 bShowFinger:= false; |
220 if not CurrentTeam^.ExtDriven then SendIPC('J'); |
220 if not CurrentTeam^.ExtDriven then SendIPC('J'); |
221 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
221 with CurrentHedgehog^.Gear^ do |
222 Message:= Message or gm_HJump |
222 Message:= Message or gm_HJump |
223 end; |
223 end; |
224 |
224 |
225 procedure chAttack_p(var s: shortstring); |
225 procedure chAttack_p(var s: shortstring); |
226 begin |
226 begin |
227 if CheckNoTeamOrHH then exit; |
227 if CheckNoTeamOrHH then exit; |
228 bShowFinger:= false; |
228 bShowFinger:= false; |
229 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
229 with CurrentHedgehog^.Gear^ do |
230 begin |
230 begin |
231 {$IFDEF DEBUGFILE}AddFileLog('/+attack: Gear^.State = '+inttostr(State));{$ENDIF} |
231 {$IFDEF DEBUGFILE}AddFileLog('/+attack: Gear^.State = '+inttostr(State));{$ENDIF} |
232 if ((State and gstHHDriven) <> 0) and |
232 if ((State and gstHHDriven) <> 0) and |
233 ((State and (gstAttacked or gstHHChooseTarget)) = 0) then |
233 ((State and (gstAttacked or gstHHChooseTarget)) = 0) then |
234 begin |
234 begin |
235 FollowGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear; |
235 FollowGear:= CurrentHedgehog^.Gear; |
236 if not CurrentTeam^.ExtDriven then SendIPC('A'); |
236 if not CurrentTeam^.ExtDriven then SendIPC('A'); |
237 Message:= Message or gm_Attack |
237 Message:= Message or gm_Attack |
238 end |
238 end |
239 end |
239 end |
240 end; |
240 end; |
241 |
241 |
242 procedure chAttack_m(var s: shortstring); |
242 procedure chAttack_m(var s: shortstring); |
243 begin |
243 begin |
244 if CheckNoTeamOrHH then exit; |
244 if CheckNoTeamOrHH then exit; |
245 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^ do |
245 with CurrentHedgehog^.Gear^ do |
246 begin |
246 begin |
247 if not CurrentTeam^.ExtDriven and |
247 if not CurrentTeam^.ExtDriven and |
248 ((Message and gm_Attack) <> 0) then SendIPC('a'); |
248 ((Message and gm_Attack) <> 0) then SendIPC('a'); |
249 Message:= Message and not gm_Attack |
249 Message:= Message and not gm_Attack |
250 end |
250 end |