Morphan1_calico_DoorEvents:
type: world
debug: true
constants:
directions:
- 0,0,1
- 1,0,0
- 0,0,-1
- -1,0,0
- 0,0,-1
- -1,0,0
- 0,0,1
- 1,0,0
doorclosetimer:
- if %data% >= 4 && <def[loc].find.players.within[2]||li@> == li@ {
- switch %loc%
- - if <def[other]||false>
+ - if <def[other]||false> {
- switch %other%
}
- queue clear
}
else {
- wait 5s
- inject locally doorclosetimer
}
events:
on player right clicks block:
- if <context.location.material.name.contains[door]> {
- if <player.is_sneaking> && <context.item||i@air> != i@air {
- queue clear
}
- if <server.list_scripts> contains s@dRegions_CanUse_Block && !<proc[dRegions_CanUse_Block].context[<player>|<c.location>]||false> {
- queue clear
}
else {
- define loc <context.location.block>
- define data <def[loc].material.data>
- if %data% > 7 {
- define loc <context.location.block.sub[0,1,0]>
- define data <def[loc].material.data>
}
- define direction <script.constant[directions].get[<def[data].add[1]>]>
- define top_data <def[loc].add[0,1,0].material.data>
- define other <def[loc].add[%direction%]>
- define other_top <def[other].add[0,1,0].material.data>
- if <def[other].material.name.ends_with[door]> && <def[other].material.data> == %data% && %other_top% != %top_data% {
- switch %other%
- wait 5s
- inject locally path:doorclosetimer
}
- define other <def[loc].sub[%direction%]>
- define other_top <def[other].add[0,1,0].material.data>
- if <def[other].material.name.ends_with[door]> && <def[other].material.data> == %data% && %other_top% != %top_data% {
- switch %other%
- wait 5s
- inject locally path:doorclosetimer
}
else {
- wait 5s
- inject locally path:doorclosetimer
}
}
}
-