12 |
|
|
13 |
function DefaultGame::startMatch(%game) |
function DefaultGame::startMatch(%game) |
14 |
{ |
{ |
15 |
|
if (ClientGroup.getCount() == 0) { |
16 |
|
$logpos_wait = true; |
17 |
|
} else { |
18 |
|
$logpos_wait = false; |
19 |
|
logpos_start(); |
20 |
|
} |
21 |
|
|
22 |
|
Parent::startMatch(%game); |
23 |
|
} |
24 |
|
|
25 |
|
|
26 |
|
function logpos_start() |
27 |
|
{ |
28 |
$logpos_flag_count = 0; |
$logpos_flag_count = 0; |
29 |
|
|
30 |
%file = "positiondata/" @ $missionSequence @ "_" @ $CurrentMissionType @ |
%file = "positiondata/" @ $missionSequence @ "_" @ $CurrentMissionType @ |
55 |
$logpos_vehicle_count = 0; |
$logpos_vehicle_count = 0; |
56 |
$logpos_gameover = false; |
$logpos_gameover = false; |
57 |
schedule(1000, 0, logpos_write_position_data); |
schedule(1000, 0, logpos_write_position_data); |
|
|
|
|
Parent::startMatch(%game); |
|
58 |
} |
} |
59 |
|
|
60 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
61 |
|
|
62 |
function DefaultGame::gameOver(%game) |
function DefaultGame::gameOver(%game) |
63 |
{ |
{ |
64 |
|
if ($logpos_wait) { |
65 |
|
Parent::gameOver(%game); |
66 |
|
return; |
67 |
|
} |
68 |
|
|
69 |
for (%ci = 0; %ci != ClientGroup.getCount(); %ci++) { |
for (%ci = 0; %ci != ClientGroup.getCount(); %ci++) { |
70 |
%client = ClientGroup.getObject(%ci); |
%client = ClientGroup.getObject(%ci); |
71 |
logpos_file.writeLine("L " @ %client SPC %client.score); |
logpos_file.writeLine("L " @ %client SPC %client.score); |
72 |
} |
} |
73 |
for (%team = 1; %team <= %game.numTeams; %team++) |
for (%team = 1; %team <= %game.numTeams; %team++) |
74 |
logpos_file.writeLine("Z " @ %team SPC $TeamScore[%team]); |
logpos_file.writeLine("Z " @ %team SPC $TeamScore[%team] SPC |
75 |
|
getTaggedString(%game.getTeamName(%team))); |
76 |
logpos_file.close(); |
logpos_file.close(); |
77 |
$logpos_gameover = true; |
$logpos_gameover = true; |
78 |
|
|
152 |
|
|
153 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
154 |
|
|
|
function serverCmdSuicide(%client) |
|
|
{ |
|
|
logpos_file.writeLine("serverCmdSuicide " @ %client); |
|
|
Parent::serverCmdSuicide(%client); |
|
|
} |
|
|
|
|
155 |
function vehicleListAdd(%blockName, %obj) |
function vehicleListAdd(%blockName, %obj) |
156 |
{ |
{ |
157 |
logpos_file.writeLine("V " @ %obj SPC %obj.team SPC %blockName); |
if (!$logpos_wait) |
158 |
|
logpos_file.writeLine("V " @ %obj SPC %obj.team SPC %blockName); |
159 |
$logpos_vehicle[$logpos_vehicle_count] = %obj; |
$logpos_vehicle[$logpos_vehicle_count] = %obj; |
160 |
$logpos_vehicle_count++; |
$logpos_vehicle_count++; |
161 |
Parent::vehicleListAdd(%blockName, %obj); |
Parent::vehicleListAdd(%blockName, %obj); |
163 |
|
|
164 |
function vehicleListRemove(%data, %obj) |
function vehicleListRemove(%data, %obj) |
165 |
{ |
{ |
166 |
logpos_file.writeLine("W " @ %obj); |
if (!$logpos_wait) |
167 |
|
logpos_file.writeLine("W " @ %obj); |
168 |
for (%i = 0; %i != $logpos_vehicle_count; %i++) |
for (%i = 0; %i != $logpos_vehicle_count; %i++) |
169 |
if ($logpos_vehicle[%i] == %obj) |
if ($logpos_vehicle[%i] == %obj) |
170 |
$logpos_vehicle[%i] = 0; |
$logpos_vehicle[%i] = 0; |
173 |
|
|
174 |
function DefaultGame::playerSpawned(%game, %player) |
function DefaultGame::playerSpawned(%game, %player) |
175 |
{ |
{ |
176 |
%name = stripChars(detag(getTaggedString(%player.client.name)), |
if ($logpos_wait) { |
177 |
"\cp\co\c6\c7\c8\c9"); |
$logpos_wait = false; |
178 |
logpos_file.writeLine("S " @ %player.client SPC %player.team SPC %name); |
logpos_start(); |
179 |
|
} else { |
180 |
|
%name = stripChars(detag(getTaggedString(%player.client.name)), |
181 |
|
"\cp\co\c6\c7\c8\c9"); |
182 |
|
logpos_file.writeLine("S " @ %player.client SPC %player.team SPC %name); |
183 |
|
} |
184 |
Parent::playerSpawned(%game, %player); |
Parent::playerSpawned(%game, %player); |
185 |
} |
} |
186 |
|
|
187 |
function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, |
function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, |
188 |
%implement, %damageLocation) |
%implement, %damageLocation) |
189 |
{ |
{ |
190 |
logpos_file.writeLine("K " @ %clVictim SPC %clKiller SPC %damageType); |
if (%damageType == $DamageType::Impact || |
191 |
|
(isObject(%implement) && (%implement.getClassName() $= "Turret" || |
192 |
|
%implement.getClassName() $= "VehicleTurret" || |
193 |
|
%implement.getClassName() $= "FlyingVehicle"))) |
194 |
|
if (%controller = %implement.getControllingClient()) |
195 |
|
%clKiller = %controller; |
196 |
|
if (!$logpos_wait) |
197 |
|
logpos_file.writeLine("K " @ %clVictim SPC %clKiller SPC %damageType); |
198 |
Parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, |
Parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, |
199 |
%implement, %damageLocation); |
%implement, %damageLocation); |
200 |
} |
} |
202 |
function DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, |
function DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, |
203 |
%damageType, %sourceObject) |
%damageType, %sourceObject) |
204 |
{ |
{ |
205 |
logpos_file.writeLine("D " @ %clVictim SPC %clAttacker SPC %damageType); |
if (!$logpos_wait) |
206 |
|
logpos_file.writeLine("D " @ %clVictim SPC %clAttacker SPC %damageType); |
207 |
Parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, |
Parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, |
208 |
%sourceObject); |
%sourceObject); |
209 |
} |
} |
210 |
|
|
211 |
function DefaultGame::onClientLeaveGame(%game, %client) |
function DefaultGame::onClientLeaveGame(%game, %client) |
212 |
{ |
{ |
213 |
logpos_file.writeLine("L " @ %client SPC %client.score); |
if (!$logpos_wait) |
214 |
|
logpos_file.writeLine("L " @ %client SPC %client.score); |
215 |
Parent::onClientLeaveGame(%game, %client); |
Parent::onClientLeaveGame(%game, %client); |
216 |
} |
} |
217 |
|
|
218 |
function Player::setArmor(%this, %size) |
function Player::setArmor(%this, %size) |
219 |
{ |
{ |
220 |
logpos_file.writeLine("A " @ %this.client SPC %size); |
if (!$logpos_wait) |
221 |
|
logpos_file.writeLine("A " @ %this.client SPC %size); |
222 |
Parent::setArmor(%this, %size); |
Parent::setArmor(%this, %size); |
223 |
} |
} |
224 |
|
|
225 |
function ShapeBase::setInventory(%this, %data, %value, %force) |
function ShapeBase::setInventory(%this, %data, %value, %force) |
226 |
{ |
{ |
227 |
logpos_file.writeLine("I " @ %this.client SPC %data.getName() SPC %value); |
if (!$logpos_wait) |
228 |
|
logpos_file.writeLine("I " @ %this.client SPC %data.getName() SPC %value); |
229 |
Parent::setInventory(%this, %data, %value, %force); |
Parent::setInventory(%this, %data, %value, %force); |
230 |
} |
} |
231 |
|
|
232 |
function AIDeployObject(%client, %object) |
function AIDeployObject(%client, %object) |
233 |
{ |
{ |
234 |
logpos_file.writeLine("O " @ %object SPC %client SPC |
if (!$logpos_wait) |
235 |
%object.getDataBlock().getName() SPC %object.position); |
logpos_file.writeLine("O " @ %object SPC %client SPC |
236 |
|
%object.getDataBlock().getName() SPC %object.position); |
237 |
Parent::AIDeployObject(%client, %object); |
Parent::AIDeployObject(%client, %object); |
238 |
} |
} |
239 |
|
|
240 |
function ShapeBaseData::onDestroyed(%data, %obj, %prevstate) |
function ShapeBaseData::onDestroyed(%data, %obj, %prevstate) |
241 |
{ |
{ |
242 |
logpos_file.writeLine("P " @ %obj SPC %obj.lastDamagedBy); |
if (!$logpos_wait) |
243 |
|
logpos_file.writeLine("P " @ %obj SPC %obj.lastDamagedBy); |
244 |
Parent::onDestroyed(%data, %obj, %prevstate); |
Parent::onDestroyed(%data, %obj, %prevstate); |
245 |
} |
} |
246 |
|
|
247 |
|
function CTFGame::flagCap(%game, %player) |
248 |
|
{ |
249 |
|
if (!$logpos_wait) |
250 |
|
logpos_file.writeLine("C " @ %player.holdingFlag.team SPC %player.client); |
251 |
|
Parent::flagCap(%game, %player); |
252 |
|
} |
253 |
|
|
254 |
|
function CTFGame::flagReturn(%game, %flag, %player) |
255 |
|
{ |
256 |
|
if (!$logpos_wait) |
257 |
|
logpos_file.writeLine("R " @ %flag.team SPC %player.client); |
258 |
|
Parent::flagReturn(%game, %flag, %player); |
259 |
|
} |
260 |
|
|
261 |
}; |
}; |
262 |
|
|
263 |
activatePackage(t2matchlog); |
activatePackage(t2matchlog); |