From: fgsfds Date: Sat, 4 May 2019 23:54:17 +0000 (+0300) Subject: spawners now count delay after their first spawn dies X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=ba8cb4548eeab44bfe9c6db0081de5a9ac9600dd;p=d2df-sdl.git spawners now count delay after their first spawn dies --- diff --git a/src/game/g_triggers.pas b/src/game/g_triggers.pas index af000f0..174b47e 100644 --- a/src/game/g_triggers.pas +++ b/src/game/g_triggers.pas @@ -1359,7 +1359,7 @@ begin begin MH_SEND_GameStats(); if p.FClientID >= 0 then - MH_SEND_GameEvent(NET_EV_SECRET, p.UID, '', p.FClientID); + MH_SEND_GameEvent(NET_EV_SECRET, p.UID, ''); end; end; end; @@ -1473,7 +1473,7 @@ begin for k := 1 to tgcMonsCount do begin if (actType = ACTIVATE_CUSTOM) and (tgcDelay > 0) then - SpawnCooldown := tgcDelay; + SpawnCooldown := -1; // Çàäåðæêà âûñòàâèòñÿ ìîíñòðîì ïðè óíè÷òîæåíèè if (tgcMax > 0) and (SpawnedCount >= tgcMax) then Break; @@ -1503,11 +1503,8 @@ begin gMonstersSpawned[High(gMonstersSpawned)] := mon.UID; end; - if tgcMax > 0 then - begin - mon.SpawnTrigger := ID; - Inc(SpawnedCount); - end; + mon.SpawnTrigger := ID; + if tgcMax > 0 then Inc(SpawnedCount); case tgcEffect of EFFECT_TELEPORT: begin @@ -1588,7 +1585,7 @@ begin for k := 1 to tgcItemCount do begin if (actType = ACTIVATE_CUSTOM) and (tgcDelay > 0) then - SpawnCooldown := tgcDelay; + SpawnCooldown := -1; // Çàäåðæêà âûñòàâèòñÿ èòåìîì ïðè óíè÷òîæåíèè if (tgcMax > 0) and (SpawnedCount >= tgcMax) then Break; @@ -1597,12 +1594,9 @@ begin Result := True; - if tgcMax > 0 then - begin - it := g_Items_ByIdx(iid); - it.SpawnTrigger := ID; - Inc(SpawnedCount); - end; + it := g_Items_ByIdx(iid); + it.SpawnTrigger := ID; + if tgcMax > 0 then Inc(SpawnedCount); case tgcEffect of EFFECT_TELEPORT: begin @@ -3074,11 +3068,20 @@ end; procedure g_Triggers_DecreaseSpawner(ID: DWORD); begin if (gTriggers <> nil) then - if gTriggers[ID].SpawnedCount > 0 then - Dec(gTriggers[ID].SpawnedCount); + begin + if gTriggers[ID].tgcMax > 0 then + begin + if gTriggers[ID].SpawnedCount > 0 then + Dec(gTriggers[ID].SpawnedCount); + end; + if gTriggers[ID].tgcDelay > 0 then + begin + if gTriggers[ID].SpawnCooldown < 0 then + gTriggers[ID].SpawnCooldown := gTriggers[ID].tgcDelay; + end; + end; end; - procedure g_Triggers_Free (); var a: Integer;