diff --git a/CHANGELOG.md b/CHANGELOG.md index 65844dc..04c73e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [Jun 17th - 18th 2024] Major Update: Electricity Update Pt.1 + +- Added Copper +- Added Copper Wires +- Added Electrical Devices + - Added Time Device + - Added Block Setter Device +- Minor Texture Adjustments +- Acid Now Damages Players + ## [Jun 15th - 16th 2024] Major Update: Survival Update Pt. 3 * This update includes lot's of breaking changes! @@ -22,8 +32,8 @@ - Removed Coins from Resource Lootbox - Updated Sponge Texture - Explosions Now Damage Players -- Fire Now Damages Player -- Lava Now Damages Player +- Fire Now Damages Players +- Lava Now Damages Players - Implement Crates - Added Crafting Recipe to Crates - Changed "Useless" Lootbox Type Color Tint to Purple to Tell the Difference Between Crates diff --git a/PLANS.md b/PLANS.md deleted file mode 100644 index 01cfcd3..0000000 --- a/PLANS.md +++ /dev/null @@ -1,16 +0,0 @@ -# Plans - -These plans are for updates past the Survival Update Pt. 2 - -Plans: - -- Combat - - Melees - - Ranged - - Magic - -- Mobs - - Cow - - Pig - - Chicken - - Sheep diff --git a/mods/pyutest_core/blocks.lua b/mods/pyutest_core/blocks.lua index 4b918c7..01ef793 100644 --- a/mods/pyutest_core/blocks.lua +++ b/mods/pyutest_core/blocks.lua @@ -173,6 +173,14 @@ PyuTestCore.make_building_blocks("dirt", "Dirt", {"dirt.png"}, nil, nil, { if minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then minetest.set_node(pos, {name = "pyutest_core:grass_block"}) end + end, + + on_destruct = function (pos) + local cpos = {x = pos.x, y = pos.y - 1, z = pos.z} + if minetest.get_node(cpos).name == "pyutest_core:dirt_block" then + local timer = minetest.get_node_timer(cpos) + timer:start(8) + end end }) PyuTestCore.make_building_blocks("coarse_dirt", "Coarse Dirt", {"dirt.png"}, nil) @@ -468,4 +476,6 @@ PyuTestCore.make_liquid("pyutest_core:lava", "lava", "Lava", {}, {"lava.png"}, { damage_per_second = 2 }) PyuTestCore.make_liquid("pyutest_core:oil", "oil", "Oil", {}, {"oil.png"}) -PyuTestCore.make_liquid("pyutest_core:liquid_acid", "liquid_acid", "Acid", {}, {"acid.png"}) +PyuTestCore.make_liquid("pyutest_core:liquid_acid", "liquid_acid", "Acid", {}, {"acid.png"}, { + damage_per_second = 2 +}) diff --git a/mods/pyutest_core/electricity.lua b/mods/pyutest_core/electricity.lua new file mode 100644 index 0000000..5b6ba23 --- /dev/null +++ b/mods/pyutest_core/electricity.lua @@ -0,0 +1,131 @@ +PyuTestCore.ELECTRICITY_UPDATE_TIME = 0.1 + + + +local function set_powered(pos, value) + local meta = minetest.get_meta(pos) + if value then + meta:set_int("powered", 1) + else + meta:set_int("powered", 0) + end +end + +local function get_powered(pos) + local meta = minetest.get_meta(pos) + return meta:get_int("powered") == 1 and true or false +end + +local function is_electrified(pos) + local positions = { + vector.new(pos.x + 1, pos.y, pos.z), + vector.new(pos.x - 1, pos.y, pos.z), + vector.new(pos.x, pos.y + 1, pos.z), + vector.new(pos.x, pos.y - 1, pos.z), + vector.new(pos.x, pos.y, pos.z + 1), + vector.new(pos.x, pos.y, pos.z - 1) + } + + local result = false + for _, v in pairs(positions) do + if get_powered(v) then + result = true + break + end + end + + return result +end + +PyuTestCore.make_ore("copper", "Copper", "ingot", "Ingot", "ore-copper.png", "ingot.png", "goldenrod", 21, 9, 3, PyuTestCore.BLOCK_BREAKABLE_LONG, nil, { + on_construct = function (pos) + set_powered(pos, true) + end +}) + +PyuTestCore.make_node("pyutest_core:copper_wire", "copper_wire", "Copper Wire", { + block = PyuTestCore.BLOCK_BREAKABLE_INSTANT +}, {"wire.png"}, { + drawtype = "signlike", + paramtype = "light", + sunlight_propagates = true, + color = "goldenrod", + walkable = false, + inventory_image = "wire.png", + paramtype2 = "wallmounted", + selection_box = { + type = "wallmounted" + }, + + on_construct = function (pos) + set_powered(pos, false) + local timer = minetest.get_node_timer(pos) + timer:start(PyuTestCore.ELECTRICITY_UPDATE_TIME) + end, + + on_timer = function (pos) + if is_electrified(pos) then + set_powered(pos, true) + else + set_powered(pos, false) + end + + local timer = minetest.get_node_timer(pos) + timer:start(PyuTestCore.ELECTRICITY_UPDATE_TIME) + end +}) + +minetest.register_craft({ + output = "pyutest_core:copper_wire 16", + recipe = { + "pyutest_core:copper_ingot" + }, + type = "shapeless" +}) + +PyuTestCore.make_device = function (ns, sname, desc, color, action, setup, extra_conf) + PyuTestCore.make_node(ns..":"..sname.."_device", sname.."_device", desc, { + block = PyuTestCore.BLOCK_BREAKABLE_NORMAL + }, {"device.png"}, PyuTestCore.util.tableconcat({ + color = color, + on_construct = function (pos) + local s = setup or function (_) end + s(pos) + + local timer = minetest.get_node_timer(pos) + timer:start(PyuTestCore.ELECTRICITY_UPDATE_TIME) + end, + on_timer = function (pos) + if is_electrified(pos) then + action(true, pos) + else + action(false, pos) + end + + local timer = minetest.get_node_timer(pos) + timer:start(PyuTestCore.ELECTRICITY_UPDATE_TIME) + end + }, extra_conf or {})) +end + +PyuTestCore.make_device("pyutest_core", "time", "Time Device", "orange", function (e) + if not e then return end + minetest.chat_send_all(string.format("Time: " .. os.date("%I:%M:%S", os.time()))) +end) + +PyuTestCore.make_device("pyutest_core", "block_setter", "Block Setter Device", "blue", function (e, pos) + if not e then return end + local blocks = {} + for k, _ in pairs(minetest.registered_nodes) do + local no_disallowed_blocks_match = (k ~= "ignore" and k ~= "pyutest_core:contagious_acid") + + if no_disallowed_blocks_match then + table.insert(blocks, k) + end + end + local pos = vector.new(pos.x, pos.y + 1, pos.z) + minetest.remove_node(pos) + minetest.place_node(pos, {name = blocks[math.random(#blocks)]}) +end) + +--PyuTestCore.make_device("pyutest_core", "") diff --git a/mods/pyutest_core/init.lua b/mods/pyutest_core/init.lua index 393b110..cbefba5 100644 --- a/mods/pyutest_core/init.lua +++ b/mods/pyutest_core/init.lua @@ -37,7 +37,8 @@ dofile(PyuTestCore_Path.."/player.lua") dofile(PyuTestCore_Path.."/lootboxes.lua") dofile(PyuTestCore_Path.."/sfinv.lua") dofile(PyuTestCore_Path.."/ores.lua") -dofile(PyuTestCore_Path.."/crafts.lua") dofile(PyuTestCore_Path.."/abms.lua") dofile(PyuTestCore_Path.."/mobs.lua") dofile(PyuTestCore_Path.."/combat.lua") +dofile(PyuTestCore_Path.."/electricity.lua") +dofile(PyuTestCore_Path.."/crafts.lua") diff --git a/mods/pyutest_core/ores.lua b/mods/pyutest_core/ores.lua index 96c6d01..ef1ffb7 100644 --- a/mods/pyutest_core/ores.lua +++ b/mods/pyutest_core/ores.lua @@ -1,16 +1,16 @@ -PyuTestCore.make_ore = function (id, desc, ifix, idfix, btxt, itxt, color, y_max, scarcity, count, btype) +PyuTestCore.make_ore = function (id, desc, ifix, idfix, btxt, itxt, color, y_max, scarcity, count, btype, oconf, bconf) local oid = "pyutest_core:"..id.."_ore" local iid = "pyutest_core:"..id.."_"..ifix local block_type = btype ~= nil and btype or PyuTestCore.BLOCK_BREAKABLE_MIDDLE - minetest.register_node(oid, { + minetest.register_node(oid, PyuTestCore.util.tableconcat({ description = Translate(desc .. " Ore"), groups = {block = block_type}, tiles = {btxt}, drop = iid .. " " .. tostring(count or 1), sounds = PyuTestCore.make_node_sounds(), light_source = 3.9, -- Make ores emit little light - }) + }, oconf or {})) minetest.register_craftitem(iid, { description = Translate(desc .. " " .. idfix), @@ -23,7 +23,7 @@ PyuTestCore.make_ore = function (id, desc, ifix, idfix, btxt, itxt, color, y_max ore_type = "scatter", ore = oid, wherein = "pyutest_core:stone_block", - clust_scarcity = scarcity * scarcity * scarcity, -- I spent 1 hour debugging this just because I mispelled scarcity as scarity :sob: + clust_scarcity = scarcity * scarcity * scarcity, clust_num_ores = 5, clust_size = 3, y_max = y_max, @@ -31,9 +31,7 @@ PyuTestCore.make_ore = function (id, desc, ifix, idfix, btxt, itxt, color, y_max biomes = PyuTestCore.BIOMES, }) - PyuTestCore.make_building_blocks(id, desc, {"metal.png"}, color, { - block = block_type - }) + PyuTestCore.make_building_blocks(id, desc, {"metal.png"}, color, {block = block_type}, bconf or {}) local bid = "pyutest_core:"..id.."_block" minetest.register_craft({ @@ -53,9 +51,8 @@ PyuTestCore.make_ore = function (id, desc, ifix, idfix, btxt, itxt, color, y_max }) end - -PyuTestCore.make_ore("coal", "Coal", "lump", "Lump", "ore-coal.png", "lump.png", {r = 32, g = 32, b = 32}, 48, 8, 5) -PyuTestCore.make_ore("iron", "Iron", "ingot", "Ingot", "ore-iron.png", "ingot.png", nil, 21, 12, 4) -PyuTestCore.make_ore("gold", "Gold", "ingot", "Ingot", "ore-gold.png", "ingot.png", "gold", -50, 14.5, 3, PyuTestCore.BLOCK_BREAKABLE_LONG) -PyuTestCore.make_ore("diamond", "Diamond", "shard", "Shard", "ore-diamond.png", "shard.png", "cyan", -60, 15.7, 3, PyuTestCore.BLOCK_BREAKABLE_LONG) +PyuTestCore.make_ore("coal", "Coal", "lump", "Lump", "ore-coal.png", "lump.png", {r = 32, g = 32, b = 32}, 48, 8, 4) +PyuTestCore.make_ore("iron", "Iron", "ingot", "Ingot", "ore-iron.png", "ingot.png", nil, 21, 12, 3) +PyuTestCore.make_ore("gold", "Gold", "ingot", "Ingot", "ore-gold.png", "ingot.png", "gold", -50, 14.5, 2, PyuTestCore.BLOCK_BREAKABLE_LONG) +PyuTestCore.make_ore("diamond", "Diamond", "shard", "Shard", "ore-diamond.png", "shard.png", "cyan", -60, 15.7, 1, PyuTestCore.BLOCK_BREAKABLE_LONG) PyuTestCore.make_ore("emerald", "Emerald", "shard", "Shard", "ore-emerald.png", "shard.png", "seagreen", -110, 17.3, 1, PyuTestCore.BLOCK_BREAKABLE_LONG) diff --git a/mods/pyutest_core/textures/device.png b/mods/pyutest_core/textures/device.png new file mode 100644 index 0000000..ac63bb5 Binary files /dev/null and b/mods/pyutest_core/textures/device.png differ diff --git a/mods/pyutest_core/textures/iron-pickaxe.png b/mods/pyutest_core/textures/iron-pickaxe.png index c30021e..c6f83c4 100644 Binary files a/mods/pyutest_core/textures/iron-pickaxe.png and b/mods/pyutest_core/textures/iron-pickaxe.png differ diff --git a/mods/pyutest_core/textures/iron-sword.png b/mods/pyutest_core/textures/iron-sword.png index 13c19e7..4f5535f 100644 Binary files a/mods/pyutest_core/textures/iron-sword.png and b/mods/pyutest_core/textures/iron-sword.png differ diff --git a/mods/pyutest_core/textures/metal.png b/mods/pyutest_core/textures/metal.png index 699c49a..d427210 100644 Binary files a/mods/pyutest_core/textures/metal.png and b/mods/pyutest_core/textures/metal.png differ diff --git a/mods/pyutest_core/textures/ore-copper.png b/mods/pyutest_core/textures/ore-copper.png new file mode 100644 index 0000000..ebc052c Binary files /dev/null and b/mods/pyutest_core/textures/ore-copper.png differ diff --git a/mods/pyutest_core/textures/shard.png b/mods/pyutest_core/textures/shard.png index a12ef53..f181b96 100644 Binary files a/mods/pyutest_core/textures/shard.png and b/mods/pyutest_core/textures/shard.png differ diff --git a/mods/pyutest_core/textures/shiny-metal-overlay.png b/mods/pyutest_core/textures/shiny-metal-overlay.png new file mode 100644 index 0000000..97a3a42 Binary files /dev/null and b/mods/pyutest_core/textures/shiny-metal-overlay.png differ diff --git a/mods/pyutest_core/textures/wire.png b/mods/pyutest_core/textures/wire.png new file mode 100644 index 0000000..68e3045 Binary files /dev/null and b/mods/pyutest_core/textures/wire.png differ