Note Blocks and Delayers have been added!
This commit is contained in:
parent
b8150d6961
commit
4d230c7e8b
@ -18,9 +18,11 @@ Notable Game Changes:
|
||||
- Improved command system and added Command Blocks
|
||||
- Added many new commands, while also improving some builtin Luanti ones.
|
||||
- Redesign the electricity system using a system similar to [Age of Mending's](https://content.luanti.org/packages/Sumianvoice/pmb_core/) wiring system
|
||||
- New electricity devices:
|
||||
- New electricity devices and components:
|
||||
- Dropper
|
||||
- Dispenser
|
||||
- Note Block
|
||||
- Delayer
|
||||
|
||||
Other Game Changes:
|
||||
|
||||
@ -57,6 +59,7 @@ Other Game Changes:
|
||||
- Mushroom biomes are now marked as lowlands, only going up to Y 10
|
||||
- Superslime now bounces the player slightly higher
|
||||
- Add back the Rubies that were removed a while ago!
|
||||
- New Heater Device recipe
|
||||
|
||||
Code Changes:
|
||||
|
||||
|
@ -6,7 +6,11 @@ Programming done by me.
|
||||
|
||||
## Sounds
|
||||
|
||||
Sounds generated with [JFXR](https://jfxr.frozenfractal.com)
|
||||
Most sounds are generated with [JFXR](https://jfxr.frozenfractal.com)
|
||||
|
||||
Credit for sounds I didn't make and are not made with JFXR:
|
||||
|
||||
- Piano F#.wav by pinkyfinger -- https://freesound.org/s/68445/ -- License: Creative Commons 0
|
||||
|
||||
## Textures
|
||||
|
||||
|
4
TODO.md
4
TODO.md
@ -9,7 +9,3 @@ Those transports include:
|
||||
- Boats
|
||||
- Horses
|
||||
- Railways and Minecarts
|
||||
|
||||
## Electricity Update Pt. 2
|
||||
|
||||
Self-explanatory, this update would improve the electricity system. Currently it is badly made and even has the ability to freeze the entire server, or if in a singleplayer world your entire desktop.
|
||||
|
BIN
mods/CORE/pyutest/sounds/pyutest-note.ogg
Normal file
BIN
mods/CORE/pyutest/sounds/pyutest-note.ogg
Normal file
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
PyuTest.electricity_activate = function(pos, sender_pos)
|
||||
PyuTest.electricity_activate = function(pos, sender_pos, sender)
|
||||
local node = core.get_node(pos)
|
||||
local def = core.registered_nodes[node.name]
|
||||
|
||||
if def.__on_electricity_input then
|
||||
def.__on_electricity_input(pos, node, sender_pos)
|
||||
def.__on_electricity_input(pos, node, sender_pos, sender)
|
||||
end
|
||||
end
|
||||
|
||||
@ -15,14 +15,14 @@ end
|
||||
PyuTest.component_action = function (pos, interacter)
|
||||
core.sound_play("button", {
|
||||
pos = pos,
|
||||
gain = 1
|
||||
gain = 0.35
|
||||
})
|
||||
|
||||
local p = PyuTest.get_node_electricity_targets(pos)
|
||||
|
||||
if p then
|
||||
for _, pp in pairs(p) do
|
||||
PyuTest.electricity_activate(pp, pos)
|
||||
PyuTest.electricity_activate(pp, pos, interacter)
|
||||
end
|
||||
else
|
||||
core.chat_send_player(interacter:get_player_name(), "This component isn't bound to anything!")
|
||||
|
53
mods/ITEMS/pyutest_electricity/components/delayer.lua
Normal file
53
mods/ITEMS/pyutest_electricity/components/delayer.lua
Normal file
@ -0,0 +1,53 @@
|
||||
local DELAYS = {
|
||||
0.2,
|
||||
0.4,
|
||||
0.6,
|
||||
0.8,
|
||||
1.0
|
||||
}
|
||||
|
||||
local DELAY_POSITION_KEY = "delay"
|
||||
|
||||
local function after_place_node(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_int(DELAY_POSITION_KEY, 1)
|
||||
|
||||
PyuTest.component_after_place_node(pos)
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
local meta = core.get_meta(pos)
|
||||
local dpos = meta:get_int(DELAY_POSITION_KEY)
|
||||
|
||||
if dpos == #DELAYS then
|
||||
meta:set_int(DELAY_POSITION_KEY, 1)
|
||||
else
|
||||
meta:set_int(DELAY_POSITION_KEY, dpos + 1)
|
||||
end
|
||||
|
||||
local seconds = DELAYS[meta:get_int(DELAY_POSITION_KEY)]
|
||||
core.chat_send_player(clicker:get_player_name(), string.format("Delay set to %f seconds", seconds))
|
||||
end
|
||||
|
||||
PyuTest.make_electricity_device("pyutest_electricity:delayer", "Delayer", {
|
||||
cracky = PyuTest.BLOCK_NORMAL
|
||||
}, {"pyutest-delayer.png"}, nil, {
|
||||
after_place_node = after_place_node,
|
||||
on_rightclick = on_rightclick
|
||||
}, function (pos, node, sender_pos, sender)
|
||||
local meta = core.get_meta(pos)
|
||||
local seconds = DELAYS[meta:get_int(DELAY_POSITION_KEY)]
|
||||
|
||||
core.after(seconds, function ()
|
||||
PyuTest.component_action(pos, sender)
|
||||
end)
|
||||
end)
|
||||
|
||||
core.register_craft({
|
||||
output = "pyutest_electricity:button",
|
||||
recipe = {
|
||||
{ "group:cobble", "group:cobble", "group:cobble" },
|
||||
{ "group:cobble", "pyutest_ores:zinc_ingot", "group:cobble" },
|
||||
{ "group:cobble", "group:cobble", "group:cobble" }
|
||||
},
|
||||
})
|
@ -17,7 +17,7 @@ end)
|
||||
|
||||
PyuTest.make_electricity_device("pyutest_electricity:heater_device", "Heater Device", {
|
||||
cracky = PyuTest.BLOCK_FAST
|
||||
}, { "pyutest-heater.png" }, "pyutest_blocks:fire", nil, function(pos, node, sender_pos)
|
||||
}, { "pyutest-heater.png" }, "pyutest_blocks:magma", nil, function(pos, node, sender_pos)
|
||||
PyuTest.dorange(pos, 2, function(p)
|
||||
local n = core.get_node(p)
|
||||
|
||||
|
78
mods/ITEMS/pyutest_electricity/devices/noteblock.lua
Normal file
78
mods/ITEMS/pyutest_electricity/devices/noteblock.lua
Normal file
@ -0,0 +1,78 @@
|
||||
-- Thanks Minecraft wiki! https://minecraft.wiki/w/Note_Block
|
||||
local NOTES = {
|
||||
{2^(-12/12), "#77D700"},
|
||||
{2^(-11/12), "#95C000"},
|
||||
{2^(-10/12), "#B2A500"},
|
||||
{2^(-9/12), "#CC8600"},
|
||||
{2^(-8/12), "#E26500"},
|
||||
{2^(-7/12), "#F34100"},
|
||||
{2^(-6/12), "#FC1E00"},
|
||||
{2^(-5/12), "#FE000F"},
|
||||
{2^(-4/12), "#F70033"},
|
||||
{2^(-3/12), "#E8005A"},
|
||||
{2^(-2/12), "#CF0083"},
|
||||
{2^(-1/12), "#AE00A9"},
|
||||
{2^(0/12), "#8600CC"},
|
||||
{2^(1/12), "#5B00E7"},
|
||||
{2^(2/12), "#2D00F9"},
|
||||
{2^(3/12), "#020AFE"},
|
||||
{2^(4/12), "#0037F6"},
|
||||
{2^(5/12), "#0068E0"},
|
||||
{2^(6/12), "#009ABC"},
|
||||
{2^(7/12), "#00C68D"},
|
||||
{2^(8/12), "#00E958"},
|
||||
{2^(9/12), "#00FC21"},
|
||||
{2^(10/12), "#1FFC00"},
|
||||
{2^(11/12), "#59E800"},
|
||||
{2^(12/12), "#94C100"},
|
||||
}
|
||||
|
||||
local NOTE_POSITION_KEY = "pitch_position"
|
||||
|
||||
local function after_place_node(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
|
||||
meta:set_int(NOTE_POSITION_KEY, #NOTES)
|
||||
end
|
||||
|
||||
local function play_sound(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
local opts = NOTES[meta:get_int(NOTE_POSITION_KEY)]
|
||||
local pitch = opts[1]
|
||||
|
||||
core.sound_play("pyutest-note", {
|
||||
pos = pos,
|
||||
gain = 0.5,
|
||||
pitch = pitch
|
||||
})
|
||||
|
||||
math.randomseed(os.time())
|
||||
core.add_particle({
|
||||
texture = "pyutest-note.png^[multiply:"..opts[2],
|
||||
pos = pos + vector.new(0, 1, 0),
|
||||
velocity = vector.new(0, 0.45, 0),
|
||||
expirationtime = 1,
|
||||
size = 2,
|
||||
vertical = true,
|
||||
})
|
||||
end
|
||||
|
||||
PyuTest.make_electricity_device("pyutest_electricity:note_block", "Note Block", {
|
||||
choppy = PyuTest.BLOCK_FAST
|
||||
}, {"pyutest-note-block.png"}, nil, {
|
||||
after_place_node = after_place_node,
|
||||
on_rightclick = function (pos, node, clicker)
|
||||
local meta = core.get_meta(pos)
|
||||
local ppos = meta:get_int(NOTE_POSITION_KEY)
|
||||
|
||||
if ppos == #NOTES then
|
||||
meta:set_int(NOTE_POSITION_KEY, 1)
|
||||
else
|
||||
meta:set_int(NOTE_POSITION_KEY, ppos + 1)
|
||||
end
|
||||
|
||||
play_sound(pos)
|
||||
end
|
||||
}, function (pos, node, sender_pos)
|
||||
play_sound(pos)
|
||||
end)
|
@ -2,8 +2,12 @@ local modpath = core.get_modpath("pyutest_electricity")
|
||||
|
||||
dofile(modpath .. "/wirecutter.lua")
|
||||
dofile(modpath .. "/api.lua")
|
||||
|
||||
dofile(modpath .. "/components.lua")
|
||||
dofile(modpath .. "/components/delayer.lua")
|
||||
|
||||
dofile(modpath .. "/devices.lua")
|
||||
dofile(modpath .. "/devices/lamp.lua")
|
||||
dofile(modpath .. "/devices/dropper.lua")
|
||||
dofile(modpath .. "/devices/noteblock.lua")
|
||||
dofile(modpath .. "/devices/command_block.lua")
|
||||
|
@ -1,4 +1,5 @@
|
||||
PyuTest.WIRECUTTER_META_NAME = "WIRECUTTER_TARGET"
|
||||
|
||||
local function wirecutter_meta(pos)
|
||||
return core.serialize({
|
||||
x = pos.x,
|
||||
|
BIN
textures/pyutest-delayer.png
Normal file
BIN
textures/pyutest-delayer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 139 B |
BIN
textures/pyutest-note-block.png
Normal file
BIN
textures/pyutest-note-block.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 155 B |
BIN
textures/pyutest-note.png
Normal file
BIN
textures/pyutest-note.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 B |
Loading…
x
Reference in New Issue
Block a user