final cleanup for bot survival (I hope)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6524 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -33,6 +33,7 @@ on_quit_aliases = [
|
||||
tmp_numargs
|
||||
tmp_numbots
|
||||
tmp_old_sets
|
||||
tmp_sum
|
||||
tmp_svol
|
||||
tmp_tutsets
|
||||
tmp_wc
|
||||
|
||||
+12
-17
@@ -30,15 +30,15 @@ survival = [
|
||||
tmpSurvSets = $survNumBots; curSurvDifficulty = 0; survLastKill = ""; survTimeBetKills = ""; resetSurvAliases
|
||||
if (! (checkalias onKill)) [ onKill = "" ]
|
||||
if (! (strstr $onKill survKills)) [
|
||||
add2alias onKill [
|
||||
if $startedSurvival [
|
||||
if (&& (= $arg1 (findcn $curname)) (!= $arg1 $arg2)) [
|
||||
+= survKills 1
|
||||
if (! (listlen $survTimeBetKills)) [
|
||||
survTimeBetKills = (- (millis) $startSurvMillis)
|
||||
] [ add2list survTimeBetKills (- (millis) $survLastKill) ]
|
||||
survLastKill = (millis)
|
||||
] [ if (= $arg2 (findcn $curname)) [ add2list tmpSurvSets (concat $arg1 $arg2 $arg3 $arg4 (findpn $arg1)) ] ]
|
||||
add2alias onKill [ // Use onKill for enemies killed counter and other stats
|
||||
if $startedSurvival [ //
|
||||
if (&& (= $arg1 (findcn $curname)) (!= $arg1 $arg2)) [ // Player1 was actor and was not suicide
|
||||
+= survKills 1 // Increment enemies killed counter
|
||||
if (! (listlen $survTimeBetKills)) [ // First kill
|
||||
survTimeBetKills = (- (millis) $startSurvMillis) //
|
||||
] [ add2list survTimeBetKills (- (millis) $survLastKill) ] // Other kills
|
||||
survLastKill = (millis) // Update last kill
|
||||
] [ if (= $arg2 (findcn $curname)) [ add2list tmpSurvSets (concat $arg1 $arg2 $arg3 $arg4 (findpn $arg1)) ] ] // Player1 was target, pass arguments/data along for use in the after game results/stats messages.
|
||||
]
|
||||
]
|
||||
]
|
||||
@@ -96,20 +96,15 @@ survOfcZones = [
|
||||
|
||||
setOfcZones = [
|
||||
survMapIndex = (findlist $survOfcZones (curmap 1))
|
||||
if (>= $survMapIndex 0) [
|
||||
tmpSurvZone = ""; tmpSurvCtr = 0
|
||||
loop soz 4 [ += tmpSurvCtr 1; add2list tmpSurvZone (at $survOfcZones (+ $survMapIndex $tmpSurvCtr)) ]
|
||||
setzone $tmpSurvZone
|
||||
]
|
||||
if $survMapIndex [ tmpSurvZone = ""; loop soz 4 [ add2list tmpSurvZone (at $survOfcZones (+ $survMapIndex (+ $soz 1))) ]; setzone $tmpSurvZone ]
|
||||
]
|
||||
|
||||
findCenter = [
|
||||
midZoneX = (+f (divf (-f (at $tmpSurvZone 1) (at $tmpSurvZone 0)) 2) (at $tmpSurvZone 0))
|
||||
midZoneY = (+f (divf (-f (at $tmpSurvZone 3) (at $tmpSurvZone 2)) 2) (at $tmpSurvZone 2))
|
||||
tmpZoneCenter = (concat $midZoneX $midZoneY)
|
||||
]
|
||||
|
||||
teleportPlayer = [ if (! (alive)) [ attack ]; if (!= $gamespeed 100) [ gamespeed 100 ]; survTeleported = 1; findCenter; if (! $editing) [ edittoggle ]; go_to (at $tmpZoneCenter 0) (at $tmpZoneCenter 1); sleep 25 [ edittoggle ] ]
|
||||
teleportPlayer = [ if (! (alive)) [ attack ]; if (!= $gamespeed 100) [ gamespeed 100 ]; survTeleported = 1; findCenter; if (! $editing) [ edittoggle ]; go_to $midZoneX $midZoneY; sleep 25 [ edittoggle ] ]
|
||||
|
||||
isInZone = [ if (&& (checkrange (player1 x) (at $zone 0) (at $zone 1)) (checkrange (player1 y) (at $zone 2) (at $zone 3))) [ result 1 ] [ result 0 ] ]
|
||||
|
||||
@@ -156,6 +151,6 @@ endSurvival = [
|
||||
]
|
||||
|
||||
// List of aliases that need to be cleared from saved.cfg on quit:
|
||||
survAliases = (concat $survResetAliases "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis genSurvDifStr increaseDifficulty isInZone midZoneX midZoneY onKill resetSurvAliases setOfcZones setzone startOBCount startOBMillis startSurvival survLastKill survMapIndex survOfcZones survTimeBetKills tmpSCtr tmpstrlist tmpSurvCtr tmpSurvInt tmpSurvSets tmp_sum tmp_survstr tmpSurvZone tmpZoneCenter zone aliasinit survResetAliases survAliases")
|
||||
survAliases = (concat $survResetAliases "resetSurvAliases genSurvDifStr survival tmpSurvSets curSurvDifficulty survLastKill survTimeBetKills startPreSurvMillis startSurvival startedSurvival setzone survOfcZones setOfcZones survMapIndex tmpSurvZone findCenter midZoneX midZoneY teleportPlayer survTeleported isInZone checkzone startOBCount startedOBCount startOBMillis backInZone tmpSCtr increaseDifficulty lastCheckPoint tmpSurvInt endSurvival tmp_survstr survIsFinished tmpstrlist finalSurvMillis zone survSetsList survDifList survSetDif survResetAliases survAliases")
|
||||
|
||||
addListOnQuit $survAliases
|
||||
Reference in New Issue
Block a user