mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +00:00
feat: extended blocks rotation
This commit is contained in:
parent
65a2a3e475
commit
90ed175915
8 changed files with 109 additions and 13 deletions
|
|
@ -11,7 +11,7 @@
|
|||
"light-passing": true,
|
||||
"sky-light-passing": true,
|
||||
"size": [1, 2, 1],
|
||||
"rotation": "pipe",
|
||||
"rotation": "pane",
|
||||
"model": "aabb",
|
||||
"hitbox": [0.0, 0.0, 0.8, 1.0, 2.0, 0.2]
|
||||
"hitbox": [0.0, 0.0, 0.0, 1.0, 2.0, 0.2]
|
||||
}
|
||||
|
|
|
|||
6
res/content/base/preload.json
Normal file
6
res/content/base/preload.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"sounds": [
|
||||
"blocks/door_open",
|
||||
"blocks/door_close"
|
||||
]
|
||||
}
|
||||
13
res/content/base/scripts/door.lua
Normal file
13
res/content/base/scripts/door.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function on_interact(x, y, z)
|
||||
local inc = 1
|
||||
if block.get_user_bits(x, y, z, 0, 1) > 0 then
|
||||
inc = 3
|
||||
block.set_user_bits(x, y, z, 0, 1, 0)
|
||||
audio.play_sound("blocks/door_close", x+0.5, y+1, z+0.5, 1, 1)
|
||||
else
|
||||
block.set_user_bits(x, y, z, 0, 1, 1)
|
||||
audio.play_sound("blocks/door_open", x+0.5, y+1, z+0.5, 1, 1)
|
||||
end
|
||||
block.set_rotation(x, y, z, (block.get_rotation(x, y, z) + inc) % 4)
|
||||
return true
|
||||
end
|
||||
BIN
res/content/base/sounds/blocks/door_close.ogg
Normal file
BIN
res/content/base/sounds/blocks/door_close.ogg
Normal file
Binary file not shown.
BIN
res/content/base/sounds/blocks/door_open.ogg
Normal file
BIN
res/content/base/sounds/blocks/door_open.ogg
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue