@name Anti-Hippie
@inputs Ranger
@persist State Origin
@trigger all

if (first()) {
    State=2
    Origin=Ranger
    printColor(vec(0,255,255),"[AntiHippie] ",vec(255),"Default door position set to ",vec(0,255,0),Origin)
    timer("d",1500)
}

if (State==0 & changed(Ranger) & Ranger!=Origin) {
    State=1
    soundPlay(0,0,"mvm/mvm_bomb_warning.wav")
    concmd("say /r Raid in progress!")
    printColor(vec(0,255,255),"[AntiHippie] ",vec(255,0,0),"The door has been cracked!")
    timer("d",1500)
}

runOnChat(1)
if (lastSaid():lower()=="-open" & State==0) {
    State=2
    timer("d",1500)
}

if (clk("d")) {
    if (Origin==Ranger) {
        State=0
    } else {timer("d",1000)}
}
