2019-12-31 02:13:28 +00:00
|
|
|
// Orange State Block
|
|
|
|
function main() {
|
2020-12-30 04:31:35 +00:00
|
|
|
Self.SetHitbox(0, 0, 42, 42);
|
2019-12-31 02:13:28 +00:00
|
|
|
|
|
|
|
// Orange block is OFF by default.
|
2022-01-17 04:09:27 +00:00
|
|
|
let state = false;
|
2019-12-31 02:13:28 +00:00
|
|
|
|
2022-01-17 04:09:27 +00:00
|
|
|
Message.Subscribe("broadcast:state-change", (newState) => {
|
2019-12-31 02:13:28 +00:00
|
|
|
state = newState;
|
|
|
|
|
|
|
|
// Layer 0: OFF
|
|
|
|
// Layer 1: ON
|
2020-01-03 01:58:22 +00:00
|
|
|
Self.ShowLayer(state ? 1 : 0);
|
2019-12-31 02:13:28 +00:00
|
|
|
});
|
|
|
|
|
2022-01-17 04:09:27 +00:00
|
|
|
Events.OnCollide((e) => {
|
2019-12-31 02:13:28 +00:00
|
|
|
if (e.Actor.IsMobile() && e.InHitbox) {
|
|
|
|
if (state) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|