@name Diabolical Lock
@inputs CurLength
@outputs Length FreezeDoor Freezebase
@persist Pl:array ToolSet:string
@trigger 
@model models/expression 2/cpu_interface_nano.mdl
interval(findUpdateRate())
findInSphere(entity():pos(),500)
findIncludeClass("player")
findSortByDistance(entity():pos())
Pl=findToArray()
Open=127
Tool=Pl[1,entity]:tool()
if(first()){
    ToolSet="wire_expression2"
}
Tool1=owner():tool()
runOnChat(1)
if(chatClk()&owner():lastSaid()=="!lock set"){
    ToolSet=Tool1
    print("Lock opens with: '"+ToolSet+ "' now.")
}
if(Tool==ToolSet){Length=0}else{Length=Open}
if((round(CurLength)==Open)&(Length==Open)){FreezeDoor=1}else{FreezeDoor=0}
if(!entity():isConstrainedTo():isPlayerHolding()){Freezebase=1}else{Freezebase=FreezeDoor=0}
