From 2d96fa083c90b32b71d76e77dd5120f56e1eba63 Mon Sep 17 00:00:00 2001 From: IamPyu Date: Tue, 18 Jun 2024 13:25:02 -0600 Subject: [PATCH] Major Update --- CHANGELOG.md | 14 +- PLANS.md | 16 --- mods/pyutest_core/blocks.lua | 12 +- mods/pyutest_core/electricity.lua | 131 ++++++++++++++++++ mods/pyutest_core/init.lua | 3 +- mods/pyutest_core/ores.lua | 21 ++- mods/pyutest_core/textures/device.png | Bin 0 -> 172 bytes mods/pyutest_core/textures/iron-pickaxe.png | Bin 276 -> 279 bytes mods/pyutest_core/textures/iron-sword.png | Bin 223 -> 235 bytes mods/pyutest_core/textures/metal.png | Bin 179 -> 218 bytes mods/pyutest_core/textures/ore-copper.png | Bin 0 -> 354 bytes mods/pyutest_core/textures/shard.png | Bin 157 -> 174 bytes .../textures/shiny-metal-overlay.png | Bin 0 -> 105 bytes mods/pyutest_core/textures/wire.png | Bin 0 -> 455 bytes 14 files changed, 165 insertions(+), 32 deletions(-) delete mode 100644 PLANS.md create mode 100644 mods/pyutest_core/electricity.lua create mode 100644 mods/pyutest_core/textures/device.png create mode 100644 mods/pyutest_core/textures/ore-copper.png create mode 100644 mods/pyutest_core/textures/shiny-metal-overlay.png create mode 100644 mods/pyutest_core/textures/wire.png 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 0000000000000000000000000000000000000000..ac63bb5d7a9383da13653efb7ae6d34b0eef1558 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`#hxyXAr`%7Cm-Z(FyLY4O={*3z%(a}eU6cK V%KAx*jsvY{@O1TaS?83{1ORugJKF#N literal 0 HcmV?d00001 diff --git a/mods/pyutest_core/textures/iron-pickaxe.png b/mods/pyutest_core/textures/iron-pickaxe.png index c30021eee83f0e58555552578cbd755aa8460a3c..c6f83c4500b65f0c3ba987047067aae447dea3c0 100644 GIT binary patch delta 251 zcmbQjG@WUJO8q@g7sn8b-sFS@0tSyJ?fCZQZ@olx%WPJ?xQwKO2Y_J1mv5nNd)OWr zxlHMAZv=vaUJ%gt{)50Yr=b6wyBH*|?7aPVfAxFa!+W>C zmo&S#|0Kv5g=6PWpKw`o*5K@mb7~n5vz9)r7c?sqDLI?J?_cBT%@3}0K6&FVZsuJAbtPeA5#;LuV%M6%(a^F#JOY3BE7u?^x70Ti_H{gZ)G)x*=Y$5 zTrM*<>+i4i4B|?5DKpzvp~f;p0tilA^$}%YV99C9^;bxL#sCDKu6{1-oD!M4Tq3U0oQlP}6YMmvc9tP;2_&}23oOqE#q9fjxz;|S#9qazaa5Hn)M4wS90)y^ yipyP#Z6uJ`u{eG7!`L&nZq6pP0N`8mU-SUg{elEQ$3h+e0000xWX(q}5e3}^;7#Nt4Ior=Y{(tQH^Z&$ZW?*1oU_lr7`27z9vLX01 zWA(!JbC3TsFfcIib3)9v(v-yOO(t}K_1S)KmkVh)j>7%0<7 pmXQ>fFhr|r|F;y9!fV^$1OR(rXDE>(KRf^c002ovPDHLkV1iB#Qi}ip delta 195 zcmV;!06hQe0p9_TB!8w!L_t(IjbmgW6a4@G|33o*0|O%^nx8&>N}lHb|NsAg^5n_? zQO#Juwr$(~A3S&vu8WKjHw4)`csvcLbGQ5d_02Da{g)px x9DnzW(aXz=krbCOM5}85w-k~hJ)Q>~000g*f~o2zM$iBN002ovPDHLkV1kyASt|el diff --git a/mods/pyutest_core/textures/metal.png b/mods/pyutest_core/textures/metal.png index 699c49ae04c65cc9fc100ce89af8e1f07a3cee87..d4272106af12660b9ba4fa5b3e02130e4552f261 100644 GIT binary patch delta 190 zcmV;v073t=0onnOB!8hvL_t(Ijir)73WG2ZMPG~H8KigUJ%rw_o1Vf|Ah!_79i(Rv zgmzJkj1!a5&hqOY{>%K!>)CzyV=910dzb3_2F+MBJ0G|z)o2z8oDTrh(+u=XbtQiK z=_oxePzc6EX#}HLBv=si1Q?{U#VI3X5|t4$=4BMZ{)=mzxHmu`9O!{YI9Q^X!1-{h sL~()X3W;>~D`e1;Mbfd?3v9oA0UexAzqm7-XaE2J07*qoM6N<$g0VDJrT_o{ delta 151 zcmcb`xS4T+N_~~5i(`mIZ*t7`q@(q0TnyaI%*@R*J2@j~`OmdHe88piZGre4tKzms zAaIQE=>gFX->weV=ql(u%SB6NcI1 z1xHzo7OWFL;ptMqJYlaxj#5*k&+L|#^EY1|yBFmD$2||aTk$ep#WDY;12?}rz1{&ZI0F88#E;Cn8;7&ZpzkSvyipb^w^h0by_efPYmO3fiuhW|D2TJHgW;g05u<0p;tN^+?k= zAT1(;NCRPDu4#pEl>K>PCvVL|v%eA!dy5{rMw}^Lh0G=WijP zZF4(;myKElNo*~bAg$Apm9f-iWxQ0NncJ>6ROsFKo@>}D1eABV?!^`2dh=D?7)xBu zWro4)P4DyMCV75bixJWyG7_{^FHYwf*1Ny+A12bAb%707*qoM6N<$f+B{Q As{jB1 literal 0 HcmV?d00001 diff --git a/mods/pyutest_core/textures/shard.png b/mods/pyutest_core/textures/shard.png index a12ef53b1d1b682591ba3f727c4627232ec9dd43..f181b96c3dafa43e3a49ebdfd72909f1ddfe31d9 100644 GIT binary patch delta 146 zcmV;D0B!%B0j>d%B!6{DL_t(IjbmWI5B@_jPQZvy^Z)-4y^M^EIMw1Z0InIX5Qia5 z_%vUB{01&~?b&+<1}xseW&m8XuB-?yX~G5&3ve1hjP0~_0aXpS{`|uLx&WW;1Pvgh znSlXMQii5HIM9+3#Ht=|W`Y@lOEWQmV0H!oOqnUgre8>D01E&B07*qoM6N<$g8KM7 A8UO$Q delta 128 zcmV-`0Du3k0i6MmBza^>L_t(IjqQ`M4Zt7_1mD>q1^W*NQnG_ngt+qCPDR5@bbkj( zHV{YWp^*qyeOVEqT_!NtibQf$U;yY>2b}MCf?wH!qF~%(;R~YMQ$Yp;!6?tkv$V6h i{cxE+34<$1*ZBdF4f|U4kmPld0)? zpPqhifF1No-SRMUfn*38$h!nj{T=dog^uy?s*@^-A3V7`{I~0sxMAUKX4K zKsPN*YpfL%MQy>kAR;VUH_rPr02G{qLI~Z{}N^MN%ysttCU1F?ltaFm02zizXmZlPbh>6-CTxw%P z!Fjjxf0?*7!fy``WyV