From 256d6bded7defbe58eb48425c2b1c6eb0a785ba2 Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 8 Sep 2022 18:32:59 +0200 Subject: [PATCH] Add sculk veins, generate shriekers and sensors --- mods/ITEMS/mcl_sculk/init.lua | 103 ++++++++++++++---- mods/ITEMS/mcl_sculk/mod.conf | 2 +- .../mcl_sculk/textures/mcl_sculk_vein.png | Bin 0 -> 7133 bytes 3 files changed, 82 insertions(+), 23 deletions(-) create mode 100644 mods/ITEMS/mcl_sculk/textures/mcl_sculk_vein.png diff --git a/mods/ITEMS/mcl_sculk/init.lua b/mods/ITEMS/mcl_sculk/init.lua index b347ac41c..e9b01146c 100644 --- a/mods/ITEMS/mcl_sculk/init.lua +++ b/mods/ITEMS/mcl_sculk/init.lua @@ -1,7 +1,8 @@ +local S = minetest.get_translator(minetest.get_current_modname()) local spread_to = {"mcl_core:stone","mcl_core:dirt","mcl_core:sand","mcl_core:dirt_with_grass","group:grass_block","mcl_core:andesite","mcl_core:diorite","mcl_core:granite"} -local range = 16 +local range = 8 local function get_node_xp(pos) local meta = minetest.get_meta(pos) return meta:get_int("xp") @@ -25,7 +26,7 @@ local function sculk_on_destruct(pos) end minetest.register_node("mcl_sculk:sculk", { - description = ("Sculk"), + description = S("Sculk"), tiles = { { name = "mcl_sculk_sculk.png", animation = { @@ -36,9 +37,9 @@ minetest.register_node("mcl_sculk:sculk", { }, }, }, drop = "", - groups = {handy = 1, hoey = 1, building_block=1,}, + groups = {handy = 1, hoey = 1, building_block=1, sculk = 1,}, place_param2 = 1, --- sounds = , + sounds = mcl_sounds.node_sound_leaves_defaults(), is_ground_content = false, on_destruct = sculk_on_destruct, _mcl_blast_resistance = 0.2, @@ -46,16 +47,47 @@ minetest.register_node("mcl_sculk:sculk", { _mcl_silk_touch_drop = true, }) +minetest.register_node("mcl_sculk:vein", { + description = S("Sculk Vein"), + _doc_items_longdesc = S("Sculk vein."), + drawtype = "signlike", + tiles = {"mcl_sculk_vein.png"}, + inventory_image = "mcl_sculk_vein.png", + wield_image = "mcl_sculk_vein.png", + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + buildable_to = true, + selection_box = { + type = "wallmounted", + }, + stack_max = 64, + groups = { + handy = 1, axey = 1, shearsy = 1, swordy = 1, deco_block = 1, + dig_by_piston = 1, destroy_by_lava_flow = 1, sculk = 1, + }, + sounds = mcl_sounds.node_sound_leaves_defaults(), + drop = "", + _mcl_shears_drop = true, + node_placement_prediction = "", + -- Restrict placement of vines + _mcl_blast_resistance = 0.2, + _mcl_hardness = 0.2, + on_rotate = false, +}) + minetest.register_node("mcl_sculk:catalyst", { - description = ("Sculk Catalyst"), + description = S("Sculk Catalyst"), tiles = { "mcl_sculk_catalyst_top.png", "mcl_sculk_catalyst_bottom.png", "mcl_sculk_catalyst_side.png" }, drop = "", --- sounds = , - groups = {handy = 1, hoey = 1, building_block=1,}, + sounds = mcl_sounds.node_sound_leaves_defaults(), + groups = {handy = 1, hoey = 1, building_block=1, sculk = 1,}, place_param2 = 1, is_ground_content = false, on_destruct = sculk_on_destruct, @@ -66,15 +98,15 @@ minetest.register_node("mcl_sculk:catalyst", { }) minetest.register_node("mcl_sculk:sensor", { - description = ("Sculk Sensor"), + description = S("Sculk Sensor"), tiles = { "mcl_sculk_sensor_top.png", "mcl_sculk_sensor_bottom.png", "mcl_sculk_sensor_side.png" }, drop = "", --- sounds = , - groups = {handy = 1, hoey = 1, building_block=1,}, + sounds = mcl_sounds.node_sound_leaves_defaults(), + groups = {handy = 1, hoey = 1, building_block=1, sculk = 1,}, place_param2 = 1, is_ground_content = false, on_destruct = sculk_on_destruct, @@ -84,15 +116,15 @@ minetest.register_node("mcl_sculk:sensor", { _mcl_silk_touch_drop = true, }) minetest.register_node("mcl_sculk:shrieker", { - description = ("Sculk Shrieker"), + description = S("Sculk Shrieker"), tiles = { "mcl_sculk_shrieker_top.png", "mcl_sculk_shrieker_bottom.png", "mcl_sculk_shrieker_side.png" }, drop = "", --- sounds = , - groups = {handy = 1, hoey = 1, building_block=1,}, + sounds = mcl_sounds.node_sound_leaves_defaults(), + groups = {handy = 1, hoey = 1, building_block=1, sculk = 1,}, place_param2 = 1, is_ground_content = false, on_destruct = sculk_on_destruct, @@ -117,13 +149,21 @@ local function has_air(pos) end end +local function has_nonsculk(pos) + for _,v in pairs(adjacents) do + local p = vector.add(pos,v) + if minetest.get_item_group(minetest.get_node(p).name,"sculk") <= 0 and minetest.get_item_group(minetest.get_node(p).name,"solid") > 0 then return p end + end +end + local old_on_step = minetest.registered_entities["mcl_experience:orb"].on_step minetest.registered_entities["mcl_experience:orb"].on_step = function(self,dtime) local p = self.object:get_pos() - local n = minetest.get_node(vector.offset(p,0,-1,0)) + local n = minetest.find_node_near(p,2,{"mcl_sculk:sculk"}) + local nu = minetest.get_node(vector.offset(p,0,-1,0)) local ret = old_on_step(self,dtime) - if n.name == "mcl_sculk:sculk" and not self._sculkdrop then + if n and not self._sculkdrop then local c = minetest.find_node_near(p,range,{"mcl_sculk:catalyst"}) if c then local nnn = minetest.find_nodes_in_area(vector.offset(p,-range,-range,-range),vector.offset(p,range,range,range),spread_to) @@ -137,14 +177,33 @@ minetest.registered_entities["mcl_experience:orb"].on_step = function(self,dtime return vector.distance(p, a) < vector.distance(p, b) end) if nn and #nn > 0 and self._xp > 0 then - local r = math.min(math.random(#nn),self._xp) - for i=1,r do - minetest.set_node(nn[i],{name = "mcl_sculk:sculk"}) - set_node_xp(nn[i],math.floor(self._xp / r)) + local d = math.random(100) + if d <= 1 then + minetest.set_node(nn[1],{name = "mcl_sculk:shrieker"}) + set_node_xp(nn[1],math.min(1,self._xp - 10)) + self.object:remove() + return ret + elseif d <= 9 then + minetest.set_node(nn[1],{name = "mcl_sculk:sensor"}) + set_node_xp(nn[1],math.min(1,self._xp - 5)) + self.object:remove() + return ret + else + local r = math.min(math.random(#nn),self._xp) + for i=1,r do + minetest.set_node(nn[i],{name = "mcl_sculk:sculk" }) + set_node_xp(nn[i],math.floor(self._xp / r)) + end + for i=1,r do + local p = has_nonsculk(nn[i]) + if p and has_air(p) then + minetest.set_node(vector.offset(p,0,1,0),{name = "mcl_sculk:vein", param2 = 1}) + end + end + set_node_xp(nn[1],get_node_xp(nn[1]) + self._xp % r) + self.object:remove() + return ret end - set_node_xp(nn[1],get_node_xp(nn[1]) + self._xp % r) - self.object:remove() - return ret end end end diff --git a/mods/ITEMS/mcl_sculk/mod.conf b/mods/ITEMS/mcl_sculk/mod.conf index 95156561e..a7db304a4 100644 --- a/mods/ITEMS/mcl_sculk/mod.conf +++ b/mods/ITEMS/mcl_sculk/mod.conf @@ -1,3 +1,3 @@ name = mcl_sculk author = cora -depends = mcl_experience +depends = mcl_core, mcl_sounds, mcl_experience diff --git a/mods/ITEMS/mcl_sculk/textures/mcl_sculk_vein.png b/mods/ITEMS/mcl_sculk/textures/mcl_sculk_vein.png new file mode 100644 index 0000000000000000000000000000000000000000..53d62f70be53fd7efcc8efb3456d85ef39855fd3 GIT binary patch literal 7133 zcmeHLd0bOh+71HBqDWDZB4~&UDBk4eW{-d@p%65H1W~Lw+?(7$BpX=>pt#i15rvAN zXssJmDO%hG*%U#n4Am+wR1_5f#Su4$6g5@}g*q#zl6Q3;TMGe^vQJ zv_@9J8!^>v?T!$y`0sfSU))*d+VLvI>uO3Dk9B6qsy4W+vjFXStUVl(a*Z( zbyr1Z&xQkIeT3`d?5R_9Rzbqd)5_;Us8}08vmNvab(@< zMPqE8pWd&HY-;R;PZrG_w~6Y~)MyU-THLh>NjiMdqBd&lgTGDF_}|%FKklXZ=&?g@ zta##dR+WBCoAs*s>+vnwl6f}g&UcGjuWakBl+Qg^yzf-`15;ned||nJ%Fyr4UGyoR zo*dIT_N=JVj?AdNIYhe`N~oIa_K|5$hR58xqxIL$_?k~iUc|w~-E)*ASa6Oz{W0es9!}QJd znQ?lRiS4y#9$Dj?d&~aexZlPiXylRVD%mC%?4vEESGsC-JDnZOTivYJ=&Za~@BB1+ zIENT*%E|R+A_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