Function SuicideUntilSignal

Line
1846
Location
common.ai
Constant?
no
Type
function
Arguments
integer seconds, player p
Returns
nothing
1846
function SuicideUntilSignal takes integer seconds, player p returns nothing
1847
    local integer save
1848
    local integer wave_prep = PrepTime()
1849
1850
    loop
1851
        call AddSleepSeconds(seconds)
1852
        if sleep_seconds-wave_prep > 0 then
1853
            call SuicideSleep(sleep_seconds-wave_prep)
1854
        endif
1855
1856
        set save = campaign_wood_peons
1857
        set campaign_wood_peons = 0
1858
        loop
1859
            loop
1860
                call FormGroup(5, true)
1861
                exitwhen sleep_seconds <= 0
1862
                exitwhen CommandsWaiting() != 0
1863
            endloop
1864
            exitwhen SuicidePlayer(p,sleep_seconds >= -60)
1865
            exitwhen CommandsWaiting() != 0
1866
            call SuicideSleep(3)
1867
        endloop
1868
        set campaign_wood_peons = save
1869
1870
        loop
1871
            exitwhen CaptainIsEmpty()
1872
            exitwhen CommandsWaiting() != 0
1873
            call SuicideSleep(5)
1874
        endloop
1875
        exitwhen CommandsWaiting() != 0
1876
    endloop
1877
endfunction