diff --git a/LEGAL.md b/LEGAL.md index d95f17624..a9c1be5ea 100644 --- a/LEGAL.md +++ b/LEGAL.md @@ -46,6 +46,9 @@ Armor trim models were created by Aeonix_Aeon Source: License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) +Charcoal block texture was created by [blitzdoughnuts](https://gitlab.com/ApplemunchFromDaDead), based on the Pixel Perfection coal block. +License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/) + The main menu images are released under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/) All other files, unless mentioned otherwise, fall under: diff --git a/mods/CORE/_mcl_autogroup/init.lua b/mods/CORE/_mcl_autogroup/init.lua index 884508032..7139535d2 100644 --- a/mods/CORE/_mcl_autogroup/init.lua +++ b/mods/CORE/_mcl_autogroup/init.lua @@ -117,10 +117,6 @@ end -- Array of unique hardness values for each group which affects dig time. local hardness_values = get_hardness_values_for_groups() --- Map indexed by hardness values which return the index of that value in --- hardness_value. Used for quick lookup. -local hardness_lookup = get_hardness_lookup_for_groups(hardness_values) - --[[local function compute_creativetimes(group) local creativetimes = {} @@ -186,6 +182,7 @@ local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency) local mult = capsdef.speed or 1 local uses = capsdef.uses local def = mcl_autogroup.registered_diggroups[g] + assert(def, toolname .. " has unknown diggroup '" .. dump(g) .. "'") local max_level = def.levels and #def.levels or 1 assert(capsdef.level, toolname .. ' is missing level for ' .. g) @@ -313,6 +310,13 @@ function mcl_autogroup.get_wear(toolname, diggroup) end local function overwrite() + -- Refresh, now that all groups are known. + hardness_values = get_hardness_values_for_groups() + + -- Map indexed by hardness values which return the index of that value in + -- hardness_value. Used for quick lookup. + local hardness_lookup = get_hardness_lookup_for_groups(hardness_values) + for nname, ndef in pairs(minetest.registered_nodes) do local newgroups = table.copy(ndef.groups) if (nname ~= "ignore" and ndef.diggable) then @@ -374,4 +378,5 @@ local function overwrite() end end -overwrite() +-- Make sure all tools and groups are registered +minetest.register_on_mods_loaded(overwrite) diff --git a/mods/CORE/_mcl_autogroup/mod.conf b/mods/CORE/_mcl_autogroup/mod.conf index db43aff39..f62edd60b 100644 --- a/mods/CORE/_mcl_autogroup/mod.conf +++ b/mods/CORE/_mcl_autogroup/mod.conf @@ -1,3 +1,4 @@ name = _mcl_autogroup +depends = mcl_autogroup author = ryvnf description = VoxeLibre core mod which automatically adds groups to all items. Very important for digging times. diff --git a/mods/CORE/flowlib/API.md b/mods/CORE/flowlib/API.md index 20e85036b..dfef0e06c 100644 --- a/mods/CORE/flowlib/API.md +++ b/mods/CORE/flowlib/API.md @@ -2,33 +2,33 @@ Simple flow functions. ## flowlib.is_touching(realpos, nodepos, radius) -Return true if a sphere of at collide with node at . +Return true if a sphere of `radius` at `realpos` collide with node at `nodepos`. * realpos: position * nodepos: position * radius: number ## flowlib.is_water(pos) -Return true if node at is water, false overwise. +Return true if node at `pos` is water, false otherwise. * pos: position ## flowlib.node_is_water(node) -Return true if is water, false overwise. +Return true if `node` is water, false otherwise. * node: node ## flowlib.is_lava(pos) -Return true if node at is lava, false overwise. +Return true if node at `pos` is lava, false otherwise. * pos: position ## flowlib.node_is_lava(node) -Return true if is lava, false overwise. +Return true if `node` is lava, false otherwise. * node: node ## flowlib.is_liquid(pos) -Return true if node at is liquid, false overwise. +Return true if node at `pos` is liquid, false otherwise. * pos: position ## flowlib.node_is_liquid(node) -Return true if is liquid, false overwise. +Return true if `node` is liquid, false otherwise. * node: node ## flowlib.quick_flow(pos, node) @@ -37,9 +37,9 @@ Return direction where the water is flowing (to be use to push mobs, items...). * node: node ## flowlib.move_centre(pos, realpos, node, radius) -Return the pos of the nearest not water block near from in a sphere of at . -WARNING: This function is never used in mcl2, use at your own risk. The informations described here may be wrong. +Return the pos of the nearest not water block near from `pos` in a sphere of `radius` at `realpos`. +WARNING: This function is never used in VL, use at your own risk. The informations described here may be wrong. * pos: position * realpos: position, position of the entity * node: node -* radius: number \ No newline at end of file +* radius: number diff --git a/mods/CORE/mcl_autogroup/API.md b/mods/CORE/mcl_autogroup/API.md index b3a913ab6..f95516882 100644 --- a/mods/CORE/mcl_autogroup/API.md +++ b/mods/CORE/mcl_autogroup/API.md @@ -1,8 +1,8 @@ # mcl_autogroup -This mod emulate digging times from mc. +This mod emulates digging times from MC. ## mcl_autogroup.can_harvest(nodename, toolname, player) -Return true if can be dig with by . +Return true if `nodename` can be dig with `toolname` by . * nodename: string, valid nodename * toolname: (optional) string, valid toolname * player: (optinal) ObjectRef, valid player @@ -14,7 +14,7 @@ WARNING: This function can only be called after mod initialization. * efficiency: (optional) integer, the efficiency level the tool is enchanted with (default 0) ## mcl_autogroup.get_wear(toolname, diggroup) -Return the max wear of with +Return the max wear of `toolname` with `diggroup` WARNING: This function can only be called after mod initialization. * toolname: string, name of the tool used * diggroup: string, the name of the diggroup the tool is used on @@ -25,4 +25,4 @@ WARNING: This function can only be called after mod initialization. * level: (optional) string, if specified it is an array containing the names of the different digging levels the digging group supports ## mcl_autogroup.registered_diggroups -List of registered diggroups, indexed by name. \ No newline at end of file +List of registered diggroups, indexed by name. diff --git a/mods/CORE/mcl_colors/API.md b/mods/CORE/mcl_colors/API.md index 71cad335b..f58a38a3b 100644 --- a/mods/CORE/mcl_colors/API.md +++ b/mods/CORE/mcl_colors/API.md @@ -1,5 +1,5 @@ # mcl_colors -Mod providing global table containing legacity minecraft colors to be used in mods. +Mod providing global table containing legacy Minecraft colors to be used in mods. ## mcl_colors.* Colors by upper name, in hex value. diff --git a/mods/CORE/mcl_damage/API.md b/mods/CORE/mcl_damage/API.md index 9ffdcb9f4..0ca5c6e38 100644 --- a/mods/CORE/mcl_damage/API.md +++ b/mods/CORE/mcl_damage/API.md @@ -6,10 +6,10 @@ WARNING: Not using it inside your mods may cause strange bugs (using the native ## Callbacks -To modify the amount of damage made by something: +To modify the amount of damage dealt by something: ```lua --obj: an ObjectRef mcl_damage.register_modifier(function(obj, damage, reason) end, 0) -``` \ No newline at end of file +``` diff --git a/mods/CORE/mcl_events/API.md b/mods/CORE/mcl_events/API.md index c94328e50..caa99c0b4 100644 --- a/mods/CORE/mcl_events/API.md +++ b/mods/CORE/mcl_events/API.md @@ -1,9 +1,13 @@ -## mcl_events -### Registering Events - `mlc_events.register_event("name",def)` +# mcl_events -#### Event Definition - { +## Registering Events + +`mcl_events.register_event("name", def)` + +### Event Definition + +``` +{ stage = 0, max_stage = 1, percent = 100, @@ -22,6 +26,8 @@ cond_complete = function(event) end, --return true if event finished successfully } +``` -### Debugging - * /event_start -- starts the given event at the current player coordinates +## Debugging + +* /event_start `event` -- starts the given event at the current player coordinates diff --git a/mods/CORE/mcl_explosions/API.md b/mods/CORE/mcl_explosions/API.md index cb0e9252d..58748582f 100644 --- a/mods/CORE/mcl_explosions/API.md +++ b/mods/CORE/mcl_explosions/API.md @@ -3,13 +3,13 @@ This mod provide helper functions to create explosions. ## mcl_explosions.explode(pos, strength, info, puncher) * pos: position, initial position of the explosion -* strenght: number, radius of the explosion +* strength: number, radius of the explosion * info: table, explosion informations: * drop_chance: number, if specified becomes the drop chance of all nodes in the explosion (default: 1.0 / strength) * max_blast_resistance: int, if specified the explosion will treat all non-indestructible nodes as having a blast resistance of no more than this value * sound: bool, if true, the explosion will play a sound (default: true) * particles: bool, if true, the explosion will create particles (default: true) - * fire: bool, if true, 1/3 nodes become fire (default: false) + * fire: bool, if true, 1/3 of nodes become fire (default: false) * griefing: bool, if true, the explosion will destroy nodes (default: true) * grief_protected: bool, if true, the explosion will also destroy nodes which have been protected (default: false) -* puncher: (optional) entity, will be used as source for damage done by the explosion \ No newline at end of file +* puncher: (optional) entity, will be used as source for damage done by the explosion diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index b6fd71673..2d2b8a609 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -48,6 +48,20 @@ function table.pairs_by_keys(t, f) return iter end +-- Removes one element randomly selected from the array section of the table and +-- returns it, or nil if there are no elements in the array section of the table +function table.remove_random_element(table) + local count = #table + if count == 0 then return nil end + + local idx = math.random(count) + local res = table[idx] + table[idx] = table[count] + table[count] = nil + count = count - 1 + return res +end + local LOGGING_ON = minetest.settings:get_bool("mcl_logging_default", false) local LOG_MODULE = "[MCL2]" function mcl_util.mcl_log(message, module, bypass_default_logger) @@ -1103,3 +1117,39 @@ function mcl_util.is_it_christmas() return false end end + +function mcl_util.to_bool(val) + if not val then return false end + return true +end + +if not vector.in_area then + -- backport from minetest 5.8, can be removed when the minimum version is 5.8 + vector.in_area = function(pos, min, max) + return (pos.x >= min.x) and (pos.x <= max.x) and + (pos.y >= min.y) and (pos.y <= max.y) and + (pos.z >= min.z) and (pos.z <= max.z) + end +end + +-- Traces along a line of nodes vertically to find the next possition that isn't an allowed node +---@param pos The position to start tracing from +---@param dir The direction to trace in. 1 is up, -1 is down, all other values are not allowed. +---@param allowed_nodes A set of node names to trace along. +---@param limit The maximum number of steps to make. Defaults to 16 if nil or missing +---@return Three return values: +--- the position of the next node that isn't allowed or nil if no such node was found, +--- the distance from the start where that node was found, +--- the node table if a node was found +function mcl_util.trace_nodes(pos, dir, allowed_nodes, limit) + if (dir ~= -1) and (dir ~= 1) then return nil, 0, nil end + limit = limit or 16 + + for i = 1,limit do + pos = vector.offset(pos, 0, dir, 0) + local node = minetest.get_node(pos) + if not allowed_nodes[node.name] then return pos, i, node end + end + + return nil, limit, nil +end diff --git a/mods/CORE/mcl_worlds/API.md b/mods/CORE/mcl_worlds/API.md index 6ad7639f4..f7da7b199 100644 --- a/mods/CORE/mcl_worlds/API.md +++ b/mods/CORE/mcl_worlds/API.md @@ -5,20 +5,21 @@ This mod provides utility functions about positions and dimensions. This function returns: * true, true: if pos is in deep void (deadly) -* true, false: if the pos is in void (non deadly) -* false, false: owerwise +* true, false: if the pos is in void (non-deadly) +* false, false: otherwise Params: * pos: position ## mcl_worlds.y_to_layer(y) -This function is used to calculate the minetest y layer and dimension of the given minecraft layer. +This function is used to calculate the Minetest y layer and dimension of the given y Minecraft layer. Mainly used for ore generation. -Takes an Y coordinate as input and returns: +Takes a Y coordinate as input and returns: + +* The corresponding Minecraft layer (can be `nil` if void) +* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if y is in the void -* The corresponding Minecraft layer (can be nil if void) -* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if is in the void If the Y coordinate is not located in any dimension, it will return: nil, "void" Params: @@ -26,7 +27,7 @@ Params: * y: int ## mcl_worlds.pos_to_dimension(pos) -This function return the Minecraft dimension of ("overworld", "nether" or "end") or "void" if is in the void. +This function return the Minecraft dimension of pos ("overworld", "nether" or "end") or "void" if y is in the void. * pos: position @@ -38,31 +39,32 @@ mc_dimension can be "overworld", "nether", "end" (default: "overworld"). * mc_dimension: string ## mcl_worlds.has_weather(pos) -Returns true if can have weather, false owerwise. +Returns true if pos can have weather, false otherwise. Weather can be only in the overworld. * pos: position ## mcl_worlds.has_dust(pos) -Returns true if can have nether dust, false owerwise. +Returns true if pos can have nether dust, false otherwise. Nether dust can be only in the nether. * pos: position ## mcl_worlds.compass_works(pos) -Returns true if compasses are working at , false owerwise. -In mc, you cant use compass in the nether and the end. +Returns true if compasses are working at pos, false otherwise. +In MC, you cant use compass in the nether and the end. * pos: position ## mcl_worlds.compass_works(pos) -Returns true if clock are working at , false owerwise. -In mc, you cant use clock in the nether and the end. +Returns true if clock are working at pos, false otherwise. +In MC, you cant use clock in the nether and the end. * pos: position ## mcl_worlds.register_on_dimension_change(function(player, dimension, last_dimension)) Register a callback function func(player, dimension). + It will be called whenever a player changes between dimensions. The void counts as dimension. @@ -75,7 +77,7 @@ The void counts as dimension. Table containing all function registered with mcl_worlds.register_on_dimension_change() ## mcl_worlds.dimension_change(player, dimension) -Notify this mod of a dimension change of to +Notify this mod of a dimension change of player to dimension * player: player, player who changed the dimension * dimension: string, new dimension ("overworld", "nether", "end", "void") diff --git a/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr b/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr index c1864a871..08ad99e89 100644 --- a/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr +++ b/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr @@ -10,3 +10,14 @@ Rightclick on a water source to place the boat. Rightclick the boat to enter it. Spruce Boat=Fichtenboot Water vehicle=Wasserfahrzeug Sneak to dismount=Zum Aussteigen schleichen +Obsidian Boat=Obsidianboot +Mangrove Boat= +Cherry Boat=Kirschholzboot +Oak Chest Boat=Eichentruhenboot +Spruce Chest Boat= +Birch Chest Boat=Birkentruhenboot +Jungle Chest Boat=Dschungeltruhenboot +Acacia Chest Boat= +Dark Oak Chest Boat= +Mangrove Chest Boat= +Cherry Chest Boat= diff --git a/mods/ENTITIES/mcl_dripping/init.lua b/mods/ENTITIES/mcl_dripping/init.lua index 5a96e65c4..6aa229a8c 100644 --- a/mods/ENTITIES/mcl_dripping/init.lua +++ b/mods/ENTITIES/mcl_dripping/init.lua @@ -29,7 +29,7 @@ local function make_drop(pos, liquid, sound, interval, texture) pt.expirationtime = t pt.texture = "[combine:2x2:" .. - -math.random(1, 16) .. "," .. -math.random(1, 16) .. "=" .. texture + math.random(-14, 0) .. "," .. math.random(-14, 0) .. "=" .. texture minetest.add_particle(pt) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index f23d7af42..c56102254 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -321,6 +321,7 @@ function minetest.handle_node_drops(pos, drops, digger) if tool and nodedef._mcl_fortune_drop and enchantments.fortune then local fortune_level = enchantments.fortune local fortune_drop = nodedef._mcl_fortune_drop + local simple_drop = nodedef._mcl_fortune_drop.drop_without_fortune if fortune_drop.discrete_uniform_distribution then local min_count = fortune_drop.min_count local max_count = fortune_drop.max_count + fortune_level * (fortune_drop.factor or 1) @@ -336,6 +337,12 @@ function minetest.handle_node_drops(pos, drops, digger) local drop = get_fortune_drops(fortune_drop, fortune_level) drops = get_drops(drop, tool:get_name(), dug_node.param2, nodedef.paramtype2) end + + if simple_drop then + for _, item in pairs(simple_drop) do + table.insert(drops, item) + end + end end if digger and mcl_experience.throw_xp and not silk_touch_drop then diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index b3d1ac142..dd3c84819 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -388,7 +388,7 @@ end -local function on_step_work (self, dtime) +local function on_step_work(self, dtime, moveresult) local pos = self.object:get_pos() if not pos then return end @@ -402,7 +402,7 @@ local function on_step_work (self, dtime) -- Do we abandon out of here now? end - if self:falling(pos) then return end + if self:falling(pos, moveresult) then return end if self:step_damage (dtime, pos) then return end if self.state == "die" then return end @@ -502,11 +502,11 @@ end -- main mob function -function mob_class:on_step(dtime) +function mob_class:on_step(dtime, moveresult) if not DEVELOPMENT then -- Removed as bundled Lua (5.1 doesn't support xpcall) --local status, retVal = xpcall(on_step_work, on_step_error_handler, self, dtime) - local status, retVal = pcall(on_step_work, self, dtime) + local status, retVal = pcall(on_step_work, self, dtime, moveresult) if status then return retVal else @@ -521,7 +521,7 @@ function mob_class:on_step(dtime) log_error (dump(retVal), dump(pos), dump(self)) end else - return on_step_work (self, dtime) + return on_step_work (self, dtime, moveresult) end end diff --git a/mods/ENTITIES/mcl_mobs/breeding.lua b/mods/ENTITIES/mcl_mobs/breeding.lua index 90e625db8..426353b5a 100644 --- a/mods/ENTITIES/mcl_mobs/breeding.lua +++ b/mods/ENTITIES/mcl_mobs/breeding.lua @@ -285,6 +285,7 @@ function mob_class:check_breeding() end local child = mcl_mobs.spawn_child(pos, parent1.name) + if not child then return end local ent_c = child:get_luaentity() diff --git a/mods/ENTITIES/mcl_mobs/effects.lua b/mods/ENTITIES/mcl_mobs/effects.lua index e746fef39..27811e5c2 100644 --- a/mods/ENTITIES/mcl_mobs/effects.lua +++ b/mods/ENTITIES/mcl_mobs/effects.lua @@ -5,6 +5,7 @@ local validate_vector = mcl_util.validate_vector local active_particlespawners = {} local disable_blood = minetest.settings:get_bool("mobs_disable_blood") local DEFAULT_FALL_SPEED = -9.81*1.5 +local PI_THIRD = math.pi / 3 -- 60 degrees local PATHFINDING = "gowp" @@ -294,86 +295,66 @@ function mcl_mobs:set_animation(self, anim) self:set_animation(anim) end -local function dir_to_pitch(dir) - --local dir2 = vector.normalize(dir) - local xz = math.abs(dir.x) + math.abs(dir.z) - return -math.atan2(-dir.y, xz) -end - local function who_are_you_looking_at (self, dtime) - local pos = self.object:get_pos() + if self.order == "sleep" then + self._locked_object = nil + return + end - local stop_look_at_player_chance = math.random(833/self.curiosity) -- was 10000 - div by 12 for avg entities as outside loop - - local stop_look_at_player = stop_look_at_player_chance == 1 + local stop_look_at_player = math.random() * 833 <= self.curiosity if self.attack then - if not self.target_time_lost then - self._locked_object = self.attack - else - self._locked_object = nil - end + self._locked_object = not self.target_time_lost and self.attack or nil elseif self.following then self._locked_object = self.following elseif self._locked_object then - if stop_look_at_player then - --minetest.log("Stop look: ".. self.name) - self._locked_object = nil - end + if stop_look_at_player then self._locked_object = nil end elseif not self._locked_object then if mcl_util.check_dtime_timer(self, dtime, "step_look_for_someone", 0.2) then - --minetest.log("Change look check: ".. self.name) - - -- For the wither this was 20/60=0.33, so probably need to rebalance and divide rates. - -- but frequency of check isn't good as it is costly. Making others too infrequent requires testing - local chance = 150/self.curiosity - - if chance < 1 then chance = 1 end - local look_at_player_chance = math.random(chance) - - -- was 5000 but called in loop based on entities. so div by 12 as estimate avg of entities found, - -- then div by 20 as less freq lookup - - local look_at_player = look_at_player_chance == 1 - + local pos = self.object:get_pos() for _, obj in pairs(minetest.get_objects_inside_radius(pos, 8)) do - if obj:is_player() and vector.distance(pos,obj:get_pos()) < 4 then - --minetest.log("Change look to player: ".. self.name) + if obj:is_player() and vector.distance(pos, obj:get_pos()) < 4 then self._locked_object = obj break - elseif obj:is_player() or (obj:get_luaentity() and obj:get_luaentity().name == self.name and self ~= obj:get_luaentity()) then - if look_at_player then - --minetest.log("Change look to mob: ".. self.name) + elseif obj:is_player() or (obj:get_luaentity() and self ~= obj:get_luaentity() and obj:get_luaentity().name == self.name) then + -- For the wither this was 20/60=0.33, so probably need to rebalance and divide rates. + -- but frequency of check isn't good as it is costly. Making others too infrequent requires testing + -- was 5000 but called in loop based on entities. so div by 12 as estimate avg of entities found, + -- then div by 20 as less freq lookup + if math.random() * 150 <= self.curiosity then self._locked_object = obj break end end end end - end end function mob_class:check_head_swivel(dtime) if not self.head_swivel or type(self.head_swivel) ~= "string" then return end + who_are_you_looking_at(self, dtime) - who_are_you_looking_at (self, dtime) + local newr, oldp, oldr = vector.zero(), nil, nil + if self.object.get_bone_override then -- minetest >= 5.9 + local ov = self.object:get_bone_override(self.head_swivel) + oldp, oldr = ov.position.vec, ov.rotation.vec + else -- minetest < 5.9 + oldp, oldr = self.object:get_bone_position(self.head_swivel) + oldr = vector.apply(oldr, math.rad) -- old API uses radians + end - local final_rotation = vector.zero() - local oldp,oldr = self.object:get_bone_position(self.head_swivel) - - if self._locked_object and (self._locked_object:is_player() or self._locked_object:get_luaentity()) and self._locked_object:get_hp() > 0 then + local locked_object = self._locked_object + if locked_object and (locked_object:is_player() or locked_object:get_luaentity()) and locked_object:get_hp() > 0 then local _locked_object_eye_height = 1.5 - if self._locked_object:get_luaentity() then - _locked_object_eye_height = self._locked_object:get_luaentity().head_eye_height - end - if self._locked_object:is_player() then - _locked_object_eye_height = self._locked_object:get_properties().eye_height + if locked_object:is_player() then + _locked_object_eye_height = locked_object:get_properties().eye_height + elseif locked_object:get_luaentity() then + _locked_object_eye_height = locked_object:get_luaentity().head_eye_height end if _locked_object_eye_height then - local self_rot = self.object:get_rotation() -- If a mob is attached, should we really be messing with what they are looking at? -- Should this be excluded? @@ -381,40 +362,48 @@ function mob_class:check_head_swivel(dtime) self_rot = self.object:get_attach():get_rotation() end - local player_pos = self._locked_object:get_pos() - local direction_player = vector.direction(vector.add(self.object:get_pos(), vector.new(0, self.head_eye_height*.7, 0)), vector.add(player_pos, vector.new(0, _locked_object_eye_height, 0))) - local mob_yaw = math.deg(-(-(self_rot.y)-(-minetest.dir_to_yaw(direction_player))))+self.head_yaw_offset - local mob_pitch = math.deg(-dir_to_pitch(direction_player))*self.head_pitch_multiplier + local ps = self.object:get_pos() + ps.y = ps.y + self.head_eye_height * .7 + local pt = locked_object:get_pos() + pt.y = pt.y + _locked_object_eye_height + local dir = vector.direction(ps, pt) + local mob_yaw = self_rot.y + math.atan2(dir.x, dir.z) + self.head_yaw_offset + local mob_pitch = math.asin(-dir.y) * self.head_pitch_multiplier - if (mob_yaw < -60 or mob_yaw > 60) and not (self.attack and self.state == "attack" and not self.runaway) then - final_rotation = vector.multiply(oldr, 0.9) + if (mob_yaw < -PI_THIRD or mob_yaw > PI_THIRD) and not (self.attack and self.state == "attack" and not self.runaway) then + newr = vector.multiply(oldr, 0.9) elseif self.attack and self.state == "attack" and not self.runaway then if self.head_yaw == "y" then - final_rotation = vector.new(mob_pitch, mob_yaw, 0) + newr = vector.new(mob_pitch, mob_yaw, 0) elseif self.head_yaw == "z" then - final_rotation = vector.new(mob_pitch, 0, -mob_yaw) + newr = vector.new(mob_pitch, 0, -mob_yaw) end - else - if self.head_yaw == "y" then - final_rotation = vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, ((mob_yaw-oldr.y)*.3)+oldr.y, 0) + newr = vector.new((mob_pitch-oldr.x)*.3+oldr.x, (mob_yaw-oldr.y)*.3+oldr.y, 0) elseif self.head_yaw == "z" then - final_rotation = vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, 0, -(((mob_yaw-oldr.y)*.3)+oldr.y)*3) + newr = vector.new((mob_pitch-oldr.x)*.3+oldr.x, 0, ((mob_yaw-oldr.y)*.3+oldr.y)*-3) end end end - elseif not self._locked_object and math.abs(oldr.y) > 3 and math.abs(oldr.x) < 3 then - final_rotation = vector.multiply(oldr, 0.9) - else - --final_rotation = vector.new(0,0,0) + elseif not locked_object and math.abs(oldr.y) > 0.05 and math.abs(oldr.x) < 0.05 then + newr = vector.multiply(oldr, 0.9) + end + + -- 0.02 is about 1.14 degrees tolerance, to update less often + local newp = vector.new(0, self.bone_eye_height, self.horizontal_head_height) + if math.abs(oldr.x-newr.x) + math.abs(oldr.y-newr.y) + math.abs(oldr.z-newr.z) < 0.02 and vector.equals(oldp, newp) then return end + if self.object.get_bone_override then -- minetest >= 5.9 + self.object:set_bone_override(self.head_swivel, { + position = { vec = newp, absolute = true }, + rotation = { vec = newr, absolute = true } }) + else -- minetest < 5.9 + -- old API uses degrees not radians + self.object:set_bone_position(self.head_swivel, newp, vector.apply(newr, math.deg)) end - - mcl_util.set_bone_position(self.object,self.head_swivel, vector.new(0,self.bone_eye_height,self.horizontal_head_height), final_rotation) end - function mob_class:set_animation_speed() local v = self.object:get_velocity() if v then diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 81b5fdfe7..b0a7ed9d4 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -141,7 +141,7 @@ function mcl_mobs.register_mob(name, def) local final_def = { use_texture_alpha = def.use_texture_alpha, head_swivel = def.head_swivel or nil, -- bool to activate this function - head_yaw_offset = def.head_yaw_offset or 0, -- for wonkey model bones + head_yaw_offset = math.rad(def.head_yaw_offset or 0), -- for wonkey model bones head_pitch_multiplier = def.head_pitch_multiplier or 1, --for inverted pitch bone_eye_height = def.bone_eye_height or 1.4, -- head bone offset head_eye_height = def.head_eye_height or def.bone_eye_height or 0, -- how hight aproximatly the mobs head is fromm the ground to tell the mob how high to look up at the player @@ -528,7 +528,7 @@ end -- Note: This also introduces the “spawn_egg” group: -- * spawn_egg=1: Spawn egg (generic mob, no metadata) -- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata) -function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addegg, no_creative) +function mcl_mobs.register_egg(mob_id, desc, background_color, overlay_color, addegg, no_creative) local grp = {spawn_egg = 1} @@ -539,7 +539,7 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg local invimg = "(spawn_egg.png^[multiply:" .. background_color ..")^(spawn_egg_overlay.png^[multiply:" .. overlay_color .. ")" if old_spawn_icons then - local mobname = mob:gsub("mobs_mc:","") + local mobname = mob_id:gsub("mobs_mc:","") local fn = "mobs_mc_spawn_icon_"..mobname..".png" if mcl_util.file_exists(minetest.get_modpath("mobs_mc").."/textures/"..fn) then invimg = fn @@ -551,7 +551,7 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg end -- register old stackable mob egg - minetest.register_craftitem(mob, { + minetest.register_craftitem(mob_id, { description = desc, inventory_image = invimg, @@ -561,7 +561,6 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg _doc_items_usagehelp = S("Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns."), on_place = function(itemstack, placer, pointed_thing) - local pos = pointed_thing.above -- am I clicking on something with existing on_rightclick function? @@ -571,11 +570,12 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg return def.on_rightclick(pointed_thing.under, under, placer, itemstack) end + local mob_name = itemstack:get_name() + if pos and within_limits(pos, 0) and not minetest.is_protected(pos, placer:get_player_name()) then local name = placer:get_player_name() local privs = minetest.get_player_privs(name) - if under.name == "mcl_mobspawners:spawner" then if minetest.is_protected(pointed_thing.under, name) then minetest.record_protection_violation(pointed_thing.under, name) @@ -593,7 +593,6 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg --minetest.log("max light: " .. mob_light_lvl[2]) -- Handle egg conversion - local mob_name = itemstack:get_name() local convert_to = (minetest.registered_entities[mob_name] or {})._convert_to if convert_to then mob_name = convert_to end @@ -604,19 +603,24 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg return itemstack end - if not minetest.registered_entities[mob] then + if not minetest.registered_entities[mob_name] then return itemstack end if minetest.settings:get_bool("only_peaceful_mobs", false) - and minetest.registered_entities[mob].type == "monster" then + and minetest.registered_entities[mob_name].type == "monster" then minetest.chat_send_player(name, S("Only peaceful mobs allowed!")) return itemstack end - pos.y = pos.y - 0.5 + pos.y = pos.y - 1 + local mob = mcl_mobs.spawn(pos, mob_name) + if not mob then + pos.y = pos.y + 1 + mob = mcl_mobs.spawn(pos, mob_name) + if not mob then return end + end - local mob = minetest.add_entity(pos, mob) local entityname = itemstack:get_name() minetest.log("action", "Player " ..name.." spawned "..entityname.." at "..minetest.pos_to_string(pos)) local ent = mob:get_luaentity() @@ -647,5 +651,4 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg return itemstack end, }) - end diff --git a/mods/ENTITIES/mcl_mobs/movement.lua b/mods/ENTITIES/mcl_mobs/movement.lua index ff9a38f56..dc4dcd272 100644 --- a/mods/ENTITIES/mcl_mobs/movement.lua +++ b/mods/ENTITIES/mcl_mobs/movement.lua @@ -362,7 +362,7 @@ function mob_class:env_danger_movement_checks(player_in_active_range) self.state = "stand" self:set_animation( "stand") end - yaw = yaw + math.random(-0.5, 0.5) + yaw = yaw + math.random() - 0.5 yaw = self:set_yaw( yaw, 8) return end @@ -788,9 +788,9 @@ function mob_class:flop() if self.object:get_velocity().y < 0.1 then self:mob_sound("flop") self.object:set_velocity({ - x = math.random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED), + x = (math.random()-0.5) * 2 * FLOP_HOR_SPEED, y = FLOP_HEIGHT, - z = math.random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED), + z = (math.random()-0.5) * 2 * FLOP_HOR_SPEED, }) end end @@ -920,7 +920,7 @@ function mob_class:do_states_walk() -- Randomly turn if math.random(1, 100) <= 30 then - yaw = yaw + math.random(-0.5, 0.5) + yaw = yaw + math.random() - 0.5 yaw = self:set_yaw( yaw, 8) end end @@ -929,7 +929,7 @@ function mob_class:do_states_walk() -- otherwise randomly turn elseif math.random(1, 100) <= 30 then - yaw = yaw + math.random(-0.5, 0.5) + yaw = yaw + math.random() - 0.5 yaw = self:set_yaw( yaw, 8) end @@ -989,7 +989,7 @@ function mob_class:do_states_stand(player_in_active_range) if lp.x > s.x then yaw = yaw +math.pi end else - yaw = yaw + math.random(-0.5, 0.5) + yaw = yaw + math.random() - 0.5 end yaw = self:set_yaw( yaw, 8) diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 73aefb509..441156a1d 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -692,14 +692,10 @@ function mob_class:do_env_damage() local nodef3 = minetest.registered_nodes[self.standing_under] -- rain - if self.rain_damage > 0 then - if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then - self.health = self.health - self.rain_damage - - if self:check_for_death("rain", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end + if self.rain_damage > 0 and mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then + self.health = self.health - self.rain_damage + if self:check_for_death("rain", {type = "environment", pos = pos, node = self.standing_in}) then + return true end end @@ -707,14 +703,10 @@ function mob_class:do_env_damage() -- water damage if self.water_damage > 0 and nodef.groups.water then - if self.water_damage ~= 0 then - self.health = self.health - self.water_damage - mcl_mobs.effect(pos, 5, "mcl_particles_smoke.png", nil, nil, 1, nil) - - if self:check_for_death("water", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end + self.health = self.health - self.water_damage + mcl_mobs.effect(pos, 5, "mcl_particles_smoke.png", nil, nil, 1, nil) + if self:check_for_death("water", {type = "environment", pos = pos, node = self.standing_in}) then + return true end elseif self.lava_damage > 0 and (nodef.groups.lava) then -- lava damage @@ -730,91 +722,69 @@ function mob_class:do_env_damage() end elseif self.fire_damage > 0 and (nodef2.groups.fire) then -- magma damage - if self.fire_damage ~= 0 then - self.health = self.health - self.fire_damage - - if self:check_for_death("fire", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end + self.health = self.health - self.fire_damage + if self:check_for_death("fire", {type = "environment", pos = pos, node = self.standing_in}) then + return true end elseif self.fire_damage > 0 and (nodef.groups.fire) then -- fire damage - if self.fire_damage ~= 0 then - self.health = self.health - self.fire_damage - mcl_mobs.effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil) - mcl_burning.set_on_fire(self.object, 5) - - if self:check_for_death("fire", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end + self.health = self.health - self.fire_damage + mcl_mobs.effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil) + mcl_burning.set_on_fire(self.object, 5) + if self:check_for_death("fire", {type = "environment", pos = pos, node = self.standing_in}) then + return true end elseif nodef.damage_per_second ~= 0 and not nodef.groups.lava and not nodef.groups.fire then -- damage_per_second node check self.health = self.health - nodef.damage_per_second mcl_mobs.effect(pos, 5, "mcl_particles_smoke.png") - - if self:check_for_death("dps", {type = "environment", - pos = pos, node = self.standing_in}) then + if self:check_for_death("dps", {type = "environment", pos = pos, node = self.standing_in}) then return true end end -- Cactus damage - local near = minetest.find_node_near(pos, 1, "mcl_core:cactus", true) - if not near and near ~= nil then - near = find_node_near({x=pos.x, y=pos.y-1, z=pos.z}, 1, "mcl_core:cactus", true) - end - if near then - -- is mob touching the cactus? - local dist = vector.distance(pos, near) - local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near) - local large_mob = false - local medium_mob = false - if self.name == "mobs_mc:ender_dragon" or - self.name == "mobs_mc:ghast" or - self.name == "mobs_mc:guardian_elder" or - self.name == "mobs_mc:slime_big" or - self.name == "mobs_mc:magma_cube_big" or - self.name == "mobs_mc:wither" then - - large_mob = true - elseif self.name == "mobs_mc:hoglin" or - self.name == "mobs_mc:zoglin" or - self.name == "mobs_mc:horse" or - self.name == "mobs_mc:skeleton_horse" or - self.name == "mobs_mc:zombie_horse" or - self.name == "mobs_mc:donkey" or - self.name == "mobs_mc:mule" or - self.name == "mobs_mc:iron_golem" or - self.name == "mobs_mc:polar_bear" or - self.name == "mobs_mc:spider" or - self.name == "mobs_mc:cave_spider" or - self.name == "mobs_mc:strider" then - - medium_mob = true + if self.standing_on == "mcl_core:cactus" or self.standing_in == "mcl_core:cactus" or self.standing_under == "mcl_core:cactus" then + self:damage_mob("cactus", 2) + if self:check_for_death("cactus", {type = "environment", pos = pos, node = self.standing_in}) then + return true end - if (not large_mob and not medium_mob and (dist < 1.03 or dist_feet < 1.6)) or (medium_mob and (dist < 1.165 or dist_feet < 1.73)) or (large_mob and (dist < 1.25 or dist_feet < 1.9)) then - if self.health ~= 0 then + else + local near = minetest.find_node_near(pos, 1, "mcl_core:cactus") + if near then + -- is mob touching the cactus? + local dist = vector.distance(pos, near) + local threshold = 1.04 -- small mobs + -- medium mobs + if self.name == "mobs_mc:spider" or + self.name == "mobs_mc:iron_golem" or + self.name == "mobs_mc:horse" or + self.name == "mobs_mc:donkey" or + self.name == "mobs_mc:mule" or + self.name == "mobs_mc:polar_bear" or + self.name == "mobs_mc:cave_spider" or + self.name == "mobs_mc:skeleton_horse" or + self.name == "mobs_mc:zombie_horse" or + self.name == "mobs_mc:strider" or + self.name == "mobs_mc:hoglin" or + self.name == "mobs_mc:zoglin" then + threshold = 1.165 + elseif self.name == "mobs_mc:slime_big" or + self.name == "mobs_mc:magma_cube_big" or + self.name == "mobs_mc:ghast" or + self.name == "mobs_mc:guardian_elder" or + self.name == "mobs_mc:wither" or + self.name == "mobs_mc:ender_dragon" then + threshold = 1.25 + end + if dist < threshold then self:damage_mob("cactus", 2) - - if self:check_for_death("cactus", {type = "environment", - pos = pos, node = self.standing_in}) then + if self:check_for_death("cactus", {type = "environment", pos = pos, node = self.standing_in}) then return true end end end end - -- is mob standing on the cactus? - if self.standing_on == "mcl_core:cactus" or self.standing_in == "mcl_core:cactus" or self.standing_under == "mcl_core:cactus" then - self:damage_mob("cactus", 2) - - if self:check_for_death("cactus", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end - end -- Drowning damage if self.breath_max ~= -1 then @@ -957,8 +927,7 @@ end -- falling and fall damage -- returns true if mob died -function mob_class:falling(pos) - +function mob_class:falling(pos, moveresult) if self.fly and self.state ~= "die" then return end @@ -981,7 +950,13 @@ function mob_class:falling(pos) new_acceleration = vector.new(0, DEFAULT_FALL_SPEED, 0) elseif v.y <= 0 and v.y > self.fall_speed then -- fall downwards at set speed - new_acceleration = vector.new(0, self.fall_speed, 0) + if moveresult and moveresult.touching_ground then + -- when touching ground, retain a minimal gravity to keep the touching_ground flag + -- but also to not get upwards acceleration with large dtime when on bouncy ground + new_acceleration = vector.new(0, self.fall_speed * 0.01, 0) + else + new_acceleration = vector.new(0, self.fall_speed, 0) + end else -- stop accelerating once max fall speed hit new_acceleration =vector.zero() diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index b0b63ff39..8436540bf 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -10,12 +10,12 @@ local overworld_sky_threshold = tonumber(minetest.settings:get("mcl_mobs_overwor local overworld_passive_threshold = tonumber(minetest.settings:get("mcl_mobs_overworld_passive_threshold")) or 7 local get_node = minetest.get_node -local get_item_group = minetest.get_item_group local get_node_light = minetest.get_node_light local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air local mt_get_biome_name = minetest.get_biome_name local get_objects_inside_radius = minetest.get_objects_inside_radius local get_connected_players = minetest.get_connected_players +local registered_nodes = minetest.registered_nodes local math_min = math.min local math_max = math.max @@ -25,6 +25,7 @@ local math_ceil = math.ceil local math_cos = math.cos local math_sin = math.sin local math_sqrt = math.sqrt +local math_abs = math.abs local vector_distance = vector.distance local vector_new = vector.new @@ -35,18 +36,14 @@ local table_remove = table.remove local pairs = pairs local logging = minetest.settings:get_bool("mcl_logging_mobs_spawn", false) -local function mcl_log (message, property) - if logging then - if property then - message = message .. ": " .. dump(property) - end - mcl_util.mcl_log (message, "[Mobs spawn]", true) - end +local function mcl_log(message, property) + if property then message = message .. ": " .. dump(property) end + mcl_util.mcl_log(message, "[Mobs spawn]", true) end +if not logging then mcl_log = function() end end local dbg_spawn_attempts = 0 local dbg_spawn_succ = 0 -local dbg_spawn_counts = {} local remove_far = true @@ -99,169 +96,6 @@ mcl_log("Percentage of hostile spawns are group: " .. hostile_group_percentage_s local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false --- THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs --- Also used for missing parameter --- Please update the list when adding new biomes! - -local list_of_all_biomes = { - - -- underground: - - "FlowerForest_underground", - "JungleEdge_underground", - "ColdTaiga_underground", - "IcePlains_underground", - "IcePlainsSpikes_underground", - "MegaTaiga_underground", - "Taiga_underground", - "ExtremeHills+_underground", - "JungleM_underground", - "ExtremeHillsM_underground", - "JungleEdgeM_underground", - "MangroveSwamp_underground", - - -- ocean: - - "RoofedForest_ocean", - "JungleEdgeM_ocean", - "BirchForestM_ocean", - "BirchForest_ocean", - "IcePlains_deep_ocean", - "Jungle_deep_ocean", - "Savanna_ocean", - "MesaPlateauF_ocean", - "ExtremeHillsM_deep_ocean", - "Savanna_deep_ocean", - "SunflowerPlains_ocean", - "Swampland_deep_ocean", - "Swampland_ocean", - "MegaSpruceTaiga_deep_ocean", - "ExtremeHillsM_ocean", - "JungleEdgeM_deep_ocean", - "SunflowerPlains_deep_ocean", - "BirchForest_deep_ocean", - "IcePlainsSpikes_ocean", - "Mesa_ocean", - "StoneBeach_ocean", - "Plains_deep_ocean", - "JungleEdge_deep_ocean", - "SavannaM_deep_ocean", - "Desert_deep_ocean", - "Mesa_deep_ocean", - "ColdTaiga_deep_ocean", - "Plains_ocean", - "MesaPlateauFM_ocean", - "Forest_deep_ocean", - "JungleM_deep_ocean", - "FlowerForest_deep_ocean", - "MushroomIsland_ocean", - "MegaTaiga_ocean", - "StoneBeach_deep_ocean", - "IcePlainsSpikes_deep_ocean", - "ColdTaiga_ocean", - "SavannaM_ocean", - "MesaPlateauF_deep_ocean", - "MesaBryce_deep_ocean", - "ExtremeHills+_deep_ocean", - "ExtremeHills_ocean", - "MushroomIsland_deep_ocean", - "Forest_ocean", - "MegaTaiga_deep_ocean", - "JungleEdge_ocean", - "MesaBryce_ocean", - "MegaSpruceTaiga_ocean", - "ExtremeHills+_ocean", - "Jungle_ocean", - "RoofedForest_deep_ocean", - "IcePlains_ocean", - "FlowerForest_ocean", - "ExtremeHills_deep_ocean", - "MesaPlateauFM_deep_ocean", - "Desert_ocean", - "Taiga_ocean", - "BirchForestM_deep_ocean", - "Taiga_deep_ocean", - "JungleM_ocean", - "MangroveSwamp_ocean", - "MangroveSwamp_deep_ocean", - - -- water or beach? - - "MesaPlateauFM_sandlevel", - "MesaPlateauF_sandlevel", - "MesaBryce_sandlevel", - "Mesa_sandlevel", - - -- beach: - - "FlowerForest_beach", - "Forest_beach", - "StoneBeach", - "ColdTaiga_beach_water", - "Taiga_beach", - "Savanna_beach", - "Plains_beach", - "ExtremeHills_beach", - "ColdTaiga_beach", - "Swampland_shore", - "MushroomIslandShore", - "JungleM_shore", - "Jungle_shore", - "BambooJungleM_shore", - "BambooJungle_shore", - "MangroveSwamp_shore", - - -- dimension biome: - - "Nether", - "BasaltDelta", - "CrimsonForest", - "WarpedForest", - "SoulsandValley", - "End", - - -- Overworld regular: - - "Mesa", - "FlowerForest", - "Swampland", - "Taiga", - "ExtremeHills", - "ExtremeHillsM", - "ExtremeHills+_snowtop", - "Jungle", - "Savanna", - "BirchForest", - "MegaSpruceTaiga", - "MegaTaiga", - "ExtremeHills+", - "Forest", - "Plains", - "Desert", - "ColdTaiga", - "MushroomIsland", - "IcePlainsSpikes", - "SunflowerPlains", - "IcePlains", - "RoofedForest", - "ExtremeHills+_snowtop", - "MesaPlateauFM_grasstop", - "JungleEdgeM", - "JungleM", - "BirchForestM", - "MesaPlateauF", - "MesaPlateauFM", - "MesaPlateauF_grasstop", - "MesaBryce", - "JungleEdge", - "SavannaM", - "MangroveSwamp", - "BambooJungle", - "BambooJungleEdge", - "BambooJungleEdgeM", - "BambooJungleM", -} - -- count how many mobs are in an area local function count_mobs(pos,r,mob_type) local num = 0 @@ -289,11 +123,7 @@ local function count_mobs_total(mob_type) end local function count_mobs_add_entry (mobs_list, mob_cat) - if mobs_list[mob_cat] then - mobs_list[mob_cat] = mobs_list[mob_cat] + 1 - else - mobs_list[mob_cat] = 1 - end + mobs_list[mob_cat] = (mobs_list[mob_cat] or 0) + 1 end --categorise_by can be name or type or spawn_class @@ -452,7 +282,7 @@ function mcl_mobs:spawn_setup(def) local dimension = def.dimension or "overworld" local type_of_spawning = def.type_of_spawning or "ground" - local biomes = def.biomes or list_of_all_biomes + local biomes = def.biomes or nil local min_light = def.min_light or 0 local max_light = def.max_light or (minetest.LIGHT_MAX + 1) local chance = def.chance or 1000 @@ -619,14 +449,14 @@ local function get_next_mob_spawn_pos(pos) xoff, yoff, zoff = xoff * dd, yoff * dd, zoff * dd local goal_pos = vector.offset(pos, xoff, yoff, zoff) - if not ( math.abs(goal_pos.x) <= SPAWN_MAPGEN_LIMIT and math.abs(goal_pos.y) <= SPAWN_MAPGEN_LIMIT and math.abs(goal_pos.z) <= SPAWN_MAPGEN_LIMIT ) then + if not (math_abs(goal_pos.x) <= SPAWN_MAPGEN_LIMIT and math_abs(goal_pos.y) <= SPAWN_MAPGEN_LIMIT and math_abs(goal_pos.z) <= SPAWN_MAPGEN_LIMIT) then mcl_log("Pos outside mapgen limits: " .. minetest.pos_to_string(goal_pos)) return nil end -- Calculate upper/lower y limits local d2 = xoff*xoff + zoff*zoff -- squared distance in x,z plane only - local y1 = math_sqrt( MOB_SPAWN_ZONE_OUTER_SQ - d2 ) -- absolue value of distance to outer sphere + local y1 = math_sqrt(MOB_SPAWN_ZONE_OUTER_SQ - d2) -- absolue value of distance to outer sphere local y_min, y_max if d2 >= MOB_SPAWN_ZONE_INNER_SQ then @@ -635,7 +465,7 @@ local function get_next_mob_spawn_pos(pos) y_max = pos.y + y1 else -- Inner region, y range spans between inner and outer spheres - local y2 = math_sqrt( MOB_SPAWN_ZONE_INNER_SQ - d2 ) + local y2 = math_sqrt(MOB_SPAWN_ZONE_INNER_SQ - d2) if goal_pos.y > pos.y then -- Upper hemisphere y_min = pos.y + y2 @@ -680,12 +510,12 @@ end --a simple helper function for mob_spawn local function biome_check(biome_list, biome_goal) + if not biome_goal then return false end for _, data in pairs(biome_list) do if data == biome_goal then return true end end - return false end @@ -700,8 +530,8 @@ local function get_water_spawn(p) end end -local function has_room(self,pos) - local cb = self.collisionbox +local function has_room(self, pos) + local cb = self.spawnbox or self.collisionbox local nodes = {} if self.fly_in then local t = type(self.fly_in) @@ -712,18 +542,74 @@ local function has_room(self,pos) end end table.insert(nodes,"air") - local x = cb[4] - cb[1] - local y = cb[5] - cb[2] - local z = cb[6] - cb[3] - local r = math.ceil(x * y * z) - local p1 = vector.offset(pos,cb[1],cb[2],cb[3]) - local p2 = vector.offset(pos,cb[4],cb[5],cb[6]) - local n = #minetest.find_nodes_in_area(p1,p2,nodes) or 0 - if r > n then - minetest.log("warning","[mcl_mobs] No room for mob "..self.name.." at "..minetest.pos_to_string(vector.round(pos))) - return false + + -- Calculate area to check for room + local cb_height = cb[5] - cb[2] + local p1 = vector.new( + math.round(pos.x + cb[1]), + math.floor(pos.y), + math.round(pos.z + cb[3])) + local p2 = vector.new( + math.round(pos.x + cb[4]), + math.ceil(p1.y + cb_height) - 1, + math.round(pos.z + cb[6])) + + -- Check if the entire spawn volume is free + local dx = p2.x - p1.x + 1 + local dy = p2.y - p1.y + 1 + local dz = p2.z - p1.z + 1 + local found_nodes = minetest.find_nodes_in_area(p1,p2,nodes) or 0 + local n = #found_nodes + if n == dx * dy * dz then + return true end - return true + + -- If we don't have an implementation of get_node_boxes, we can't check for sub-node space + if not minetest.get_node_boxes then return false end + + -- Check if it's possible for a sub-node space check to succeed + local needed_in_bottom_section = dx * ( dy - 1) * dz + if n < needed_in_bottom_section then return false end + + -- Make sure the entire volume except for the top level is free before checking the top layer + if dy > 1 then + -- Remove nodes in the top layer from the count + for i = 1,#found_nodes do + if found_nodes[i].y == p2.y then + n = n - 1 + end + end + + -- If the entire volume except the top layer isn't air (or nodes) then we can't spawn this mob here + if n < needed_in_bottom_section then return false end + end + + -- Check the top layer to see if we have enough space to spawn in + local top_layer_height = 1 + local processed = {} + for x = p1.x,p2.x do + for z = p1.z,p2.z do + local test_pos = vector.new(x,p2.y,z) + local node = minetest.get_node(test_pos) or { name = "ignore" } + local cache_name = string.format("%s-%d", node.name, node.param2) + if not processed[cache_name] then + -- Calculate node bounding box and select the lowest y value + local boxes = minetest.get_node_boxes("collision_box", test_pos, node) + for i = 1,#boxes do + local box = boxes[i] + local y_test = box[2] + 0.5 + if y_test < top_layer_height then top_layer_height = y_test end + + local y_test = box[5] + 0.5 + if y_test < top_layer_height then top_layer_height = y_test end + end + end + end + end + if top_layer_height + dy - 1 >= cb_height then return true end + + -- We don't have room + return false end mcl_mobs.custom_biomecheck = nil @@ -732,119 +618,92 @@ function mcl_mobs.register_custom_biomecheck(custom_biomecheck) mcl_mobs.custom_biomecheck = custom_biomecheck end - local function get_biome_name(pos) - if mcl_mobs.custom_biomecheck then - return mcl_mobs.custom_biomecheck (pos) - else - local gotten_biome = minetest.get_biome_data(pos) - - if not gotten_biome then - return - end - - gotten_biome = mt_get_biome_name(gotten_biome.biome) - --minetest.log ("biome: " .. dump(gotten_biome)) - - return gotten_biome - end + if mcl_mobs.custom_biomecheck then return mcl_mobs.custom_biomecheck(pos) end + local gotten_biome = minetest.get_biome_data(pos) + return gotten_biome and mt_get_biome_name(gotten_biome.biome) end local function spawn_check(pos, spawn_def) if not spawn_def or not pos then return end - dbg_spawn_attempts = dbg_spawn_attempts + 1 + local dimension = mcl_worlds.pos_to_dimension(pos) - local mob_def = minetest.registered_entities[spawn_def.name] - local mob_type = mob_def.type - local gotten_node = get_node(pos).name - if not gotten_node then return end - - local biome_name = get_biome_name(pos) - if not biome_name then return end - - local is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0 - if not is_ground then + if spawn_def.dimension ~= dimension then return end -- wrong dimension + -- find ground node below spawn position + local node_name = get_node(pos).name + local node_def = registered_nodes[node_name] + if node_def and not node_def.groups.solid then -- try node one below instead pos.y = pos.y - 1 - gotten_node = get_node(pos).name - is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0 + node_name = get_node(pos).name + node_def = registered_nodes[node_name] end + if not node_def or not node_def.groups then return end + -- do not spawn on bedrock + if node_name == "mcl_core:bedrock" then return end pos.y = pos.y + 1 - local is_water = get_item_group(gotten_node, "water") ~= 0 - local is_lava = get_item_group(gotten_node, "lava") ~= 0 - local is_leaf = get_item_group(gotten_node, "leaves") ~= 0 - local is_bedrock = gotten_node == "mcl_core:bedrock" - local is_grass = minetest.get_item_group(gotten_node,"grass_block") ~= 0 + -- check spawn height + if pos.y < spawn_def.min_height or pos.y > spawn_def.max_height then return end + mcl_log("spawn_check#1 position checks passed") - if pos.y >= spawn_def.min_height - and pos.y <= spawn_def.max_height - and spawn_def.dimension == dimension - and biome_check(spawn_def.biomes, biome_name) then + -- do not spawn ground mobs on leaves + if spawn_def.type_of_spawning == "ground" and (not node_def.groups.solid or node_def.groups.leaves) then return end + -- water mobs only on water + if spawn_def.type_of_spawning == "water" and not node_def.groups.water then return end + -- lava mobs only on lava + if spawn_def.type_of_spawning == "lava" and not node_def.groups.lava then return end + -- farm animals on grass only + if is_farm_animal(spawn_def.name) and not node_def.groups.grass_block then return end - mcl_log("Spawn level 1 check - Passed") - if (is_ground or spawn_def.type_of_spawning ~= "ground") - and (spawn_def.type_of_spawning ~= "ground" or not is_leaf) - and (not is_farm_animal(spawn_def.name) or is_grass) - and (spawn_def.type_of_spawning ~= "water" or is_water) - and not is_bedrock - and has_room(mob_def,pos) - and (spawn_def.check_position and spawn_def.check_position(pos) or spawn_def.check_position == nil) - and ( not spawn_protected or not minetest.is_protected(pos, "") ) then + ---- More expensive calls: + -- check the biome + if spawn_def.biomes and not biome_check(spawn_def.biomes, get_biome_name(pos)) then return end + -- check if there is enough room + local mob_def = minetest.registered_entities[spawn_def.name] + if not has_room(mob_def,pos) then return end + -- additional checks (slime etc.) + if spawn_def.check_position and not spawn_def.check_position(pos) then return end + if spawn_protected and minetest.is_protected(pos, "") then return end + mcl_log("spawn_check#2 advanced checks passed") - mcl_log("Spawn level 2 check - Passed") - local gotten_light = get_node_light(pos) + -- check light thresholds + local gotten_light = get_node_light(pos) + -- old lighting + if not modern_lighting then return gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light end - if modern_lighting then - local my_node = get_node(pos) - local sky_light = minetest.get_natural_light(pos) - local art_light = minetest.get_artificial_light(my_node.param1) - - if mob_def.spawn_check then - return mob_def.spawn_check(pos, gotten_light, art_light, sky_light) - elseif mob_type == "monster" then - if dimension == "nether" then - if art_light <= nether_threshold then - return true - end - elseif dimension == "end" then - if art_light <= end_threshold then - return true - end - elseif dimension == "overworld" then - if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then - return true - end - end - else - -- passive threshold is apparently the same in all dimensions ... - if gotten_light > overworld_passive_threshold then - return true - end - end - else - if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then - return true - end + local sky_light = minetest.get_natural_light(pos) + local art_light = minetest.get_artificial_light(get_node(pos).param1) + if mob_def.spawn_check then + return mob_def.spawn_check(pos, gotten_light, art_light, sky_light) + end + if mob_def.type == "monster" then + if dimension == "nether" then + if art_light <= nether_threshold then + return true + end + elseif dimension == "end" then + if art_light <= end_threshold then + return true + end + elseif dimension == "overworld" then + if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then + return true end end + return false end - return false + -- passive threshold is apparently the same in all dimensions ... + return gotten_light > overworld_passive_threshold end function mcl_mobs.spawn(pos,id) + if not pos or not id then return false end local def = minetest.registered_entities[id] or minetest.registered_entities["mobs_mc:"..id] or minetest.registered_entities["extra_mobs:"..id] - if not def or (def.can_spawn and not def.can_spawn(pos)) or not def.is_mob then - return false - end - if not dbg_spawn_counts[def.name] then - dbg_spawn_counts[def.name] = 1 - else - dbg_spawn_counts[def.name] = dbg_spawn_counts[def.name] + 1 - end + if not def or not def.is_mob or (def.can_spawn and not def.can_spawn(pos)) then return false end + if not has_room(def, pos) then return false end return minetest.add_entity(pos, def.name) end - local function spawn_group(p,mob,spawn_on,amount_to_spawn) local nn= minetest.find_nodes_in_area_under_air(vector.offset(p,-5,-3,-5),vector.offset(p,5,3,5),spawn_on) local o @@ -1238,7 +1097,6 @@ end minetest.register_chatcommand("mobstats",{ privs = { debug = true }, func = function(n,param) - --minetest.chat_send_player(n,dump(dbg_spawn_counts)) local pos = minetest.get_player_by_name(n):get_pos() minetest.chat_send_player(n,"mobs: within 32 radius of player/total loaded :"..count_mobs(pos,MOB_CAP_INNER_RADIUS) .. "/" .. count_mobs_total()) minetest.chat_send_player(n,"spawning attempts since server start:" .. dbg_spawn_succ .. "/" .. dbg_spawn_attempts) diff --git a/mods/ENTITIES/mobs_mc/axolotl.lua b/mods/ENTITIES/mobs_mc/axolotl.lua index a30f8ffe1..5f5a90764 100644 --- a/mods/ENTITIES/mobs_mc/axolotl.lua +++ b/mods/ENTITIES/mobs_mc/axolotl.lua @@ -72,18 +72,24 @@ local axolotl = { fly = true, fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, breathes_in_water = true, - jump = true, + jump = false, -- would get them out of the water too often damage = 2, reach = 2, attack_type = "dogfight", attack_animals = true, specific_attack = { - "extra_mobs_cod", - "extra_mobs_glow_squid", - "extra_mobs_salmon", - "extra_mobs_tropical_fish", - "mobs_mc_squid" - }, + "mobs_mc:cod", + "mobs_mc:glow_squid", + "mobs_mc:salmon", + "mobs_mc:tropical_fish", + "mobs_mc:squid", + "mobs_mc:zombie", -- todo: only drowned? + "mobs_mc:baby_zombie", + "mobs_mc:husk", + "mobs_mc:baby_husk", + "mobs_mc:guardian_elder", + "mobs_mc:guardian", + }, runaway = true, } diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index bbc47df94..f5dd40470 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -95,8 +95,8 @@ mcl_mobs.register_mob("mobs_mc:blaze", { end local pos = self.object:get_pos() minetest.add_particle({ - pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2}, - velocity = {x=0, y=math.random(1,1), z=0}, + pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()}, + velocity = {x=0, y=1, z=0}, expirationtime = math.random(), size = math.random(1, 4), collisiondetection = true, @@ -110,8 +110,8 @@ mcl_mobs.register_mob("mobs_mc:blaze", { }, }) minetest.add_particle({ - pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2}, - velocity = {x=0, y=math.random(1,1), z=0}, + pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()}, + velocity = {x=0, y=1, z=0}, expirationtime = math.random(), size = math.random(1, 4), collisiondetection = true, @@ -125,8 +125,8 @@ mcl_mobs.register_mob("mobs_mc:blaze", { }, }) minetest.add_particle({ - pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2}, - velocity = {x=0, y=math.random(1,1), z=0}, + pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()}, + velocity = {x=0, y=1, z=0}, expirationtime = math.random(), size = math.random(1, 4), collisiondetection = true, diff --git a/mods/ENTITIES/mobs_mc/cod.lua b/mods/ENTITIES/mobs_mc/cod.lua index a2aa2eadf..fba769694 100644 --- a/mods/ENTITIES/mobs_mc/cod.lua +++ b/mods/ENTITIES/mobs_mc/cod.lua @@ -84,7 +84,7 @@ local cod = { self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0)) if minetest.get_item_group(self.standing_in, "water") ~= 0 then if self.object:get_velocity().y < 5 then - self.object:add_velocity({ x = 0 , y = math.random(-.007, .007), z = 0 }) + self.object:add_velocity({ x = 0 , y = math.random()*.014-.007, z = 0 }) end end --]] diff --git a/mods/ENTITIES/mobs_mc/dolphin.lua b/mods/ENTITIES/mobs_mc/dolphin.lua index 0db7647b9..45753ff7f 100644 --- a/mods/ENTITIES/mobs_mc/dolphin.lua +++ b/mods/ENTITIES/mobs_mc/dolphin.lua @@ -81,16 +81,16 @@ local dolphin = { reach = 2, damage = 2.5, attack_type = "dogfight", + --[[ this is supposed to make them jump out the water but doesn't appear to work very well do_custom = function(self,dtime) - --[[ this is supposed to make them jump out the water but doesn't appear to work very well self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0)) if minetest.get_item_group(self.standing_in, "water") ~= 0 then if self.object:get_velocity().y < 5 then - self.object:add_velocity({ x = 0 , y = math.random(-.007, .007), z = 0 }) + self.object:add_velocity({ x = 0 , y = math.random()*.014-.007, z = 0 }) end end - --]] end, + --]] } mcl_mobs.register_mob("mobs_mc:dolphin", dolphin) diff --git a/mods/ENTITIES/mobs_mc/mod.conf b/mods/ENTITIES/mobs_mc/mod.conf index ec7446505..f90989d1a 100644 --- a/mods/ENTITIES/mobs_mc/mod.conf +++ b/mods/ENTITIES/mobs_mc/mod.conf @@ -1,5 +1,5 @@ name = mobs_mc author = maikerumine description = Adds Minecraft-like monsters and animals. -depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util +depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util, mcl_entity_invs optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, doc_items, mcl_worlds diff --git a/mods/ENTITIES/mobs_mc/piglin.lua b/mods/ENTITIES/mobs_mc/piglin.lua index e81782b1c..8062e2da6 100644 --- a/mods/ENTITIES/mobs_mc/piglin.lua +++ b/mods/ENTITIES/mobs_mc/piglin.lua @@ -360,7 +360,7 @@ piglin_brute.xp_min = 20 piglin_brute.xp_max = 20 piglin_brute.hp_min = 50 piglin_brute.hp_max = 50 -piglin_brute.fire_resistant = 1 +piglin_brute.fire_resistant = false piglin_brute.do_custom = function() return end @@ -371,8 +371,8 @@ piglin_brute.on_rightclick = function() return end piglin_brute.attacks_monsters = true -piglin_brute.lava_damage = 0 -piglin_brute.fire_damage = 0 +piglin_brute.lava_damage = 4 +piglin_brute.fire_damage = 2 piglin_brute.attack_animals = true piglin_brute.mesh = "extra_mobs_sword_piglin.b3d" piglin_brute.textures = {"extra_mobs_piglin_brute.png", "default_tool_goldaxe.png", "extra_mobs_trans.png"} diff --git a/mods/ENTITIES/mobs_mc/salmon.lua b/mods/ENTITIES/mobs_mc/salmon.lua index 47a1a5028..c029c0b03 100644 --- a/mods/ENTITIES/mobs_mc/salmon.lua +++ b/mods/ENTITIES/mobs_mc/salmon.lua @@ -52,7 +52,7 @@ local salmon = { makes_footstep_sound = false, swim = true, fly = true, - fly_in = "mcl_core:water_source", + fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, breathes_in_water = true, jump = false, view_range = 16, diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index 8ea4d9ced..711c11091 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -103,6 +103,7 @@ local skeleton = { return true end, ignited_by_sunlight = true, + floats = 0, view_range = 16, fear_height = 4, attack_type = "dogshoot", diff --git a/mods/ENTITIES/mobs_mc/skeleton_wither.lua b/mods/ENTITIES/mobs_mc/skeleton_wither.lua index b01fb4b96..331b4fd06 100644 --- a/mods/ENTITIES/mobs_mc/skeleton_wither.lua +++ b/mods/ENTITIES/mobs_mc/skeleton_wither.lua @@ -94,6 +94,7 @@ mcl_mobs.register_mob("mobs_mc:witherskeleton", { dogshoot_switch = 1, dogshoot_count_max =0.5, fear_height = 4, + floats = 0, harmed_by_heal = true, fire_resistant = true, dealt_effect = { diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index d56b6e2a2..57eb5a859 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -1,112 +1,31 @@ --License for code WTFPL and otherwise stated in readmes local S = minetest.get_translator("mobs_mc") -local MAPBLOCK_SIZE = 16 - -local seed = minetest.get_mapgen_setting("seed") - -local slime_chunk_match +local MAPBLOCK_SIZE = 16 -- size for slime chunk logic +local SEED_OFFSET = 362 -- module specific seed +local world_seed = (minetest.get_mapgen_setting("seed") + SEED_OFFSET) % 4294967296 +-- slime density, where default N=10 is every 10th chunk +local slime_ratio = tonumber(minetest.settings:get("slime_ratio")) or 10 +-- use 3D chunking instead of 2d chunks +local slime_3d_chunks = minetest.settings:get_bool("slime_3d_chunks", false) +-- maximum light level, for slimes in caves only, not magma/swamps +local slime_max_light = (tonumber(minetest.settings:get("slime_max_light")) or minetest.LIGHT_MAX) + 1 +-- maximum light level for swamp spawning +local swamp_light_max = 7 +-- maximum height to spawn in slime chunks local slime_chunk_spawn_max = mcl_worlds.layer_to_y(40) -local x_modifier -local z_modifier -local function split_by_char (inputstr, sep, limit) - if sep == nil then - sep = "%d" - end - local t = {} - - local i = 0 - for str in string.gmatch(inputstr, "(["..sep.."])") do - i = i --+ 1 - table.insert(t, tonumber(str)) - if limit and i >= limit then - break - end - end - return t -end - ---Seed: "16002933932875202103" == random seed ---Seed: "1807191622654296300" == cheese ---Seed: "1" = 1 -local function process_seed (seed) - --minetest.log("seed: " .. seed) - - local split_chars = split_by_char(tostring(seed), nil, 10) - - slime_chunk_match = split_chars[1] - x_modifier = split_chars[2] - z_modifier = split_chars[3] - - --minetest.log("x_modifier: " .. tostring(x_modifier)) - --minetest.log("z_modifier: " .. tostring(z_modifier)) - --minetest.log("slime_chunk_match: " .. tostring(slime_chunk_match)) -end - -local processed = process_seed (seed) - - -local function convert_to_chunk_value (co_ord, modifier) - local converted = math.floor(math.abs(co_ord) / MAPBLOCK_SIZE) - - if modifier then - converted = (converted + modifier) - end - converted = converted % 10 - - --minetest.log("co_ord: " .. co_ord) - --minetest.log("converted: " .. converted) - return converted -end - -assert(convert_to_chunk_value(-16) == 1, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(-15) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(-1) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(0) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(1) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(15) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(16) == 1, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(31) == 1, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(32) == 2, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(1599) == 9, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(1600) == 0, "Incorrect convert_to_chunk_value result") - -assert(convert_to_chunk_value(0,9) == 9, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(16,5) == 6, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(1599,4) == 3, "Incorrect convert_to_chunk_value result") - -local function calculate_chunk_value (pos, x_mod, z_mod) - local chunk_val = math.abs(convert_to_chunk_value(pos.x, x_mod) - convert_to_chunk_value(pos.z, z_mod)) % 10 - return chunk_val -end - -assert(calculate_chunk_value(vector.new(0,0,0)) == 0, "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(0,0,0), 1, 1) == 0, "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(0,0,0), 2, 1) == 1, "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(64,0,16)) == (4-1), "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(16,0,64)) == (3), "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(-160,0,-160)) == 0, "calculate_chunk_value failed") +local floor = math.floor +local max = math.max local function is_slime_chunk(pos) - if not pos then return end - - local chunk_val = calculate_chunk_value (pos, x_modifier, z_modifier) - local slime_chunk = chunk_val == slime_chunk_match - - --minetest.log("x: " ..pos.x .. ", z:" .. pos.z) - - --minetest.log("seed slime_chunk_match: " .. tostring(slime_chunk_match)) - --minetest.log("chunk_val: " .. tostring(chunk_val)) - --minetest.log("Is slime chunk: " .. tostring(slime_chunk)) - return slime_chunk + if not pos then return end -- no position given + if slime_ratio == 0 then return end -- no slime chunks + if slime_ratio <= 1 then return true end -- slime everywhere + local bpos = vector.new(floor(pos.x / MAPBLOCK_SIZE), slime_3d_chunks and floor(pos.y / MAPBLOCK_SIZE) or 0, floor(pos.z / MAPBLOCK_SIZE)) + return PcgRandom(minetest.hash_node_position(bpos) + world_seed):next(0,1e9)/1e9 * slime_ratio < 1 end -local check_position = function (pos) - return is_slime_chunk(pos) -end - - -- Returns a function that spawns children in a circle around pos. -- To be used as on_die callback. -- self: mob reference @@ -116,19 +35,15 @@ end -- eject_speed: Initial speed of child mob away from "mother" mob local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) return function(self, pos) - local posadd, newpos, dir - if not eject_speed then - eject_speed = 1 - end + eject_speed = eject_speed or 1 local mndef = minetest.registered_nodes[minetest.get_node(pos).name] local mother_stuck = mndef and mndef.walkable - local angle = math.random(0, math.pi*2) + local angle = math.random() * math.pi * 2 local children = {} local spawn_count = math.random(2, 4) for i = 1, spawn_count do - dir = vector.new(math.cos(angle), 0, math.sin(angle)) - posadd = vector.normalize(dir) * spawn_distance - newpos = pos + posadd + local dir = vector.new(math.cos(angle), 0, math.sin(angle)) + local newpos = pos + dir * spawn_distance -- If child would end up in a wall, use position of the "mother", unless -- the "mother" was stuck as well if not mother_stuck then @@ -138,12 +53,14 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) eject_speed = eject_speed * 0.5 end end - local mob = minetest.add_entity(newpos, child_mob) - if not mother_stuck then - mob:set_velocity(dir * eject_speed) + local mob = mcl_mobs.spawn(newpos, child_mob) + if mob then + if not mother_stuck then + mob:set_velocity(dir * eject_speed) + end + mob:set_yaw(angle - math.pi/2) + table.insert(children, mob) end - mob:set_yaw(angle - math.pi/2) - table.insert(children, mob) angle = angle + (math.pi*2) / spawn_count end -- If mother was murdered, children attack the killer after 1 second @@ -162,16 +79,12 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) end end -local swamp_light_max = 7 - +-- two different rules, underground slime chunks and regular swamp spawning local function slime_spawn_check(pos, environmental_light, artificial_light, sky_light) - local maxlight = swamp_light_max - if pos.y <= slime_chunk_spawn_max and is_slime_chunk(pos) then - maxlight = minetest.LIGHT_MAX + 1 + return max(artificial_light, sky_light) <= slime_max_light end - - return math.max(artificial_light, sky_light) <= maxlight + return max(artificial_light, sky_light) <= swamp_light_max end -- Slime @@ -322,13 +235,13 @@ mcl_mobs:spawn_specific( "ground", cave_biomes, 0, -minetest.LIGHT_MAX+1, +slime_max_light, 30, 1000, 4, cave_min, cave_max, -nil, nil, check_position) +nil, nil, is_slime_chunk) mcl_mobs:spawn_specific( "mobs_mc:slime_tiny", @@ -349,13 +262,13 @@ mcl_mobs:spawn_specific( "ground", cave_biomes, 0, -minetest.LIGHT_MAX+1, +slime_max_light, 30, 1000, 4, cave_min, cave_max, -nil, nil, check_position) +nil, nil, is_slime_chunk) mcl_mobs:spawn_specific( "mobs_mc:slime_small", @@ -376,13 +289,13 @@ mcl_mobs:spawn_specific( "ground", cave_biomes, 0, -minetest.LIGHT_MAX+1, +slime_max_light, 30, 1000, 4, cave_min, cave_max, -nil, nil, check_position) +nil, nil, is_slime_chunk) mcl_mobs:spawn_specific( "mobs_mc:slime_big", @@ -559,3 +472,4 @@ mcl_mobs:non_spawn_specific("mobs_mc:magma_cube_big","overworld",0, minetest.LIG mcl_mobs.register_egg("mobs_mc:slime_big", S("Slime"), "#52a03e", "#7ebf6d") -- FIXME: add spawn eggs for small and tiny slimes and magma cubes + diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index d01c7afbe..7fd8909ba 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -67,6 +67,7 @@ local spider = { curiosity = 10, head_yaw="z", collisionbox = {-0.7, -0.01, -0.7, 0.7, 0.89, 0.7}, + spawnbox = {-1.2, -0.01, -1.2, 1.2, 0.89, 1.2}, visual = "mesh", mesh = "mobs_mc_spider.b3d", textures = { diff --git a/mods/ENTITIES/mobs_mc/stalker.lua b/mods/ENTITIES/mobs_mc/stalker.lua index 962fbdea9..bcb5a5d7e 100644 --- a/mods/ENTITIES/mobs_mc/stalker.lua +++ b/mods/ENTITIES/mobs_mc/stalker.lua @@ -7,12 +7,13 @@ local S = minetest.get_translator("mobs_mc") --################### -local function get_texture(self) - local on_name = self.standing_on +local function get_texture(self, prev) + local standing_on = minetest.registered_nodes[self.standing_on] + -- TODO: we do not have access to param2 here (color palette index) yet local texture local texture_suff = "" - if on_name and on_name ~= "air" then - local tiles = minetest.registered_nodes[on_name].tiles + if standing_on and (standing_on.walkable or standing_on.groups.liquid) then + local tiles = standing_on.tiles if tiles then local tile = tiles[1] local color @@ -25,7 +26,7 @@ local function get_texture(self) texture = tile end if not color then - color = minetest.colorspec_to_colorstring(minetest.registered_nodes[on_name].color) + color = minetest.colorspec_to_colorstring(standing_on.color) end if color then texture_suff = "^[multiply:" .. color .. "^[hsl:0:0:20" @@ -33,14 +34,19 @@ local function get_texture(self) end end if not texture or texture == "" then + -- try to keep last texture when, e.g., falling + if prev and (not (not self.attack)) == (string.find(prev, "vl_mobs_stalker_overlay_angry.png") ~= nil) then + return prev + end texture = "vl_stalker_default.png" - end - texture = texture:gsub("([\\^:\\[])","\\%1") -- escape texture modifiers - texture = "([combine:16x24:0,0=(" .. texture .. "):0,16=(" .. texture ..")".. texture_suff - if self.attack then - texture = texture .. ")^vl_mobs_stalker_overlay_angry.png" else - texture = texture .. ")^vl_mobs_stalker_overlay.png" + texture = texture:gsub("([\\^:\\[])", "\\%1") -- escape texture modifiers + texture = "(vl_stalker_default.png^[combine:16x24:0,0=(" .. texture .. "):0,16=(" .. texture .. ")" .. texture_suff .. ")" + end + if self.attack then + texture = texture .. "^vl_mobs_stalker_overlay_angry.png" + else + texture = texture .. "^vl_mobs_stalker_overlay.png" end return texture end @@ -132,7 +138,7 @@ mcl_mobs.register_mob("mobs_mc:stalker", { self:boom(mcl_util.get_object_center(self.object), self.explosion_strength) end end - local new_texture = get_texture(self) + local new_texture = get_texture(self, self._stalker_texture) if self._stalker_texture ~= new_texture then self.object:set_properties({textures={new_texture, "mobs_mc_empty.png"}}) self._stalker_texture = new_texture diff --git a/mods/ENTITIES/mobs_mc/tropical_fish.lua b/mods/ENTITIES/mobs_mc/tropical_fish.lua index 6f0c4b43b..47f5b787a 100644 --- a/mods/ENTITIES/mobs_mc/tropical_fish.lua +++ b/mods/ENTITIES/mobs_mc/tropical_fish.lua @@ -97,7 +97,7 @@ local tropical_fish = { makes_footstep_sound = false, swim = true, fly = true, - fly_in = "mcl_core:water_source", + fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, breathes_in_water = true, jump = false, view_range = 16, diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index b1e291037..5ea20c707 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -818,7 +818,7 @@ local function find_closest_bed (self) if (owned_by and owned_by == self._id) then mcl_log("Clear as already owned by me.") - bed_meta:set_string("villager", nil) + bed_meta:set_string("villager", "") owned_by = nil end @@ -1049,14 +1049,18 @@ local function has_summon_participants(self) end local function summon_golem(self) - vector.offset(self.object:get_pos(),-10,-10,-10) - local nn = minetest.find_nodes_in_area_under_air(vector.offset(self.object:get_pos(),-10,-10,-10),vector.offset(self.object:get_pos(),10,10,10),{"group:solid","group:water"}) - table.shuffle(nn) - for _,n in pairs(nn) do - local up = minetest.find_nodes_in_area(vector.offset(n,0,1,0),vector.offset(n,0,3,0),{"air"}) - if up and #up >= 3 then + local pos = self.object:get_pos() + local p1 = vector.offset(pos, -10, -10, -10) + local p2 = vector.offset(pos, 10, 10, 10) + local nn = minetest.find_nodes_in_area_under_air(p1, p2,{"group:solid","group:water"}) + while #nn > 0 do + local n = table.remove_random_element(nn) + n.y = n.y + 1 + + local summon = mcl_mobs.spawn(n, "mobs_mc:iron_golem") + if summon then minetest.sound_play("mcl_portals_open_end_portal", {pos=n, gain=0.5, max_hear_distance = 16}, true) - return minetest.add_entity(vector.offset(n,0,1,0),"mobs_mc:iron_golem") + return summon end end end @@ -1279,7 +1283,7 @@ local function validate_jobsite(self) mcl_log("Jobsite far, so resettle: " .. tostring(resettle)) if resettle then local m = minetest.get_meta(self._jobsite) - m:set_string("villager", nil) + m:set_string("villager", "") remove_job (self) return false end @@ -1421,7 +1425,7 @@ local function validate_bed(self) mcl_log("Bed far, so resettle: " .. tostring(resettle)) if resettle then mcl_log("Resettled. Ditch bed.") - m:set_string("villager", nil) + m:set_string("villager", "") self._bed = nil bed_valid = false return false @@ -1431,7 +1435,7 @@ local function validate_bed(self) mcl_log("Player owner: " .. owned_by_player) if owned_by_player ~= "" then mcl_log("Player owns this. Villager won't take this.") - m:set_string("villager", nil) + m:set_string("villager", "") self._bed = nil bed_valid = false return false @@ -2300,13 +2304,13 @@ mcl_mobs.register_mob("mobs_mc:villager", { local bed = self._bed if bed then local bed_meta = minetest.get_meta(bed) - bed_meta:set_string("villager", nil) + bed_meta:set_string("villager", "") mcl_log("Died, so bye bye bed") end local jobsite = self._jobsite if jobsite then local jobsite_meta = minetest.get_meta(jobsite) - jobsite_meta:set_string("villager", nil) + jobsite_meta:set_string("villager", "") mcl_log("Died, so bye bye jobsite") end diff --git a/mods/ENTITIES/mobs_mc/villager_evoker.lua b/mods/ENTITIES/mobs_mc/villager_evoker.lua index 9d465c25d..2dc175341 100644 --- a/mods/ENTITIES/mobs_mc/villager_evoker.lua +++ b/mods/ENTITIES/mobs_mc/villager_evoker.lua @@ -55,14 +55,16 @@ mcl_mobs.register_mob("mobs_mc:evoker", { basepos.y = basepos.y + 1 for i=1, r do local spawnpos = vector.add(basepos, minetest.yaw_to_dir(pr:next(0,360))) - local vex = minetest.add_entity(spawnpos, "mobs_mc:vex") - local ent = vex:get_luaentity() + local vex = mcl_mobs.spawn(spawnpos, "mobs_mc:vex") + if vex then + local ent = vex:get_luaentity() - -- Mark vexes as summoned and start their life clock (they take damage it reaches 0) - ent._summoned = true - ent._lifetimer = pr:next(33, 108) + -- Mark vexes as summoned and start their life clock (they take damage it reaches 0) + ent._summoned = true + ent._lifetimer = pr:next(33, 108) - table.insert(spawned_vexes[self],ent) + table.insert(spawned_vexes[self],ent) + end end end, passive = false, diff --git a/mods/ENTITIES/mobs_mc/villager_zombie.lua b/mods/ENTITIES/mobs_mc/villager_zombie.lua index ada456aff..6e343c327 100644 --- a/mods/ENTITIES/mobs_mc/villager_zombie.lua +++ b/mods/ENTITIES/mobs_mc/villager_zombie.lua @@ -134,6 +134,7 @@ mcl_mobs.register_mob("mobs_mc:villager_zombie", { end, sunlight_damage = 2, ignited_by_sunlight = true, + floats = 0, view_range = 16, fear_height = 4, harmed_by_heal = true, diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index 2f6d7e79f..83eae82ad 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -96,6 +96,7 @@ local zombie = { }, ignited_by_sunlight = true, sunlight_damage = 2, + floats = 0, view_range = 16, attack_type = "dogfight", harmed_by_heal = true, diff --git a/mods/ENVIRONMENT/lightning/init.lua b/mods/ENVIRONMENT/lightning/init.lua index 41d6f458c..d4756bd9f 100644 --- a/mods/ENVIRONMENT/lightning/init.lua +++ b/mods/ENVIRONMENT/lightning/init.lua @@ -19,7 +19,6 @@ local set_node = minetest.set_node local sound_play = minetest.sound_play local add_particlespawner = minetest.add_particlespawner local after = minetest.after -local add_entity = minetest.add_entity local get_objects_inside_radius = minetest.get_objects_inside_radius local get_item_group = minetest.get_item_group @@ -165,7 +164,7 @@ function lightning.strike_func(pos, pos2, objects) -- Events caused by the lightning strike: Fire, damage, mob transformations, rare skeleton spawn - pos2.y = pos2.y + 1/2 + pos2.y = pos2.y + 1 local skeleton_lightning = false if rng:next(1,100) <= 3 then skeleton_lightning = true @@ -174,14 +173,14 @@ function lightning.strike_func(pos, pos2, objects) if get_node(pos2).name == "air" then -- Low chance for a lightning to spawn skeleton horse + skeletons if skeleton_lightning then - add_entity(pos2, "mobs_mc:skeleton_horse") + mcl_mobs.spawn(pos2, "mobs_mc:skeleton_horse") local angle, posadd - angle = math.random(0, math.pi*2) + angle = math.random() * math.pi * 2 for i=1,3 do posadd = { x=math.cos(angle),y=0,z=math.sin(angle) } posadd = vector.normalize(posadd) - local mob = add_entity(vector.add(pos2, posadd), "mobs_mc:skeleton") + local mob = mcl_mobs.spawn(vector.add(pos2, posadd), "mobs_mc:skeleton") if mob then mob:set_yaw(angle-math.pi/2) end diff --git a/mods/ENVIRONMENT/mcl_void_damage/mod.conf b/mods/ENVIRONMENT/mcl_void_damage/mod.conf index 1358e5217..83d76956f 100644 --- a/mods/ENVIRONMENT/mcl_void_damage/mod.conf +++ b/mods/ENVIRONMENT/mcl_void_damage/mod.conf @@ -1,4 +1,4 @@ name = mcl_void_damage author = Wuzzy description = Deal damage to entities stuck in the deep void -depends = mcl_worlds +depends = mcl_worlds, mcl_spawn diff --git a/mods/ENVIRONMENT/mcl_weather/mod.conf b/mods/ENVIRONMENT/mcl_weather/mod.conf index 4f1102b7a..ee6f03407 100644 --- a/mods/ENVIRONMENT/mcl_weather/mod.conf +++ b/mods/ENVIRONMENT/mcl_weather/mod.conf @@ -1,5 +1,5 @@ name = mcl_weather author = xeranas description = Weather and sky handling: Rain, snow, thunderstorm, End and Nether ambience -depends = mcl_init, mcl_worlds +depends = mcl_init, mcl_worlds, mcl_playerinfo, mcl_util optional_depends = lightning diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index 00dc2f6eb..9307dd64c 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -60,13 +60,15 @@ end -- set skybox based on time (uses skycolor api) function mcl_weather.rain.set_sky_box() if mcl_weather.state == "rain" then - mcl_weather.skycolor.add_layer( - "weather-pack-rain-sky", - {{r=0, g=0, b=0}, - {r=85, g=86, b=98}, - {r=135, g=135, b=151}, - {r=85, g=86, b=98}, - {r=0, g=0, b=0}}) + if mcl_weather.skycolor.current_layer_name() ~= "weather-pack-rain-sky" then + mcl_weather.skycolor.add_layer( + "weather-pack-rain-sky", + {{r=0, g=0, b=0}, + {r=85, g=86, b=98}, + {r=135, g=135, b=151}, + {r=85, g=86, b=98}, + {r=0, g=0, b=0}}) + end mcl_weather.skycolor.active = true for _, player in pairs(get_connected_players()) do player:set_clouds({color="#5D5D5FE8"}) @@ -155,6 +157,7 @@ function mcl_weather.rain.clear() mcl_weather.rain.remove_sound(player) mcl_weather.rain.remove_player(player) mcl_weather.remove_spawners_player(player) + player:set_clouds({color="#FFF0EF"}) end end diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 87952845b..eb217b3b2 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -1,15 +1,20 @@ -local mods_loaded = false +-- Constants +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) local NIGHT_VISION_RATIO = 0.45 +local DEBUG = false -local MINIMUM_LIGHT_LEVEL = 0.2 +-- Settings +local minimum_update_interval = { 250e3 } -local water_color = "#3F76E4" - -local mg_name = minetest.get_mapgen_setting("mg_name") +-- Module state +local mods_loaded = false function mcl_weather.set_sky_box_clear(player, sky, fog) - local pos = player:get_pos() - if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then return end + -- Make sure the player's head isn't in water before changing the skybox + local node_head = mcl_playerinfo[player:get_player_name()].node_head + if minetest.get_item_group(node_head, "water") ~= 0 then return end + local sc = { day_sky = "#7BA4FF", day_horizon = "#C0D8FF", @@ -38,8 +43,10 @@ function mcl_weather.set_sky_box_clear(player, sky, fog) end function mcl_weather.set_sky_color(player, def) - local pos = player:get_pos() - if minetest.get_item_group(minetest.get_node(vector.offset(pos, 0, 1.5, 0)).name, "water") ~= 0 then return end + -- Make sure the player's head isn't in water before changing the skybox + local node_head = mcl_playerinfo[player:get_player_name()].node_head + if minetest.get_item_group(node_head, "water") ~= 0 then return end + player:set_sky({ type = def.type, sky_color = def.sky_color, @@ -47,25 +54,7 @@ function mcl_weather.set_sky_color(player, def) }) end --- Function to work out light modifier at different times --- Noon is brightest, midnight is darkest, 0600 and 18000 is in the middle of this -local function get_light_modifier(time) - -- 0.1 = 0.2 - -- 0.4 = 0.8 - -- 0.5 = 1 - -- 0.6 = 0.8 - -- 0.9 = 0.2 - - local light_multiplier = time * 2 - if time > 0.5 then - light_multiplier = 2 * (1 - time) - else - light_multiplier = time / 0.5 - end - return light_multiplier -end - -mcl_weather.skycolor = { +local skycolor = { -- Should be activated before do any effect. active = true, @@ -85,319 +74,226 @@ mcl_weather.skycolor = { -- number of colors while constructing gradient of user given colors max_val = 1000, + NIGHT_VISION_RATIO = NIGHT_VISION_RATIO, + -- Table for tracking layer order layer_names = {}, - -- To layer to colors table - add_layer = function(layer_name, layer_color, instant_update) - mcl_weather.skycolor.colors[layer_name] = layer_color - table.insert(mcl_weather.skycolor.layer_names, layer_name) - mcl_weather.skycolor.force_update = true - end, - - current_layer_name = function() - return mcl_weather.skycolor.layer_names[#mcl_weather.skycolor.layer_names] - end, - - -- Retrieve layer from colors table - retrieve_layer = function() - local last_layer = mcl_weather.skycolor.current_layer_name() - return mcl_weather.skycolor.colors[last_layer] - end, - - -- Remove layer from colors table - remove_layer = function(layer_name) - for k, name in pairs(mcl_weather.skycolor.layer_names) do - if name == layer_name then - table.remove(mcl_weather.skycolor.layer_names, k) - mcl_weather.skycolor.force_update = true - return - end - end - end, - - -- Wrapper for updating day/night ratio that respects night vision - override_day_night_ratio = function(player, ratio) - local meta = player:get_meta() - local has_night_vision = meta:get_int("night_vision") == 1 - local has_darkness = meta:get_int("darkness") == 1 - local is_visited_shepherd = meta:get_int("mcl_shepherd:special") == 1 - local arg - if has_darkness and not is_visited_shepherd then - if has_night_vision then arg = 0.1 - else arg = 0 end - else - -- Apply night vision only for dark sky - local is_dark = minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none" - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - if (has_night_vision or is_visited_shepherd) and is_dark and dim ~= "nether" and dim ~= "end" then - if ratio == nil then - arg = NIGHT_VISION_RATIO - else - arg = math.max(ratio, NIGHT_VISION_RATIO) - end - else - arg = ratio - end - end - player:override_day_night_ratio(arg) - end, - - -- Update sky color. If players not specified update sky for all players. - update_sky_color = function(players) - -- Override day/night ratio as well - players = mcl_weather.skycolor.utils.get_players(players) - for _, player in ipairs(players) do - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) - local checkname = minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name - if minetest.get_item_group(checkname, "water") ~= 0 then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then water_color = biome._mcl_waterfogcolor end - if not biome then water_color = "#3F76E4" end - if checkname == "mclx_core:river_water_source" or checkname == "mclx_core:river_water_flowing" then water_color = "#0084FF" end - player:set_sky({ type = "regular", - sky_color = { - day_sky = water_color, - day_horizon = water_color, - dawn_sky = water_color, - dawn_horizon = water_color, - night_sky = water_color, - night_horizon = water_color, - indoors = water_color, - fog_sun_tint = water_color, - fog_moon_tint = water_color, - fog_tint_type = "custom" - }, - clouds = false, - }) - end - if dim == "overworld" then - local biomesky - local biomefog - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor - biomefog = biome._mcl_fogcolor - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - if (mcl_weather.state == "none") then - -- Clear weather - mcl_weather.set_sky_box_clear(player,biomesky,biomefog) - player:set_sun({visible = true, sunrise_visible = true}) - player:set_moon({visible = true}) - player:set_stars({visible = true}) - mcl_weather.skycolor.override_day_night_ratio(player, nil) - elseif not has_weather then - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) - mcl_weather.set_sky_color(player, { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - }) - player:set_sun({visible = false, sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - elseif has_weather then - -- Weather skies - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0) - mcl_weather.set_sky_color(player, { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - }) - player:set_sun({visible = false, sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - - local light_factor = mcl_weather.get_current_light_factor() - if mcl_weather.skycolor.current_layer_name() == "lightning" then - mcl_weather.skycolor.override_day_night_ratio(player, 1) - elseif light_factor then - local time = minetest.get_timeofday() - local light_multiplier = get_light_modifier(time) - local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) - mcl_weather.skycolor.override_day_night_ratio(player, new_light) - else - mcl_weather.skycolor.override_day_night_ratio(player, nil) - end - end - elseif dim == "end" then - local biomesky = "#000000" - local biomefog = "#A080A0" - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor - biomefog = biome._mcl_fogcolor -- The End biomes seemingly don't use the fog colour, despite having this value according to the wiki. The sky colour is seemingly used for both sky and fog? - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - local t = "mcl_playerplus_end_sky.png" - player:set_sky({ type = "skybox", - base_color = biomesky, - textures = {t,t,t,t,t,t}, - clouds = false, - }) - player:set_sun({visible = false , sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - mcl_weather.skycolor.override_day_night_ratio(player, 0.5) - elseif dim == "nether" then - local biomesky = "#6EB1FF" - local biomefog = "#330808" - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor -- The Nether biomes seemingly don't use the sky colour, despite having this value according to the wiki. The fog colour is used for both sky and fog. - biomefog = biome._mcl_fogcolor - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - mcl_weather.set_sky_color(player, { - type = "regular", - sky_color = { - day_sky = biomefog, - day_horizon = biomefog, - dawn_sky = biomefog, - dawn_horizon = biomefog, - night_sky = biomefog, - night_horizon = biomefog, - indoors = biomefog, - fog_sun_tint = biomefog, - fog_moon_tint = biomefog, - fog_tint_type = "custom" - }, - clouds = false, - }) - player:set_sun({visible = false , sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - mcl_weather.skycolor.override_day_night_ratio(player, nil) - elseif dim == "void" then - player:set_sky({ type = "plain", - base_color = "#000000", - clouds = false, - }) - player:set_sun({visible = false, sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - end - end - end, - - -- Returns current layer color in {r, g, b} format - get_sky_layer_color = function(timeofday) - if #mcl_weather.skycolor.layer_names == 0 then - return nil - end - - -- min timeofday value 0; max timeofday value 1. So sky color gradient range will be between 0 and 1 * mcl_weather.skycolor.max_val. - local rounded_time = math.floor(timeofday * mcl_weather.skycolor.max_val) - local color = mcl_weather.skycolor.utils.convert_to_rgb(mcl_weather.skycolor.min_val, mcl_weather.skycolor.max_val, rounded_time, mcl_weather.skycolor.retrieve_layer()) - return color - end, - - utils = { - convert_to_rgb = function(minval, maxval, current_val, colors) - local max_index = #colors - 1 - local val = (current_val-minval) / (maxval-minval) * max_index + 1.0 - local index1 = math.floor(val) - local index2 = math.min(math.floor(val)+1, max_index + 1) - local f = val - index1 - local c1 = colors[index1] - local c2 = colors[index2] - return {r=math.floor(c1.r + f*(c2.r - c1.r)), g=math.floor(c1.g + f*(c2.g-c1.g)), b=math.floor(c1.b + f*(c2.b - c1.b))} - end, - - -- Simply getter. Ether returns user given players list or get all connected players if none provided - get_players = function(players) - if players == nil or #players == 0 then - if mods_loaded then - players = minetest.get_connected_players() - elseif players == nil then - players = {} - end - end - return players - end, - - -- Returns first player sky color. I assume that all players are in same color layout. - get_current_bg_color = function() - local players = mcl_weather.skycolor.utils.get_players(nil) - if players[1] then - return players[1]:get_sky(true).sky_color - end - return nil - end - }, - + utils = {}, } +mcl_weather.skycolor = skycolor +local skycolor_utils = skycolor.utils + +-- Add layer to colors table +function skycolor.add_layer(layer_name, layer_color, instant_update) + skycolor.colors[layer_name] = layer_color + table.insert(skycolor.layer_names, layer_name) + skycolor.force_update = true +end + +function skycolor.current_layer_name() + return skycolor.layer_names[#skycolor.layer_names] +end + +-- Retrieve layer from colors table +function skycolor.retrieve_layer() + local last_layer = skycolor.current_layer_name() + return skycolor.colors[last_layer] +end + +-- Remove layer from colors table +function skycolor.remove_layer(layer_name) + for k, name in pairs(skycolor.layer_names) do + if name == layer_name then + table.remove(skycolor.layer_names, k) + skycolor.force_update = true + return + end + end +end + +-- Wrapper for updating day/night ratio that respects night vision +function skycolor.override_day_night_ratio(player, ratio) + player._skycolor_day_night_ratio = ratio + skycolor.update_player_sky_color(player) + player._skycolor_day_night_ratio = nil +end + +local skycolor_filters = {} +skycolor.filters = skycolor_filters +dofile(modpath.."/skycolor/water.lua") +dofile(modpath.."/skycolor/dimensions.lua") +dofile(modpath.."/skycolor/effects.lua") + +local function get_skycolor_info(player) + local player_name = player:get_player_name() + + local info = mcl_playerinfo[player_name] or {} + + local skycolor_data = info.skycolor + if not skycolor_data then + skycolor_data = {} + info.skycolor = skycolor_data + end + + return skycolor_data +end + +local water_sky = skycolor.water_sky +function skycolor.update_player_sky_color(player) + -- Don't update more than once every 250 milliseconds + local skycolor_data = get_skycolor_info(player) + local last_update = skycolor_data.last_update or 0 + local now_us = minetest.get_us_time() + if (now_us - last_update) < minimum_update_interval[1] then return end + skycolor_data.last_update = now_us + + local sky_data = { + day_night_ratio = player._skycolor_day_night_ratio + } + + for i = 1,#skycolor_filters do + skycolor_filters[i](player, sky_data) + end + + assert(sky_data.sky) + player:set_sky(sky_data.sky) + + if sky_data.sun then player:set_sun(sky_data.sun) end + if sky_data.moon then player:set_moon(sky_data.moon) end + if sky_data.stars then player:set_stars(sky_data.stars) end + player:override_day_night_ratio(sky_data.day_night_ratio) +end + +-- Update sky color. If players not specified update sky for all players. +function skycolor.update_sky_color(players) + -- Override day/night ratio as well + players = skycolor_utils.get_players(players) + local update = skycolor.update_player_sky_color + for _, player in ipairs(players) do + update(player) + end +end + +-- Returns current layer color in {r, g, b} format +function skycolor.get_sky_layer_color(timeofday) + if #skycolor.layer_names == 0 then + return nil + end + + -- min timeofday value 0; max timeofday value 1. So sky color gradient range will be between 0 and 1 * skycolor.max_val + local rounded_time = math.floor(timeofday * skycolor.max_val) + return skycolor_utils.convert_to_rgb( + skycolor.min_val, skycolor.max_val, + rounded_time, skycolor.retrieve_layer() + ) +end + +function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) + -- Clamp current_val to valid range + current_val = math.max(minval, current_val) + current_val = math.min(maxval, current_val) + + -- Rescale current_val from a number between minval and maxval to a number between 1 and #colors + local scaled_value = (current_val - minval) / (maxval - minval) * (#colors - 1) + 1.0 + + -- Get the first color's values + local index1 = math.floor(scaled_value) + local color1 = colors[index1] + local frac1 = 1.0 - (scaled_value - index1) + + -- Get the second color's values + local index2 = math.min(index1 + 1, #colors) -- clamp to maximum color index (will occur if index1 == #colors) + local frac2 = 1.0 - frac1 + local color2 = colors[index2] + + -- Interpolate between color1 and color2 + local res = { + r = math.floor(frac1 * color1.r + frac2 * color2.r), + g = math.floor(frac1 * color1.g + frac2 * color2.g), + b = math.floor(frac1 * color1.b + frac2 * color2.b), + } + + if DEBUG then + minetest.log(dump({ + minval = minval, + maxval = maxval, + current_val = current_val, + colors = colors, + res = res, + scaled_value = scaled_value, + + frac1 = frac1, + index1 = index1, + color1 = color1, + + frac2 = frac2, + index2 = index2, + color2 = color2, + })) + end + + return res +end + +-- Simple getter. Either returns user given players list or get all connected players if none provided +function skycolor_utils.get_players(players) + if players == nil or #players == 0 then + if mods_loaded then + players = minetest.get_connected_players() + elseif players == nil then + players = {} + end + end + return players +end + +-- Returns the sky color of the first player, which is done assuming that all players are in same color layout. +function skycolor_utils.get_current_bg_color() + local players = skycolor_utils.get_players(nil) + if players[1] then + return players[1]:get_sky(true).sky_color + end + return nil +end local timer = 0 minetest.register_globalstep(function(dtime) - if mcl_weather.skycolor.active ~= true or #minetest.get_connected_players() == 0 then + if skycolor.active ~= true or #minetest.get_connected_players() == 0 then return end - if mcl_weather.skycolor.force_update then - mcl_weather.skycolor.update_sky_color() - mcl_weather.skycolor.force_update = false + if skycolor.force_update then + skycolor.update_sky_color() + skycolor.force_update = false return end -- regular updates based on iterval timer = timer + dtime; - if timer >= mcl_weather.skycolor.update_interval then - mcl_weather.skycolor.update_sky_color() + if timer >= skycolor.update_interval then + skycolor.update_sky_color() timer = 0 end - end) local function initsky(player) - if player.set_lighting then - player:set_lighting({ shadows = { intensity = tonumber(minetest.settings:get("mcl_default_shadow_intensity") or 0.33) } }) + player:set_lighting({ + shadows = { intensity = 0.33 }, + volumetric_light = { strength = 0.45 }, + exposure = { + luminance_min = -3.5, + luminance_max = -2.5, + exposure_correction = 0.35, + speed_dark_bright = 1500, + speed_bright_dark = 700, + }, + saturation = 1.1, + }) end - if (mcl_weather.skycolor.active) then + if (skycolor.active) then mcl_weather.skycolor.force_update = true end @@ -408,7 +304,7 @@ minetest.register_on_joinplayer(initsky) minetest.register_on_respawnplayer(initsky) mcl_worlds.register_on_dimension_change(function(player) - mcl_weather.skycolor.update_sky_color({player}) + skycolor.update_sky_color({player}) end) minetest.register_on_mods_loaded(function() diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua new file mode 100644 index 000000000..671ead2bb --- /dev/null +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -0,0 +1,185 @@ +local MINIMUM_LIGHT_LEVEL = 0.2 +local VALID_SNOW_WEATHER_STATES = { snow = true, rain = true, thunder = true } +local VALID_RAIN_WEATHER_STATES = { rain = true, thunder = true } +local mg_name = minetest.get_mapgen_setting("mg_name") + +local dimension_handlers = {} +mcl_weather.skycolor.dimension_handlers = dimension_handlers + +-- Function to work out light modifier at different times +-- Noon is brightest, midnight is darkest, 0600 and 1800 is in the middle of this +local function get_light_modifier(time) + -- 0.1 = 0.2 + -- 0.4 = 0.8 + -- 0.5 = 1 + -- 0.6 = 0.8 + -- 0.9 = 0.2 + + local light_multiplier = time * 2 + if time > 0.5 then + light_multiplier = 2 * (1 - time) + else + light_multiplier = time / 0.5 + end + return light_multiplier +end + +function dimension_handlers.overworld(player, sky_data) + local pos = player:get_pos() + + local biomesky + local biomefog + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor + end + end + + -- Use overworld defaults + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = day_color or "#7BA4FF", + day_horizon = day_color or "#C0D8FF", + dawn_sky = dawn_color or "7BA4FF", + dawn_horizon = dawn_color or "#C0D8FF", + night_sky = night_color or "000000", + night_horizon = night_color or "4A6790", + fog_sun_tint = "#ff5f33", + fog_moon_tint = nil, + fog_tint_type = "custom", + }, + clouds = true, + } + sky_data.sun = {visible = true, sunrise_visible = true} + sky_data.moon = {visible = true} + sky_data.stars = {visible = true} + + if mcl_weather.state == "none" then + -- Clear weather + mcl_weather.set_sky_box_clear(player,biomesky,biomefog) + return + end + + -- Check if we currently have weather that affects the sky color + local has_weather = mcl_worlds.has_weather(pos) and ( + mcl_weather.has_snow(pos) and VALID_SNOW_WEATHER_STATES[mcl_weather.state] or + mcl_weather.has_rain(pos) and VALID_RAIN_WEATHER_STATES[mcl_weather.state] + ) + if has_weather then + -- Weather skies + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0) + table.update(sky_data.sky.sky_color,{ + day_sky = day_color or "#7BA4FF", + day_horizon = day_color or "#C0D8FF", + dawn_sky = dawn_color or "7BA4FF", + dawn_horizon = dawn_color or "#C0D8FF", + night_sky = night_color or "000000", + night_horizon = night_color or "4A6790", + fog_tint_type = "default", + }) + sky_data.sun = {visible = false, sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} + + local light_factor = mcl_weather.get_current_light_factor() + if mcl_weather.skycolor.current_layer_name() == "lightning" then + sky_data.day_night_ratio = 1 + elseif light_factor then + local time = minetest.get_timeofday() + local light_multiplier = get_light_modifier(time) + local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) + sky_data.day_night_ratio = new_light + end + end +end + +-- This can't be function dimension_handlers.end() due to lua syntax +dimension_handlers["end"] = function(player, sky_data) + local biomesky = "#000000" + local biomefog = "#A080A0" + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor -- The End biomes seemingly don't use the fog colour, despite having this value according to the wiki. The sky colour is seemingly used for both sky and fog? + end + end + local t = "mcl_playerplus_end_sky.png" + sky_data.sky = { type = "skybox", + base_color = biomesky, + textures = {t,t,t,t,t,t}, + clouds = false, + } + sky_data.sun = {visible = false , sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} + sky_data.day_night_ratio = 0.5 +end + +function dimension_handlers.nether(player, sky_data) + local biomesky = "#6EB1FF" + local biomefog = "#330808" + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + -- The Nether biomes seemingly don't use the sky colour, despite having this value according to the wiki. + -- The fog colour is used for both sky and fog. + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor + end + end + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = biomefog, + day_horizon = biomefog, + dawn_sky = biomefog, + dawn_horizon = biomefog, + night_sky = biomefog, + night_horizon = biomefog, + indoors = biomefog, + fog_sun_tint = biomefog, + fog_moon_tint = biomefog, + fog_tint_type = "custom" + }, + clouds = false, + } + sky_data.sun = {visible = false , sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} +end + +function dimension_handlers.void(player, sky_data) + sky_data.sky = { + type = "plain", + base_color = "#000000", + clouds = false, + } + sky_data.sun = {visible = false, sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} +end + +local function dimension(player, sky_data) + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + + local handler = dimension_handlers[dim] + if handler then return handler(player, sky_data) end +end +table.insert(mcl_weather.skycolor.filters, dimension) + diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua new file mode 100644 index 000000000..ce90bb13a --- /dev/null +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua @@ -0,0 +1,56 @@ +local DIM_ALLOW_NIGHT_VISION = { + overworld = true, + void = true, +} + +local NIGHT_VISION_RATIO = mcl_weather.skycolor.NIGHT_VISION_RATIO +local effects_handlers = {} +local has_mcl_potions = mcl_util.to_bool(minetest.get_modpath("mcl_potions")) + +function effects_handlers.darkness(player, meta, effect, sky_data) + -- No darkness effect if is a visited shepherd + if meta:get_int("mcl_shepherd:special") == 1 then return end + + -- High stars + sky_data.stars = {visible = false} + + -- Minor visibility if the player has the night vision effect + if mcl_potions.has_effect(player, "night_vision") then + sky_data.day_night_ratio = 0.1 + else + sky_data.day_night_ratio = 0 + end +end + +function effects_handlers.night_vision(player, meta, effect, sky_data) + -- Apply night vision only for dark sky + if not (minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none") then return end + + -- Only some dimensions allow night vision + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + if not DIM_ALLOW_NIGHT_VISION[dim] then return end + + -- Apply night vision + sky_data.day_night_ratio = math.max(sky_data.day_night_ratio or 0, NIGHT_VISION_RATIO) +end + +local function effects(player, sky_data) + if not has_mcl_potions then return end + + local meta = player:get_meta() + for name,effect in pairs(mcl_potions.registered_effects) do + local effect_data = mcl_potions.get_effect(player, name) + if effect_data then + local hook = effect.mcl_weather_skycolor or effects_handlers[name] + if hook then hook(player, meta, effect_data, sky_data) end + end + end + + -- Handle night vision for shepherd + if meta:get_int("mcl_shepherd:special") == 1 then + return effects_handlers.night_vision(player, meta, {}, sky_data) + end +end +table.insert(mcl_weather.skycolor.filters, effects) + diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua new file mode 100644 index 000000000..ec14d8844 --- /dev/null +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua @@ -0,0 +1,40 @@ + +local DEFAULT_WATER_COLOR = "#3F76E4" +local mg_name = minetest.get_mapgen_setting("mg_name") + +local function water_sky(player, sky_data) + local water_color = DEFAULT_WATER_COLOR + + local checkname = mcl_playerinfo[player:get_player_name()].node_head + if minetest.get_item_group(checkname, "water") == 0 then return end + + local pos = player:get_pos() + local biome = nil + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(pos).biome + local biome_name = minetest.get_biome_name(biome_index) + biome = minetest.registered_biomes[biome_name] + end + if biome then water_color = biome._mcl_waterfogcolor end + if not biome then water_color = DEFAULT_WATER_COLOR end + + if checkname == "mclx_core:river_water_source" or checkname == "mclx_core:river_water_flowing" then water_color = "#0084FF" end + + sky_data.sky = { type = "regular", + sky_color = { + day_sky = water_color, + day_horizon = water_color, + dawn_sky = water_color, + dawn_horizon = water_color, + night_sky = water_color, + night_horizon = water_color, + indoors = water_color, + fog_sun_tint = water_color, + fog_moon_tint = water_color, + fog_tint_type = "custom" + }, + clouds = true, + } +end +table.insert(mcl_weather.skycolor.filters, water_sky) + diff --git a/mods/ENVIRONMENT/mcl_weather/snow.lua b/mods/ENVIRONMENT/mcl_weather/snow.lua index 9ff2605df..73c65c3da 100644 --- a/mods/ENVIRONMENT/mcl_weather/snow.lua +++ b/mods/ENVIRONMENT/mcl_weather/snow.lua @@ -75,13 +75,15 @@ function mcl_weather.has_snow(pos) end function mcl_weather.snow.set_sky_box() - mcl_weather.skycolor.add_layer( - "weather-pack-snow-sky", - {{r=0, g=0, b=0}, - {r=85, g=86, b=86}, - {r=135, g=135, b=135}, - {r=85, g=86, b=86}, - {r=0, g=0, b=0}}) + if mcl_weather.skycolor.current_layer_name() ~= "weather-pack-snow-sky" then + mcl_weather.skycolor.add_layer( + "weather-pack-snow-sky", + {{r=0, g=0, b=0}, + {r=85, g=86, b=86}, + {r=135, g=135, b=135}, + {r=85, g=86, b=86}, + {r=0, g=0, b=0}}) + end mcl_weather.skycolor.active = true for _, player in pairs(get_connected_players()) do player:set_clouds({color="#ADADADE8"}) diff --git a/mods/ENVIRONMENT/mcl_weather/thunder.lua b/mods/ENVIRONMENT/mcl_weather/thunder.lua index f8e5a0371..1431e423d 100644 --- a/mods/ENVIRONMENT/mcl_weather/thunder.lua +++ b/mods/ENVIRONMENT/mcl_weather/thunder.lua @@ -10,6 +10,10 @@ mcl_weather.thunder = { init_done = false, } +lightning.register_on_strike(function(pos, pos2, objects) + if not mcl_weather.has_rain(pos) then return nil, true end +end) + minetest.register_globalstep(function(dtime) if mcl_weather.get_weather() ~= "thunder" then return false @@ -19,13 +23,15 @@ minetest.register_globalstep(function(dtime) mcl_weather.rain.make_weather() if mcl_weather.thunder.init_done == false then - mcl_weather.skycolor.add_layer("weather-pack-thunder-sky", { - {r=0, g=0, b=0}, - {r=40, g=40, b=40}, - {r=85, g=86, b=86}, - {r=40, g=40, b=40}, - {r=0, g=0, b=0}, - }) + if mcl_weather.skycolor.current_layer_name() ~= "weather-pack-thunder-sky" then + mcl_weather.skycolor.add_layer("weather-pack-thunder-sky", { + {r=0, g=0, b=0}, + {r=40, g=40, b=40}, + {r=85, g=86, b=86}, + {r=40, g=40, b=40}, + {r=0, g=0, b=0}, + }) + end mcl_weather.skycolor.active = true for _, player in pairs(get_connected_players()) do player:set_clouds({color="#3D3D3FE8"}) diff --git a/mods/HELP/mcl_tt/snippets_base.lua b/mods/HELP/mcl_tt/snippets_base.lua index f20f3dfe2..0468c50ac 100644 --- a/mods/HELP/mcl_tt/snippets_base.lua +++ b/mods/HELP/mcl_tt/snippets_base.lua @@ -37,6 +37,8 @@ end -- Digging capabilities of tool tt.register_snippet(function(itemstring, toolcaps, itemstack) local def = minetest.registered_items[itemstring] + if not def then return end + if not toolcaps then return end @@ -165,6 +167,8 @@ end)]] -- Food tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + local desc if def._tt_food then desc = S("Food item") @@ -179,6 +183,8 @@ end) -- Node info tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + local desc = "" -- Health-related node facts diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 639422295..a964b96a3 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -64,6 +64,8 @@ end) tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + local s = "" if def.groups.eatable and def.groups.eatable > 0 then s = s .. S("Hunger points: +@1", def.groups.eatable) @@ -89,6 +91,8 @@ end) tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + if def.groups.place_flowerlike == 1 then return S("Grows on grass blocks or dirt") elseif def.groups.place_flowerlike == 2 then @@ -98,6 +102,8 @@ end) tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + if def.groups.flammable then return S("Flammable") end @@ -127,6 +133,8 @@ end) tt.register_snippet(function(itemstring, _, itemstack) if not itemstack then return end local def = itemstack:get_definition() + if not def then return end + if def.groups._mcl_potion ~= 1 then return end local s = "" diff --git a/mods/HELP/tt/init.lua b/mods/HELP/tt/init.lua index 8cc893d47..eba65c22a 100644 --- a/mods/HELP/tt/init.lua +++ b/mods/HELP/tt/init.lua @@ -20,23 +20,12 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/snippets.lua") -- Apply item description updates local function apply_snippets(desc, itemstring, toolcaps, itemstack) - local first = true -- Apply snippets for s=1, #tt.registered_snippets do local str, snippet_color = tt.registered_snippets[s](itemstring, toolcaps, itemstack) - if snippet_color == nil then - snippet_color = tt.COLOR_DEFAULT - end if str then - if first then - first = false - end - desc = desc .. "\n" - if snippet_color then - desc = desc .. minetest.colorize(snippet_color, str) - else - desc = desc .. str - end + if snippet_color == nil then snippet_color = tt.COLOR_DEFAULT end + desc = desc .. "\n" .. (snippet_color and minetest.colorize(snippet_color, str) or str) end end return desc @@ -67,10 +56,7 @@ function tt.reload_itemstack_description(itemstack) if def and def._mcl_generate_description then def._mcl_generate_description(itemstack) elseif should_change(itemstring, def) then - local toolcaps - if def.tool_capabilities then - toolcaps = itemstack:get_tool_capabilities() - end + local toolcaps = def.tool_capabilities and itemstack:get_tool_capabilities() local orig_desc = def._tt_original_description or def.description if meta:get_string("name") ~= "" then orig_desc = minetest.colorize(tt.NAME_COLOR, meta:get_string("name")) @@ -78,17 +64,13 @@ function tt.reload_itemstack_description(itemstack) local potency = meta:get_int("mcl_potions:potion_potent") local plus = meta:get_int("mcl_potions:potion_plus") if potency > 0 then - local sym_potency = mcl_util.to_roman(potency+1) - orig_desc = orig_desc.. " ".. sym_potency + orig_desc = orig_desc .. " " .. mcl_util.to_roman(potency+1) end if plus > 0 then - local sym_plus = " " - local i = plus - while i>0 do - i = i - 1 - sym_plus = sym_plus.. "+" + orig_desc = orig_desc .. " " + for i = 1, plus do + orig_desc = orig_desc .. "+" end - orig_desc = orig_desc.. sym_plus end end local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack) diff --git a/mods/HELP/tt/snippets.lua b/mods/HELP/tt/snippets.lua index 694b22513..69956385e 100644 --- a/mods/HELP/tt/snippets.lua +++ b/mods/HELP/tt/snippets.lua @@ -3,9 +3,7 @@ -- Custom text (_tt_help) tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] - if def._tt_help then - return def._tt_help - end + return def and def._tt_help or nil end) diff --git a/mods/HUD/hudbars/init.lua b/mods/HUD/hudbars/init.lua index 7f86a959d..543692d51 100644 --- a/mods/HUD/hudbars/init.lua +++ b/mods/HUD/hudbars/init.lua @@ -330,9 +330,16 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value, new_icon local name = player:get_player_name() local hudtable = hb.get_hudtable(identifier) + + -- hb.change_hudbar may be called with a non-existing hudbar like hunger. + if hudtable == nil then + return false + end + if not hudtable.hudstate[name] then return false end + local value_changed, max_changed = false, false if new_value then diff --git a/mods/HUD/mcl_death_messages/mod.conf b/mods/HUD/mcl_death_messages/mod.conf index a634e16de..5497e9473 100644 --- a/mods/HUD/mcl_death_messages/mod.conf +++ b/mods/HUD/mcl_death_messages/mod.conf @@ -1,4 +1,4 @@ name = mcl_death_messages author = 4Evergreen4 description = Shows messages in chat when a player dies. -depends = mcl_colors +depends = mcl_colors, mcl_damage diff --git a/mods/HUD/mcl_experience/locale/mcl_experience.de.tr b/mods/HUD/mcl_experience/locale/mcl_experience.de.tr index 351cf1911..e0e48d0ef 100644 --- a/mods/HUD/mcl_experience/locale/mcl_experience.de.tr +++ b/mods/HUD/mcl_experience/locale/mcl_experience.de.tr @@ -5,3 +5,4 @@ Error: Too many parameters!=Fehler: Zu viele Parameter! Error: Incorrect value of XP=Fehler: Ungültiger EP-Wert Error: Player not found=Fehler: Spieler nicht gefunden Added @1 XP to @2, total: @3, experience level: @4=@1 EP an @2 gegeben, gesamt: @3, Erfahrungsstufe: @4 +Bottle o' Enchanting=Erfahrungsfläschchen diff --git a/mods/HUD/mcl_info/API.md b/mods/HUD/mcl_info/API.md index 18c901162..789a5c76b 100644 --- a/mods/HUD/mcl_info/API.md +++ b/mods/HUD/mcl_info/API.md @@ -1,8 +1,10 @@ ## mcl_info -An api to make custom entries in the mcl2 debug hud. +An API to make custom entries in the VL debug hud. ### mcl_info.register_debug_field(name,defintion) Debug field defintion example: + +``` { level = 3, --show with debug level 3 and upwards @@ -13,6 +15,7 @@ Debug field defintion example: -- It should output a string and determines -- the content of the debug field. } +``` ### mcl_info.registered_debug_fields Table the debug definitions are stored in. Do not modify this directly. If you need to overwrite a field just set it again with mcl_info.register_debug_field(). diff --git a/mods/HUD/mcl_inventory/API.md b/mods/HUD/mcl_inventory/API.md index 5fc5a8d6e..3ba784559 100644 --- a/mods/HUD/mcl_inventory/API.md +++ b/mods/HUD/mcl_inventory/API.md @@ -32,4 +32,5 @@ mcl_inventory.register_survival_inventory_tab({ -- Returns true by default access = function(player) end, +}) ``` diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 4ddbd0823..18b3b4c5e 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -418,6 +418,18 @@ minetest.register_on_joinplayer(function(player) end end) +---@param player mt.PlayerObjectRef +local function is_touch_enabled(playername) + -- Minetest < 5.7.0 support + if not minetest.get_player_window_information then + return false + end + local window = minetest.get_player_window_information(playername) + -- Always return a boolean (not nil) to avoid false-negatives when + -- comparing to a boolean later. + return window and window.touch_controls or false +end + ---@param player mt.PlayerObjectRef function mcl_inventory.set_creative_formspec(player) local playername = player:get_player_name() @@ -566,8 +578,10 @@ function mcl_inventory.set_creative_formspec(player) bg_img = "crafting_creative_inactive" .. button_bg_postfix[this_tab] .. ".png" end return table.concat({ - "style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=;noclip=true]", - "image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]", + "style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=]", + "style[" .. this_tab .. "_outer;border=false;bgimg=" .. bg_img .. + ";bgimg_pressed=" .. bg_img .. "]", + "button[" .. offset[this_tab] .. ";1.5,1.44;" .. this_tab .. "_outer;]", "item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]", }) end @@ -577,11 +591,21 @@ function mcl_inventory.set_creative_formspec(player) caption = "label[0.375,0.375;" .. F(C(mcl_formspec.label_color, filtername[name])) .. "]" end + local touch_enabled = is_touch_enabled(playername) + players[playername].last_touch_enabled = touch_enabled + local formspec = table.concat({ "formspec_version[6]", - "size[13,8.75]", + -- Original formspec height was 8.75, increased to include tab buttons. + -- This avoids tab buttons going off-screen with high scaling values. + "size[13,11.43]", + -- Use as much space as possible on mobile - the tab buttons are a lot + -- of padding already. + touch_enabled and "padding[-0.015,-0.015]" or "", - "style_type[image;noclip=true]", + "no_prepend[]", mcl_vars.gui_nonbg, mcl_vars.gui_bg_color, + "background9[0,1.34;13,8.75;mcl_base_textures_background9.png;;7]", + "container[0,1.34]", -- Hotbar mcl_formspec.get_itemslot_bg_v4(0.375, 7.375, 9, 1), @@ -638,6 +662,7 @@ function mcl_inventory.set_creative_formspec(player) "set_focus[search;true]", }) end + formspec = formspec .. "container_end[]" if pagenum then formspec = formspec .. "p" .. tostring(pagenum) end player:set_inventory_formspec(formspec) end @@ -655,54 +680,54 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) local name = player:get_player_name() - if fields.blocks then + if fields.blocks or fields.blocks_outer then if players[name].page == "blocks" then return end set_inv_page("blocks", player) page = "blocks" - elseif fields.deco then + elseif fields.deco or fields.deco_outer then if players[name].page == "deco" then return end set_inv_page("deco", player) page = "deco" - elseif fields.redstone then + elseif fields.redstone or fields.redstone_outer then if players[name].page == "redstone" then return end set_inv_page("redstone", player) page = "redstone" - elseif fields.rail then + elseif fields.rail or fields.rail_outer then if players[name].page == "rail" then return end set_inv_page("rail", player) page = "rail" - elseif fields.misc then + elseif fields.misc or fields.misc_outer then if players[name].page == "misc" then return end set_inv_page("misc", player) page = "misc" - elseif fields.nix then + elseif fields.nix or fields.nix_outer then set_inv_page("all", player) page = "nix" - elseif fields.food then + elseif fields.food or fields.food_outer then if players[name].page == "food" then return end set_inv_page("food", player) page = "food" - elseif fields.tools then + elseif fields.tools or fields.tools_outer then if players[name].page == "tools" then return end set_inv_page("tools", player) page = "tools" - elseif fields.combat then + elseif fields.combat or fields.combat_outer then if players[name].page == "combat" then return end set_inv_page("combat", player) page = "combat" - elseif fields.mobs then + elseif fields.mobs or fields.mobs_outer then if players[name].page == "mobs" then return end set_inv_page("mobs", player) page = "mobs" - elseif fields.brew then + elseif fields.brew or fields.brew_outer then if players[name].page == "brew" then return end set_inv_page("brew", player) page = "brew" - elseif fields.matr then + elseif fields.matr or fields.matr_outer then if players[name].page == "matr" then return end set_inv_page("matr", player) page = "matr" - elseif fields.inv then + elseif fields.inv or fields.inv_outer then if players[name].page == "inv" then return end page = "inv" elseif fields.search == "" and not fields.creative_next and not fields.creative_prev then @@ -818,3 +843,19 @@ minetest.register_on_player_inventory_action(function(player, action, inventory, player:get_inventory():set_stack("main", inventory_info.index, stack) end end) + +-- This is necessary because get_player_window_information may return nil in +-- on_joinplayer. +-- (Also, Minetest plans to add support for toggling touchscreen mode in-game.) +minetest.register_globalstep(function(dtime) + for _, player in pairs(minetest.get_connected_players()) do + local name = player:get_player_name() + + if minetest.is_creative_enabled(name) then + local touch_enabled = is_touch_enabled(name) + if touch_enabled ~= players[name].last_touch_enabled then + mcl_inventory.set_creative_formspec(player) + end + end + end +end) diff --git a/mods/HUD/mcl_title/API.md b/mods/HUD/mcl_title/API.md index 37f1c279f..78621488f 100644 --- a/mods/HUD/mcl_title/API.md +++ b/mods/HUD/mcl_title/API.md @@ -8,7 +8,7 @@ Show a hud message of `type` to player `player` with `data` as params. The element will stay for the per-player param `stay` or `data.stay` (in gametick which is 1/20 second). -Here is a usage exemple: +Here is a usage example: ```lua --show a title in the HUD with minecraft color "gold" @@ -35,7 +35,7 @@ Basicaly run `mcl_title.remove(player, type)` for every type. ## mcl_title.params_set(player, params) -Allow mods to set `stay` and upcomming `fadeIn`/`fadeOut` params. +Allow mods to set `stay` and upcoming `fadeIn`/`fadeOut` params. ```lua mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field will stay during 30s (600/20) @@ -43,8 +43,8 @@ mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field ## mcl_title.params_get(player) -Get `stay` and upcomming `fadeIn` and `fadeOut` params of a player as a table. +Get `stay` and upcoming `fadeIn` and `fadeOut` params of a player as a table. ```lua mcl_title.params_get(player) -``` \ No newline at end of file +``` diff --git a/mods/HUD/mcl_title/mod.conf b/mods/HUD/mcl_title/mod.conf index 0f29a8118..ee6104479 100644 --- a/mods/HUD/mcl_title/mod.conf +++ b/mods/HUD/mcl_title/mod.conf @@ -1,4 +1,4 @@ name = mcl_title -description = Add an API to add in HUD title -depends = mcl_colors +description = Add an API to add in HUD title +depends = mcl_colors, mcl_util author = AFCMS \ No newline at end of file diff --git a/mods/ITEMS/REDSTONE/mcl_observers/init.lua b/mods/ITEMS/REDSTONE/mcl_observers/init.lua index 6045b5677..dfdbeb8a9 100644 --- a/mods/ITEMS/REDSTONE/mcl_observers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_observers/init.lua @@ -113,8 +113,8 @@ mesecon.register_node("mcl_observers:observer", { sounds = mcl_sounds.node_sound_stone_defaults(), paramtype2 = "facedir", on_rotate = false, - _mcl_blast_resistance = 3.5, - _mcl_hardness = 3.5, + _mcl_blast_resistance = 3, + _mcl_hardness = 3, }, { description = S("Observer"), _tt_help = S("Emits redstone pulse when block in front changes"), @@ -172,8 +172,8 @@ mesecon.register_node("mcl_observers:observer_down", { sounds = mcl_sounds.node_sound_stone_defaults(), groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, on_rotate = false, - _mcl_blast_resistance = 3.5, - _mcl_hardness = 3.5, + _mcl_blast_resistance = 3, + _mcl_hardness = 3, drop = "mcl_observers:observer_off", }, { tiles = { @@ -224,8 +224,8 @@ mesecon.register_node("mcl_observers:observer_up", { sounds = mcl_sounds.node_sound_stone_defaults(), groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, on_rotate = false, - _mcl_blast_resistance = 3.5, - _mcl_hardness = 3.5, + _mcl_blast_resistance = 3, + _mcl_hardness = 3, drop = "mcl_observers:observer_off", }, { tiles = { diff --git a/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr b/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr new file mode 100644 index 000000000..90d81bde6 --- /dev/null +++ b/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_target +Target=Zielscheibe +A target is a block that provides a temporary redstone charge when hit by a projectile.= +Throw a projectile on the target to activate it.= diff --git a/mods/ITEMS/REDSTONE/mesecons_button/locale/mesecons_button.de.tr b/mods/ITEMS/REDSTONE/mesecons_button/locale/mesecons_button.de.tr index 9b311b9a8..2a9181306 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/locale/mesecons_button.de.tr +++ b/mods/ITEMS/REDSTONE/mesecons_button/locale/mesecons_button.de.tr @@ -2,13 +2,19 @@ Use the button to push it.=Benutzen Sie den Knopf, um ihn zu drücken. Stone Button=Steinknopf A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.=Ein Steinknopf ist eine Redstonekomponente aus Stein. Er kann gedrückt werden, um ein Redstonesignal zu senden. Im gedrückten Zustand versorgt er benachbarte Redstonekomponenten für 1 Sekunde mit Redstoneenergie. +Polished Blackstone Button=Polierter Schwarzsteinknopf +A polished blackstone button is a redstone component made out of polished blackstone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.= Oak Button=Eichenknopf Acacia Button=Akazienknopf Birch Button=Birkenknopf Dark Oak Button=Schwarzeichenknopf Spruce Button=Fichtenknopf Jungle Button=Dschungelknopf +Mangrove Button= +Crimson Button=Karmesinholzknopf +Warped Button=Wirrholzknopf A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows.=Ein Holzknopf ist eine Redstonekomponente aus Holz. Er kann gedrückt werden, um ein Redstonesignal zu senden. Im gedrückten Zustand versorgt er benachbarte Redstonekomponenten für 1,5 Sekunden mit Redstoneenergie. Holzknöpfe können auch von Pfeilen gedrückt werden. Provides redstone power when pushed=Gibt Redstoneenergie, wenn gedrückt Push duration: @1s=Druckdauer: @1s Pushable by arrow=Drückbar von Pfeilen +A button is a redstone component which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for @1 seconds.= diff --git a/mods/ITEMS/REDSTONE/mesecons_button/mod.conf b/mods/ITEMS/REDSTONE/mesecons_button/mod.conf index be127362b..a554792a1 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/mod.conf +++ b/mods/ITEMS/REDSTONE/mesecons_button/mod.conf @@ -1,3 +1,3 @@ name = mesecons_button -depends = mesecons +depends = mesecons, mesecons_mvps optional_depends = doc diff --git a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua index 262ac6eb5..57272317e 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua @@ -218,7 +218,7 @@ minetest.register_node("mesecons_pistons:piston_normal_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_up_normal_off"}) @@ -255,7 +255,7 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -326,7 +326,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_up_sticky_off"}) @@ -363,7 +363,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -449,7 +449,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", { footstep = mcl_sounds.node_sound_wood_defaults().footstep }), _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_down_normal_off"}) @@ -487,7 +487,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -556,7 +556,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_down_sticky_off"}) @@ -594,7 +594,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -680,7 +680,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_normal_off"}) @@ -718,7 +718,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -782,7 +782,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_sticky_off"}) @@ -820,7 +820,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) diff --git a/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr b/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr index 6e5e761ef..74a71f225 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr +++ b/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr @@ -6,11 +6,18 @@ Birch Pressure Plate=Birkendruckplatte Dark Oak Pressure Plate=Schwarzeichendruckplatte Spruce Pressure Plate=Fichtendruckplatte Jungle Pressure Plate=Dschungeldruckplatte +Mangrove Pressure Plate= +Crimson Pressure Plate=Karmesinholzdruckplatte +Warped Pressure Plate=Wirrholzdruckplatte A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=Eine Holzdruckplatte ist eine Redstonekomponente, die ihre benachbarten Blöcke mit Redstoneenergie versorgt, solange sich ein beliebiges bewegliches Objekt (wie Gegenstände, Spieler und Mobs) auf ihm befindet. -Stone Pressure Plate=Steindruckplatte +Polished Blackstone Pressure Plate=Polierte Schwarzsteindruckplatte A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=Eine Steindruckplatte ist eine Redstonekomponente, die ihre benachbarten Blöcke mit Redstoneenergie versorgt, solange sich ein Spieler oder Mob auf ihm befindet. Sie wird von nichts anderem ausgelöst. +Stone Pressure Plate=Steindruckplatte Provides redstone power when pushed=Gibt Redstoneenergie aus, wenn gedrückt Pushable by players, mobs and objects=Drückbar von Spielern, Mobs und Objekten +Pushable by players, mobs and objects= Pushable by players and mobs=Drückbar von Spielern und Mobs Pushable by players=Drückbar von Spielern Pushable by mobs=Drückbar von Mobs +Pushable by players= +Pushable by mobs= diff --git a/mods/ITEMS/mcl_armor/API.md b/mods/ITEMS/mcl_armor/API.md index 507deab39..4c4284017 100644 --- a/mods/ITEMS/mcl_armor/API.md +++ b/mods/ITEMS/mcl_armor/API.md @@ -119,7 +119,7 @@ mcl_armor.register_set({ end, }, - --this is used to generate automaticaly armor crafts based on each element type folowing the regular minecraft pattern + --this is used to generate automaticaly armor crafts based on each element type following the regular minecraft pattern --if set to nil no craft will be added craft_material = "mcl_mobitems:leather", diff --git a/mods/ITEMS/mcl_armor/init.lua b/mods/ITEMS/mcl_armor/init.lua index 8f592d3ac..ac66c1648 100644 --- a/mods/ITEMS/mcl_armor/init.lua +++ b/mods/ITEMS/mcl_armor/init.lua @@ -58,10 +58,25 @@ mcl_armor = { }, player_view_range_factors = {}, trims = { - core_textures = {}, - blacklisted = {["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true}, + core_textures = {}, + blacklisted = {["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true}, overlays = {"sentry","dune","coast","wild","tide","ward","vex","rib","snout","eye","spire","silence","wayfinder"}, - colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"}, + translations = { + sentry = S("sentry"), + dune = S("dune"), + coast = S("coast"), + wild = S("wild"), + tide = S("tide"), + ward = S("ward"), + vex = S("vex"), + rib = S("rib"), + snout = S("snout"), + eye = S("eye"), + spire = S("spire"), + silence = S("silence"), + wayfinder = S("wayfinder"), + }, + colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"}, }, } diff --git a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr index cd2e9a479..991089204 100644 --- a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr +++ b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr @@ -1,6 +1,21 @@ # textdomain: mcl_armor +Blast Protection=Explosionsschutz +Projectile Protection=Projektilschutz +Thorns=Dornen This is a piece of equippable armor which reduces the amount of damage you receive.=Dies ist ein Teil einer tragbaren Rüstung, die die Menge an Schaden, den Sie erleiden, reduziert. To equip it, put it on the corresponding armor slot in your inventory menu.=Um es zu tragen, legen Sie es in den passenden Rüstungsplatz in Ihrem Inventarmenü. +sentry= +dune= +coast=Küste +wild= +ward=Bezirk +vex= +rib= +snout=Schnauze +eye=Auge +spire= +silence= +wayfinder=Pfadfinder Leather Cap=Lederkappe Iron Helmet=Eisenhelm Golden Helmet=Goldhelm @@ -21,6 +36,4 @@ Iron Boots=Eisenstiefel Golden Boots=Goldstiefel Diamond Boots=Diamantstiefel Chain Boots=Kettenstiefel - - -Smithing Template '@1'=Schmiedevorlage '@1' \ No newline at end of file +Smithing Template '@1'=Schmiedevorlage '@1' diff --git a/mods/ITEMS/mcl_armor/locale/template.txt b/mods/ITEMS/mcl_armor/locale/template.txt index 29d98f6b9..50d99dec6 100644 --- a/mods/ITEMS/mcl_armor/locale/template.txt +++ b/mods/ITEMS/mcl_armor/locale/template.txt @@ -1,6 +1,18 @@ # textdomain: mcl_armor This is a piece of equippable armor which reduces the amount of damage you receive.= To equip it, put it on the corresponding armor slot in your inventory menu.= +sentry= +dune= +coast= +wild= +ward= +vex= +rib= +snout= +eye= +spire= +silence= +wayfinder= Leather Cap= Iron Helmet= Golden Helmet= diff --git a/mods/ITEMS/mcl_armor/trims.lua b/mods/ITEMS/mcl_armor/trims.lua index 76d37deb0..eec48d148 100644 --- a/mods/ITEMS/mcl_armor/trims.lua +++ b/mods/ITEMS/mcl_armor/trims.lua @@ -2,63 +2,63 @@ local mod_registername = minetest.get_current_modname() .. ":" local S = minetest.get_translator(minetest.get_current_modname()) for _, template_name in pairs(mcl_armor.trims.overlays) do - minetest.register_craftitem(mod_registername .. template_name, { - description = S("Smithing Template '@1'", template_name), - inventory_image = template_name .. "_armor_trim_smithing_template.png", - }) - - minetest.register_craft({ - output = mod_registername .. template_name .. " 2", - recipe = { - {"mcl_core:diamond",mod_registername .. template_name,"mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:cobble","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } - }) + minetest.register_craftitem(mod_registername .. template_name, { + description = S("Smithing Template '@1'", mcl_armor.trims.translations[template_name]), + inventory_image = template_name .. "_armor_trim_smithing_template.png", + }) + + minetest.register_craft({ + output = mod_registername .. template_name .. " 2", + recipe = { + {"mcl_core:diamond",mod_registername .. template_name,"mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:cobble","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } + }) end --temp craft recipies, missing structures minetest.register_craft({ - output = mod_registername .. "eye", - recipe = { - {"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "eye", + recipe = { + {"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) minetest.register_craft({ - output = mod_registername .. "ward", - recipe = { - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:apple_gold_enchanted","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "ward", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:apple_gold_enchanted","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) minetest.register_craft({ - output = mod_registername .. "snout", - recipe = { - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "snout", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) minetest.register_craft({ - output = mod_registername .. "silence", - recipe = { - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - {"mcl_core:diamond", mod_registername.."ward","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "silence", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond", mod_registername.."ward","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) minetest.register_craft({ - output = mod_registername .. "wayfinder", - recipe = { - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - {"mcl_core:diamond", "mcl_maps:empty_map","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } -}) \ No newline at end of file + output = mod_registername .. "wayfinder", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond", "mcl_maps:empty_map","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } +}) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 33e0cebaa..15f9da5b0 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -5,9 +5,6 @@ --- Copyright (C) 2022 - 2023, Michieal. See License.txt -- CONSTS -local DOUBLE_DROP_CHANCE = 8 --- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it... --- "BAMBOO" goes here. local BAMBOO = "mcl_bamboo:bamboo" local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap" local BAMBOO_PLANK = BAMBOO .. "_plank" @@ -16,7 +13,7 @@ local BAMBOO_PLANK = BAMBOO .. "_plank" local modname = minetest.get_current_modname() local S = minetest.get_translator(modname) local node_sound = mcl_sounds.node_sound_wood_defaults() -local pr = PseudoRandom((os.time() + 15766) * 12) -- switched from math.random() to PseudoRandom because the random wasn't very random. +local pr = PseudoRandom((os.time() + 15766) * 12) local on_rotate if minetest.get_modpath("screwdriver") then @@ -31,38 +28,16 @@ local bamboo_def = { paramtype = "light", groups = {handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3}, sounds = node_sound, - - drop = { - max_items = 1, - -- From the API: - -- max_items: Maximum number of item lists to drop. - -- The entries in 'items' are processed in order. For each: - -- Item filtering is applied, chance of drop is applied, if both are - -- successful the entire item list is dropped. - -- Entry processing continues until the number of dropped item lists - -- equals 'max_items'. - -- Therefore, entries should progress from low to high drop chance. - items = { - -- Examples: - { - -- 1 in DOUBLE_DROP_CHANCE chance of dropping. - -- Default rarity is '1'. - rarity = DOUBLE_DROP_CHANCE, - items = {BAMBOO .. " 2"}, - }, - { - -- 1 in 1 chance of dropping. (Note: this means that it will drop 100% of the time.) - -- Default rarity is '1'. - rarity = 1, - items = {BAMBOO}, - }, - }, - }, + drop = BAMBOO, inventory_image = "mcl_bamboo_bamboo_shoot.png", wield_image = "mcl_bamboo_bamboo_shoot.png", _mcl_blast_resistance = 1, - _mcl_hardness = 1.5, + _mcl_hardness = 1, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + return mcl_bamboo.grow_bamboo(pos, true) + end, node_box = { type = "fixed", fixed = { @@ -86,7 +61,6 @@ local bamboo_def = { on_rotate = on_rotate, on_place = function(itemstack, placer, pointed_thing) - if not pointed_thing then return itemstack end @@ -241,9 +215,6 @@ local bamboo_def = { if node_above and ((bamboo_node and bamboo_node > 0) or node_above.name == BAMBOO_ENDCAP_NAME) then minetest.remove_node(new_pos) minetest.sound_play(node_sound.dug, sound_params, true) - if pr:next(1, DOUBLE_DROP_CHANCE) == 1 then - minetest.add_item(new_pos, istack) - end minetest.add_item(new_pos, istack) end end, @@ -253,10 +224,12 @@ minetest.register_node(BAMBOO, bamboo_def) local bamboo_top = table.copy(bamboo_def) bamboo_top.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3} bamboo_top.tiles = {"mcl_bamboo_endcap.png"} -bamboo_top.drawtype = "plantlike_rooted" --"plantlike" ---bamboo_top.paramtype2 = "meshoptions" ---bamboo_top.param2 = 2 --- bamboo_top.waving = 2 + +-- bamboo_top.drawtype = "plantlike_rooted" --"plantlike" +bamboo_top.drawtype = "plantlike" +bamboo_top.paramtype2 = "meshoptions" +bamboo_top.param2 = 2 +bamboo_top.waving = 2 bamboo_top.special_tiles = {{name = "mcl_bamboo_endcap.png"}} bamboo_top.nodebox = nil bamboo_top.selection_box = nil @@ -277,7 +250,7 @@ local bamboo_block_def = { sounds = node_sound, paramtype2 = "facedir", drops = "mcl_bamboo:bamboo_block", - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 2, _mcl_hardness = 2, _mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. on_place = mcl_util.rotate_axis, diff --git a/mods/ITEMS/mcl_bamboo/bamboo_items.lua b/mods/ITEMS/mcl_bamboo/bamboo_items.lua index a7a28257e..6ecc2f027 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_items.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_items.lua @@ -9,8 +9,6 @@ local SIDE_SCAFFOLDING = false local SIDE_SCAFFOLD_NAME = "mcl_bamboo:scaffolding_horizontal" -- --------------------------------------------------------------------------- local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding" --- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it... --- "BAMBOO" goes here. local BAMBOO = "mcl_bamboo:bamboo" local BAMBOO_PLANK = BAMBOO .. "_plank" @@ -208,7 +206,7 @@ if minetest.get_modpath("mcl_fences") then wood_groups, minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, - node_sound) -- note: about missing params.. will use defaults. + node_sound) mcl_bamboo.mcl_log(dump(fence_id)) mcl_bamboo.mcl_log(dump(gate_id)) diff --git a/mods/ITEMS/mcl_bamboo/globals.lua b/mods/ITEMS/mcl_bamboo/globals.lua index 37fafc2fd..eea779b90 100644 --- a/mods/ITEMS/mcl_bamboo/globals.lua +++ b/mods/ITEMS/mcl_bamboo/globals.lua @@ -44,6 +44,10 @@ mcl_bamboo.bamboo_index = { "mcl_bamboo:bamboo_2", "mcl_bamboo:bamboo_3", } +mcl_bamboo.bamboo_set = {} +for _,key in pairs(mcl_bamboo.bamboo_index) do + mcl_bamboo.bamboo_set[key] = true +end function mcl_bamboo.is_bamboo(node_name) local index = table.indexof(mcl_bamboo.bamboo_index, node_name) @@ -74,7 +78,7 @@ function mcl_bamboo.break_orphaned(pos) local node_name = node_below.name -- short circuit checks. - if mcl_bamboo.is_dirt(node_name) or mcl_bamboo.is_bamboo(node_name) or mcl_bamboo.is_bamboo(minetest.get_node(pos).name) == false then + if node_name == "ignore" or mcl_bamboo.is_dirt(node_name) or mcl_bamboo.is_bamboo(node_name) or mcl_bamboo.is_bamboo(minetest.get_node(pos).name) == false then return end @@ -94,172 +98,84 @@ end --]] function mcl_bamboo.grow_bamboo(pos, bonemeal_applied) + local log = mcl_bamboo.mcl_log local node_above = minetest.get_node(vector.offset(pos, 0, 1, 0)) - mcl_bamboo.mcl_log("Grow bamboo called; bonemeal: " .. tostring(bonemeal_applied)) + log("Grow bamboo called; bonemeal: " .. tostring(bonemeal_applied)) - if not bonemeal_applied and mcl_bamboo.is_bamboo(node_above.name) ~= false then - return false -- short circuit this function if we're trying to grow (std) the bamboo and it's not the top shoot. + if not bonemeal_applied then + -- Only allow natural growth at the top of the bamboo + if mcl_bamboo.is_bamboo(node_above.name) ~= false then return false end + + -- Don't perform natual growth in low light + if minetest.get_node_light(pos) < 8 then return false end end - if minetest.get_node_light(pos) < 8 then + + -- Determine the location of soil + local soil_pos + soil_pos,a,b = mcl_util.trace_nodes(pos, -1, mcl_bamboo.bamboo_set, BAMBOO_MAX_HEIGHT - 1) + + -- No soil found, return false so that bonemeal isn't used + if not soil_pos then return false end + log("Grow bamboo; soil found. ") + + -- Find the first bamboo shoot and retrieve data about it + local first_shoot = vector.offset(soil_pos, 0, 1, 0) + local first_shoot_meta = minetest.get_meta(first_shoot) + + -- Get or initialize bamboo height + local height = (first_shoot_meta and first_shoot_meta:get_int("height", -1)) or -1 + if height == -1 then + height = rand(BAM_MAX_HEIGHT_STPCHK + 1, BAM_MAX_HEIGHT_TOP + 1) + first_shoot_meta:set_int("height", height) + end + log("Grow bamboo; height: " .. height) + + -- Locate the bamboo tip + local bamboo_tip,actual_height,bamboo_tip_node = mcl_util.trace_nodes(first_shoot, 1, mcl_bamboo.bamboo_set, height - 1) + log("Current height: "..tostring(actual_height)) + + -- Short circuit growth if the bamboo is already finished growing + if not bamboo_tip or not actual_height or actual_height >= height then + log("Bamboo is already as large as it can grow") return false end - -- variables used in more than one spot. - local first_shoot - local chk_pos - local soil_pos - local node_name = "" - local dist = 0 - local node_below - -- ------------------- + -- Now that we are actually going to add nodes, initialize some more information + local first_shoot_node_name = minetest.get_node(first_shoot).name - mcl_bamboo.mcl_log("Grow bamboo; checking for soil: ") - -- the soil node below the bamboo. - for py = -1, BAMBOO_SOIL_DIST, -1 do - chk_pos = vector.offset(pos, 0, py, 0) - node_name = minetest.get_node(chk_pos).name - if mcl_bamboo.is_dirt(node_name) then - soil_pos = chk_pos - break - end - if mcl_bamboo.is_bamboo(node_name) == false then - break - end - end - -- requires knowing where the soil node is. - if soil_pos == nil then - return false -- returning false means don't use up the bonemeal. - end - - mcl_bamboo.mcl_log("Grow bamboo; soil found. ") - local grow_amount = rand(1, GROW_DOUBLE_CHANCE) - grow_amount = rand(1, GROW_DOUBLE_CHANCE) - grow_amount = rand(1, GROW_DOUBLE_CHANCE) -- because yeah, not truly random, or even a good prng. - grow_amount = rand(1, GROW_DOUBLE_CHANCE) - local init_height = rand(BAM_MAX_HEIGHT_STPCHK + 1, BAM_MAX_HEIGHT_TOP + 1) - mcl_bamboo.mcl_log("Grow bamboo; random height: " .. init_height) - - node_name = "" - - -- update: add randomized max height to first node's meta data. - first_shoot = vector.offset(soil_pos, 0, 1, 0) - local meta = minetest.get_meta(first_shoot) - node_below = minetest.get_node(first_shoot).name - - mcl_bamboo.mcl_log("Grow bamboo; checking height meta ") - -- check the meta data for the first node, to see how high to make the stalk. - if not meta then - -- if no metadata, set the metadata!!! - meta:set_int("height", init_height) - end - local height = meta:get_int("height", -1) - mcl_bamboo.mcl_log("Grow bamboo; meta-height: " .. height) - if height <= 10 then - height = init_height - meta:set_int("height", init_height) - end - - mcl_bamboo.mcl_log("Grow bamboo; height: " .. height) - - -- Bonemeal: Grows the bamboo by 1-2 stems. (per the minecraft wiki.) + -- If applying bonemeal, randomly grow two segments instead of one + local grow_amount = 1 if bonemeal_applied then - -- handle applying bonemeal. - for py = 1, BAM_MAX_HEIGHT_TOP do - -- find the top node of bamboo. - chk_pos = vector.offset(pos, 0, py, 0) - node_name = minetest.get_node(chk_pos).name - dist = vector.distance(soil_pos, chk_pos) - if mcl_bamboo.is_bamboo(node_name) == false or node_name == BAMBOO_ENDCAP_NAME then - break - end - end - - mcl_bamboo.mcl_log("Grow bamboo; dist: " .. dist) - - if node_name == BAMBOO_ENDCAP_NAME then - -- prevent overgrowth - return false - end - - -- check to see if we have a full stalk of bamboo. - if dist >= height - 1 then - if dist == height - 1 then - -- equals top of the stalk before the cap - if node_name == "air" then - mcl_bamboo.mcl_log("Grow bamboo; Placing endcap") - minetest.set_node(vector.offset(chk_pos, 0, 1, 0), { name = BAMBOO_ENDCAP_NAME }) - return true -- returning true means use up the bonemeal. - else - return false - end - else - -- okay, we're higher than the end cap, fail out. - return false -- returning false means don't use up the bonemeal. - end - end - - -- and now, the meat of the section... add bamboo to the stalk. - -- at this point, we should be lower than the generated maximum height. ~ about height -2 or lower. - if dist <= height - 2 then - if node_name == "air" then - -- here we can check to see if we can do up to 2 bamboo shoots onto the stalk - mcl_bamboo.mcl_log("Grow bamboo; Placing bamboo.") - minetest.set_node(chk_pos, { name = node_below }) - -- handle growing a second node. - if grow_amount == 2 then - chk_pos = vector.offset(chk_pos, 0, 1, 0) - if minetest.get_node(chk_pos).name == "air" then - mcl_bamboo.mcl_log("Grow bamboo; OOOH! It's twofer day!") - minetest.set_node(chk_pos, { name = node_below }) - end - end - return true -- exit out with a success. We've added 1-2 nodes, per the wiki. - end + local rng = PcgRandom(minetest.hash_node_position(pos) + minetest.get_us_time()) + if rng:next(1, GROW_DOUBLE_CHANGE) == 1 then + grow_amount = 2 end end + log("Growing up to "..grow_amount.." segments") - -- Non-Bonemeal growth. - for py = 1, BAM_MAX_HEIGHT_TOP do - -- Find the topmost node above the stalk, and check it for "air" - chk_pos = vector.offset(pos, 0, py, 0) - node_below = minetest.get_node(pos).name - node_name = minetest.get_node(chk_pos).name - dist = vector.distance(soil_pos, chk_pos) - - if node_name ~= "air" and mcl_bamboo.is_bamboo(node_name) == false then - break + -- Perform bamboo growth + for i = 1,grow_amount do + -- Check for air to grow into + local bamboo_tip_node = minetest.get_node(bamboo_tip) + if not bamboo_tip_node or bamboo_tip_node.name ~= "air" then + -- Something is blocking growth, stop and signal that use bonemeal has been used if at least on segment has grown + return i ~= 1 end - -- stop growing check. ie, handle endcap placement. - if dist >= height - 1 then - local above_node_name = minetest.get_node(vector.offset(chk_pos, 0, 1, 0)).name - if node_name == "air" and above_node_name == "air" then - if height - 1 == dist then - mcl_bamboo.mcl_log("Grow bamboo; Placing endcap") - minetest.set_node(chk_pos, { name = BAMBOO_ENDCAP_NAME }) - end - end - break + if actual_height + 1 == height then + -- This is the end cap + minetest.set_node(bamboo_tip, { name = BAMBOO_ENDCAP_NAME }) + return true + else + -- This isn't the end cap, add a bamboo segment + minetest.set_node(bamboo_tip, { name = first_shoot_node_name }) + actual_height = actual_height + 1 end - -- handle regular node placement. - -- find the air node above the top shoot. place a node. And then, if short enough, - -- check for second node placement. - if node_name == "air" then - mcl_bamboo.mcl_log("Grow bamboo; dist: " .. dist) - mcl_bamboo.mcl_log("Grow bamboo; Placing bamboo.") - minetest.set_node(chk_pos, { name = node_below }) - -- handle growing a second node. (1 in 32 chance.) - if grow_amount == 2 and dist <= height - 2 then - chk_pos = vector.offset(chk_pos, 0, 1, 0) - if minetest.get_node(chk_pos).name == "air" then - mcl_bamboo.mcl_log("Grow bamboo; OOOH! It's twofer day!") - minetest.set_node(chk_pos, { name = node_below }) - end - end - break - end + bamboo_tip = vector.offset(bamboo_tip, 0, 1, 0) end + + return true end -- Add Groups function, courtesy of Warr1024. diff --git a/mods/ITEMS/mcl_bamboo/init.lua b/mods/ITEMS/mcl_bamboo/init.lua index f2323b66c..b8051841f 100644 --- a/mods/ITEMS/mcl_bamboo/init.lua +++ b/mods/ITEMS/mcl_bamboo/init.lua @@ -7,8 +7,6 @@ -- LOCALS local modname = minetest.get_current_modname() --- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it... --- "BAMBOO" goes here. local BAMBOO = "mcl_bamboo:bamboo" mcl_bamboo = {} diff --git a/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr new file mode 100644 index 000000000..8ec98c73c --- /dev/null +++ b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr @@ -0,0 +1,46 @@ +# textdomain: mcl_bamboo + +### bamboo_base.lua ### + +Bamboo=Bambus +Bamboo Mosaic Plank=Bambusmosaikplanken +Bamboo Plank=Bambusplanken +Stripped Bamboo Block= +Bamboo Block=Bambusblock + +### bamboo_items.lua ### + +A bamboo button is a redstone component made out of bamboo which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.= + +A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.= + +Bamboo=Bambus +Bamboo Button=Bambusknopf +Bamboo Door=Bambustür +Bamboo Fence=Bambuszaun +Bamboo Fence Gate=Bambuszauntor +Bamboo Mosaic Slab= +Bamboo Mosaic Stair=Bambusmosaikstufe +Bamboo Plank Slab=Bambusplatte +Bamboo Plank Stair=Bambusplankenstufe +Bamboo Pressure Plate=Bambusdruckplatte +Bamboo Sign=Bambusschild +Bamboo Slab=Bambusplatte +Bamboo Stair=Bambusstufe +Bamboo Trapdoor=Bambusfalltür +Double Bamboo Mosaic Slab= +Double Bamboo Plank Slab= +Double Bamboo Slab= +Double Stripped Bamboo Slab= +Scaffolding=Bambusdruckplatte +Scaffolding (horizontal)= +Scaffolding block used to climb up or out across areas.= +Stripped Bamboo Slab= +Stripped Bamboo Stair= + +To open or close the trapdoor, rightclick it or send a redstone signal to it.= + +Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder.= + +Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal.= +To open or close a wooden door, rightclick it or supply its lower half with a redstone signal.= diff --git a/mods/ITEMS/mcl_bamboo/recipes.lua b/mods/ITEMS/mcl_bamboo/recipes.lua index 74f9f9879..f5c697a1b 100644 --- a/mods/ITEMS/mcl_bamboo/recipes.lua +++ b/mods/ITEMS/mcl_bamboo/recipes.lua @@ -5,8 +5,6 @@ --- These are all of the fuel recipes and all of the crafting recipes, consolidated into one place. --- Copyright (C) 2022 - 2023, Michieal. See License.txt --- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it... --- "BAMBOO" goes here. local BAMBOO = "mcl_bamboo:bamboo" local BAMBOO_PLANK = BAMBOO .. "_plank" -- Craftings diff --git a/mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr b/mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr index e1fa1b603..c5ccb803f 100644 --- a/mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr +++ b/mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr @@ -1,5 +1,5 @@ # textdomain: mcl_barrels -Barrel= +Barrel=Fass Barrels are containers which provide 27 inventory slots.= To access its inventory, rightclick it. When broken, the items will drop out.= -27 inventory slots= \ No newline at end of file +27 inventory slots= diff --git a/mods/ITEMS/mcl_beds/api.lua b/mods/ITEMS/mcl_beds/api.lua index b96953017..7abadb85a 100644 --- a/mods/ITEMS/mcl_beds/api.lua +++ b/mods/ITEMS/mcl_beds/api.lua @@ -210,7 +210,7 @@ function mcl_beds.register_bed(name, def) stack_max = 1, groups = {handy=1, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1}, _mcl_hardness = 0.2, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, sounds = def.sounds or default_sounds, selection_box = common_box, collision_box = common_box, @@ -288,7 +288,7 @@ function mcl_beds.register_bed(name, def) is_ground_content = false, groups = {handy = 1, flammable = -1, bed = 2, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, not_in_creative_inventory = 1}, _mcl_hardness = 0.2, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, sounds = def.sounds or default_sounds, drop = "", selection_box = common_box, diff --git a/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr b/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr index 6771596a5..fae0cf9fe 100644 --- a/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr +++ b/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr @@ -15,7 +15,7 @@ Black Bed=Schwarzes Bett Yellow Bed=Gelbes Bett Green Bed=Grünes Bett Magenta Bed=Magenta Bett -Orange Bed=Orange Bett +Orange Bed=Oranges Bett Purple Bed=Violettes Bett Brown Bed=Braunes Bett Pink Bed=Rosa Bett @@ -47,4 +47,4 @@ You are missing the 'shout' privilege! It's required in order to talk in chat... You exceeded the maximum number of messages per 10 seconds!=Sie haben die maximale Anzahl an Chatnachrichten pro 10 Sekunden überschritten! Hey! Would you guys mind sleeping?=Hey, würdet Ihr bitte zu Bett gehen? Sorry, but you have to wait @1 seconds until you may use this button again!=Sie müssen leider noch @1 Sekunden warten, bevor sie diesen Knopf erneut benutzen können! -@1/@2 players currently in bed.=@1/@2 Spieler aktuell im Bett. \ No newline at end of file +@1/@2 players currently in bed.=@1/@2 Spieler aktuell im Bett. diff --git a/mods/ITEMS/mcl_beds/mod.conf b/mods/ITEMS/mcl_beds/mod.conf index fc6d54f1f..fd54cd7e1 100644 --- a/mods/ITEMS/mcl_beds/mod.conf +++ b/mods/ITEMS/mcl_beds/mod.conf @@ -2,4 +2,4 @@ name = mcl_beds author = BlockMen description = depends = playerphysics -optional_depends = mcl_sounds, mcl_worlds, mcl_wool, mcl_dye, mcl_explosions, mcl_weather, mcl_spawn, doc, mesecons \ No newline at end of file +optional_depends = mcl_sounds, mcl_worlds, mcl_wool, mcl_dye, mcl_explosions, mcl_weather, mcl_spawn, doc, mesecons, mesecons_mvps diff --git a/mods/ITEMS/mcl_beehives/locale/mcl_beehives.de.tr b/mods/ITEMS/mcl_beehives/locale/mcl_beehives.de.tr new file mode 100644 index 000000000..b01ce52b5 --- /dev/null +++ b/mods/ITEMS/mcl_beehives/locale/mcl_beehives.de.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_beehives +Beehive=Bienenstock +Artificial bee nest.= +Bee Nest= +A naturally generating block that houses bees and a tasty treat...if you can get it.= diff --git a/mods/ITEMS/mcl_bells/locale/mcl_bells.de.tr b/mods/ITEMS/mcl_bells/locale/mcl_bells.de.tr new file mode 100644 index 000000000..1f03cae0f --- /dev/null +++ b/mods/ITEMS/mcl_bells/locale/mcl_bells.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_bells +Bell=Dorfglocke diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index 63d085877..fdc9e7d4e 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -33,8 +33,8 @@ minetest.register_node("mcl_blackstone:blackstone_gilded", { {items = {"mcl_blackstone:blackstone_gilded"}, rarity = 1}, } }, - _mcl_blast_resistance = 2, - _mcl_hardness = 2, + _mcl_blast_resistance = 6, + _mcl_hardness = 1.5, _mcl_silk_touch_drop = true, _mcl_fortune_drop = { discrete_uniform_distribution = true, @@ -226,18 +226,7 @@ mcl_stairs.register_stair_and_slab("blackstone_brick_polished", "mcl_blackstone: S("Double Polished Blackstone Brick Slab"), nil) --Wall -mcl_walls.register_wall( - "mcl_blackstone:wall", - S("Blackstone Wall"), - "mcl_blackstone:blackstone", - { - "mcl_blackstone_top.png", - "mcl_blackstone_top.png", - "mcl_blackstone_side.png" - }, - "", - { cracky=3, pickaxey=1, material_stone=1 } -) +mcl_walls.register_wall("mcl_blackstone:wall", S("Blackstone Wall"), "mcl_blackstone:blackstone") --lavacooling diff --git a/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr b/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr index 80cb8384d..3ef4f370e 100644 --- a/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr +++ b/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr @@ -5,22 +5,28 @@ Chiseled Polished Blackstone=Gemeißelter polierter Schwarzstein Polished Blackstone Bricks=Polierter Schwarzsteinziegel Basalt=Basalt Polished Basalt=Polierter Basalt -Blackstone Slab=Schwarzstein Stufe -Polished Blackstone Slab=Polierte Schwarzstein Stufe -Chiseled Polished Blackstone Slab=Gemeißelte Polierte Schwarzstein Stufe -Polished Blackstone Brick Slab=Polierte Schwarzsteinziegel Stufe -Blackstone Stair=Schwarzstein Treppe -Polished Blackstone Stair=Polierte Schwarzstein Treppe -Chiseled Polished Blackstone Stair=Gemeißelte Polierte Schwarzstein Treppe -Polished Blackstone Brick Stair=Polierte Schwarzsteinziegel Treppe -Quartz Bricks=Quartz Ziegel +Blackstone Slab=Schwarzsteinstufe +Polished Blackstone Slab=Polierte Schwarzsteinstufe +Chiseled Polished Blackstone Slab=Gemeißelte polierte Schwarzsteinstufe +Polished Blackstone Brick Slab=Polierte Schwarzsteinziegelstufe +Blackstone Stair=Schwarzsteintreppe +Polished Blackstone Stair=Polierte Schwarzsteintreppe +Chiseled Polished Blackstone Stair=Gemeißelte polierte Schwarzsteintreppe +Polished Blackstone Brick Stair=Polierte Schwarzsteinziegeltreppe +Quartz Bricks=Quarzziegel Soul Torch=Seelenfakel +Torches are light sources which can be placed at the side or on the top of most blocks.= Soul Lantern=Seelenlaterne Soul Soil=Seelenerde Eternal Soul Fire=Seelenfeuer Gilded Blackstone=Vergoldeter Schwarzstein Nether Gold Ore=Nethergolderz Smooth Basalt=Glatter Basalt +Blackstone Wall=Schwarzsteinmauer +Double Blackstone Slab= +Polished Double Blackstone Slab= +Double Chiseled Polished Blackstone Slab= +Double Polished Blackstone Brick Slab= @1 has been cooked crisp.=@1 wurde knusprig gebraten. @1 felt the burn.=@1 ist völlig verbrannt. diff --git a/mods/ITEMS/mcl_blast_furnace/locale/mcl_blast_furnace.de.tr b/mods/ITEMS/mcl_blast_furnace/locale/mcl_blast_furnace.de.tr new file mode 100644 index 000000000..7d030c158 --- /dev/null +++ b/mods/ITEMS/mcl_blast_furnace/locale/mcl_blast_furnace.de.tr @@ -0,0 +1,11 @@ +# textdomain: mcl_blast_furnace +Inventory= +Blast Furnace=Schmelzofen +Smelts ores faster than furnace= +Use the recipe book to see what ores you can smelt, what you can use as fuel and how long it will burn.= +Use the blast furnace to open the furnace menu.= +Place a furnace fuel in the lower slot and the source material in the upper slot.= +The blast furnace will slowly use its fuel to smelt the item.= +The result will be placed into the output slot at the right side.= +Blast Furnaces smelt several items, mainly ores and armor, using a furnace fuel, but twice as fast as a normal furnace.= +Active Blast Furnace= diff --git a/mods/ITEMS/mcl_bone_meal/API.md b/mods/ITEMS/mcl_bone_meal/API.md new file mode 100644 index 000000000..b365c3900 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/API.md @@ -0,0 +1,76 @@ + +# Bone meal API +Bonemealing callbacks and particle functions. + + +## _on_bone_meal(itemstack, placer, pointed_thing) +The bone meal API provides a callback definition that nodes can use to +register a handler that is executed when a bone meal item is used on it. + +Nodes that wish to use the bone meal API should in their node registration +define a callback handler named `_on_bone_meal`. + +Note that by registering the callback handler, the node declares that bone +meal can be used on it and as a result, when the user is not in creative +mode, the used bone meal is spent and taken from the itemstack passed to +the `on_place()` handler of the bone meal item used regardless of whether +the bone meal had an effect on the node and regardless of the result of +the callback handler. + +It is for all intents and purposes up to the callback defined in the node to +decide how to handle the specific effect that bone meal has on that node. + +The `_on_bone_meal` callback handler is a + + `function(itemstack, placer, pointed_thing)` + +Its arguments are: +* `itemstack`: the stack of bonem eal being applied +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! +* `pointed_thing`: exact pointing location (see Minetest API), where the + bone meal is applied + +The return value of the handler function indicates if the bonemealing had +its intended effect. If `true`, 'bone meal particles' are spawned at the +position of the bonemealed node. + +The `on_place` code in the bone meal item will spawn bone meal particles and +decrease the bone meal itemstack if the handler returned `true` and the +`placer` is not in creative mode. + + +## mcl_bone_meal.add_bone_meal_particle(pos, def) +Spawns standard or custom bone meal particles. +* `pos`: position, is ignored if you define def.minpos and def.maxpos +* `def`: (optional) particle definition; see minetest.add_particlespawner() + for more details. + +## mcl_bone_meal.use_bone_meal(itemstack, placer, pointed_thing) +For use in on_rightclick handlers that need support bone meal processing in addition +to other behaviors. Before calling, verify that the player is wielding bone meal. +* `itemstack`: The stack of bone meal being used +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! +* `pointed_thing`: exact pointing location (see Minetest API), where the + bone meal is applied + +Returns itemstack with one bone meal consumed if not in creative mode. + +# Legacy API +The bone meal API also provides a legacy compatibility function. This +function is not meant to be continued and callers should migrate to the +newer bonemealing API. + +## mcl_bone_meal.register_on_bone_meal_apply(function(pointed_thing, placer)) +Called when the bone meal is applied anywhere. +* `pointed_thing`: exact pointing location (see Minetest API), where the + bone meal is applied +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! +This function is deprecated and will be removed at some time in the future. +Bone meal is not consumed unless the provided function returns true. + +## mcl_dye.add_bone_meal_particle(pos, def) +## mcl_dye.register_on_bone_meal_apply(function(pointed_thing, user)) +These shims in mcl_dye that point to corresponding legacy compatibility +functions in mcl_bone_meal remain for legacy callers that have not yet been +updated to the new API. These shims will be removed at some time in the +future. diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua new file mode 100644 index 000000000..e899ca765 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -0,0 +1,156 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + +local longdesc = S( + "Bone meal is a white dye and also useful as a fertilizer to " .. + "speed up the growth of many plants." +) +local usagehelp = S( + "Rightclick a sheep to turn its wool white. Rightclick a plant " .. + "to speed up its growth. Note that not all plants can be " .. + "fertilized like this. When you rightclick a grass block, tall " .. + "grass and flowers will grow all over the place." +) + +mcl_bone_meal = {} + +-- Bone meal particle API: + +--- Spawns bone meal particles. +-- pos: where the particles spawn +-- def: particle spawner parameters, see minetest.add_particlespawner() for +-- details on these parameters. +-- +function mcl_bone_meal.add_bone_meal_particle(pos, def) + def = def or {} + minetest.add_particlespawner({ + amount = def.amount or 10, + time = def.time or 0.1, + minpos = def.minpos or vector.subtract(pos, 0.5), + maxpos = def.maxpos or vector.add(pos, 0.5), + minvel = def.minvel or vector.new(-0.01, 0.01, -0.01), + maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01), + minacc = def.minacc or vector.new(0, 0, 0), + maxacc = def.maxacc or vector.new(0, 0, 0), + minexptime = def.minexptime or 1, + maxexptime = def.maxexptime or 4, + minsize = def.minsize or 0.7, + maxsize = def.maxsize or 2.4, + texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", + glow = def.glow or 1, + }) +end + +-- Begin legacy bone meal API. +-- +-- Compatibility code for legacy users of the old bone meal API. +-- This code will be removed at some time in the future. +-- +mcl_bone_meal.bone_meal_callbacks = {} + +-- Shims for the old API are still available in mcl_dye and defer to +-- the real functions in mcl_bone_meal. +-- +function mcl_bone_meal.register_on_bone_meal_apply(func) + minetest.log("warning", "register_on_bone_meal_apply(func) is deprecated. Read mcl_bone_meal/API.md!") + local lines = string.split(debug.traceback(),"\n") + for _,line in ipairs(lines) do + minetest.log("warning",line) + end + table.insert(mcl_bone_meal.bone_meal_callbacks, func) +end + +-- Legacy registered users of the old API are handled through this function. +-- +local function legacy_apply_bone_meal(pointed_thing, placer) + -- Legacy API support + local callbacks = mcl_bone_meal.bone_meal_callbacks + for i = 1,#callbacks do + if callbacks[i](pointed_thing, placer) then + return true + end + end + + return false +end +-- End legacy bone meal API + +function mcl_bone_meal.use_bone_meal(itemstack, placer, pointed_thing) + local positions = {pointed_thing.under, pointed_thing.above} + for i = 1,2 do + local pos = positions[i] + + -- Check protection + if mcl_util.check_area_protection(pos, pointed_thing.above, placer) then return false end + + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + local success = false + local consume + + -- If the pointed node can be bonemealed, let it handle the processing. + if ndef and ndef._on_bone_meal then + success = ndef._on_bone_meal(itemstack, placer, {under = pos, above = vector.offset(pos, 0, 1, 0)}) + consume = true + else + -- Otherwise try the legacy API. + success = legacy_apply_bone_meal(pointed_thing, placer) + consume = success + end + + -- Take the item + if consume then + -- Particle effects + mcl_bone_meal.add_bone_meal_particle(pos) + + if not placer or not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + + return itemstack + end + + if success then return itemstack end + end + + return itemstack +end + +minetest.register_craftitem("mcl_bone_meal:bone_meal", { + description = S("Bone Meal"), + _tt_help = S("Speeds up plant growth"), + _doc_items_longdesc = longdesc, + _doc_items_usagehelp = usagehelp, + inventory_image = "mcl_bone_meal.png", + groups = {craftitem=1}, + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + + -- Use pointed node's on_rightclick function first, if present. + if placer and not placer:get_player_control().sneak then + if ndef and ndef.on_rightclick then + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) + if new_stack and new_stack ~= itemstack then return new_stack end + end + end + + return mcl_bone_meal.use_bone_meal(itemstack, placer, pointed_thing) + end, + _on_dispense = function(itemstack, pos, droppos, dropnode, dropdir) + local pointed_thing + if dropnode.name == "air" then + pointed_thing = {above = droppos, under = vector.offset(droppos, 0, -1 ,0)} + else + pointed_thing = {above = pos, under = droppos} + end + + return mcl_bone_meal.use_bone_meal(itemstack, nil, pointed_thing) + end, + _dispense_into_walkable = true +}) + +minetest.register_craft({ + output = "mcl_bone_meal:bone_meal 3", + recipe = {{"mcl_mobitems:bone"}}, +}) diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.de.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.de.tr new file mode 100644 index 000000000..22aad0ae5 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.de.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Knochenmehl +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Knochenmehl ist ein weißer Farbstoff und auch nützlich als Dünger, um das Wachstum vieler Pflanzen zu beschleunigen. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Rechtsklicken Sie auf ein Schaf, um die Wolle weiß einzufärben. Rechtsklicken Sie auf eine Pflanze, um ihr Wachstum zu beschleunigen. Beachten Sie, dass nicht alle Pflanzen darauf ansprechen. Benutzen Sie es auf einem Grasblock, wächst viel hohes Gras und vielleicht auch ein paar Blumen. +Speeds up plant growth=Beschleunigt Pflanzenwachstum diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.es.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.es.tr new file mode 100644 index 000000000..4d991624f --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.es.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Harina de hueso +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar. +Speeds up plant growth=Acelera el crecimiento de las plantas diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr new file mode 100644 index 000000000..197151a36 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Farine d'Os +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et est également utile comme engrais pour accélérer la croissance de nombreuses plantes. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Cependant, toutes les plantes ne peuvent pas être fertilisées de cette manière. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent autour. +Speeds up plant growth=Accélère la croissance des plantes diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.pl.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.pl.tr new file mode 100644 index 000000000..7c17c4032 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.pl.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Mączka kostna +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Mączka kostna to biała farba i przydatny nawóz, który przyspiesza rośnięcie wielu roślin. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Kliknij prawym na owcę, aby wybielić jej wełnę. Kliknij prawym na roślinę aby przyspieszyć jej wzrost. Zważ, że nie na wszystkie rośliny to tak działa. Gdy klikniesz prawym na blok trawy, wysoka trawa wyrośnie wokół. +Speeds up plant growth=Przyspiesza wzrost roślin diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.ru.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.ru.tr new file mode 100644 index 000000000..83b9fbe02 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.ru.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Костная мука +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Костная мука является белым красителем. Она также полезна в качестве удобрения, чтобы увеличить скорость роста многих растений. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Кликните правой по овце, чтобы сделать её шерсть белой. Кликните правой по растению, чтобы ускорить его рост. Имейте в виду, что не все растения можно удобрять таким способом. Если вы кликнете по травяному блоку, то на этом месте вырастет высокая трава и цветы. +Speeds up plant growth=Ускоряет рост растений diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.zh_TW.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.zh_TW.tr new file mode 100644 index 000000000..e9c240d19 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.zh_TW.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=骨粉 +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=骨粉是一種白色染料,也可作為肥料,加速許多植物的生長。 +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=右鍵點擊一隻羊,使其羊毛變白。右鍵點擊一株植物以加快其生長速度。注意,不是所有的植物都能像這樣施肥。當你右鍵點擊一個草方時,高高的草和花會到處生長。 +Speeds up plant growth=加速植物生長 diff --git a/mods/ITEMS/mcl_bone_meal/locale/template.txt b/mods/ITEMS/mcl_bone_meal/locale/template.txt new file mode 100644 index 000000000..9ecc61044 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/template.txt @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal= +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.= +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.= +Speeds up plant growth= diff --git a/mods/ITEMS/mcl_bone_meal/mod.conf b/mods/ITEMS/mcl_bone_meal/mod.conf new file mode 100644 index 000000000..60dfaa59e --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/mod.conf @@ -0,0 +1,3 @@ +name = mcl_bone_meal +description = Bone meal can be used as a fertilizer and as a dye. +author = kabou, teknomunk diff --git a/textures/mcl_bone_meal_bone_meal.png b/mods/ITEMS/mcl_bone_meal/textures/mcl_bone_meal.png similarity index 100% rename from textures/mcl_bone_meal_bone_meal.png rename to mods/ITEMS/mcl_bone_meal/textures/mcl_bone_meal.png diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index 652819aa6..14d289c10 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -257,10 +257,10 @@ function ARROW_ENTITY.on_step(self, dtime) mcl_burning.set_on_fire(obj, 5) end if not self._in_player and not self._blocked then - obj:punch(self.object, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=self._damage}, - }, self.object:get_velocity()) + mcl_util.deal_damage(obj, self._damage, {type = "arrow", source = self._shooter, direct = self.object}) + if self._extra_hit_func then + self._extra_hit_func(obj) + end if obj:is_player() then if not mcl_shields.is_blocking(obj) then local placement diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 9f381f501..88bea6444 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -168,7 +168,8 @@ S("The speed and damage of the arrow increases the longer you charge. The regula itemstack:get_meta():set_string("active", "true") return itemstack end, - groups = {weapon=1,weapon_ranged=1,bow=1,enchantability=1}, + groups = {weapon=1,weapon_ranged=1,bow=1,cannot_block=1,enchantability=1}, + touch_interaction = "short_dig_long_place", _mcl_uses = 385, }) @@ -216,7 +217,7 @@ for level=0, 2 do wield_scale = mcl_vars.tool_wield_scale, stack_max = 1, range = 0, -- Pointing range to 0 to prevent punching with bow :D - groups = {not_in_creative_inventory=1, not_in_craft_guide=1, bow=1, enchantability=1}, + groups = {not_in_creative_inventory=1, not_in_craft_guide=1, bow=1, cannot_block=1, enchantability=1}, -- Trick to disable digging as well on_use = function() return end, on_drop = function(itemstack, dropper, pos) @@ -235,6 +236,7 @@ for level=0, 2 do on_place = function(itemstack) return itemstack end, + touch_interaction = "short_dig_long_place", _mcl_uses = 385, }) end diff --git a/mods/ITEMS/mcl_bows/crossbow.lua b/mods/ITEMS/mcl_bows/crossbow.lua index c1cb7f8be..0810e6a8c 100644 --- a/mods/ITEMS/mcl_bows/crossbow.lua +++ b/mods/ITEMS/mcl_bows/crossbow.lua @@ -158,7 +158,8 @@ S("The speed and damage of the arrow increases the longer you charge. The regula itemstack:get_meta():set_string("active", "true") return itemstack end, - groups = {weapon=1,weapon_ranged=1,crossbow=1,enchantability=1}, + groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1}, + touch_interaction = "short_dig_long_place", _mcl_uses = 326, }) @@ -193,7 +194,8 @@ S("The speed and damage of the arrow increases the longer you charge. The regula itemstack:get_meta():set_string("active", "true") return itemstack end, - groups = {weapon=1,weapon_ranged=1,crossbow=1,enchantability=1,not_in_creative_inventory=1}, + groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1,not_in_creative_inventory=1}, + touch_interaction = "short_dig_long_place", _mcl_uses = 326, }) @@ -238,7 +240,7 @@ for level=0, 2 do wield_scale = mcl_vars.tool_wield_scale, stack_max = 1, range = 0, -- Pointing range to 0 to prevent punching with bow :D - groups = {not_in_creative_inventory=1, not_in_craft_guide=1, bow=1, enchantability=1}, + groups = {not_in_creative_inventory=1, not_in_craft_guide=1, cannot_block=1, bow=1, enchantability=1}, -- Trick to disable digging as well on_use = function() return end, on_drop = function(itemstack, dropper, pos) @@ -257,6 +259,7 @@ for level=0, 2 do on_place = function(itemstack) return itemstack end, + touch_interaction = "short_dig_long_place", _mcl_uses = 385, }) end diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr index c3b426810..7c12f414d 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr @@ -13,3 +13,6 @@ Ammunition=Munition Damage from bow: 1-10=Schaden vom Bogen: 1-10 Damage from dispenser: 3=Schaden vom Werfer: 3 Launches arrows=Verschießt Pfeile +Crossbow=Armbrust +Crossbows are ranged weapons to shoot arrows at your foes.= +To use the crossbow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to load an arrow into the chamber, then to shoot press left mouse.= diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 937d9089c..1021b1517 100644 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -456,8 +456,8 @@ minetest.register_node("mcl_brewing:stand_000", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -537,8 +537,8 @@ minetest.register_node("mcl_brewing:stand_100", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -617,8 +617,8 @@ minetest.register_node("mcl_brewing:stand_010", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -692,8 +692,8 @@ minetest.register_node("mcl_brewing:stand_001", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -777,8 +777,8 @@ minetest.register_node("mcl_brewing:stand_110", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -858,8 +858,8 @@ minetest.register_node("mcl_brewing:stand_101", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -939,8 +939,8 @@ minetest.register_node("mcl_brewing:stand_011", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -1027,8 +1027,8 @@ minetest.register_node("mcl_brewing:stand_111", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, diff --git a/mods/ITEMS/mcl_buckets/API.md b/mods/ITEMS/mcl_buckets/API.md index 94ec48de5..007f78343 100644 --- a/mods/ITEMS/mcl_buckets/API.md +++ b/mods/ITEMS/mcl_buckets/API.md @@ -1,25 +1,28 @@ # mcl_buckets -Add an API to register buckets to mcl +Adds an API to register buckets to VL ## mcl_buckets.register_liquid(def) -Register a new liquid -Accept folowing params: -* source_place: a string or function. - * string: name of the node to place - * function(pos): will returns name of the node to place with pos being the placement position -* source_take: table of liquid source node names to take -* bucketname: itemstring of the new bucket item -* inventory_image: texture of the new bucket item (ignored if itemname == nil) -* name: user-visible bucket description -* longdesc: long explanatory description (for help) -* usagehelp: short usage explanation (for help) -* tt_help: very short tooltip help -* extra_check(pos, placer): (optional) function(pos) -* groups: optional list of item groups +Register a new liquid. + +Accepts the following parameters: + +* `source_place`: a string or a function + * `string`: name of the node to place + * `function(pos)`: will return name of the node to place with pos being the placement position +* `source_take`: table of liquid source node names to take +* `bucketname`: itemstring of the new bucket item +* `inventory_image`: texture of the new bucket item (ignored if itemname == nil) +* `name`: user-visible bucket description +* `longdesc`: long explanatory description (for help) +* `usagehelp`: short usage explanation (for help) +* `tt_help`: very short tooltip help +* `extra_check(pos, placer)`: (optional) additional check before liquid placement (return 2 booleans: (1) whether to place the liquid source and (2) whether to empty the bucket) +* `groups`: optional list of item groups -**Usage exemple:** +**Usage example:** + ```lua mcl_buckets.register_liquid({ bucketname = "dummy:bucket_dummy", @@ -39,7 +42,7 @@ mcl_buckets.register_liquid({ tt_help = S("Places a dummy liquid source"), extra_check = function(pos, placer) --pos = pos where the liquid should be placed - --placer people who tried to place the bucket (can be nil) + --placer who tried to place the bucket (can be nil) --no liquid node will be placed --the bucket will not be emptied @@ -51,4 +54,4 @@ mcl_buckets.register_liquid({ end, groups = { dummy_group = 123 }, }) -``` \ No newline at end of file +``` diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index 6aebbc759..3783d65d7 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -209,7 +209,7 @@ local function on_place_bucket_empty(itemstack, user, pointed_thing) -- Call on_rightclick if the pointed node defines it local new_stack = mcl_util.call_on_rightclick(itemstack, user, pointed_thing) - if new_stack then + if new_stack and new_stack ~= itemstack then return new_stack end diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index 98318f3f1..bacbdeccc 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -39,9 +39,9 @@ local function drop_items(pos, node, oldmeta) if food_entity:get_luaentity().name == "mcl_campfires:food_entity" then food_entity:remove() for i = 1, 4 do - meta:set_string("food_x_"..tostring(i), nil) - meta:set_string("food_y_"..tostring(i), nil) - meta:set_string("food_z_"..tostring(i), nil) + meta:set_string("food_x_"..tostring(i), "") + meta:set_string("food_y_"..tostring(i), "") + meta:set_string("food_z_"..tostring(i), "") end end end @@ -135,9 +135,9 @@ function mcl_campfires.cook_item(pos, elapsed) if cooked then if food_entity then food_entity:remove() -- Remove visual food entity - meta:set_string("food_x_"..tostring(i), nil) - meta:set_string("food_y_"..tostring(i), nil) - meta:set_string("food_z_"..tostring(i), nil) + meta:set_string("food_x_"..tostring(i), "") + meta:set_string("food_y_"..tostring(i), "") + meta:set_string("food_z_"..tostring(i), "") minetest.add_item(pos, cooked.item) -- Drop Cooked Item -- Throw some Experience Points because why not? -- Food is cooked, xp is deserved for using this unique cooking method. Take that Minecraft ;) diff --git a/mods/ITEMS/mcl_campfires/locale/mcl_campfires.de.tr b/mods/ITEMS/mcl_campfires/locale/mcl_campfires.de.tr new file mode 100644 index 000000000..f71e512fd --- /dev/null +++ b/mods/ITEMS/mcl_campfires/locale/mcl_campfires.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_campfires +Campfire=Lagerfeuer diff --git a/mods/ITEMS/mcl_cherry_blossom/growth.lua b/mods/ITEMS/mcl_cherry_blossom/growth.lua index bca926539..c7bbf3044 100644 --- a/mods/ITEMS/mcl_cherry_blossom/growth.lua +++ b/mods/ITEMS/mcl_cherry_blossom/growth.lua @@ -30,7 +30,7 @@ minetest.register_abm({ local cherry_particle = { velocity = vector.zero(), acceleration = vector.new(0,-1,0), - size = math.random(1.3,2.5), + size = 1.3 + math.random() * 1.2, texture = "mcl_cherry_blossom_particle_" .. math.random(1, 12) .. ".png", animation = { type = "vertical_frames", @@ -45,8 +45,8 @@ local cherry_particle = { local wind_direction -- vector local time_changed -- 0 - afternoon; 1 - evening; 2 - morning local function change_wind_direction() - local east_west = math.random(-0.5,0.5) - local north_south = math.random(-0.5,0.5) + local east_west = math.random() - 0.5 + local north_south = math.random() - 0.5 wind_direction = vector.new(east_west, 0, north_south) end change_wind_direction() @@ -57,10 +57,10 @@ minetest.register_abm({ interval = 5, chance = 10, action = function(pos, node) - minetest.after(math.random(0.1,1.5),function() + minetest.after(0.1 + math.random() * 1.4,function() local pt = table.copy(cherry_particle) - pt.pos = vector.offset(pos,math.random(-0.5,0.5),-0.51,math.random(-0.5,0.5)) - pt.expirationtime = math.random(1.2,4.5) + pt.pos = vector.offset(pos,math.random()-0.5,-0.51,math.random()-0.5) + pt.expirationtime = 1.2 + math.random() * 3.3 pt.texture = "mcl_cherry_blossom_particle_" .. math.random(1, 12) .. ".png" local time = minetest.get_timeofday() if time_changed ~= 0 and time > 0.6 and time < 0.605 then diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr new file mode 100644 index 000000000..6efe3a00a --- /dev/null +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr @@ -0,0 +1,24 @@ +# textdomain: mcl_cherry_blossom +Cherry Log=Kirschbaumsetzling +The trunk of a cherry blossom tree.= +Stripped Cherry Log= +The stripped trunk of a cherry blossom tree.= +Cherry Bark=Kirschbaumsetzling +This is a decorative block surrounded by the bark of a tree trunk.= +Stripped Cherry Wood= +The stripped wood of a cherry blossom tree.= +Cherry Wood Planks=Kirschbaumsetzling +Cherry Leaves= +Cherry blossom leaves are grown from cherry blossom trees.= +Cherry Sapling=Kirschbaumsetzling +Cherry blossom sapling can be planted to grow cherry trees.= +Cherry Door=Kirschholztür +Cherry Trapdoor=Kirschholzfalltür +Cherry Stairs=Kirschholztreppe +Cherry Slab=Kirschholzstufe +Double Cherry Slab= Doppelte Kirschholzstufe +Cherry Sign=Kirschholzschild +Cherry Fence=Kirschholzzaun +Cherry Gate=Kirschholzzauntor +Cherry Pressure Plate=Kirschholzdruckplatte +Cherry Button=Kirschholzknopf diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.fr.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.fr.tr index 2f6b7db22..7cc9bd47c 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.fr.tr +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.fr.tr @@ -19,6 +19,6 @@ Cherry Slab=Dalle en cerisier Double Cherry Slab=Double Dalle en cerisier Cherry Sign=Panneau de cerisier Cherry Fence=Barrière en cerisier -Cherry Gate=Portillion en cerisier +Cherry Fence Gate=Portillion en cerisier Cherry Pressure Plate=Plaque de pression en cerisier Cherry Button=Bouton de Cerisier diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.pt_BR.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.pt_BR.tr index e3dc6d2fd..1cbe31bd2 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.pt_BR.tr +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.pt_BR.tr @@ -19,6 +19,6 @@ Cherry Slab=Laje de Cerejeira Double Cherry Slab=Laje Dupla de Cerejeira Cherry Sign=Placa de Cerejeira Cherry Fence=Cerca de Cerejeira -Cherry Gate=Portão de Cerejeira +Cherry Fence Gate=Portão de Cerejeira Cherry Pressure Plate=Placa de Pressão de Cerejeira Cherry Button=Botão de Cerejeira diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.ru.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.ru.tr index 1dc530f7a..9959561d2 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.ru.tr +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.ru.tr @@ -19,6 +19,6 @@ Cherry Slab=Вишнёвая плита Double Cherry Slab=Двойная вишнёвая плита Cherry Sign=Вишнёвая табличка Cherry Fence=Вишнёвый забор -Cherry Gate=Вишнёвая калитка +Cherry Fence Gate=Вишнёвая калитка Cherry Pressure Plate=Вишнёвая нажимная плита Cherry Button=Вишнёвая кнопка diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/template.txt b/mods/ITEMS/mcl_cherry_blossom/locale/template.txt index 39ba7026a..a1aee1194 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/template.txt +++ b/mods/ITEMS/mcl_cherry_blossom/locale/template.txt @@ -19,6 +19,6 @@ Cherry Slab= Double Cherry Slab= Cherry Sign= Cherry Fence= -Cherry Gate= +Cherry Fence Gate= Cherry Pressure Plate= Cherry Button= diff --git a/mods/ITEMS/mcl_cherry_blossom/nodes.lua b/mods/ITEMS/mcl_cherry_blossom/nodes.lua index 403982872..5b9e0ce49 100644 --- a/mods/ITEMS/mcl_cherry_blossom/nodes.lua +++ b/mods/ITEMS/mcl_cherry_blossom/nodes.lua @@ -51,13 +51,13 @@ mcl_stairs.register_stair("cherrywood", "mcl_cherry_blossom:cherrywood", {handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {"mcl_cherry_blossom_planks.png"}, S("Cherry Stairs"), - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab("cherrywood", "mcl_cherry_blossom:cherrywood", {handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {"mcl_cherry_blossom_planks.png"}, S("Cherry Slab"), - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, S("Double Cherry Slab")) -- Signs @@ -69,7 +69,7 @@ mcl_signs.register_sign_custom("mcl_cherry_blossom", "_cherrywood", mcl_fences.register_fence_and_fence_gate( "cherry_fence", S("Cherry Fence"), - S("Cherry Gate"), + S("Cherry Fence Gate"), "mcl_cherry_blossom_planks.png", {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, diff --git a/mods/ITEMS/mcl_chests/API.md b/mods/ITEMS/mcl_chests/API.md index 5550cfbfa..e0e6bde5e 100644 --- a/mods/ITEMS/mcl_chests/API.md +++ b/mods/ITEMS/mcl_chests/API.md @@ -5,9 +5,9 @@ animations are achieved by giving each chest node an entity, as Minetest (as of 5.8.1) doesn't support giving nodes animated meshes, only static ones. Because of that, a lot of parameters passed through the exposed functions are -be related to nodes and entities. +related to nodes and entities. -Please refer to [Minetest documentation](http://api.minetest.net/) and the code +Please refer to the [Minetest documentation](http://api.minetest.net/) and code comments in `api.lua`. diff --git a/mods/ITEMS/mcl_chests/ender.lua b/mods/ITEMS/mcl_chests/ender.lua index cf3e7b0fe..d76d627bb 100644 --- a/mods/ITEMS/mcl_chests/ender.lua +++ b/mods/ITEMS/mcl_chests/ender.lua @@ -94,7 +94,7 @@ minetest.register_node("mcl_chests:ender_chest_small", { mcl_chests.player_chest_close(sender) end end, - _mcl_blast_resistance = 3000, + _mcl_blast_resistance = 600, _mcl_hardness = 22.5, _mcl_silk_touch_drop = { "mcl_chests:ender_chest" }, on_rotate = mcl_chests.simple_rotate, diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index 9294ee642..988353601 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -79,7 +79,7 @@ minetest.register_lbm({ local node_name = node.name node.name = node_name .. "_small" minetest.swap_node(pos, node) - select_and_spawn_entity(pos, node) + mcl_chests.select_and_spawn_entity(pos, node) if node_name == "mcl_chests:trapped_chest_on" then minetest.log("action", "[mcl_chests] Disabled active trapped chest on load: " .. minetest.pos_to_string(pos)) mcl_chests.chest_update_after_close(pos) diff --git a/mods/ITEMS/mcl_chests/shulkers.lua b/mods/ITEMS/mcl_chests/shulkers.lua index b6ada6c46..f7e16dc11 100644 --- a/mods/ITEMS/mcl_chests/shulkers.lua +++ b/mods/ITEMS/mcl_chests/shulkers.lua @@ -295,7 +295,7 @@ for color, desc in pairs(boxtypes) do end end, on_rotate = mcl_chests.simple_rotate, - _mcl_blast_resistance = 6, + _mcl_blast_resistance = 2, _mcl_hardness = 2, _mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list) local meta = minetest.get_meta(pos) diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 0792972be..2d1a0efd6 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -2,29 +2,34 @@ local S = minetest.get_translator(minetest.get_current_modname()) mcl_cocoas = {} --- Place cocoa -local function cocoa_place(itemstack, placer, pt, plantname) +--- Place a cocoa pod. +-- Attempt to place a cocoa pod on a jungle tree. Checks if attachment +-- point is a jungle tree and sets the correct orientation of the stem. +-- +function mcl_cocoas.place(itemstack, placer, pt, plantname) -- check if pointing at a node if not pt or pt.type ~= "node" then return end - local under = minetest.get_node(pt.under) + local node = minetest.get_node(pt.under) -- return if any of the nodes are not registered - if not minetest.registered_nodes[under.name] then + local def = minetest.registered_nodes[node.name] + if not def then return end -- Am I right-clicking on something that has a custom on_rightclick set? if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[under.name] and minetest.registered_nodes[under.name].on_rightclick then - return minetest.registered_nodes[under.name].on_rightclick(pt.under, under, placer, itemstack) or itemstack + if def and def.on_rightclick then + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pt) + if new_stack and new_stack ~= itemstack then return new_stack end end end -- Check if pointing at jungle tree - if under.name ~= "mcl_core:jungletree" + if node.name ~= "mcl_core:jungletree" or minetest.get_node(pt.above).name ~= "air" then return end @@ -39,9 +44,7 @@ local function cocoa_place(itemstack, placer, pt, plantname) -- Add the node, set facedir and remove 1 item from the itemstack minetest.set_node(pt.above, {name = plantname, param2 = minetest.dir_to_facedir(clickdir)}) - minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}, true) - if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end @@ -49,111 +52,119 @@ local function cocoa_place(itemstack, placer, pt, plantname) return itemstack end --- Attempts to grow a cocoa at pos, returns true when grown, returns false if there's no cocoa --- or it is already at full size +--- Grows cocoa pod one size larger. +-- Attempts to grow a cocoa at pos, returns true when grown, returns false +-- if there's no cocoa or it is already at full size. +-- function mcl_cocoas.grow(pos) local node = minetest.get_node(pos) if node.name == "mcl_cocoas:cocoa_1" then minetest.set_node(pos, {name = "mcl_cocoas:cocoa_2", param2 = node.param2}) elseif node.name == "mcl_cocoas:cocoa_2" then minetest.set_node(pos, {name = "mcl_cocoas:cocoa_3", param2 = node.param2}) - return true + else + return false end - return false + return true end --- Cocoa definition --- 1st stage -local crop_def = { - description = S("Premature Cocoa Pod"), - _doc_items_create_entry = true, - _doc_items_longdesc = S("Cocoa pods grow on the side of jungle trees in 3 stages."), - drawtype = "mesh", - mesh = "mcl_cocoas_cocoa_stage_0.obj", - tiles = {"mcl_cocoas_cocoa_stage_0.png"}, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, - paramtype = "light", - sunlight_propagates = true, - paramtype2 = "facedir", - walkable = true, - drop = "mcl_cocoas:cocoa_beans", - collision_box = { - type = "fixed", - fixed = { - {-0.125, -0.0625, 0.1875, 0.125, 0.25, 0.4375}, -- Pod +-- only caller was mcl_dye, consider converting these into local functions. +local cocoa_place = mcl_cocoas.place +local cocoa_grow = mcl_cocoas.grow + +-- Cocoa pod variant definitions. +--[[ TODO: Use a mesh for cocoas for perfect texture compability. ]] +local podinfo = { + { desc = S("Premature Cocoa Pod"), + longdesc = S("Cocoa pods grow on the side of jungle trees in 3 stages."), + tiles = { + "mcl_cocoas_cocoa_stage_0.png", }, + n_box = {-0.125, -0.0625, 0.1875, 0.125, 0.25, 0.4375}, + s_box = {-0.125, -0.0625, 0.1875, 0.125, 0.5, 0.5 }, }, - selection_box = { - type = "fixed", - fixed = { - {-0.125, -0.0625, 0.1875, 0.125, 0.5, 0.5}, -- Pod + { desc = S("Medium Cocoa Pod"), + tiles = { + "mcl_cocoas_cocoa_stage_1.png", }, + n_box = {-0.1875, -0.1875, 0.0625, 0.1875, 0.25, 0.4375}, + s_box = {-0.1875, -0.1875, 0.0625, 0.1875, 0.5, 0.5 }, }, - groups = { - handy = 1, axey = 1, - dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, - attached_node_facedir=1, - not_in_creative_inventory=1, - cocoa=1 - }, - sounds = mcl_sounds.node_sound_wood_defaults(), - on_rotate = false, - _mcl_blast_resistance = 3, - _mcl_hardness = 0.2, -} - --- 2nd stage -minetest.register_node("mcl_cocoas:cocoa_1", table.copy(crop_def)) - -crop_def.description = S("Medium Cocoa Pod") -crop_def._doc_items_create_entry = false -crop_def.groups.cocoa = 2 -crop_def.mesh = "mcl_cocoas_cocoa_stage_1.obj" -crop_def.tiles = {"mcl_cocoas_cocoa_stage_1.png"} -crop_def.collision_box = { - type = "fixed", - fixed = { - {-0.1875, -0.1875, 0.0625, 0.1875, 0.25, 0.4375}, -- Pod - }, -} -crop_def.selection_box = { - type = "fixed", - fixed = { - {-0.1875, -0.1875, 0.0625, 0.1875, 0.5, 0.5}, + { desc = S("Mature Cocoa Pod"), + longdesc = S("A mature cocoa pod grew on a jungle tree to its full size and it is ready to be harvested for cocoa beans. It won't grow any further."), + tiles = { + "mcl_cocoas_cocoa_stage_2.png", + }, + n_box = {-0.25, -0.3125, -0.0625, 0.25, 0.25, 0.4375}, + s_box = {-0.25, -0.3125, -0.0625, 0.25, 0.5, 0.5 }, }, } -minetest.register_node("mcl_cocoas:cocoa_2", table.copy(crop_def)) +for i = 1, 3 do + local def = { + description = podinfo[i].desc, + _doc_items_create_entry = true, + _doc_items_longdesc = podinfo[i].longdesc, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + tiles = podinfo[i].tiles, + use_texture_alpha = "clip", + node_box = { + type = "fixed", + fixed = { + podinfo[i].n_box, -- Pod + -- FIXME: This has a thickness of 0. Is this OK in Minetest? + { 0, 0.25, 0.25, 0, 0.5, 0.5 }, }, -- Stem + }, + collision_box = { + type = "fixed", + fixed = podinfo[i].n_box + }, + selection_box = { + type = "fixed", + fixed = podinfo[i].s_box + }, + groups = { + handy = 1, axey = 1, attached_node_facedir = 1, + dig_by_water = 1, destroy_by_lava_flow = 1, dig_by_piston = 1, + cocoa = i, not_in_creative_inventory = 1, + }, + sunlight_propagates = true, + walkable = true, + drop = "mcl_cocoas:cocoa_beans", + sounds = mcl_sounds.node_sound_wood_defaults(), + on_rotate = false, + _mcl_blast_resistance = 3, + _mcl_hardness = 0.2, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + return cocoa_grow(pos) + end, + } --- Final stage -crop_def.description = S("Mature Cocoa Pod") -crop_def._doc_items_longdesc = S("A mature cocoa pod grew on a jungle tree to its full size and it is ready to be harvested for cocoa beans. It won't grow any further.") -crop_def._doc_items_create_entry = true -crop_def.groups.cocoa = 3 -crop_def.mesh = "mcl_cocoas_cocoa_stage_2.obj" -crop_def.tiles = {"mcl_cocoas_cocoa_stage_2.png"} -crop_def.collision_box = { - type = "fixed", - fixed = { - {-0.25, -0.3125, -0.0625, 0.25, 0.25, 0.4375}, -- Pod - }, -} -crop_def.selection_box = { - type = "fixed", - fixed = { - {-0.25, -0.3125, -0.0625, 0.25, 0.5, 0.5}, - }, -} -crop_def.drop = "mcl_cocoas:cocoa_beans 3" -minetest.register_node("mcl_cocoas:cocoa_3", table.copy(crop_def)) + if i == 2 then + def._doc_items_longdesc = nil + def._doc_items_create_entry = false + end + if i == 3 then + def.drop = "mcl_cocoas:cocoa_beans 3" + def._on_bone_mealing = nil + end + + minetest.register_node("mcl_cocoas:cocoa_" .. i, table.copy(def)) +end minetest.register_craftitem("mcl_cocoas:cocoa_beans", { - description = S("Cocoa Beans"), + inventory_image = "mcl_cocoa_beans.png", _tt_help = S("Grows at the side of jungle trees"), - _doc_items_longdesc = S("Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye."), - _doc_items_usagehelp = S("Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa."), - inventory_image = "mcl_cocoas_cocoa_beans.png", - groups = {craftitem = 1, compostability = 65}, + _doc_items_longdesc = S("Cocoa beans can be used to plant cocoa, bake cookies or cract brown dye."), + _doc_items_usagehelp = S("Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa."), + description = S("Cocoa Beans"), + stack_max = 64, + groups = { + craftitem = 1, compostability = 65, + }, on_place = function(itemstack, placer, pointed_thing) return cocoa_place(itemstack, placer, pointed_thing, "mcl_cocoas:cocoa_1") end, diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr index 3740c41cf..ba0eb433e 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr @@ -2,7 +2,7 @@ Cocoa Beans=Kakaobohnen Grows at the side of jungle trees=Wächst an der Seite von Dschungelbäumen Cocoa beans can be used to plant cocoa pods, bake chocolate cookies or craft brown dye.=Kakaobohnen können benutzt werden, um Kakao anzupflanzen, Kekse zu backen oder braune Farbstoffe herzustellen. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie auf ein Schaf, um die Wolle braun einzufärben. Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen. Premature Cocoa Pod=Junge Kakaoschote Cocoa pods grow on the side of jungle trees in 3 stages.=Kakaoschoten wachsen an der Seite von Dschungelbäumen in 3 Stufen. Medium Cocoa Pod=Mittelgroße Kakaoschote diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr index c76fc512f..750cb2695 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr @@ -2,7 +2,7 @@ Cocoa Beans=Granos de cacao Grows at the side of jungle trees=Crece al lado de los árboles de la jungla Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Los granos de cacao se pueden usar para plantar cacao, hornear galletas o hacer tintes marrones. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en el costado del tronco de un árbol de la jungla para plantar un cacao joven. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de la jungla para plantar un cacao joven. Premature Cocoa Pod=Vaina de cacao prematura Cocoa pods grow on the side of jungle trees in 3 stages.=Las vainas de cacao crecen al lado de los árboles de jungla en 3 etapas. Medium Cocoa Pod=Vaina de cacao mediana diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr index 5d64eb5be..2cd11dc93 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr @@ -2,7 +2,7 @@ Cocoa Beans=Fèves de Cacao Grows at the side of jungle trees=Pousse à côté des arbres de la jungle Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Les fèves de cacao peuvent être utilisées pour planter du cacao, faire des biscuits ou fabriquer de la teinture brune. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacaoyer. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Faites un clic droit sur un mouton pour brunir sa laine. Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacao. Premature Cocoa Pod=Gousse de cacao prématurée Cocoa pods grow on the side of jungle trees in 3 stages.=Les cabosses de cacao poussent sur le côté des arbres d'Acajou en 3 étapes. Medium Cocoa Pod=Gousse de cacao moyenne diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr index 83df9be7a..5e33ca727 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr @@ -2,7 +2,7 @@ Cocoa Beans=Ziarna kakaowe Grows at the side of jungle trees=Rośnie na boku tropikalnych drzew Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Ziarna kakaowe mogą być używane do sadzenia kakao, pieczenia ciasteczek lub robienia brązowego barwnika. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym aby zafarbować wełnę owcy na brązowo. Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao. Premature Cocoa Pod=Niedojrzała roślina kakao Cocoa pods grow on the side of jungle trees in 3 stages.=Roślina kakao rośnie na bokach tropikalnych drzew w 3 etapach Medium Cocoa Pod=Średnio-dojrzała roślina kakao diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr index acce2fa83..7840c5e4a 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr @@ -2,7 +2,7 @@ Cocoa Beans=Какао-бобы Grows at the side of jungle trees=Растут на стволах тропических деревьев Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Какао-бобы можно использовать для посадки какао, выпечки печенья или изготовления коричневого красителя. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по боковой части ствола тропического дерева, чтобы посадить молодое какао. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по овце, чтобы сделать её шерсть коричневой. Кликните правой по боковой части ствола тропического дерева, чтобы посадить молодое какао. Premature Cocoa Pod=Молодой стручок какао Cocoa pods grow on the side of jungle trees in 3 stages.=Стручки какао растут на деревьях джунглей в 3 этапа. Medium Cocoa Pod=Средний стручок какао diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.zh_TW.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.zh_TW.tr index 038746155..d7eec03bc 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.zh_TW.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.zh_TW.tr @@ -2,7 +2,7 @@ Cocoa Beans=可可豆 Grows at the side of jungle trees=在叢林木側生長 Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=可可豆可用於種植可可、烘烤餅乾或製作棕色染料。 -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊叢林木的一側,可以種植一個可可。 +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊一隻羊,使其羊毛變成褐色。右鍵點擊叢林木的一側,可以種植一個可可。 Premature Cocoa Pod=成長中的可可豆莢(第1階段) Cocoa pods grow on the side of jungle trees in 3 stages.=可可莢果分3個階段生長在叢林樹的側面。 Medium Cocoa Pod=成長中的可可豆莢(第2階段) diff --git a/mods/ITEMS/mcl_cocoas/locale/template.txt b/mods/ITEMS/mcl_cocoas/locale/template.txt index cb8c5bbfd..06d6e2480 100644 --- a/mods/ITEMS/mcl_cocoas/locale/template.txt +++ b/mods/ITEMS/mcl_cocoas/locale/template.txt @@ -2,7 +2,7 @@ Cocoa Beans= Grows at the side of jungle trees= Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.= -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.= +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.= Premature Cocoa Pod= Cocoa pods grow on the side of jungle trees in 3 stages.= Medium Cocoa Pod= diff --git a/mods/ITEMS/mcl_cocoas/mod.conf b/mods/ITEMS/mcl_cocoas/mod.conf index 867636191..fb084f39a 100644 --- a/mods/ITEMS/mcl_cocoas/mod.conf +++ b/mods/ITEMS/mcl_cocoas/mod.conf @@ -1,4 +1,4 @@ name = mcl_cocoas description = Cocoa pods which grow at jungle trees. Does not include cocoa beans. -depends = mcl_sounds, mcl_core -optional_depends = doc \ No newline at end of file +depends = mcl_sounds, mcl_core, mcl_util +optional_depends = doc diff --git a/mods/ITEMS/mcl_colorblocks/init.lua b/mods/ITEMS/mcl_colorblocks/init.lua index dff30484a..72406014f 100644 --- a/mods/ITEMS/mcl_colorblocks/init.lua +++ b/mods/ITEMS/mcl_colorblocks/init.lua @@ -162,7 +162,7 @@ for _, row in ipairs(block.dyes) do stack_max = 64, is_ground_content = false, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4.2, + _mcl_blast_resistance = 1.4, _mcl_hardness = 1.4, on_rotate = on_rotate, }) diff --git a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr index 359a2f7cb..ac6fcba41 100644 --- a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr +++ b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr @@ -1,76 +1,94 @@ # textdomain: mcl_colorblocks White Terracotta=Weiße Terrakotta White Glazed Terracotta=Weiße glasierte Terrakotta +White Glazed Terracotta Pillar= White Concrete Powder=Weißes Betonpulver White Concrete=Weißer Beton Grey Terracotta=Graue Terrakotta Grey Glazed Terracotta=Graue glasierte Terrakotta +Grey Glazed Terracotta Pillar= Grey Concrete Powder=Graues Betonpulver Grey Concrete=Grauer Beton Light Grey Terracotta=Hellgraue Terrakotta Light Grey Glazed Terracotta=Hellgraue glasierte Terrakotta +Light Grey Glazed Terracotta Pillar= Light Grey Concrete Powder=Hellgraues Betonpulver Light Grey Concrete=Hellgrauer Beton Black Terracotta=Schwarze Terrakotta Black Glazed Terracotta=Schwarze glasierte Terrakotta +Black Glazed Terracotta Pillar= Black Concrete Powder=Schwarzes Betonpulver Black Concrete=Schwarzer Beton Red Terracotta=Rote Terrakotta Red Glazed Terracotta=Rote glasierte Terrakotta +Red Glazed Terracotta Pillar= Red Concrete Powder=Rotes Betonpulver Red Concrete=Roter Beton Yellow Terracotta=Gelbe Terrakotta Yellow Glazed Terracotta=Gelbe glasierte Terrakotta +Yellow Glazed Terracotta Pillar= Yellow Concrete Powder=Gelbes Betonpulver Yellow Concrete=Gelber Beton Green Terracotta=Grüne Terrakotta Green Glazed Terracotta=Grüne glasierte Terrakotta +Green Glazed Terracotta Pillar= Green Concrete Powder=Grünes Betonpulver Green Concrete=Grüner Beton Cyan Terracotta=Türkise Terrakotta Cyan Glazed Terracotta=Türkise glasierte Terrakotta +Cyan Glazed Terracotta Pillar= Cyan Concrete Powder=Türkises Betonpulver Cyan Concrete=Türkiser Beton Blue Terracotta=Blaue Terrakotta Blue Glazed Terracotta=Blaue glasierte Terrakotta +Blue Glazed Terracotta Pillar= Blue Concrete Powder=Blaues Betonpulver Blue Concrete=Blauer Beton Magenta Terracotta=Magenta Terrakotta Magenta Glazed Terracotta=Magenta glasierte Terrakotta +Magenta Glazed Terracotta Pillar= Magenta Concrete Powder=Magenta Betonpulver Magenta Concrete=Magenta Beton Orange Terracotta=Orange Terrakotta Orange Glazed Terracotta=Orange glasierte Terrakotta -Orange Concrete Powder=Orange Betonpulver +Orange Glazed Terracotta Pillar=Orange glasierte Terrakottasäule +Orange Concrete Powder=Oranges Betonpulver Orange Concrete=Orange Beton Purple Terracotta=Violette Terrakotta Purple Glazed Terracotta=Violette glasierte Terrakotta +Purple Glazed Terracotta Pillar=Violett glasierte Terrakottasäule Purple Concrete Powder=Violettes Betonpulver Purple Concrete=Violetter Beton Brown Terracotta=Braune Terrakotta Brown Glazed Terracotta=Braune glasierte Terrakotta +Brown Glazed Terracotta Pillar= Brown Concrete Powder=Braunes Betonpulver Brown Concrete=Brauner Beton Pink Terracotta=Rosa Terrakotta Pink Glazed Terracotta=Rosa glasierte Terrakotta +Pink Glazed Terracotta Pillar= Pink Concrete Powder=Rosa Betonpulver Pink Concrete=Rosa Beton Lime Terracotta=Lindgrüne Terrakotta Lime Glazed Terracotta=Lindgrüne glasierte Terrakotta +Lime Glazed Terracotta Pillar= Lime Concrete Powder=Lindgrünes Betonpulver Lime Concrete=Lindgrüner Beton Light Blue Terracotta=Hellbaue Terrakotta Light Blue Glazed Terracotta=Hellblaue glasierte Terrakotta +Light Blue Glazed Terracotta Pillar= Light Blue Concrete Powder=Hellblaues Betonpulver Light Blue Concrete=Hellblauer Beton Terracotta is a basic building material. It comes in many different colors.=Terrakotta ist ein Baumaterial. Es gibt es in vielen verschiedenen Farben. Glazed terracotta is a decorative block with a complex pattern. It can be rotated by placing it in different directions.=Glasierte Terrakotta ist ein dekorativer Block mit einem komplexen Muster. Sie kann rotiert werden, indem man sie in verschiedene Richtungen platziert. +Glazed terracotta pillar is a decorative block with a complex pattern. It can be used with Glazed terracotta to make uneven patterns.= Concrete powder is used for creating concrete, but it can also be used as decoration itself. It comes in different colors. Concrete powder turns into concrete of the same color when it comes in contact with water.=Betonpulver wird benutzt, um Beton herzustellen, aber es kann auch selbst als Dekoration benutzt werden. Es kommt in verschiedenen Farben daher. Betonpulver verwandelt sich in Beton der selben Farbe, wenn es mit Wasser in Berührung kommt. Concrete is a decorative block which comes in many different colors. It is notable for having a very strong and clean color.=Beton ist ein dekorativer Block, der in verschiedenen Farben daherkommt. Er hat eine besonders kräftige und klare Farbe. Terracotta=Terrakotta Terracotta is a basic building material which comes in many different colors. This particular block is uncolored.=Terrakotta ist ein Baumaterial, welches in vielen verschiedenen Farben vorkommt. Diese Variante ist ungefärbt. Colored Terracotta=Gefärbte Terrakotta Glazed Terracotta=Glasierte Terrakotta +Glazed Terracotta Pillar= Concrete Powder=Betonpulver Concrete=Beton Turns into concrete on water contact=Wird zu Beton bei Wasserkontakt diff --git a/mods/ITEMS/mcl_compass/init.lua b/mods/ITEMS/mcl_compass/init.lua index 2905c0b3b..0117b3a89 100644 --- a/mods/ITEMS/mcl_compass/init.lua +++ b/mods/ITEMS/mcl_compass/init.lua @@ -312,8 +312,8 @@ minetest.register_node("mcl_compass:lodestone",{ "lodestone_side4.png" }, groups = {pickaxey=1, material_stone=1}, - _mcl_hardness = 1.5, - _mcl_blast_resistance = 6, + _mcl_hardness = 3.5, + _mcl_blast_resistance = 3.5, sounds = mcl_sounds.node_sound_stone_defaults() }) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index efa08c75c..28883dc48 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -11,7 +11,7 @@ local composter_description = S( "Composter" ) local composter_longdesc = S( - "Composters can convert various organic items into bonemeal." + "Composters can convert various organic items into bone meal." ) local composter_usagehelp = S( "Use organic items on the composter to fill it with layers of compost. " .. @@ -48,6 +48,41 @@ local vector_offset = vector.offset local is_protected = minetest.is_protected local record_protection_violation = minetest.record_protection_violation +--- Math and node swap during compost progression +---@param pos Vector Position of the node +---@param node node +---@param chance integer Value of "compostability" group of inserted item +local function composter_progress_chance(pos, node, chance) + -- calculate leveling up chance + local rand = math.random(0,100) + if chance >= rand then + -- get current compost level + local level = registered_nodes[node.name]["_mcl_compost_level"] + -- spawn green particles above new layer + mcl_bone_meal.add_bone_meal_particle(vector_offset(pos, 0, level/8, 0)) + -- update composter block + if level < 7 then + level = level + 1 + else + level = "ready" + end + swap_node(pos, {name = "mcl_composters:composter_" .. level}) + minetest.sound_play({name="default_grass_footstep", gain=0.4}, { + pos = pos, + gain= 0.4, + max_hear_distance = 16, + }, true) + -- a full composter becomes ready for harvest after one second + -- the block will get updated by the node timer callback set in node reg def + if level == 7 then + local timer = get_node_timer(pos) + if not timer:is_started() then + timer:start(1) + end + end + end +end + --- Fill the composter when rightclicked. -- -- `on_rightclick` handler for composter blocks of all fill levels except @@ -86,41 +121,6 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) return itemstack end ---- Math and node swap during compost progression ----@param pos Vector Position of the node ----@param node node ----@param chance integer Value of "compostability" group of inserted item -function composter_progress_chance(pos, node, chance) - -- calculate leveling up chance - local rand = math.random(0,100) - if chance >= rand then - -- get current compost level - local level = registered_nodes[node.name]["_mcl_compost_level"] - -- spawn green particles above new layer - mcl_dye.add_bone_meal_particle(vector_offset(pos, 0, level/8, 0)) - -- update composter block - if level < 7 then - level = level + 1 - else - level = "ready" - end - swap_node(pos, {name = "mcl_composters:composter_" .. level}) - minetest.sound_play({name="default_grass_footstep", gain=0.4}, { - pos = pos, - gain= 0.4, - max_hear_distance = 16, - }, true) - -- a full composter becomes ready for harvest after one second - -- the block will get updated by the node timer callback set in node reg def - if level == 7 then - local timer = get_node_timer(pos) - if not timer:is_started() then - timer:start(1) - end - end - end -end - --- Update a full composter block to ready for harvesting. -- -- `on_timer` handler. The timer is set in function 'composter_add_item' @@ -203,7 +203,7 @@ end -- minetest.register_node("mcl_composters:composter", { description = composter_description, - _tt_help = S("Converts organic items into bonemeal"), + _tt_help = S("Converts organic items into bone meal"), _doc_items_longdesc = composter_longdesc, _doc_items_usagehelp = composter_usagehelp, paramtype = "light", diff --git a/mods/ITEMS/mcl_composters/locale/mcl_composters.de.tr b/mods/ITEMS/mcl_composters/locale/mcl_composters.de.tr new file mode 100644 index 000000000..cd5c20e0c --- /dev/null +++ b/mods/ITEMS/mcl_composters/locale/mcl_composters.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_composters +Composter=Komposter diff --git a/mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr b/mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr index 0f4e665e6..909b889e8 100644 --- a/mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr +++ b/mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr @@ -4,4 +4,4 @@ Composters can convert various organic items into bonemeal.=Les composteurs peuv Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter.=Utiliser des objets organiques sur le composteur pour le remplir de couches de compost. Chaque fois qu'un objet est mis dans le composteur, il y a une chance d'ajouter une nouvelle couche de compost au composteur. Certains objets ont une plus grande chance que d'autres d'ajouter une couche supplémentaire. Après l'avoir rempli de 7 couches de compost, le composteur est plein. Après un délai d'approximativement une seconde, le composteur est prêt et on peut récupérer la farine d'os. Cliquer droit le composteur permet de récupérer la farine d'os et de vider le composteur. filled=rempli ready for harvest=prêt pour la récolte -Converts organic items into bonemeal=Convertit les objets organiques en farine d'os. +Converts organic items into bone meal=Convertit les objets organiques en farine d'os. diff --git a/mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr b/mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr index 6d8908486..115d53b17 100644 --- a/mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr +++ b/mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr @@ -4,4 +4,4 @@ Composters can convert various organic items into bonemeal.=コンポスター Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter."=コンポスターに有機物を入れて、堆肥の層を作りましょう。コンポスターに有機物を入れるたびに、次の堆肥の層が追加されるチャンスが起きます。 追加される確率がより高くなっているアイテムもいくつかあります。 7層分の堆肥が充填されると、コンポスターは満杯となります。その約1秒後に、骨粉を取り出せる準備が完了します。右クリックして骨粉を取り出すと、コンポスターは空になります。 filled=充足 ready for harvest=収穫可能 -Converts organic items into bonemeal=有機物を骨粉に変える +Converts organic items into bone meal=有機物を骨粉に変える diff --git a/mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr b/mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr index 39f172199..99dfa62eb 100644 --- a/mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr +++ b/mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr @@ -4,4 +4,4 @@ Composters can convert various organic items into bonemeal.=Компостер Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter.=Используйте органические предметы на компостере, чтобы заполнить его слоями перегноя. Каждый раз когда в компостер попадает предмет, есть шанс что в компостере появится новый слой перегноя. Некоторые предметы имеют больший шанс на появление нового слоя. После заполнения 7 слоями перегноя, компостер можно опустошить, забрав из него костную муку. После задержки в одну секунду компостер будет готов и костная мука будет извлечена из него. Правым кликом по компостеру чтобы забрать костную муку. filled=заполнен ready for harvest=готов к сбору -Converts organic items into bonemeal=Перерабатывает органику в костную муку +Converts organic items into bone meal=Перерабатывает органику в костную муку diff --git a/mods/ITEMS/mcl_composters/locale/template.txt b/mods/ITEMS/mcl_composters/locale/template.txt index f3329719a..344e48c31 100644 --- a/mods/ITEMS/mcl_composters/locale/template.txt +++ b/mods/ITEMS/mcl_composters/locale/template.txt @@ -1,7 +1,7 @@ # textdomain: mcl_composters Composter= -Composters can convert various organic items into bonemeal.= -Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter.= +Composters can convert various organic items into bone meal.= +Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter.= filled= ready for harvest= -Converts organic items into bonemeal= +Converts organic items into bone meal= diff --git a/mods/ITEMS/mcl_composters/mod.conf b/mods/ITEMS/mcl_composters/mod.conf index ed6119d3a..f7f229fbc 100644 --- a/mods/ITEMS/mcl_composters/mod.conf +++ b/mods/ITEMS/mcl_composters/mod.conf @@ -1,5 +1,5 @@ name = mcl_composters author = kabou description = Composters can convert various organic items into bonemeal. -depends = mcl_core, mcl_sounds, mcl_dye, mcl_hoppers +depends = mcl_core, mcl_sounds, mcl_bone_meal, mcl_hoppers optional_depends = doc diff --git a/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr b/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr new file mode 100644 index 000000000..a734cc415 --- /dev/null +++ b/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr @@ -0,0 +1,3 @@ +# textdomain: mcl_compressed_blocks +Compressed Cobblestone=Verdichtetes Kopfsteinpflaster +Double Compressed Cobblestone=Doppelt verdichtetes Kopfsteinpflaster diff --git a/mods/ITEMS/mcl_compressed_blocks/locale/template.txt b/mods/ITEMS/mcl_compressed_blocks/locale/template.txt new file mode 100644 index 000000000..0fe61dcc4 --- /dev/null +++ b/mods/ITEMS/mcl_compressed_blocks/locale/template.txt @@ -0,0 +1,17 @@ +# textdomain: mcl_compressed_blocks +Compressed Cobblestone= +Compressed Cobblestone is a decorative block made from 9 Cobblestone. It is useful for saving space in your inventories.= +Double Compressed Cobblestone= +Double Compressed Cobblestone is a decorative block made from 9 Compressed Cobblestone. It is useful for saving space in your inventories.= +Triple Compressed Cobblestone= +Triple Compressed Cobblestone is a decorative block made from 9 Double Compressed Cobblestone. It is useful for saving space in your inventories.= +Quadruple Compressed Cobblestone= +Quadruple Compressed Cobblestone is a decorative block made from 9 Triple Compressed Cobblestone. It is useful for saving space in your inventories.= +Quintuple Compressed Cobblestone= +Quintuple Compressed Cobblestone is a decorative block made from 9 Quadruple Compressed Cobblestone. It is useful for saving space in your inventories.= +Sextuple Compressed Cobblestone= +Sextuple Compressed Cobblestone is a decorative block made from 9 Quintuple Compressed Cobblestone. It is useful for saving space in your inventories.= +Septuple Compressed Cobblestone= +Septuple Compressed Cobblestone is a decorative block made from 9 Sextuple Compressed Cobblestone. It is useful for saving space in your inventories.= +Octuple Compressed Cobblestone= +Octuple Compressed Cobblestone is a decorative block made from 9 Septuple Compressed Cobblestone. It is useful for saving space in your inventories.= diff --git a/mods/ITEMS/mcl_compressed_blocks/nodes.lua b/mods/ITEMS/mcl_compressed_blocks/nodes.lua index 32c47bfd4..15a893752 100644 --- a/mods/ITEMS/mcl_compressed_blocks/nodes.lua +++ b/mods/ITEMS/mcl_compressed_blocks/nodes.lua @@ -1,7 +1,10 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) + --Compressed Cobblestone minetest.register_node("mcl_compressed_blocks:compressed_cobblestone", { - description = "Compressed Cobblestone", - _doc_items_longdesc = ("Compressed Cobblestone is a decorative block made from 9 Cobblestone. It is useful for saving space in your inventories."), + description = S("Compressed Cobblestone"), + _doc_items_longdesc = S("Compressed Cobblestone is a decorative block made from 9 Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_compressed_cobblestone.png"}, is_ground_content = true, @@ -14,8 +17,8 @@ minetest.register_node("mcl_compressed_blocks:compressed_cobblestone", { --Double Compressed Cobble minetest.register_node("mcl_compressed_blocks:double_compressed_cobblestone", { - description = "Double Compressed Cobblestone", - _doc_items_longdesc = ("Double Compressed Cobblestone is a decorative block made from 9 Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Double Compressed Cobblestone"), + _doc_items_longdesc = S("Double Compressed Cobblestone is a decorative block made from 9 Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_double_compressed_cobblestone.png"}, is_ground_content = true, @@ -28,8 +31,8 @@ minetest.register_node("mcl_compressed_blocks:double_compressed_cobblestone", { --Triple Compressed Cobble minetest.register_node("mcl_compressed_blocks:triple_compressed_cobblestone", { - description = "Triple Compressed Cobblestone", - _doc_items_longdesc = ("Triple Compressed Cobblestone is a decorative block made from 9 Double Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Triple Compressed Cobblestone"), + _doc_items_longdesc = S("Triple Compressed Cobblestone is a decorative block made from 9 Double Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_triple_compressed_cobblestone.png"}, is_ground_content = true, @@ -42,8 +45,8 @@ minetest.register_node("mcl_compressed_blocks:triple_compressed_cobblestone", { --Quadruple Compressed Cobble minetest.register_node("mcl_compressed_blocks:quadruple_compressed_cobblestone", { - description = "Quadruple Compressed Cobblestone", - _doc_items_longdesc = ("Quadruple Compressed Cobblestone is a decorative block made from 9 Triple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Quadruple Compressed Cobblestone"), + _doc_items_longdesc = S("Quadruple Compressed Cobblestone is a decorative block made from 9 Triple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_quadruple_compressed_cobblestone.png"}, is_ground_content = true, @@ -56,8 +59,8 @@ minetest.register_node("mcl_compressed_blocks:quadruple_compressed_cobblestone", --Quintuple Compressed Cobble minetest.register_node("mcl_compressed_blocks:quintuple_compressed_cobblestone", { - description = "Quintuple Compressed Cobblestone", - _doc_items_longdesc = ("Quintuple Compressed Cobblestone is a decorative block made from 9 Quadruple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Quintuple Compressed Cobblestone"), + _doc_items_longdesc = S("Quintuple Compressed Cobblestone is a decorative block made from 9 Quadruple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_quintuple_compressed_cobblestone.png"}, is_ground_content = true, @@ -70,8 +73,8 @@ minetest.register_node("mcl_compressed_blocks:quintuple_compressed_cobblestone", --Sextuple Compressed Cobble minetest.register_node("mcl_compressed_blocks:sextuple_compressed_cobblestone", { - description = "Sextuple Compressed Cobblestone", - _doc_items_longdesc = ("Sextuple Compressed Cobblestone is a decorative block made from 9 Quintuple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Sextuple Compressed Cobblestone"), + _doc_items_longdesc = S("Sextuple Compressed Cobblestone is a decorative block made from 9 Quintuple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_sextuple_compressed_cobblestone.png"}, is_ground_content = true, @@ -84,8 +87,8 @@ minetest.register_node("mcl_compressed_blocks:sextuple_compressed_cobblestone", --Septuple Compressed Cobble minetest.register_node("mcl_compressed_blocks:septuple_compressed_cobblestone", { - description = "Septuple Compressed Cobblestone", - _doc_items_longdesc = ("Septuple Compressed Cobblestone is a decorative block made from 9 Sextuple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Septuple Compressed Cobblestone"), + _doc_items_longdesc = S("Septuple Compressed Cobblestone is a decorative block made from 9 Sextuple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_septuple_compressed_cobblestone.png"}, is_ground_content = true, @@ -98,8 +101,8 @@ minetest.register_node("mcl_compressed_blocks:septuple_compressed_cobblestone", --Ocutple Compressed Cobble minetest.register_node("mcl_compressed_blocks:octuple_compressed_cobblestone", { - description = "Octuple Compressed Cobblestone", - _doc_items_longdesc = ("Octuple Compressed Cobblestone is a decorative block made from 9 Septuple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Octuple Compressed Cobblestone"), + _doc_items_longdesc = S("Octuple Compressed Cobblestone is a decorative block made from 9 Septuple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_octuple_compressed_cobblestone.png"}, is_ground_content = true, diff --git a/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr b/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr index cc2290e1e..3b28eb371 100644 --- a/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr +++ b/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr @@ -2,36 +2,56 @@ A block of copper is mostly a decorative block.=Ein Kupferblock wird meistens als dekorativer Block verwendet. A block used for compact raw copper storage.=Ein Block für die kompakte Lagerung von Rohkupfer. Block of Copper=Kupferblock +Waxed Block of Copper=Gewachster Kupferblock Block of Raw Copper=Rohkupferblock -Copper Ingot=Kupfer Barren +Copper Ingot=Kupferbarren Copper Ore=Kupfererz Cut copper is a decorative block.=Ein Geschnittener Kupferblock ist ein dekorativer Block. Cut Copper=Geschnittener Kupferblock +Waxed Cut Copper=Gewachster geschnittener Kupferblock Double Slab of Cut Copper=Doppelte Geschnittene Kupferstufe Double Slab of Exposed Cut Copper=Doppelte Angelaufene Geschnittene Kupferstufe Double Slab of Oxidized Cut Copper=Doppelte Oxidierte Geschnittene Kupferstufe Double Slab of Weathered Cut Copper=Doppelte Verwitterte Geschnittene Kupferstufe +Waxed Double Slab of Cut Copper= +Waxed Double Slab of Exposed Cut Copper= +Waxed Double Slab of Oxidized Cut Copper= +Waxed Double Slab of Weathered Cut Copper= Exposed copper is a decorative block.=Ein Angelaufener Kupferblock ist ein dekorativer Block. Exposed Copper=Angelaufener Kupferblock +Waxed Exposed Copper= Exposed cut copper is a decorative block.=Ein Angelaufener geschnittener Kupferblock ist ein dekorativer Block. Exposed Cut Copper=Angelaufener geschnittener Kupferblock +Waxed Exposed Cut Copper= Molten Raw Copper. It is used to craft blocks.=Geschmolzenes Rohkupfer. Es wird verwendet, um Blöcke herzustellen. Oxidized copper is a decorative block.=Ein Oxidierter Kupferblockist ist ein dekorativer Block. Oxidized Copper=Oxidierter Kupferblock +Waxed Oxidized Copper= Oxidized cut copper is a decorative block.=Ein Oxidierter geschnittener Kupferblock ist ein dekorativer Block. Oxidized Cut Copper=Oxidierter geschnittener Kupferblock +Waxed Oxidized Cut Copper= Raw Copper. Mine a Copper Ore to get it.=Bauen sie ein Kupfererz ab, um es zu erhalten. Raw Copper=Rohkupfer Slab of Cut Copper=Geschnittene Kupferstufe Slab of Exposed Cut Copper=Angelaufene Geschnittene Kupferstufe Slab of Oxidized Cut Copper=Oxidierte Geschnittene Kupferstufe Slab of Weathered Cut Copper=Verwitterte Geschnittene Kupferstufe +Waxed Slab of Cut Copper= +Waxed Slab of Exposed Cut Copper= +Waxed Slab of Oxidized Cut Copper= +Waxed Slab of Weathered Cut Copper= Some copper contained in stone, it is pretty common and can be found below sea level.=Stein, in dem etwas Kupfer enthalten ist. Es ist ziemlich häufig und kann unter dem Meeresspiegel gefunden werden. Stairs of Cut Copper=Geschnittene Kupfertreppe Stairs of Exposed Cut Copper=Angelaufene Geschnittene Kupfertreppe Stairs of Oxidized Cut Copper=Oxidierte Geschnittene Kupfertreppe Stairs of Weathered Cut Copper=Verwitterte Geschnittene Kupfertreppe +Waxed Stairs of Cut Copper= +Waxed Stairs of Exposed Cut Copper= +Waxed Stairs of Oxidized Cut Copper= +Waxed Stairs of Weathered Cut Copper= Weathered copper is a decorative block.=Ein Verwitterter Kupferblock ist ein dekorativer Block. Weathered Copper=Verwitterter Kupferblock +Waxed Weathered Copper= Weathered cut copper is a decorative block.=Ein Verwitterter geschnittener Kupferblock ist ein dekorativer Block. Weathered Cut Copper=Verwitterter geschnittener Kupferblock +Waxed Weathered Cut Copper= diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index af5a49a1c..f2ebe03ec 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -58,7 +58,7 @@ minetest.register_node("mcl_copper:block_exposed", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_oxidized_variant = "mcl_copper:block_weathered", _mcl_waxed_variant = "mcl_copper:waxed_block_exposed", _mcl_stripped_variant = "mcl_copper:block", @@ -72,7 +72,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_exposed", }) @@ -84,7 +84,7 @@ minetest.register_node("mcl_copper:block_weathered", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_oxidized_variant = "mcl_copper:block_oxidized", _mcl_waxed_variant = "mcl_copper:waxed_block_weathered", _mcl_stripped_variant = "mcl_copper:block_exposed", @@ -98,7 +98,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_weathered", }) @@ -110,7 +110,7 @@ minetest.register_node("mcl_copper:block_oxidized", { groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized", _mcl_stripped_variant = "mcl_copper:block_weathered", }) @@ -123,7 +123,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_oxidized", }) @@ -135,7 +135,7 @@ minetest.register_node("mcl_copper:block_cut", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_oxidized_variant = "mcl_copper:block_exposed_cut", _mcl_waxed_variant = "mcl_copper:waxed_block_cut", }) @@ -148,7 +148,7 @@ minetest.register_node("mcl_copper:waxed_block_cut", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_cut", }) @@ -160,7 +160,7 @@ minetest.register_node("mcl_copper:block_exposed_cut", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_waxed_variant = "mcl_copper:waxed_block_exposed_cut", _mcl_oxidized_variant = "mcl_copper:block_weathered_cut", _mcl_stripped_variant = "mcl_copper:block_cut", @@ -174,7 +174,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed_cut", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", }) @@ -186,7 +186,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", _mcl_oxidized_variant = "mcl_copper:block_oxidized_cut", _mcl_waxed_variant = "mcl_copper:waxed_block_weathered_cut", @@ -200,7 +200,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered_cut", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_weathered_cut", }) @@ -212,7 +212,7 @@ minetest.register_node("mcl_copper:block_oxidized_cut", { groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_weathered_cut", _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized_cut", }) @@ -225,7 +225,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_oxidized_cut", }) @@ -289,54 +289,54 @@ mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", {pickaxey = 2, oxidizable = 1}, {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, S("Stairs of Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("waxed_copper_cut", "mcl_copper:waxed_block_cut", {pickaxey = 2, waxed = 1}, {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, S("Waxed Stairs of Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", {pickaxey = 2, oxidizable = 1}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, S("Stairs of Exposed Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", {pickaxey = 2, waxed = 1}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, S("Waxed Stairs of Exposed Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cut", {pickaxey = 2, oxidizable = 1}, {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, S("Stairs of Weathered Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", {pickaxey = 2, waxed = 1}, {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, S("Waxed Stairs of Weathered Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", {pickaxey = 2}, {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, S("Stairs of Oxidized Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", {pickaxey = 2, waxed = 1}, {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, S("Waxed Stairs of Oxidized Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") diff --git a/mods/ITEMS/mcl_core/crafting.lua b/mods/ITEMS/mcl_core/crafting.lua index ffba04a7b..7baddbefd 100644 --- a/mods/ITEMS/mcl_core/crafting.lua +++ b/mods/ITEMS/mcl_core/crafting.lua @@ -165,6 +165,22 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "mcl_core:charcoalblock", + recipe = { + {"mcl_core:charcoal_lump", "mcl_core:charcoal_lump", "mcl_core:charcoal_lump"}, + {"mcl_core:charcoal_lump", "mcl_core:charcoal_lump", "mcl_core:charcoal_lump"}, + {"mcl_core:charcoal_lump", "mcl_core:charcoal_lump", "mcl_core:charcoal_lump"}, + } +}) + +minetest.register_craft({ + output = "mcl_core:charcoal_lump 9", + recipe = { + {"mcl_core:charcoalblock"}, + } +}) + minetest.register_craft({ output = "mcl_core:ironblock", recipe = { @@ -497,6 +513,12 @@ minetest.register_craft({ burntime = 800, }) +minetest.register_craft({ + type = "fuel", + recipe = "mcl_core:charcoalblock", + burntime = 800, +}) + minetest.register_craft({ type = "fuel", recipe = "mcl_core:coal_lump", diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index b520777d6..49395b588 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1,13 +1,20 @@ --- --- Lava vs water interactions --- - local modpath = minetest.get_modpath(minetest.get_current_modname()) - local mg_name = minetest.get_mapgen_setting("mg_name") -local math = math -local vector = vector +local random = math.random +local sqrt = math.sqrt +local floor = math.floor +local ceil = math.ceil +local abs = math.abs +local max = math.max + +local vector_new = vector.new +local vector_zero = vector.zero +local vector_offset = vector.offset +local vector_copy = vector.copy +local vector_add = vector.add +local vector_subtract = vector.subtract +local vector_distance = vector.distance local OAK_TREE_ID = 1 local DARK_OAK_TREE_ID = 2 @@ -24,7 +31,7 @@ minetest.register_abm({ chance = 1, min_y = mcl_vars.mg_end_min, action = function(pos, node, active_object_count, active_object_count_wider) - local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "group:water") + local water = minetest.find_nodes_in_area(vector_offset(pos, -1, -1, -1), vector_offset(pos, 1, 1, 1), "group:water") local lavatype = minetest.registered_nodes[node.name].liquidtype @@ -57,44 +64,41 @@ minetest.register_abm({ -- -- Papyrus and cactus growing -- - --- Functions -function mcl_core.grow_cactus(pos, node) - pos.y = pos.y-1 - local name = minetest.get_node(pos).name - if minetest.get_item_group(name, "sand") ~= 0 then - pos.y = pos.y+1 - local height = 0 - while minetest.get_node(pos).name == "mcl_core:cactus" and height < 4 do - height = height+1 - pos.y = pos.y+1 - end - if height < 3 then - if minetest.get_node(pos).name == "air" then - minetest.set_node(pos, {name="mcl_core:cactus"}) - end - end +function grow_cactus(pos, node) + pos.y = pos.y - 1 -- below + if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then return end + pos.y = pos.y + 2 -- above + local above = minetest.get_node(pos).name + if above == "air" then + minetest.set_node(pos, {name="mcl_core:cactus"}) + return + end + if above ~= "mcl_core:cactus" then return end + pos.y = pos.y + 1 -- at max height 3 + if minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name="mcl_core:cactus"}) end end -function mcl_core.grow_reeds(pos, node) - pos.y = pos.y-1 - local name = minetest.get_node(pos).name - if minetest.get_item_group(name, "soil_sugarcane") ~= 0 then - if minetest.find_node_near(pos, 1, {"group:water"}) == nil and minetest.find_node_near(pos, 1, {"group:frosted_ice"}) == nil then - return - end - pos.y = pos.y+1 - local height = 0 - while minetest.get_node(pos).name == "mcl_core:reeds" and height < 3 do - height = height+1 - pos.y = pos.y+1 - end - if height < 3 then - if minetest.get_node(pos).name == "air" then - minetest.set_node(pos, {name="mcl_core:reeds"}) - end - end +function grow_reeds(pos, node) + pos.y = pos.y - 1 -- below + if minetest.get_item_group(minetest.get_node(pos).name, "soil_sugarcane") == 0 then return end + pos.y = pos.y + 2 -- above + local above = minetest.get_node(pos).name + if above == "air" then + pos.y = pos.y - 1 -- original position, check for water + if minetest.find_node_near(pos, 1, {"group:water", "group:frosted_ice"}) == nil then return end + pos.y = pos.y + 1 -- above + minetest.set_node(pos, {name="mcl_core:reeds"}) + return + end + if above ~= "mcl_core:reeds" then return end + pos.y = pos.y + 1 -- at max height 3 + if minetest.get_node(pos).name == "air" then + pos.y = pos.y - 2 -- original position, check for water + if minetest.find_node_near(pos, 1, {"group:water", "group:frosted_ice"}) == nil then return end + pos.y = pos.y + 2 -- above + minetest.set_node(pos, {name="mcl_core:reeds"}) end end @@ -103,18 +107,11 @@ end local function drop_attached_node(p) local nn = minetest.get_node(p).name - if nn == "air" or nn == "ignore" then - return - end + if nn == "air" or nn == "ignore" then return end minetest.remove_node(p) for _, item in pairs(minetest.get_node_drops(nn, "")) do - local pos = { - x = p.x + math.random()/2 - 0.25, - y = p.y + math.random()/2 - 0.25, - z = p.z + math.random()/2 - 0.25, - } if item ~= "" then - minetest.add_item(pos, item) + minetest.add_item(vector_offset(p, random() * 0.5 - 0.25, random() * 0.5 - 0.25, random() * 0.5 - 0.25), item) end end end @@ -122,36 +119,25 @@ end -- Helper function for node actions for liquid flow local function liquid_flow_action(pos, group, action) local function check_detach(pos, xp, yp, zp) - local p = {x=pos.x+xp, y=pos.y+yp, z=pos.z+zp} - local n = minetest.get_node_or_nil(p) - if not n then - return false - end - local d = minetest.registered_nodes[n.name] - if not d then - return false - end + local n = minetest.get_node_or_nil(vector_offset(pos, xp, yp, zp)) + local d = n and minetest.registered_nodes[n.name] + if not d then return false end --[[ Check if we want to perform the liquid action. * 1: Item must be in liquid group * 2a: If target node is below liquid, always succeed * 2b: If target node is horizontal to liquid: succeed if source, otherwise check param2 for horizontal flow direction ]] local range = d.liquid_range or 8 - if (minetest.get_item_group(n.name, group) ~= 0) and - ((yp > 0) or - (yp == 0 and ((d.liquidtype == "source") or (n.param2 > (8-range) and n.param2 < 9)))) then + if minetest.get_item_group(n.name, group) ~= 0 and + (yp > 0 or + (yp == 0 and (d.liquidtype == "source" or (n.param2 > 8-range and n.param2 < 9)))) then action(pos) end end - local posses = { - { x=-1, y=0, z=0 }, - { x=1, y=0, z=0 }, - { x=0, y=0, z=-1 }, - { x=0, y=0, z=1 }, - { x=0, y=1, z=0 }, - } - for p=1,#posses do - check_detach(pos, posses[p].x, posses[p].y, posses[p].z) - end + check_detach(pos, -1, 0, 0) + check_detach(pos, 1, 0, 0) + check_detach(pos, 0, 0, -1) + check_detach(pos, 0, 0, 1) + check_detach(pos, 0, 1, 0) end -- Drop some nodes next to flowing water, if it would flow into the node @@ -164,7 +150,7 @@ minetest.register_abm({ action = function(pos, node, active_object_count, active_object_count_wider) liquid_flow_action(pos, "water", function(pos) drop_attached_node(pos) - minetest.dig_node(pos) + minetest.remove_node(pos) end) end, }) @@ -191,12 +177,14 @@ minetest.register_abm({ nodenames = {"mcl_core:cactus"}, neighbors = {"group:sand"}, interval = 25, - chance = 10, - action = function(pos) - mcl_core.grow_cactus(pos) - end, + chance = 40, + action = grow_cactus }) +local function is_walkable(pos) + local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + return ndef and ndef.walkable +end minetest.register_abm({ label = "Cactus mechanisms", nodenames = {"mcl_core:cactus"}, @@ -209,18 +197,22 @@ minetest.register_abm({ object:remove() end end - local posses = { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } } - for _, p in pairs(posses) do - local ndef = minetest.registered_nodes[minetest.get_node(vector.new(pos.x + p[1], pos.y, pos.z + p[2])).name] - if ndef and ndef.walkable then - local posy = pos.y - while minetest.get_node(vector.new(pos.x, posy, pos.z)).name == "mcl_core:cactus" do - local pos = vector.new(pos.x, posy, pos.z) - minetest.dig_node(pos) - -- minetest.add_item(vector.offset(pos, math.random(-0.5, 0.5), 0, math.random(-0.5, 0.5)), "mcl_core:cactus") - posy = posy + 1 - end - break + if is_walkable(vector_offset(pos, 1, 0, 0)) + or is_walkable(vector_offset(pos, -1, 0, 0)) + or is_walkable(vector_offset(pos, 0, 0, 1)) + or is_walkable(vector_offset(pos, 0, 0, -1)) then + local lpos = vector_copy(pos) + local dx, dy + while true do + local node = minetest.get_node(lpos) + if not node or node.name ~= "mcl_core:cactus" then break end + -- minetest.dig_node ignores protected nodes and causes infinite drop (#4628) + minetest.remove_node(lpos) + dx = dx or ((random(0,1)-0.5) * sqrt(random())) * 1.5 + dy = dy or ((random(0,1)-0.5) * sqrt(random())) * 1.5 + local obj = minetest.add_item(vector_offset(lpos, dx, 0.25, dy), "mcl_core:cactus") + obj:set_velocity(vector_new(dx, 1, dy)) + lpos.y = lpos.y + 1 end end end, @@ -232,61 +224,32 @@ minetest.register_abm({ nodenames = {"mcl_core:reeds"}, neighbors = {"group:soil_sugarcane"}, interval = 25, - chance = 10, - action = function(pos) - mcl_core.grow_reeds(pos) - end, + chance = 40, + action = grow_reeds }) -- -- Sugar canes drop -- - -local timber_nodenames={"mcl_core:reeds"} - minetest.register_on_dignode(function(pos, node) - local i=1 - while timber_nodenames[i]~=nil do - local np={x=pos.x, y=pos.y+1, z=pos.z} - while minetest.get_node(np).name==timber_nodenames[i] do - minetest.remove_node(np) - minetest.add_item(np, timber_nodenames[i]) - np={x=np.x, y=np.y+1, z=np.z} - end - i=i+1 + local name = "mcl_core:reeds" + local np = vector_offset(pos, 0, 1, 0) + while minetest.get_node(np).name == name do + minetest.remove_node(np) + minetest.add_item(np, name) + np.y = np.y + 1 end end) -local function air_leaf(leaftype) - if math.random(0, 50) == 3 then - return {name = "air"} - else - return {name = leaftype} - end -end - --- Check if a node stops a tree from growing. Torches, plants, wood, tree, +-- Check if a node stops a tree from growing. Torches, plants, wood, tree, -- leaves and dirt does not affect tree growth. local function node_stops_growth(node) - if node.name == "air" then - return false - end - + if node.name == "air" then return false end local def = minetest.registered_nodes[node.name] - if not def then - return true - end + local groups = def and def.groups + if not groups then return true end - local groups = def.groups - if not groups then - return true - end - if groups.plant or groups.torch or groups.dirt or groups.tree - or groups.bark or groups.leaves or groups.wood then - return false - end - - return true + return not (groups.leaves or groups.wood or groups.tree or groups.plant or groups.dirt or groups.torch or groups.bark) end -- Check if a tree can grow at position. The width is the width to check @@ -296,16 +259,11 @@ end local function check_growth_width(pos, width, height) -- Huge tree (with even width to check) will check one more node in -- positive x and y directions. - local neg_space = math.min((width - 1) / 2) - local pos_space = math.max((width - 1) / 2) + local neg_space, pos_space = floor((width - 1) * 0.5), ceil((width - 1) * 0.5) for x = -neg_space, pos_space do for z = -neg_space, pos_space do for y = 1, height do - local np = vector.new( - pos.x + x, - pos.y + y, - pos.z + z) - if node_stops_growth(minetest.get_node(np)) then + if node_stops_growth(minetest.get_node(vector_offset(pos, x, y, z))) then return false end end @@ -357,13 +315,7 @@ end -- generate huge trees. The 'balloon' option is used by oak to generate a balloon -- oak tree. function mcl_core.generate_tree(pos, tree_type, options) - pos.y = pos.y-1 - --local nodename = minetest.get_node(pos).name - - pos.y = pos.y+1 - if not minetest.get_node_light(pos) then - return - end + if not minetest.get_node_light(pos) then return end local two_by_two = options and options.two_by_two local balloon = options and options.balloon @@ -409,65 +361,36 @@ function mcl_core.generate_tree(pos, tree_type, options) end -- Classic oak in v6 style -function mcl_core.generate_v6_oak_tree(pos) - local trunk = "mcl_core:tree" - local leaves = "mcl_core:leaves" - local node - for dy=1,4 do - pos.y = pos.y+dy - if minetest.get_node(pos).name ~= "air" then - return - end - pos.y = pos.y-dy +function mcl_core.generate_v6_oak_tree(p) + local pos = vector_copy(p) + for dy = 0, 4 do + pos.y = p.y + dy + if minetest.get_node(pos).name ~= "air" then return end end - node = {name = trunk} - for dy=0,4 do - pos.y = pos.y+dy - if minetest.get_node(pos).name == "air" then - minetest.add_node(pos, node) - end - pos.y = pos.y-dy + local trunk = {name = "mcl_core:tree" } + for dy = 0, 4 do + pos.y = p.y + dy + minetest.add_node(pos, trunk) end - node = {name = leaves} - pos.y = pos.y+3 - --[[local rarity = 0 - if math.random(0, 10) == 3 then - rarity = 1 - end]] - for dx=-2,2 do - for dz=-2,2 do - for dy=0,3 do - pos.x = pos.x+dx - pos.y = pos.y+dy - pos.z = pos.z+dz - - if dx == 0 and dz == 0 and dy==3 then - if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then - minetest.add_node(pos, node) - minetest.add_node(pos, air_leaf(leaves)) + local leaves = { name = "mcl_core:leaves" } + for dx = -2, 2 do + for dz = -2, 2 do + for dy = 3, 6 do + pos.x, pos.y, pos.z = p.x + dx, p.y + dy, p.z + dz + if dy == 6 then + if dx == 0 and dz == 0 and minetest.get_node(pos).name == "air" and random(1, 5) <= 4 then + minetest.add_node(pos, leaves) end - elseif dx == 0 and dz == 0 and dy==4 then - if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then - minetest.add_node(pos, node) - minetest.add_node(pos, air_leaf(leaves)) - end - elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then + elseif abs(dx) ~= 2 and abs(dz) ~= 2 then if minetest.get_node(pos).name == "air" then - minetest.add_node(pos, node) - minetest.add_node(pos, air_leaf(leaves)) + minetest.add_node(pos, leaves) end - else - if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then - if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then - minetest.add_node(pos, node) - minetest.add_node(pos, air_leaf(leaves)) - end + elseif abs(dx) ~= 2 or abs(dz) ~= 2 then + if minetest.get_node(pos).name == "air" and random(1, 5) <= 4 then + minetest.add_node(pos, leaves) end end - pos.x = pos.x-dx - pos.y = pos.y-dy - pos.z = pos.z-dz end end end @@ -475,39 +398,32 @@ end -- Ballon Oak function mcl_core.generate_balloon_oak_tree(pos) - local path - local offset - local s = math.random(1, 12) - if s == 1 then + if random(1, 12) == 1 then -- Small balloon oak - path = modpath .. "/schematics/mcl_core_oak_balloon.mts" - offset = { x = -2, y = -1, z = -2 } - else - -- Large balloon oak - local t = math.random(1, 4) - path = modpath .. "/schematics/mcl_core_oak_large_"..t..".mts" - if t == 1 or t == 3 then - offset = { x = -3, y = -1, z = -3 } - elseif t == 2 or t == 4 then - offset = { x = -4, y = -1, z = -4 } - end + minetest.place_schematic(vector_offset(pos, -2, -1, -2), + modpath .. "/schematics/mcl_core_oak_balloon.mts", + "random", nil, false) + return + end + -- Large balloon oak + local t = random(1, 4) + local path = modpath .. "/schematics/mcl_core_oak_large_"..t..".mts" + if t == 1 or t == 3 then + minetest.place_schematic(vector_offset(pos, -3, -1, -3), path, "random", nil, false) + elseif t == 2 or t == 4 then + minetest.place_schematic(vector_offset(pos, -4, -1, -4), path, "random", nil, false) end - minetest.place_schematic(vector.add(pos, offset), path, "random", nil, false) end -- Oak local path_oak_tree = modpath.."/schematics/mcl_core_oak_classic.mts" - function mcl_core.generate_oak_tree(pos) - local offset = { x = -2, y = -1, z = -2 } - minetest.place_schematic(vector.add(pos, offset), path_oak_tree, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -2, -1, -2 ), path_oak_tree, "random", nil, false) end -- Birch function mcl_core.generate_birch_tree(pos) - local path = modpath .. - "/schematics/mcl_core_birch.mts" - minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -2, -1, -2), modpath .. "/schematics/mcl_core_birch.mts", "random", nil, false) end -- BEGIN of spruce tree generation functions -- @@ -523,7 +439,7 @@ end function mcl_core.generate_v6_spruce_tree(pos) local x, y, z = pos.x, pos.y, pos.z - local maxy = y + math.random(9, 13) -- Trunk top + local maxy = y + random(9, 13) -- Trunk top local c_air = minetest.get_content_id("air") local c_ignore = minetest.get_content_id("ignore") @@ -532,11 +448,8 @@ function mcl_core.generate_v6_spruce_tree(pos) local c_snow = minetest.get_content_id("mcl_core:snow") local vm = minetest.get_voxel_manip() - local minp, maxp = vm:read_from_map( - {x = x - 3, y = y, z = z - 3}, - {x = x + 3, y = maxy + 3, z = z + 3} - ) - local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local minp, maxp = vm:read_from_map(vector_offset(pos, -3, 0, -3), vector_offset(pos, 3, maxy - y + 3, 3)) + local a = VoxelArea:new(minp, maxp) local data = vm:get_data() -- Upper branches layer @@ -544,42 +457,32 @@ function mcl_core.generate_v6_spruce_tree(pos) for yy = maxy - 1, maxy + 1 do for zz = z - dev, z + dev do local vi = a:index(x - dev, yy, zz) - local via = a:index(x - dev, yy + 1, zz) for xx = x - dev, x + dev do - if math.random() < 0.95 - dev * 0.05 then - add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, - c_spruce_leaves) + if random() < 0.95 - dev * 0.05 then + add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, c_spruce_leaves) end vi = vi + 1 - via = via + 1 end end dev = dev - 1 end -- Centre top nodes - add_spruce_leaves(data, a:index(x, maxy + 1, z), c_air, c_ignore, c_snow, - c_spruce_leaves) - add_spruce_leaves(data, a:index(x, maxy + 2, z), c_air, c_ignore, c_snow, - c_spruce_leaves) -- Paramat added a pointy top node + add_spruce_leaves(data, a:index(x, maxy + 1, z), c_air, c_ignore, c_snow, c_spruce_leaves) + add_spruce_leaves(data, a:index(x, maxy + 2, z), c_air, c_ignore, c_snow, c_spruce_leaves) -- Lower branches layer local my = 0 for i = 1, 20 do -- Random 2x2 squares of leaves - local xi = x + math.random(-3, 2) - local yy = maxy + math.random(-6, -5) - local zi = z + math.random(-3, 2) - if yy > my then - my = yy - end - for zz = zi, zi+1 do + local xi = x + random(-3, 2) + local yy = maxy + random(-6, -5) + local zi = z + random(-3, 2) + if yy > my then my = yy end + for zz = zi, zi + 1 do local vi = a:index(xi, yy, zz) - local via = a:index(xi, yy + 1, zz) for xx = xi, xi + 1 do - add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, - c_spruce_leaves) + add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, c_spruce_leaves) vi = vi + 1 - via = via + 1 end end end @@ -588,14 +491,11 @@ function mcl_core.generate_v6_spruce_tree(pos) for yy = my + 1, my + 2 do for zz = z - dev, z + dev do local vi = a:index(x - dev, yy, zz) - local via = a:index(x - dev, yy + 1, zz) for xx = x - dev, x + dev do - if math.random() < 0.95 - dev * 0.05 then - add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, - c_spruce_leaves) + if random() < 0.95 - dev * 0.05 then + add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, c_spruce_leaves) end vi = vi + 1 - via = via + 1 end end dev = dev - 1 @@ -607,8 +507,7 @@ function mcl_core.generate_v6_spruce_tree(pos) for yy = y + 1, maxy do local vi = a:index(x, yy, z) local node_id = data[vi] - if node_id == c_air or node_id == c_ignore or - node_id == c_spruce_leaves or node_id == c_snow then + if node_id == c_air or node_id == c_ignore or node_id == c_spruce_leaves or node_id == c_snow then data[vi] = c_spruce_tree end end @@ -618,51 +517,50 @@ function mcl_core.generate_v6_spruce_tree(pos) end function mcl_core.generate_spruce_tree(pos) - local r = math.random(1, 3) - local path = modpath .. "/schematics/mcl_core_spruce_"..r..".mts" - minetest.place_schematic({ x = pos.x - 3, y = pos.y - 1, z = pos.z - 3 }, path, "0", nil, false) + minetest.place_schematic(vector_offset(pos, -3, -1, -3), + modpath .. "/schematics/mcl_core_spruce_"..random(1, 3)..".mts", "0", nil, false) end local function find_necorner(p) - local n=minetest.get_node_or_nil(vector.offset(p,0,1,1)) - local e=minetest.get_node_or_nil(vector.offset(p,1,1,0)) + local n = minetest.get_node_or_nil(vector_offset(p, 0, 1, 1)) + local e = minetest.get_node_or_nil(vector_offset(p, 1, 1, 0)) if n and n.name == "mcl_core:sprucetree" then - p=vector.offset(p,0,0,1) + p = vector_offset(p, 0, 0, 1) end if e and e.name == "mcl_core:sprucetree" then - p=vector.offset(p,1,0,0) + p = vector_offset(p, 1, 0, 0) end return p end local function generate_spruce_podzol(ps) - local pos=find_necorner(ps) - local pos1=vector.offset(pos,-6,-6,-6) - local pos2=vector.offset(pos,6,6,6) - local nn=minetest.find_nodes_in_area_under_air(pos1, pos2, {"group:dirt"}) + local pos = find_necorner(ps) + local pos1, pos2 = vector_offset(pos, -6, -6, -6), vector_offset(pos, 6, 6, 6) + local nn = minetest.find_nodes_in_area_under_air(pos1, pos2, {"group:dirt"}) for k,v in pairs(nn) do - if math.random(vector.distance(pos,v)) < 4 and not (math.abs(pos.x-v.x) == 6 and math.abs(pos.z-v.z) == 6) then --leave out the corners - minetest.set_node(v,{name="mcl_core:podzol"}) + if not (abs(pos.x - v.x) == 6 and abs(pos.z - v.z) == 6) and random(vector_distance(pos,v)) < 4 then --leave out the corners + minetest.set_node(v, {name="mcl_core:podzol"}) end end end function mcl_core.generate_huge_spruce_tree(pos) - local r1 = math.random(1, 2) - local r2 = math.random(1, 4) - local path - local offset = { x = -4, y = -1, z = -5 } + local r1, r2 = random(1, 2), random(1, 4) + local path, offset if r1 <= 2 then -- Mega Spruce Taiga (full canopy) path = modpath.."/schematics/mcl_core_spruce_huge_"..r2..".mts" + offset = vector_offset(pos, -4, -1, -5) else -- Mega Taiga (leaves only at top) if r2 == 1 or r2 == 3 then - offset = { x = -3, y = -1, z = -4} + offset = vector_offset(pos, -3, -1, -4) + else + offset = vector_offset(pos, -4, -1, -5) end path = modpath.."/schematics/mcl_core_spruce_huge_up_"..r2..".mts" end - minetest.place_schematic(vector.add(pos, offset), path, "0", nil, false) + minetest.place_schematic(offset, path, "0", nil, false) generate_spruce_podzol(pos) end @@ -670,29 +568,26 @@ end -- Acacia tree (multiple variants) function mcl_core.generate_acacia_tree(pos) - local r = math.random(1, 7) - local offset = vector.new() - if r == 2 or r == 3 then - offset = { x = -4, y = -1, z = -4 } + local r = random(1, 7) + local path, offset = modpath.."/schematics/mcl_core_acacia_"..r..".mts", nil + if r == 1 or r == 5 then + offset = vector_offset(pos, -5, -1, -5) + elseif r == 2 or r == 3 then + offset = vector_offset(pos, -4, -1, -4) elseif r == 4 or r == 6 or r == 7 then - offset = { x = -3, y = -1, z = -3 } - elseif r == 1 or r == 5 then - offset = { x = -5, y = -1, z = -5 } + offset = vector_offset(pos, -3, -1, -3) end - local path = modpath.."/schematics/mcl_core_acacia_"..r..".mts" - minetest.place_schematic(vector.add(pos, offset), path, "random", nil, false) + minetest.place_schematic(offset, path, "random", nil, false) end --- Generate dark oak tree with 2×2 trunk. +-- Generate dark oak tree with 2x2 trunk. -- With pos being the lower X and the higher Z value of the trunk function mcl_core.generate_dark_oak_tree(pos) - local path = modpath.."/schematics/mcl_core_dark_oak.mts" - minetest.place_schematic({x = pos.x - 3, y = pos.y - 1, z = pos.z - 4}, path, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -3, -1, -4), modpath.."/schematics/mcl_core_dark_oak.mts", "random", nil, false) end -- Helper function for jungle tree, form Minetest Game 0.4.15 -local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, - height, size, iters) +local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, height, size, iters) local x, y, z = pos.x, pos.y, pos.z local c_air = minetest.CONTENT_AIR local c_ignore = minetest.CONTENT_IGNORE @@ -709,33 +604,33 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, -- Force leaves near the trunk for z_dist = -1, 1 do - for y_dist = -size, 1 do - local vi = a:index(x - 1, y + height + y_dist, z + z_dist) - for x_dist = -1, 1 do - if data[vi] == c_air or data[vi] == c_ignore then - data[vi] = leaves_cid + for y_dist = -size, 1 do + local vi = a:index(x - 1, y + height + y_dist, z + z_dist) + for x_dist = -1, 1 do + if data[vi] == c_air or data[vi] == c_ignore then + data[vi] = leaves_cid + end + vi = vi + 1 end - vi = vi + 1 end end - end -- Randomly add leaves in 2x2x2 clusters. for i = 1, iters do - local clust_x = x + math.random(-size, size - 1) - local clust_y = y + height + math.random(-size, 0) - local clust_z = z + math.random(-size, size - 1) + local clust_x = x + random(-size, size - 1) + local clust_y = y + height + random(-size, 0) + local clust_z = z + random(-size, size - 1) for xi = 0, 1 do - for yi = 0, 1 do - for zi = 0, 1 do - local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi) - if data[vi] == c_air or data[vi] == c_ignore then - data[vi] = leaves_cid + for yi = 0, 1 do + for zi = 0, 1 do + local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi) + if data[vi] == c_air or data[vi] == c_ignore then + data[vi] = leaves_cid + end + end end end - end - end end end @@ -748,18 +643,15 @@ function mcl_core.generate_v6_jungle_tree(pos) --]] local x, y, z = pos.x, pos.y, pos.z - local height = math.random(8, 12) + local height = random(8, 12) local c_air = minetest.get_content_id("air") local c_ignore = minetest.get_content_id("ignore") local c_jungletree = minetest.get_content_id("mcl_core:jungletree") local c_jungleleaves = minetest.get_content_id("mcl_core:jungleleaves") local vm = minetest.get_voxel_manip() - local minp, maxp = vm:read_from_map( - {x = x - 3, y = y - 1, z = z - 3}, - {x = x + 3, y = y + height + 1, z = z + 3} - ) - local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local minp, maxp = vm:read_from_map(vector_offset(pos, -3, -1, -3), vector_offset(pos, 3, 1, 3)) + local a = VoxelArea:new(minp, maxp) local data = vm:get_data() add_trunk_and_leaves(data, a, pos, c_jungletree, c_jungleleaves, height, 3, 30) @@ -769,7 +661,7 @@ function mcl_core.generate_v6_jungle_tree(pos) local vi_1 = a:index(x - 1, y - 1, z + z_dist) local vi_2 = a:index(x - 1, y, z + z_dist) for x_dist = -1, 1 do - if math.random(1, 3) >= 2 then + if random(1, 3) >= 2 then if data[vi_1] == c_air or data[vi_1] == c_ignore then data[vi_1] = c_jungletree elseif data[vi_2] == c_air or data[vi_2] == c_ignore then @@ -786,17 +678,15 @@ function mcl_core.generate_v6_jungle_tree(pos) end function mcl_core.generate_jungle_tree(pos) - local path = modpath.."/schematics/mcl_core_jungle_tree.mts" - minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -2, -1, -2), modpath.."/schematics/mcl_core_jungle_tree.mts", "random", nil, false) end --- Generate huge jungle tree with 2×2 trunk. +-- Generate huge jungle tree with 2x2 trunk. -- With pos being the lower X and the higher Z value of the trunk. function mcl_core.generate_huge_jungle_tree(pos) - -- 2 variants - local r = math.random(1, 2) - local path = modpath.."/schematics/mcl_core_jungle_tree_huge_"..r..".mts" - minetest.place_schematic({x = pos.x - 6, y = pos.y - 1, z = pos.z - 7}, path, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -6, -1, -7), + modpath.."/schematics/mcl_core_jungle_tree_huge_"..random(1, 2)..".mts", + "random", nil, false) end @@ -804,9 +694,7 @@ local grass_spread_randomizer = PseudoRandom(minetest.get_mapgen_setting("seed") -- Return appropriate grass block node for pos function mcl_core.get_grass_block_type(pos, requested_grass_block_name) - local grass_palette_index = mcl_util.get_palette_indexes_from_pos(pos).grass_palette_index - local grass_block_name = requested_grass_block_name or minetest.get_node(pos).name - return {name = grass_block_name, param2 = grass_palette_index} + return {name = requested_grass_block_name or minetest.get_node(pos).name, param2 = mcl_util.get_palette_indexes_from_pos(pos).grass_palette_index} end -- Return appropriate foliage block node for pos @@ -823,7 +711,7 @@ end -- Spread grass blocks and mycelium on neighbor dirt ------------------------------ minetest.register_abm({ - label = "Grass Block and Mycelium spread", + label = "Grass block and mycelium spread", nodenames = {"mcl_core:dirt"}, neighbors = {"air", "group:grass_block_no_snow", "mcl_core:mycelium"}, interval = 30, @@ -832,7 +720,7 @@ minetest.register_abm({ action = function(pos) if pos == nil then return end - local above = {x=pos.x, y=pos.y+1, z=pos.z} + local above = vector_offset(pos, 0, 1, 0) local abovenode = minetest.get_node(above) if minetest.get_item_group(abovenode.name, "liquid") ~= 0 or minetest.get_item_group(abovenode.name, "opaque") == 1 then -- Never grow directly below liquids or opaque blocks @@ -843,18 +731,14 @@ minetest.register_abm({ if not light_self then return end --[[ Try to find a spreading dirt-type block (e.g. grass block or mycelium) - within a 3×5×3 area, with the source block being on the 2nd-topmost layer. ]] - local nodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+3, z=pos.z+1}, "group:spreading_dirt_type") - local p2 + within a 3x5x3 area, with the source block being on the 2nd-topmost layer. ]] + local nodes = minetest.find_nodes_in_area(vector_offset(pos, -1, -1, -1), vector_offset(pos, 1, 3, 1), "group:spreading_dirt_type") -- Nothing found ? Bail out! - if #nodes <= 0 then - return - else - p2 = nodes[grass_spread_randomizer:next(1, #nodes)] - end + if #nodes <= 0 then return end + local p2 = nodes[grass_spread_randomizer:next(1, #nodes)] -- Found it! Now check light levels! - local source_above = {x=p2.x, y=p2.y+1, z=p2.z} + local source_above = vector_offset(p2, 0, 1, 0) local light_source = minetest.get_node_light(source_above) if not light_source then return end @@ -880,16 +764,15 @@ minetest.register_abm({ -- Grass/mycelium death in darkness minetest.register_abm({ - label = "Grass Block / Mycelium in darkness", + label = "Grass block / mycelium in darkness", nodenames = {"group:spreading_dirt_type"}, interval = 8, chance = 50, catch_up = false, action = function(pos, node) - local above = {x = pos.x, y = pos.y + 1, z = pos.z} - local name = minetest.get_node(above).name + local above = minetest.get_node(vector_offset(pos, 0, 1, 0)).name -- Kill grass/mycelium when below opaque block or liquid - if name ~= "ignore" and (minetest.get_item_group(name, "opaque") == 1 or minetest.get_item_group(name, "liquid") ~= 0) then + if above ~= "ignore" and (minetest.get_item_group(above, "opaque") == 1 or minetest.get_item_group(above, "liquid") ~= 0) then minetest.set_node(pos, {name = "mcl_core:dirt"}) end end @@ -897,9 +780,8 @@ minetest.register_abm({ -- Turn Grass Path and similar nodes to Dirt if a solid node is placed above it minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) - if minetest.get_item_group(newnode.name, "solid") ~= 0 or - minetest.get_item_group(newnode.name, "dirtifier") ~= 0 then - local below = {x=pos.x, y=pos.y-1, z=pos.z} + if minetest.get_item_group(newnode.name, "solid") ~= 0 or minetest.get_item_group(newnode.name, "dirtifier") ~= 0 then + local below = vector_offset(pos, 0, -1, 0) local belownode = minetest.get_node(below) if minetest.get_item_group(belownode.name, "dirtifies_below_solid") == 1 then minetest.set_node(below, {name="mcl_core:dirt"}) @@ -908,16 +790,16 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack end) minetest.register_abm({ - label = "Turn Grass Path below solid block into Dirt", + label = "Turn grass path below solid block into dirt", nodenames = {"mcl_core:grass_path"}, neighbors = {"group:solid"}, interval = 8, chance = 50, action = function(pos, node) - local above = {x = pos.x, y = pos.y + 1, z = pos.z} - local name = minetest.get_node(above).name - local nodedef = minetest.registered_nodes[name] - if name ~= "ignore" and nodedef and (nodedef.groups and nodedef.groups.solid) then + local above = minetest.get_node(vector_offset(pos, 0, 1, 0)).name + if above == "ignore" then return end + local nodedef = minetest.registered_nodes[above] + if nodedef and (nodedef.groups and nodedef.groups.solid) then minetest.set_node(pos, {name = "mcl_core:dirt"}) end end, @@ -930,17 +812,10 @@ minetest.register_lbm({ nodenames = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt_with_dry_grass_snow"}, run_at_every_load = true, action = function(pos, node) - if node.name == "mcl_core:dirt_with_dry_grass_snow" then - node.name = "mcl_core:dirt_with_grass_snow" - else - node.name = "mcl_core:dirt_with_grass" - end + node.name = node.name == "mcl_core:dirt_with_dry_grass_snow" and "mcl_core:dirt_with_grass_snow" or "mcl_core:dirt_with_grass" -- use savanna palette index to simulate dry grass. - if not node.param2 then - node.param2 = SAVANNA_INDEX - end + node.param2 = node.param2 or SAVANNA_INDEX minetest.set_node(pos, node) - return end, }) @@ -956,7 +831,7 @@ local function sapling_grow_action(tree_id, soil_needed, one_by_one, two_by_two, -- Checks if the sapling at pos has enough light and the correct soil local light = minetest.get_node_light(pos) if not light then return end - local low_light = (light < treelight) + local low_light = light < treelight local delta = 1 local current_game_time = minetest.get_day_count() + minetest.get_timeofday() @@ -977,7 +852,7 @@ local function sapling_grow_action(tree_id, soil_needed, one_by_one, two_by_two, -- TODO: delta is [days] missed in inactive area. Currently we just add it to stage, which is far from a perfect calculation... - local soilnode = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + local soilnode = minetest.get_node(vector_offset(pos, 0, -1, 0)) local soiltype = minetest.get_item_group(soilnode.name, "soil_sapling") if soiltype < soil_needed then return end @@ -985,66 +860,67 @@ local function sapling_grow_action(tree_id, soil_needed, one_by_one, two_by_two, local meta = minetest.get_meta(pos) local stage = meta:get_int("stage") if stage == nil then stage = 0 end - stage = stage + math.max(1, math.floor(delta)) + stage = stage + max(1, floor(delta)) if stage >= 3 then meta:set_string("grown", "true") - -- This sapling grows in a special way when there are 4 saplings in a 2×2 pattern + -- This sapling grows in a special way when there are 4 saplings in a 2x2 pattern if two_by_two then - -- Check 8 surrounding saplings and try to find a 2×2 pattern + -- Check 8 surrounding saplings and try to find a 2x2 pattern local function is_sapling(pos, sapling) return minetest.get_node(pos).name == sapling end - local p2 = {x=pos.x+1, y=pos.y, z=pos.z} - local p3 = {x=pos.x, y=pos.y, z=pos.z-1} - local p4 = {x=pos.x+1, y=pos.y, z=pos.z-1} - local p5 = {x=pos.x-1, y=pos.y, z=pos.z-1} - local p6 = {x=pos.x-1, y=pos.y, z=pos.z} - local p7 = {x=pos.x-1, y=pos.y, z=pos.z+1} - local p8 = {x=pos.x, y=pos.y, z=pos.z+1} - local p9 = {x=pos.x+1, y=pos.y, z=pos.z+1} - local s2 = is_sapling(p2, sapling) - local s3 = is_sapling(p3, sapling) - local s4 = is_sapling(p4, sapling) - local s5 = is_sapling(p5, sapling) - local s6 = is_sapling(p6, sapling) - local s7 = is_sapling(p7, sapling) - local s8 = is_sapling(p8, sapling) - local s9 = is_sapling(p9, sapling) - -- In a 9×9 field there are 4 possible 2×2 squares. We check them all. - if s2 and s3 and s4 and check_tree_growth(pos, tree_id, { two_by_two = true }) then + -- clockwise from x+1, coded right/bottom/left/top + local prr = vector_offset(pos, 1, 0, 0) -- right + local prb = vector_offset(pos, 1, 0, -1) -- right bottom + local pbb = vector_offset(pos, 0, 0, -1) -- bottom + local pbl = vector_offset(pos, -1, 0, -1) -- bottom left + local pll = vector_offset(pos, -1, 0, 0) -- left + local plt = vector_offset(pos, -1, 0, 1) -- left top + local ptt = vector_offset(pos, 0, 0, 1) -- top + local ptr = vector_offset(pos, 1, 0, 1) -- top right + local srr = is_sapling(prr, sapling) + local srb = is_sapling(prb, sapling) + local sbb = is_sapling(pbb, sapling) + local sbl = is_sapling(pbl, sapling) + local sll = is_sapling(pll, sapling) + local slt = is_sapling(plt, sapling) + local stt = is_sapling(ptt, sapling) + local str = is_sapling(ptr, sapling) + -- In a 3x3 field there are 4 possible 2x2 squares. We check them all. + if srr and srb and sbb and check_tree_growth(pos, tree_id, { two_by_two = true }) then -- Success: Remove saplings and place tree minetest.remove_node(pos) - minetest.remove_node(p2) - minetest.remove_node(p3) - minetest.remove_node(p4) - mcl_core.generate_tree(pos, tree_id, { two_by_two = true }) + minetest.remove_node(prr) + minetest.remove_node(prb) + minetest.remove_node(pbb) + mcl_core.generate_tree(pos, tree_id, { two_by_two = true }) -- center is top-left of 2x2 return - elseif s3 and s5 and s6 and check_tree_growth(p6, tree_id, { two_by_two = true }) then + elseif sbb and sbl and sll and check_tree_growth(pll, tree_id, { two_by_two = true }) then minetest.remove_node(pos) - minetest.remove_node(p3) - minetest.remove_node(p5) - minetest.remove_node(p6) - mcl_core.generate_tree(p6, tree_id, { two_by_two = true }) + minetest.remove_node(pbb) + minetest.remove_node(pbl) + minetest.remove_node(pll) + mcl_core.generate_tree(pll, tree_id, { two_by_two = true }) -- ll is top-left of 2x2 return - elseif s6 and s7 and s8 and check_tree_growth(p7, tree_id, { two_by_two = true }) then + elseif sll and slt and stt and check_tree_growth(plt, tree_id, { two_by_two = true }) then minetest.remove_node(pos) - minetest.remove_node(p6) - minetest.remove_node(p7) - minetest.remove_node(p8) - mcl_core.generate_tree(p7, tree_id, { two_by_two = true }) + minetest.remove_node(pll) + minetest.remove_node(plt) + minetest.remove_node(ptt) + mcl_core.generate_tree(plt, tree_id, { two_by_two = true }) -- lt is top-left of 2x2 return - elseif s2 and s8 and s9 and check_tree_growth(p8, tree_id, { two_by_two = true }) then + elseif stt and str and srr and check_tree_growth(ptt, tree_id, { two_by_two = true }) then minetest.remove_node(pos) - minetest.remove_node(p2) - minetest.remove_node(p8) - minetest.remove_node(p9) - mcl_core.generate_tree(p8, tree_id, { two_by_two = true }) + minetest.remove_node(ptt) + minetest.remove_node(ptr) + minetest.remove_node(prr) + mcl_core.generate_tree(ptt, tree_id, { two_by_two = true }) -- tt is top-left of 2x2 return end end if one_by_one and tree_id == OAK_TREE_ID then -- There is a chance that this tree wants to grow as a balloon oak - if math.random(1, 12) == 1 then + if random(1, 12) == 1 then -- Check if there is room for that if check_tree_growth(pos, tree_id, { balloon = true }) then minetest.set_node(pos, {name="air"}) @@ -1053,11 +929,10 @@ local function sapling_grow_action(tree_id, soil_needed, one_by_one, two_by_two, end end end - -- If this sapling can grow alone + -- If this sapling can grow alone if one_by_one and check_tree_growth(pos, tree_id) then -- Single sapling minetest.set_node(pos, {name="air"}) - --local r = math.random(1, 12) mcl_core.generate_tree(pos, tree_id) return end @@ -1075,44 +950,42 @@ local grow_spruce = sapling_grow_action(SPRUCE_TREE_ID, 1, true, true, "mcl_core local grow_birch = sapling_grow_action(BIRCH_TREE_ID, 1, true, false) function mcl_core.update_sapling_foliage_colors(pos) - local pos1, pos2 = vector.offset(pos, -8, 0, -8), vector.offset(pos, 8, 30, 8) - local fnode - local foliage = minetest.find_nodes_in_area(pos1, pos2, {"group:foliage_palette", "group:foliage_palette_wallmounted"}) + local foliage = minetest.find_nodes_in_area( + vector_offset(pos, -8, 0, -8), vector_offset(pos, 8, 30, 8), + {"group:foliage_palette", "group:foliage_palette_wallmounted"}) for _, fpos in pairs(foliage) do - fnode = minetest.get_node(fpos) - minetest.set_node(fpos, fnode) + minetest.set_node(fpos, minetest.get_node(fpos)) end end --- Attempts to grow the sapling at the specified position +--- Attempts to grow the sapling at the specified position -- pos: Position -- node: Node table of the node at this position, from minetest.get_node -- Returns true on success and false on failure +-- TODO: replace this with a proper tree API function mcl_core.grow_sapling(pos, node) - local grow if node.name == "mcl_core:sapling" then - grow = grow_oak + grow_oak(pos) elseif node.name == "mcl_core:darksapling" then - grow = grow_dark_oak + grow_dark_oak(pos) elseif node.name == "mcl_core:junglesapling" then - grow = grow_jungle_tree + grow_jungle_tree(pos) elseif node.name == "mcl_core:acaciasapling" then - grow = grow_acacia + grow_acacia(pos) elseif node.name == "mcl_core:sprucesapling" then - grow = grow_spruce + grow_spruce(pos) elseif node.name == "mcl_core:birchsapling" then - grow = grow_birch - end - if grow then - grow(pos) - return true + grow_birch(pos) + elseif node.name == "mcl_cherry_blossom:cherrysapling" then + return mcl_cherry_blossom.generate_cherry_tree(pos) else return false end + return true end -- TODO: Use better tree models for everything --- TODO: Support 2×2 saplings +-- TODO: Support 2x2 saplings -- Oak tree minetest.register_abm({ @@ -1218,14 +1091,14 @@ minetest.register_lbm({ local function leafdecay_particles(pos, node) minetest.add_particlespawner({ - amount = math.random(10, 20), + amount = random(10, 20), time = 0.1, - minpos = vector.add(pos, {x=-0.4, y=-0.4, z=-0.4}), - maxpos = vector.add(pos, {x=0.4, y=0.4, z=0.4}), - minvel = {x=-0.2, y=-0.2, z=-0.2}, - maxvel = {x=0.2, y=0.1, z=0.2}, - minacc = {x=0, y=-9.81, z=0}, - maxacc = {x=0, y=-9.81, z=0}, + minpos = vector_offset(pos, -0.4, -0.4, -0.4), + maxpos = vector_offset(pos, 0.4, 0.4, 0.4), + minvel = vector_new(-0.2, -0.2, -0.2), + maxvel = vector_new(0.2, 0.1, 0.2), + minacc = vector_new(0, -9.81, 0), + maxacc = vector_new(0, -9.81, 0), minexptime = 0.1, maxexptime = 0.5, minsize = 0.5, @@ -1238,32 +1111,33 @@ end local function vinedecay_particles(pos, node) local dir = minetest.wallmounted_to_dir(node.param2) - local relpos1, relpos2 + if not dir then return end -- Don't crash if the map data got corrupted somehow + local minpos, maxpos if dir.x < 0 then - relpos1 = { x = -0.45, y = -0.4, z = -0.5 } - relpos2 = { x = -0.4, y = 0.4, z = 0.5 } + minpos = vector_offset(pos, -0.45, -0.4, -0.5) + maxpos = vector_offset(pos, -0.4, 0.4, 0.5) elseif dir.x > 0 then - relpos1 = { x = 0.4, y = -0.4, z = -0.5 } - relpos2 = { x = 0.45, y = 0.4, z = 0.5 } + minpos = vector_offset(pos, 0.4, -0.4, -0.5) + maxpos = vector_offset(pos, 0.45, 0.4, 0.5) elseif dir.z < 0 then - relpos1 = { x = -0.5, y = -0.4, z = -0.45 } - relpos2 = { x = 0.5, y = 0.4, z = -0.4 } + minpos = vector_offset(pos, -0.5, -0.4, -0.45) + maxpos = vector_offset(pos, 0.5, 0.4, -0.4) elseif dir.z > 0 then - relpos1 = { x = -0.5, y = -0.4, z = 0.4 } - relpos2 = { x = 0.5, y = 0.4, z = 0.45 } + minpos = vector_offset(pos, -0.5, -0.4, 0.4) + maxpos = vector_offset(pos, 0.5, 0.4, 0.45) else return end minetest.add_particlespawner({ - amount = math.random(8, 16), + amount = random(8, 16), time = 0.1, - minpos = vector.add(pos, relpos1), - maxpos = vector.add(pos, relpos2), - minvel = {x=-0.2, y=-0.2, z=-0.2}, - maxvel = {x=0.2, y=0.1, z=0.2}, - minacc = {x=0, y=-9.81, z=0}, - maxacc = {x=0, y=-9.81, z=0}, + minpos = minpos, + maxpos = maxpos, + minvel = vector_new(-0.2, -0.2, -0.2), + maxvel = vector_new( 0.2, 0.1, 0.2), + minacc = vector_new(0, -9.81, 0), + maxacc = vector_new(0, -9.81, 0), minexptime = 0.1, maxexptime = 0.5, minsize = 0.5, @@ -1274,17 +1148,57 @@ local function vinedecay_particles(pos, node) }) end ---------------------- --- Vine generating -- ---------------------- +----------------- +-- Vine growth -- +----------------- +-- Add vines below pos (if empty) +local function vine_spread_down(origin, node) + if random(1, 2) == 1 then return end + local target = vector_offset(origin, 0, -1, 0) + if minetest.get_node(target).name == "air" then + minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) + end +end + +-- Add vines above pos if it is backed up +local function vine_spread_up(origin, node) + if random(1, 2) == 1 then return end + local vines_in_area = minetest.find_nodes_in_area(vector_offset(origin, -4, -1, -4), vector_offset(origin, 4, 1, 4), "mcl_core:vine") + -- Less than 4 other vines blocks around the ticked vines block (remember the ticked block is counted by above function as well) + if #vines_in_area >= 5 then return end + local target = vector_offset(origin, 0, 1, 0) + if minetest.get_node(target).name ~= "air" then return end + local backupnodename = minetest.get_node(vector_subtract(target, minetest.wallmounted_to_dir(node.param2))).name + + -- Check if the block above is supported + if mcl_core.supports_vines(backupnodename) then + minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) + end +end + +local function vine_spread_horizontal(origin, dir, node) + local vines_in_area = minetest.find_nodes_in_area(vector_offset(origin, -4, -1, -4), vector_offset(origin, 4, 1, 4), "mcl_core:vine") + if #vines_in_area >= 5 then return end + -- Less than 4 other vines blocks around the ticked vines block (remember the ticked block is counted by above function as well) + local target = vector_add(origin, dir) + -- Spread horizontally, but not into support direction + local backup_dir = minetest.wallmounted_to_dir(node.param2) + if backup_dir.x == dir.x and backup_dir.y == dir.y then return end + local target_node = minetest.get_node(target) + if target_node.name ~= "air" then return end + local backupnodename = minetest.get_node(vector_add(target, backup_dir)).name + if mcl_core.supports_vines(backupnodename) then + minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) + end +end + minetest.register_abm({ - label = "Vines growth", + label = "Vine growth", nodenames = {"mcl_core:vine"}, interval = 47, chance = 4, action = function(pos, node, active_object_count, active_object_count_wider) - - -- First of all, check if we are even supported, otherwise, let's die! + -- First of all, check if we are even supported, otherwise, decay. if not mcl_core.check_vines_supported(pos, node) then minetest.remove_node(pos) vinedecay_particles(pos, node) @@ -1292,68 +1206,20 @@ minetest.register_abm({ return end - -- Add vines below pos (if empty) - local function spread_down(origin, target, dir, node) - if math.random(1, 2) == 1 then - if minetest.get_node(target).name == "air" then - minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) - end - end + local d = random(1, 6) + if d == 1 then + vine_spread_horizontal(pos, vector_new( 1, 0, 0), node) + elseif d == 2 then + vine_spread_horizontal(pos, vector_new(-1, 0, 0), node) + elseif d == 3 then + vine_spread_horizontal(pos, vector_new( 0, 0, 1), node) + elseif d == 4 then + vine_spread_horizontal(pos, vector_new( 0, 0, -1), node) + elseif d == 5 then + vine_spread_up(pos, node) + else + vine_spread_down(pos, node) end - - -- Add vines above pos if it is backed up - local function spread_up(origin, target, dir, node) - local vines_in_area = minetest.find_nodes_in_area({x=origin.x-4, y=origin.y-1, z=origin.z-4}, {x=origin.x+4, y=origin.y+1, z=origin.z+4}, "mcl_core:vine") - -- Less then 4 vines blocks around the ticked vines block (remember the ticked block is counted by above function as well) - if #vines_in_area < 5 then - if math.random(1, 2) == 1 then - if minetest.get_node(target).name == "air" then - local backup_dir = minetest.wallmounted_to_dir(node.param2) - local backup = vector.subtract(target, backup_dir) - local backupnodename = minetest.get_node(backup).name - - -- Check if the block above is supported - if mcl_core.supports_vines(backupnodename) then - minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) - end - end - end - end - end - - local function spread_horizontal(origin, target, dir, node) - local vines_in_area = minetest.find_nodes_in_area({x=origin.x-4, y=origin.y-1, z=origin.z-4}, {x=origin.x+4, y=origin.y+1, z=origin.z+4}, "mcl_core:vine") - -- Less then 4 vines blocks around the ticked vines block (remember the ticked block is counted by above function as well) - if #vines_in_area < 5 then - -- Spread horizontally - local backup_dir = minetest.wallmounted_to_dir(node.param2) - if not vector.equals(backup_dir, dir) then - local target_node = minetest.get_node(target) - if target_node.name == "air" then - local backup = vector.add(target, backup_dir) - local backupnodename = minetest.get_node(backup).name - if mcl_core.supports_vines(backupnodename) then - minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) - end - end - end - end - end - - local directions = { - { { x= 1, y= 0, z= 0 }, spread_horizontal }, - { { x=-1, y= 0, z= 0 }, spread_horizontal }, - { { x= 0, y= 1, z= 0 }, spread_up }, - { { x= 0, y=-1, z= 0 }, spread_down }, - { { x= 0, y= 0, z= 1 }, spread_horizontal }, - { { x= 0, y= 0, z=-1 }, spread_horizontal }, - } - - local d = math.random(1, #directions) - local dir = directions[d][1] - local spread = directions[d][2] - - spread(pos, vector.add(pos, dir), dir, node) end }) @@ -1379,12 +1245,11 @@ minetest.register_abm({ nodenames = {"group:orphan_leaves"}, interval = 5, chance = 10, - action = function(pos, node) + action = function(pos, node) -- Spawn item entities for any of the leaf's drops local itemstacks = minetest.get_node_drops(node.name) for _, itemname in pairs(itemstacks) do - local p_drop = vector.offset(pos, math.random() - 0.5, math.random() - 0.5, math.random() - 0.5) - minetest.add_item(p_drop, itemname) + minetest.add_item(vector_offset(pos, random() - 0.5, random() - 0.5, random() - 0.5), itemname) end -- Remove the decayed node minetest.remove_node(pos) @@ -1392,23 +1257,19 @@ minetest.register_abm({ minetest.check_for_falling(pos) -- Kill depending vines immediately to skip the vines decay delay - local surround = { - { x = 0, y = 0, z = -1 }, - { x = 0, y = 0, z = 1 }, - { x = -1, y = 0, z = 0 }, - { x = 1, y = 0, z = 0 }, - { x = 0, y = -1, z = -1 }, - } - for s=1, #surround do - local spos = vector.add(pos, surround[s]) + local function clean_vines(spos) local maybe_vine = minetest.get_node(spos) - --local surround_inverse = vector.multiply(surround[s], -1) if maybe_vine.name == "mcl_core:vine" and (not mcl_core.check_vines_supported(spos, maybe_vine)) then minetest.remove_node(spos) vinedecay_particles(spos, maybe_vine) minetest.check_for_falling(spos) end end + clean_vines(vector_offset(pos, 0, 0, -1)) + clean_vines(vector_offset(pos, 0, 0, 1)) + clean_vines(vector_offset(pos, -1, 0, 0)) + clean_vines(vector_offset(pos, 1, 0, 0)) + clean_vines(vector_offset(pos, 0, -1, 0)) end }) @@ -1423,13 +1284,11 @@ minetest.register_abm({ -- A low interval and a high inverse chance spreads the load interval = 4, chance = 8, - action = function(p0, node, _, _) - if not mcl_core.check_vines_supported(p0, node) then - -- Vines must die! - minetest.remove_node(p0) - vinedecay_particles(p0, node) - -- Just in case a falling node happens to float above vines - minetest.check_for_falling(p0) + action = function(pos, node) + if not mcl_core.check_vines_supported(pos, node) then + minetest.remove_node(pos) + vinedecay_particles(pos, node) + minetest.check_for_falling(pos) end end }) @@ -1459,7 +1318,7 @@ minetest.register_abm({ chance = 8, action = function(pos, node) if mcl_weather.has_snow(pos) - and minetest.get_natural_light(vector.offset(pos,0,1,0), 0.5) == minetest.LIGHT_MAX + 1 + and minetest.get_natural_light(vector_offset(pos, 0, 1, 0), 0.5) == minetest.LIGHT_MAX + 1 and minetest.get_artificial_light(minetest.get_node(pos).param1) < 10 then node.name = "mcl_core:ice" minetest.swap_node(pos, node) @@ -1472,49 +1331,39 @@ Given the pos and node of a vines node, this returns true if the vines are suppo and false if the vines are currently floating. Vines are considered “supported” if they face a walkable+solid block or “hang” from a vines node above. ]] function mcl_core.check_vines_supported(pos, node) - local supported = false local dir = minetest.wallmounted_to_dir(node.param2) - local pos1 = vector.add(pos, dir) - local node_neighbor = minetest.get_node(pos1) - -- Check if vines are attached to a solid block. - -- If ignore, we assume its solid. - if node_neighbor.name == "ignore" or mcl_core.supports_vines(node_neighbor.name) then - supported = true - elseif dir.y == 0 then + if not dir then return end -- Don't crash if the map data got corrupted somehow + local node_neighbor = minetest.get_node(vector_add(pos, dir)) + -- Check if vines are attached to a solid block, assume "ignore" is good. + if node_neighbor.name == "ignore" or mcl_core.supports_vines(node_neighbor.name) then return true end + if dir.y == 0 then -- Vines are not attached, now we check if the vines are “hanging” below another vines block -- of equal orientation. - local pos2 = vector.add(pos, {x=0, y=1, z=0}) - local node2 = minetest.get_node(pos2) - -- Again, ignore means we assume its supported + local node2 = minetest.get_node(vector_offset(pos, 0, 1, 0)) if node2.name == "ignore" or (node2.name == "mcl_core:vine" and node2.param2 == node.param2) then - supported = true + return true end end - return supported + return false end -- Melt ice at pos. mcl_core:ice MUST be at pos if you call this! function mcl_core.melt_ice(pos) -- Create a water source if ice is destroyed and there was something below it - local below = {x=pos.x, y=pos.y-1, z=pos.z} - local belownode = minetest.get_node(below) + local below = vector_offset(pos, 0, -1, 0) local dim = mcl_worlds.pos_to_dimension(below) - if dim ~= "nether" and belownode.name ~= "air" and belownode.name ~= "ignore" and belownode.name ~= "mcl_core:void" then - minetest.set_node(pos, {name="mcl_core:water_source"}) - else + local belownode = minetest.get_node(below) + if dim == "nether" or belownode.name == "air" or belownode.name == "ignore" or belownode.name == "mcl_core:void" then minetest.remove_node(pos) + else + minetest.set_node(pos, {name="mcl_core:water_source"}) end - local neighbors = { - {x=-1, y=0, z=0}, - {x=1, y=0, z=0}, - {x=0, y=-1, z=0}, - {x=0, y=1, z=0}, - {x=0, y=0, z=-1}, - {x=0, y=0, z=1}, - } - for n=1, #neighbors do - minetest.check_single_for_falling(vector.add(pos, neighbors[n])) - end + minetest.check_single_for_falling(vector_offset(pos, -1, 0, 0)) + minetest.check_single_for_falling(vector_offset(pos, 1, 0, 0)) + minetest.check_single_for_falling(vector_offset(pos, 0, -1, 0)) + minetest.check_single_for_falling(vector_offset(pos, 0, 1, 0)) + minetest.check_single_for_falling(vector_offset(pos, 0, 0, -1)) + minetest.check_single_for_falling(vector_offset(pos, 0, 0, 1)) end ---- FUNCTIONS FOR SNOWED NODES ---- @@ -1533,12 +1382,6 @@ end -- of the snowed node. function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tiles, sounds, clear_colorization, desc, grass_palette) local def = table.copy(minetest.registered_nodes[itemstring_clear]) - local create_doc_alias - if def.description then - create_doc_alias = true - else - create_doc_alias = false - end -- Just some group clearing def.description = desc def._doc_items_longdesc = nil @@ -1562,11 +1405,7 @@ function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tile -- Note: _mcl_snowed must be added to the clear node manually! - if not tiles then - def.tiles = {"default_snow.png", "default_dirt.png", {name="mcl_core_grass_side_snowed.png", tileable_vertical=false}} - else - def.tiles = tiles - end + def.tiles = tiles or {"default_snow.png", "default_dirt.png", {name="mcl_core_grass_side_snowed.png", tileable_vertical=false}} if clear_colorization then def.paramtype2 = nil def.palette = nil @@ -1574,20 +1413,14 @@ function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tile def.color = nil def.overlay_tiles = nil end - if not sounds then - def.sounds = mcl_sounds.node_sound_dirt_defaults({ - footstep = mcl_sounds.node_sound_snow_defaults().footstep, - }) - else - def.sounds = sounds - end + def.sounds = sounds or mcl_sounds.node_sound_dirt_defaults({footstep = mcl_sounds.node_sound_snow_defaults().footstep}) def._mcl_silk_touch_drop = {itemstring_clear} -- Register stuff minetest.register_node(itemstring_snowed, def) - if create_doc_alias and minetest.get_modpath("doc") then + if def.description and minetest.get_modpath("doc") then doc.add_entry_alias("nodes", itemstring_clear, "nodes", itemstring_snowed) end end @@ -1598,7 +1431,7 @@ end function mcl_core.clear_snow_dirt(pos, node) local def = minetest.registered_nodes[node.name] if def and def._mcl_snowless then - minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2}) + minetest.swap_node(pos, {name = def._mcl_snowless, param2 = node.param2}) end end @@ -1608,18 +1441,13 @@ end -- on_construct -- Makes constructed snowable node snowed if placed below a snow cover node. function mcl_core.on_snowable_construct(pos) - -- Myself - local node = minetest.get_node(pos) - - -- Above - local apos = {x=pos.x, y=pos.y+1, z=pos.z} - local anode = minetest.get_node(apos) - + local above = minetest.get_node(vector_offset(pos, 0, 1, 0)).name -- Make snowed if needed - if minetest.get_item_group(anode.name, "snow_cover") == 1 then + if minetest.get_item_group(above.name, "snow_cover") == 1 then + local node = minetest.get_node(pos) local def = minetest.registered_nodes[node.name] if def and def._mcl_snowed then - minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2}) + minetest.swap_node(pos, {name = def._mcl_snowed, param2 = node.param2}) end end end @@ -1636,54 +1464,47 @@ end -- on_construct -- Makes snowable node below snowed. function mcl_core.on_snow_construct(pos) - local npos = {x=pos.x, y=pos.y-1, z=pos.z} - local node = minetest.get_node(npos) + local below = vector_offset(pos, 0, -1, 0) + local node = minetest.get_node(below) local def = minetest.registered_nodes[node.name] if def and def._mcl_snowed then - minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2}) + minetest.swap_node(below, {name = def._mcl_snowed, param2 = node.param2}) end end -- after_destruct -- Clears snowed dirtlike node below. function mcl_core.after_snow_destruct(pos) - local nn = minetest.get_node(pos).name - -- No-op if snow was replaced with snow - if minetest.get_item_group(nn, "snow_cover") == 1 then - return - end - local npos = {x=pos.x, y=pos.y-1, z=pos.z} - local node = minetest.get_node(npos) - mcl_core.clear_snow_dirt(npos, node) + if minetest.get_item_group(minetest.get_node(pos).name, "snow_cover") == 1 then return end + local below = vector_offset(pos, 0, -1, 0) + mcl_core.clear_snow_dirt(below, minetest.get_node(below)) end -- Obsidian crying - local crobby_particle = { - velocity = vector.new(0,0,0), - size = math.random(1.3,2.5), + velocity = vector_zero(), + acceleration = vector_zero(), texture = "mcl_core_crying_obsidian_tear.png", + collisiondetection = false, collision_removal = false, } - minetest.register_abm({ label = "Obsidian cries", nodenames = {"mcl_core:crying_obsidian"}, interval = 5, chance = 10, action = function(pos, node) - minetest.after(math.random(0.1,1.5),function() + minetest.after(0.1 + random() * 1.4, function() local pt = table.copy(crobby_particle) - pt.acceleration = vector.new(0,0,0) - pt.collisiondetection = false - pt.expirationtime = math.random(0.5,1.5) - pt.pos = vector.offset(pos,math.random(-0.5,0.5),-0.51,math.random(-0.5,0.5)) + pt.size = 1.3 + random() * 1.2 + pt.expirationtime = 0.5 + random() + pt.pos = vector_offset(pos, random() - 0.5, -0.51, random() - 0.5) minetest.add_particle(pt) - minetest.after(pt.expirationtime,function() - pt.acceleration = vector.new(0,-9,0) + minetest.after(pt.expirationtime, function() + pt.acceleration = vector_new(0, -9, 0) pt.collisiondetection = true - pt.expirationtime = math.random(1.2,4.5) + pt.expirationtime = 1.2 + random() * 3.3 minetest.add_particle(pt) end) end) diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr index 4f9071825..22c536edc 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Birkenholzplanken Birch leaves are grown from birch trees.=Birkenblätter wachsen an Birken. Black Stained Glass=Schwarzes Buntglas Block of Coal=Kohleblock +Block of Charcoal= Block of Diamond=Diamantblock Block of Emerald=Smaragdblock Block of Gold=Goldblock Block of Iron=Eisenblock Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Kohleblöcke sind für eine kompakte Aufbewahrung von Kohle nützlich und sehr nützlich als Ofenbrennstoff. Ein Kohleblock ist so effizient wie 10 mal Kohle. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Blaues Buntglas Bone Block=Knochenblock Bone blocks are decorative blocks and a compact storage of bone meal.=Knochenblöcke sind Deko-Blöcke und geeignet zur kompakten Aufbewahrung von Knochenmehl. @@ -283,3 +285,9 @@ Slows down movement=Verlangsamt die Fortbewegung Grows on sand or dirt next to water=Wächst auf Sand oder Erde neben Wasser Stackable=Stapelbar Needs soil and water to grow=Braucht Nährboden und Wasser zum wachsen +Crying Obsidian= +Crying obsidian is a luminous obsidian that can generate as part of ruined portals.= +Enchanted Golden Apple=Verzauberter goldener Apfel +Light= +Lights are invisible blocks. They are used to light up adventure maps and the like.= +When you hold a light in hand, you reveal all placed lights in a short distance around you.= diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.es.tr b/mods/ITEMS/mcl_core/locale/mcl_core.es.tr index cf16e5bda..9d276152e 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.es.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.es.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Madera de abedul Birch leaves are grown from birch trees.=Las hojas de abedul se cultivan a partir de abedules. Black Stained Glass=Cristal negro Block of Coal=Bloque de carbón +Block of Charcoal= Block of Diamond=Bloque de diamante Block of Emerald=Bloque de esmeralda Block of Gold=Bloque de oro Block of Iron=Bloque de hierro Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Los bloques de carbón son útiles como almacenamiento compacto de carbón y son muy útiles como combustible de horno. Un bloque de carbón es tan eficiente como 10 de carbón. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Cristal azul Bone Block=Bloque de hueso Bone blocks are decorative blocks and a compact storage of bone meal.=Los bloques óseos son bloques decorativos y un almacenamiento compacto de harina de huesos. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.fr.tr b/mods/ITEMS/mcl_core/locale/mcl_core.fr.tr index db90b43c6..bd0809653 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.fr.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.fr.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Planches de bouleau Birch leaves are grown from birch trees.=Les feuilles de bouleau poussent sur les bouleaux. Black Stained Glass=Verre noir Block of Coal=Bloc de charbon +Block of Charcoal= Block of Diamond=Bloc de diamant Block of Emerald=Bloc d'émeraude Block of Gold=Bloc d'or Block of Iron=Bloc de fer Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Les blocs de charbon sont utiles pour stocker du charbon et très utiles comme combustible de four. Un bloc de charbon est aussi efficace que 10 charbon. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Verre bleu Bone Block=Bloc d'os Bone blocks are decorative blocks and a compact storage of bone meal.=Les blocs d'os sont des blocs décoratifs et servent à stocker la poudre d'os. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.ja.tr b/mods/ITEMS/mcl_core/locale/mcl_core.ja.tr index 401b02700..a722d51c9 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.ja.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.ja.tr @@ -35,11 +35,13 @@ Birch Wood Planks=シラカバの板材 Birch leaves are grown from birch trees.=シラカバの葉は、シラカバの木から育ちます。 Black Stained Glass=黒色ガラス Block of Coal=石炭ブロック +Block of Charcoal= Block of Diamond=ダイヤモンドブロック Block of Emerald=エメラルドブロック Block of Gold=金ブロック Block of Iron=鉄ブロック Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=石炭ブロックは、石炭をコンパクトに保管でき、炉の燃料として非常に便利です。1個の石炭ブロックは、10個の石炭と同じ効率です。 +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=青色ガラス Bone Block=骨ブロック Bone blocks are decorative blocks and a compact storage of bone meal.=骨ブロックは装飾用ブロックで、骨粉をコンパクトに保管できます。 @@ -283,4 +285,4 @@ Grows on sand or dirt next to water=水辺の砂や土の上に生育 Stackable=スタック可能 Crying Obsidian=泣く黒曜石 Crying obsidian is a luminous obsidian that can generate as part of ruined portals.=泣く黒曜石は、廃墟のポータルの一部として生成可能な、発光する黒曜石です。 -Enchanted Golden Apple=エンチャントされた金のリンゴ \ No newline at end of file +Enchanted Golden Apple=エンチャントされた金のリンゴ diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.pl.tr b/mods/ITEMS/mcl_core/locale/mcl_core.pl.tr index 669e4bc9b..94b19a4e8 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.pl.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.pl.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Brzozowe deski Birch leaves are grown from birch trees.=Brzozowe liście rosną na brzozach. Black Stained Glass=Czarne szkło Block of Coal=Blok węgla +Block of Charcoal= Block of Diamond=Blok diamentu Block of Emerald=Blok szmaragdu Block of Gold=Blok złota Block of Iron=Blok żelaza Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Bloki węgla są użyteczne do kompaktowego przechowywania diamentów i bardzo użyteczne jako paliwo do pieca. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Niebieskie szkło Bone Block=Blok kości Bone blocks are decorative blocks and a compact storage of bone meal.=Bloki kości są blokami dekoracyjnymi i są użyteczne do kompaktowego przechowywania mączki kostnej. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr b/mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr index c8ed5b8c3..b593181e2 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Tábuas de Bétula Birch leaves are grown from birch trees.=Folhas de bétula crescem a partir de árvores de bétula. Black Stained Glass=Vidro Tingido de Preto Block of Coal=Bloco de Carvão +Block of Charcoal= Block of Diamond=Bloco de Diamante Block of Emerald=Bloco de Esmeralda Block of Gold=Bloco de Ouro Block of Iron=Bloco de Ferro Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Blocos de carvão são úteis para armzenad carvão de forma compacta e muito úteis como combustível de fornalas. Um bloco de carvão é tão eficiente quanto 10 carvões. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Vidro Tingido de Azul Bone Block=Bloco de Osso Bone blocks are decorative blocks and a compact storage of bone meal.=Blocos de osso são blocos decorativos e uma forma compacta de armazenar farinha de osso. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.ru.tr b/mods/ITEMS/mcl_core/locale/mcl_core.ru.tr index 6f29bd37e..25cb17343 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.ru.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.ru.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Берёзовые доски Birch leaves are grown from birch trees.=Листва берёзы произрастает на берёзах. Black Stained Glass=Чёрное стекло Block of Coal=Угольный блок +Block of Charcoal=Блок древесного угля Block of Diamond=Алмазный блок Block of Emerald=Изумрудный блок Block of Gold=Золотой блок Block of Iron=Железный блок Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Угольный блок удобен для компактного хранения угля, а также полезен как топливо для печи. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.=Блок древесного угля удобен для компактного хранения древесного угля, а также полезен как топливо для печи. Blue Stained Glass=Синее стекло Bone Block=Костный блок Bone blocks are decorative blocks and a compact storage of bone meal.=Костные блоки это декоративные блоки, а также способ компактного хранения костной муки. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr b/mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr index 74f3297a1..93fa55d1a 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr @@ -34,11 +34,13 @@ Birch Wood Planks=白樺樹木材 Birch leaves are grown from birch trees.=白樺樹葉是由白樺樹樹生長出來的。 Black Stained Glass=黑色玻璃 Block of Coal=煤炭磚 +Block of Charcoal= Block of Diamond=鑽石磚 Block of Emerald=綠寶石磚 Block of Gold=金磚 Block of Iron=鐵磚 Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=煤炭磚作為煤炭的省位存儲方式,作為熔爐燃料非常有用。一個煤炭磚的燃燒時間相當於10塊煤炭。 +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=藍色玻璃 Bone Block=骨塊 Bone blocks are decorative blocks and a compact storage of bone meal.=骨粉塊是一個裝飾方塊,也是骨粉的省位存儲方式。 diff --git a/mods/ITEMS/mcl_core/locale/template.txt b/mods/ITEMS/mcl_core/locale/template.txt index 911746699..6ea2e21f2 100644 --- a/mods/ITEMS/mcl_core/locale/template.txt +++ b/mods/ITEMS/mcl_core/locale/template.txt @@ -35,11 +35,13 @@ Birch Wood Planks= Birch leaves are grown from birch trees.= Black Stained Glass= Block of Coal= +Block of Charcoal= Block of Diamond= Block of Emerald= Block of Gold= Block of Iron= Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.= +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass= Bone Block= Bone blocks are decorative blocks and a compact storage of bone meal.= diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index db2561082..595019741 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -288,7 +288,7 @@ minetest.register_node("mcl_core:stone_smooth", { sounds = mcl_sounds.node_sound_stone_defaults(), is_ground_content = false, _mcl_blast_resistance = 6, - _mcl_hardness = 1.5, + _mcl_hardness = 2, }) minetest.register_node("mcl_core:granite", { @@ -424,7 +424,7 @@ minetest.register_node("mcl_core:grass_path", { footstep = {name="default_grass_footstep", gain=0.1}, }), _mcl_blast_resistance = 0.65, - _mcl_hardness = 0.6, + _mcl_hardness = 0.65, }) -- TODO: Add particles @@ -497,8 +497,8 @@ minetest.register_node("mcl_core:podzol", { sounds = mcl_sounds.node_sound_dirt_defaults(), on_construct = mcl_core.on_snowable_construct, _mcl_snowed = "mcl_core:podzol_snow", - _mcl_blast_resistance = 0.8, - _mcl_hardness = 0.8, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, _mcl_silk_touch_drop = true, }) mcl_core.register_snowed_node("mcl_core:podzol_snow", "mcl_core:podzol", nil, nil, false, S("Podzol with Snow")) @@ -600,8 +600,8 @@ minetest.register_node("mcl_core:sandstonesmooth", { stack_max = 64, groups = {pickaxey=1, sandstone=1, normal_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = 0.8, + _mcl_hardness = 0.8, }) minetest.register_node("mcl_core:sandstonecarved", { @@ -687,8 +687,8 @@ minetest.register_node("mcl_core:redsandstonesmooth2", { stack_max = 64, groups = {pickaxey=1, sandstone=1, red_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 0.8, - _mcl_hardness = 0.8, + _mcl_blast_resistance = 6, + _mcl_hardness = 2, }) --- @@ -798,6 +798,18 @@ minetest.register_node("mcl_core:coalblock", { _mcl_hardness = 5, }) +minetest.register_node("mcl_core:charcoalblock", { + description = S("Block of Charcoal"), + _doc_items_longdesc = S("Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal."), + tiles = {"mcl_core_charcoal_block.png"}, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=1, flammable=1, building_block=1, material_stone=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_stone_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, +}) + minetest.register_node("mcl_core:ironblock", { description = S("Block of Iron"), _doc_items_longdesc = S("A block of iron is mostly a decorative block but also useful as a compact storage of iron ingots."), @@ -1051,7 +1063,15 @@ for i=1,8 do local itemstring = itemstack:get_name() local itemcount = itemstack:get_count() local fakestack = ItemStack(itemstring.." "..itemcount) - fakestack:set_name("mcl_core:snow_"..math.min(8, (i+g))) + if i+g < 8 then + fakestack:set_name("mcl_core:snow_"..(i+g)) + else + -- To stack `mcl_core:snow_8', just replacing it with `mcl_core:snowblock' Issue#4483 + if i+g == 9 then + fakestack:set_count(itemcount + 1) + end + fakestack:set_name("mcl_core:snowblock") + end itemstack = minetest.item_place(fakestack, placer, pointed_thing) minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = pointed_thing.under}, true) itemstack:set_name(itemstring) @@ -1119,8 +1139,8 @@ minetest.register_node("mcl_core:snowblock", { on_construct = mcl_core.on_snow_construct, after_destruct = mcl_core.after_snow_destruct, drop = "mcl_throwing:snowball 4", - _mcl_blast_resistance = 0.1, - _mcl_hardness = 0.1, + _mcl_blast_resistance = 0.2, + _mcl_hardness = 0.2, _mcl_silk_touch_drop = true, }) diff --git a/mods/ITEMS/mcl_core/nodes_climb.lua b/mods/ITEMS/mcl_core/nodes_climb.lua index 0de0e9abd..88c5980b4 100644 --- a/mods/ITEMS/mcl_core/nodes_climb.lua +++ b/mods/ITEMS/mcl_core/nodes_climb.lua @@ -40,7 +40,7 @@ end minetest.register_node("mcl_core:ladder", { description = S("Ladder"), _doc_items_longdesc = S( - "A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks and not on glass, leaves, ice, slabs, glowstone, nor sea lanterns."), + "A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks."), drawtype = "signlike", is_ground_content = false, tiles = { "default_ladder.png" }, @@ -85,9 +85,8 @@ minetest.register_node("mcl_core:ladder", { end local groups = def.groups - -- Don't allow to place the ladder at particular nodes - if (groups and (groups.glass or groups.leaves or groups.slab)) or - node.name == "mcl_core:ladder" or node.name == "mcl_core:ice" or node.name == "mcl_nether:glowstone" or node.name == "mcl_ocean:sea_lantern" then + -- Don't allow to place the ladder at non-solid nodes + if (groups and (not groups.solid)) then return itemstack end @@ -105,9 +104,10 @@ minetest.register_node("mcl_core:ladder", { return itemstack end local idef = itemstack:get_definition() - local success = minetest.item_place_node(itemstack, placer, pointed_thing) + local itemstack, pos = minetest.item_place_node(itemstack, placer, pointed_thing) - if success then + -- A non-nil pos indicates the node was placed in a valid position. + if pos then if idef.sounds and idef.sounds.place then minetest.sound_play(idef.sounds.place, { pos = above, gain = 1 }, true) end diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index beead761d..c71693408 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -280,6 +280,14 @@ function mcl_core.register_sapling(subname, description, longdesc, tt_help, text nn == "mcl_core:podzol" or nn == "mcl_core:podzol_snow" or nn == "mcl_core:dirt" or nn == "mcl_core:mycelium" or nn == "mcl_core:coarse_dirt" end), + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + -- Saplings: 45% chance to advance growth stage + if math.random(1,100) <= 45 then + return mcl_core.grow_sapling(pos, n) + end + end, node_placement_prediction = "", _mcl_blast_resistance = 0, _mcl_hardness = 0, diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 3a7862019..919538860 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -5,6 +5,8 @@ local modpath = minetest.get_modpath(modname) -- by debiankaios -- adapted for mcl2 by cora +local MAXIMUM_VINE_HEIGHT = 25 + local wood_slab_groups = {handy = 1, axey = 1, material_wood = 1, wood_slab = 1} local wood_stair_groups = {handy = 1, axey = 1, material_wood = 1, wood_stairs = 1} @@ -16,21 +18,36 @@ function generate_crimson_tree(pos) minetest.place_schematic(pos,modpath.."/schematics/crimson_fungus_1.mts","random",nil,false,"place_center_x,place_center_z") end -function grow_vines(pos, moreontop ,vine, dir) +function grow_vines(pos, moreontop, vine, dir) + -- Sanity checks if dir == nil then dir = 1 end - local n - repeat - pos = vector.offset(pos,0,dir,0) - n = minetest.get_node(pos) - if n.name == "air" then - for i=0,math.max(moreontop,1) do - if minetest.get_node(pos).name == "air" then - minetest.set_node(vector.offset(pos,0,i*dir,0),{name=vine}) - end - end - break - end - until n.name ~= "air" and n.name ~= vine + if not moreontop or moreontop < 1 then return false end + + local allowed_nodes = {} + allowed_nodes[vine] = true + + -- Find the root, tip and calculate height + local root,_,root_node = mcl_util.trace_nodes(pos, -dir, allowed_nodes, MAXIMUM_VINE_HEIGHT) + if not root then return false end + local tip,height,tip_node = mcl_util.trace_nodes(vector.offset(root, 0, dir, 0), dir, allowed_nodes, MAXIMUM_VINE_HEIGHT) + if not tip then return false end + + local res = false + for i = 1,moreontop do + -- Check if we can grow into this position + if height >= MAXIMUM_VINE_HEIGHT then return res end + if tip_node.name ~= "air" then return res end + + -- Update world map data + minetest.set_node(tip, {name = vine}) + + -- Move to the next position and flag that growth has occured + tip = vector.offset(tip, 0, dir, 0) + tip_node = minetest.get_node(tip) + height = height + 1 + res = true + end + return res end local nether_plants = { @@ -83,17 +100,20 @@ minetest.register_node("mcl_crimson:warped_fungus", { light_source = 1, sounds = mcl_sounds.node_sound_leaves_defaults(), node_placement_prediction = "", - on_rightclick = function(pos, node, pointed_thing, player, itemstack) - if pointed_thing:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - local nodepos = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}) - if nodepos.name == "mcl_crimson:warped_nylium" or nodepos.name == "mcl_nether:netherrack" then - local random = math.random(1, 5) - if random == 1 then - minetest.remove_node(pos) - generate_warped_tree(pos) - end + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0)) + + if nodepos.name == "mcl_crimson:warped_nylium" or nodepos.name == "mcl_nether:netherrack" then + local random = math.random(1, 5) + if random == 1 then + minetest.remove_node(pos) + generate_warped_tree(pos) + return true end end + + return false end, _mcl_blast_resistance = 0, }) @@ -102,6 +122,12 @@ mcl_flowerpots.register_potted_flower("mcl_crimson:warped_fungus", { name = "warped_fungus", desc = S("Warped Fungus"), image = "mcl_crimson_warped_fungus.png", + _on_bone_meal = function(itemstack, placer, pointed_thing) + local n = has_nylium_neighbor(pointed_thing.under) + if n then + minetest.set_node(pointed_thing.under,n) + end + end, }) minetest.register_node("mcl_crimson:twisting_vines", { @@ -121,6 +147,9 @@ minetest.register_node("mcl_crimson:twisting_vines", { fixed = { -3/16, -0.5, -3/16, 3/16, 0.5, 3/16 }, }, node_placement_prediction = "", + _on_bone_meal = function(itemstack, placer, pointed_thing) + return grow_vines(pointed_thing.under, math.random(1, 3),"mcl_crimson:twisting_vines") + end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local pn = clicker:get_player_name() if clicker:is_player() and minetest.is_protected(vector.offset(pos,0,1,0), pn or "") then @@ -141,26 +170,28 @@ minetest.register_node("mcl_crimson:twisting_vines", { end elseif clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - if not minetest.is_creative_enabled(clicker:get_player_name()) then - itemstack:take_item() - end - grow_vines(pos, math.random(1, 3),"mcl_crimson:twisting_vines") + return mcl_bone_meal.use_bone_meal(itemstack, clicker, {under=pos, above=pos}) end return itemstack end, on_place = function(itemstack, placer, pointed_thing) local under = pointed_thing.under - local above = pointed_thing.above local unode = minetest.get_node(under) + local unode_def = minetest.registered_nodes[unode.name] + + local above = pointed_thing.above + local anode = minetest.get_node(above) + local anode_def = minetest.registered_nodes[anode.name] + if under.y < above.y then minetest.set_node(above, {name = "mcl_crimson:twisting_vines"}) if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end - else - if unode.name == "mcl_crimson:twisting_vines" then - return minetest.registered_nodes[unode.name].on_rightclick(under, unode, placer, itemstack, pointed_thing) - end + elseif unode_def and unode_def.on_rightclick then + return unode_def.on_rightclick(under, unode, placer, itemstack, pointed_thing) + elseif anode_def and anode_def.on_rightclick then + return unode_def.on_rightclick(above, anode, placer, itemstack, pointed_thing) end return itemstack end, @@ -168,7 +199,7 @@ minetest.register_node("mcl_crimson:twisting_vines", { local above = vector.offset(pos,0,1,0) local abovenode = minetest.get_node(above) minetest.node_dig(pos, node, digger) - if abovenode.name == node.name and (not mcl_core.check_vines_supported(above, abovenode)) then + if abovenode.name == node.name then minetest.registered_nodes[node.name].on_dig(above, node, digger) end end, @@ -191,8 +222,7 @@ minetest.register_node("mcl_crimson:twisting_vines", { "mcl_crimson:twisting_vines", "mcl_crimson:twisting_vines", }, - _mcl_blast_resistance = 0.2, - _mcl_hardness = 0.2, + _mcl_blast_resistance = 0, }) minetest.register_node("mcl_crimson:weeping_vines", { @@ -212,6 +242,9 @@ minetest.register_node("mcl_crimson:weeping_vines", { fixed = { -3/16, -0.5, -3/16, 3/16, 0.5, 3/16 }, }, node_placement_prediction = "", + _on_bone_meal = function(itemstack, placer, pointed_thing) + return grow_vines(pointed_thing.under, math.random(1, 3),"mcl_crimson:weeping_vines", -1) + end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local pn = clicker:get_player_name() if clicker:is_player() and minetest.is_protected(vector.offset(pos,0,1,0), pn or "") then @@ -232,26 +265,28 @@ minetest.register_node("mcl_crimson:weeping_vines", { end elseif clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - if not minetest.is_creative_enabled(clicker:get_player_name()) then - itemstack:take_item() - end - grow_vines(pos, math.random(1, 3),"mcl_crimson:weeping_vines", -1) + return mcl_bone_meal.use_bone_meal(itemstack, clicker, {under=pos, above=pos}) end return itemstack end, on_place = function(itemstack, placer, pointed_thing) local under = pointed_thing.under - local above = pointed_thing.above local unode = minetest.get_node(under) + local unode_def = minetest.registered_nodes[unode.name] + + local above = pointed_thing.above + local anode = minetest.get_node(above) + local anode_def = minetest.registered_nodes[anode.name] + if under.y > above.y then minetest.set_node(above, {name = "mcl_crimson:weeping_vines"}) if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end - else - if unode.name == "mcl_crimson:weeping_vines" then - return minetest.registered_nodes[unode.name].on_rightclick(under, unode, placer, itemstack, pointed_thing) - end + elseif unode_def and unode_def.on_rightclick then + return unode_def.on_rightclick(under, unode, placer, itemstack, pointed_thing) + elseif anode_def and anode_def.on_rightclick then + return unode_def.on_rightclick(above, anode, placer, itemstack, pointed_thing) end return itemstack end, @@ -259,7 +294,7 @@ minetest.register_node("mcl_crimson:weeping_vines", { local below = vector.offset(pos,0,-1,0) local belownode = minetest.get_node(below) minetest.node_dig(pos, node, digger) - if belownode.name == node.name and (not mcl_core.check_vines_supported(below, belownode)) then + if belownode.name == node.name then minetest.registered_nodes[node.name].on_dig(below, node, digger) end end, @@ -281,8 +316,7 @@ minetest.register_node("mcl_crimson:weeping_vines", { "mcl_crimson:weeping_vines", "mcl_crimson:weeping_vines", }, - _mcl_blast_resistance = 0.2, - _mcl_hardness = 0.2, + _mcl_blast_resistance = 0, }) minetest.register_node("mcl_crimson:nether_sprouts", { @@ -395,6 +429,11 @@ minetest.register_node("mcl_crimson:warped_nylium", { _mcl_hardness = 0.4, _mcl_blast_resistance = 0.4, _mcl_silk_touch_drop = true, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local node = minetest.get_node(pointed_thing.under) + spread_nether_plants(pointed_thing.under,node) + return true + end, }) --Stem bark, stripped stem and bark @@ -465,6 +504,7 @@ minetest.register_node("mcl_crimson:warped_hyphae_wood", { tiles = {"mcl_crimson_warped_hyphae_wood.png"}, groups = {handy = 5,axey = 1, wood=1,building_block = 1, material_wood = 1}, sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 3, _mcl_hardness = 2, }) @@ -526,17 +566,21 @@ minetest.register_node("mcl_crimson:crimson_fungus", { fixed = { -3/16, -0.5, -3/16, 3/16, -2/16, 3/16 }, }, node_placement_prediction = "", - on_rightclick = function(pos, node, pointed_thing, player) - if pointed_thing:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0)) - if nodepos.name == "mcl_crimson:crimson_nylium" or nodepos.name == "mcl_nether:netherrack" then - local random = math.random(1, 5) - if random == 1 then - minetest.remove_node(pos) - generate_crimson_tree(pos) - end + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0)) + if nodepos.name == "mcl_crimson:crimson_nylium" or nodepos.name == "mcl_nether:netherrack" then + local random = math.random(1, 5) + if random == 1 then + minetest.remove_node(pos) + generate_crimson_tree(pos) + + return true end end + + -- Failed to spread nylium + return false end, _mcl_blast_resistance = 0, }) @@ -662,6 +706,7 @@ minetest.register_node("mcl_crimson:crimson_hyphae_wood", { tiles = {"mcl_crimson_crimson_hyphae_wood.png"}, groups = {handy = 5, axey = 1, wood = 1, building_block = 1, material_wood = 1}, sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 3, _mcl_hardness = 2, }) @@ -682,6 +727,11 @@ minetest.register_node("mcl_crimson:crimson_nylium", { _mcl_hardness = 0.4, _mcl_blast_resistance = 0.4, _mcl_silk_touch_drop = true, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local node = minetest.get_node(pointed_thing.under) + spread_nether_plants(pointed_thing.under,node) + return true + end, }) minetest.register_craft({ @@ -723,19 +773,6 @@ minetest.register_craft({ mcl_stairs.register_stair("crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", wood_stair_groups, false, S("Crimson Stair")) mcl_stairs.register_slab("crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", wood_slab_groups, false, S("Crimson Slab")) -mcl_dye.register_on_bone_meal_apply(function(pt,user) - if not pt.type == "node" then return end - local node = minetest.get_node(pt.under) - if node.name == "mcl_nether:netherrack" then - local n = has_nylium_neighbor(pt.under) - if n then - minetest.set_node(pt.under,n) - end - elseif node.name == "mcl_crimson:warped_nylium" or node.name == "mcl_crimson:crimson_nylium" then - spread_nether_plants(pt.under,node) - end -end) - minetest.register_abm({ label = "Turn Crimson Nylium and Warped Nylium below solid block into Netherrack", nodenames = {"mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium"}, diff --git a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr index 480094dbd..3265664ce 100644 --- a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr +++ b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr @@ -1,24 +1,51 @@ # textdomain: mcl_crimson -Warped Fungus Mushroom=Wirrpilz +Warped Fungus=Wirrpilz +Warped fungus is a mushroom found in the nether's warped forest.=Wirrpilze wachsen im Wirrwald des Nethers. Twisting Vines=Zwirbelranken +Weeping Vines=Trauerranken Nether Sprouts=Nethersprossen Warped Roots=Wirrwurzeln Warped Wart Block=Wirrwarzenblock Shroomlight=Pilzlicht Warped Hyphae=Wirrhyphe +The stem of a warped hyphae=Der Stiel einer Wirrhyphe +Warped Hyphae Bark=Wirrhypenrinde +This is a decorative block surrounded by the bark of an hyphae.=Ein dekorativer Block, umgeben von der Rinde einer Hyphe +Stripped Warped Hyphae=Entrindete Wirrhyphe +The stripped hyphae of a warped fungus=Der entrindete Stiel eines Karmesinpilzes +Stripped Warped Hyphae Bark=Wirrhyphenrinde +The stripped hyphae bark of a warped fungus=Die abgelöste Hyphenrinde eines Wirrpilzes Warped Nylium=Wirr-Nezel Warped Checknode - only to check!=Wirr Checkblock - Nur zum checken! -Warped Hyphae Wood=Wirrhyphen Holz -Warped Stair=Wirrtreppe -Warped Slab=Wirrstufe -Double Warped Slab=Doppelte Wirrstufe -Crimson Fungus Mushroom=Karmesinpilz +Warped Hyphae Wood=Wirrhypenholz +Warped Stair=Wirrholztreppe +Warped Slab=Wirrholzstufe +Double Warped Slab=Doppelte Wirrholzstufe +Crimson Fungus=Karmesinpilz +Crimson fungus is a mushroom found in the nether's crimson forest.=Karmesinpilze wachsen im Karmesinwald des Nethers. Crimson Roots=Karmesinwurzeln Crimson Hyphae=Karmesinhyphe +The stem of a crimson hyphae=Der Stiel einer Karmesinhyphe +Crimson Hyphae Bark=Karmesinhypenrinde +Stripped Crimson Hyphae=Entrindete Karmesinhyphe +The stripped stem of a crimson hyphae=Der entrindete Stiel eines Karmesinpilzes +Stripped Crimson Hyphae Bark=Karmesinhyphenrinde Crimson Hyphae Wood=Karmesinhyphenholz Crimson Stair=Karmesintreppe Crimson Slab=Karmesinstufe Double Crimson Slab=Doppelte Karmesinstufe Crimson Nylium=Karmesin-Nezel +Crimson Door=Karmesinholztür +Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal.=Holztüren sind zwei Block hohe Barrieren, die sowohl von Hand geöffnet und geschlossen werden können, als auch per Redstone-Signal. +To open or close a wooden door, rightclick it or supply its lower half with a redstone signal.=m eine Holztür zu öffnen oder zu schließen, rechtsklicke auf sie oder lege ein Redstone-Signal an die untere Hälfte an. +Crimson Trapdoor=Karmesinholzfalltür +Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder.=Falltüren aus Holz sind horizontale Barrieren, die sowohl von Hand geöffnet und geschlossen werden können, als auch per Redstone-Signal. Sie nehmen die obere oder untere Hälfte eines Blocks ein, je nachdem wo sie platziert wurden. Geöffnete Falltüren können wie Leitern beklettert werden. +To open or close the trapdoor, rightclick it or send a redstone signal to it.=Um eine Falltür zu öffnen oder zu schließen, rechtsklicke auf sie oder lege ein Redstone-Signal an. +Crimson Fence=Karmesinholzzaun +Crimson Fence Gate=Karmesinholzzauntor Crimson Checknode - only to check!=Karmesin Checkblock - Nur zum checken! +Warped Door=Wirrholztür +Warped Trapdoor=Wirrholzfalltür +Warped Fence=Wirrholzzaun +Warped Fence Gate=Wirrholzzauntor diff --git a/mods/ITEMS/mcl_crimson/locale/template.txt b/mods/ITEMS/mcl_crimson/locale/template.txt index f93b85577..80c37fa87 100644 --- a/mods/ITEMS/mcl_crimson/locale/template.txt +++ b/mods/ITEMS/mcl_crimson/locale/template.txt @@ -21,6 +21,7 @@ Warped Checknode - only to check!= Warped Hyphae Wood= Warped Stair= Warped Slab= +Double Warped Slab= Crimson Fungus= Crimson fungus is a mushroom found in the nether's crimson forest.= Crimson Roots= @@ -30,7 +31,6 @@ Crimson Hyphae Bark= Stripped Crimson Hyphae= The stripped stem of a crimson hyphae= Stripped Crimson Hyphae Bark= -The stripped wood of a crimson hyphae= Crimson Hyphae Wood= Crimson Stair= Crimson Slab= diff --git a/mods/ITEMS/mcl_crimson/mod.conf b/mods/ITEMS/mcl_crimson/mod.conf index b4303cd48..86be6bfe8 100644 --- a/mods/ITEMS/mcl_crimson/mod.conf +++ b/mods/ITEMS/mcl_crimson/mod.conf @@ -1,3 +1,3 @@ name = mcl_crimson author = debiankaios, Exhale -depends = mcl_core, mcl_stairs, mobs_mc, mcl_util, mcl_dye, mcl_flowerpots +depends = mcl_core, mcl_fences, mcl_stairs, mobs_mc, mcl_util, mcl_dye, mcl_flowerpots, mcl_doors diff --git a/mods/ITEMS/mcl_deepslate/init.lua b/mods/ITEMS/mcl_deepslate/init.lua index 0abb0c579..d9a9c7021 100644 --- a/mods/ITEMS/mcl_deepslate/init.lua +++ b/mods/ITEMS/mcl_deepslate/init.lua @@ -38,8 +38,8 @@ minetest.register_node("mcl_deepslate:infested_deepslate", { drop = "", sounds = mcl_sounds.node_sound_stone_defaults(), after_dig_node = spawn_silverfish, - _mcl_hardness = 0, - _mcl_blast_resistance = 0.5, + _mcl_hardness = 1.5, + _mcl_blast_resistance = 0.75, }) minetest.register_node("mcl_deepslate:tuff", { @@ -111,7 +111,7 @@ for _, p in pairs(deepslate_ores) do end if copper_mod then - register_deepslate_ore("Copper", "mcl_copper:raw_copper", "mcl_copper:copper_ingot", 4, 4) + register_deepslate_ore("Copper", "mcl_copper:raw_copper", "mcl_copper:copper_ingot", 3, 4) end local redstone_timer = 68.28 @@ -218,10 +218,7 @@ local function register_deepslate_variant(item, desc, longdesc) end if item ~= "chiseled" then mcl_stairs.register_stair_and_slab_simple("deepslate_"..item, "mcl_deepslate:deepslate_"..item, S(desc.." Stairs"), S(desc.." Slab"), S("Double "..desc.." Slab")) - mcl_walls.register_wall( - "mcl_deepslate:deepslate"..item.."wall", - S(desc.." Wall"), - "mcl_deepslate:deepslate_"..item) + mcl_walls.register_wall("mcl_deepslate:deepslate"..item.."wall", S(desc.." Wall"), "mcl_deepslate:deepslate_"..item) end end diff --git a/mods/ITEMS/mcl_doors/api_doors.lua b/mods/ITEMS/mcl_doors/api_doors.lua index e392bc710..0108738b4 100644 --- a/mods/ITEMS/mcl_doors/api_doors.lua +++ b/mods/ITEMS/mcl_doors/api_doors.lua @@ -25,7 +25,7 @@ end -- Registers a door -- name: The name of the door --- def: a table with the folowing fields: +-- def: a table with the following fields: -- description -- inventory_image -- groups diff --git a/mods/ITEMS/mcl_dye/API.md b/mods/ITEMS/mcl_dye/API.md deleted file mode 100644 index 04169f966..000000000 --- a/mods/ITEMS/mcl_dye/API.md +++ /dev/null @@ -1,14 +0,0 @@ -# mcl_dye - -# Bone meal API -Callback and particle functions. - -## mcl_dye.add_bone_meal_particle(pos, def) -Spawns standard or custom bone meal particles. -* `pos`: position, is ignored if you define def.minpos and def.maxpos -* `def`: (optional) particle definition - -## mcl_dye.register_on_bone_meal_apply(function(pointed_thing, user)) -Called when the bone meal is applied anywhere. -* `pointed_thing`: exact pointing location (see Minetest API), where the bone meal is applied -* `user`: ObjectRef of the player who aplied the bone meal, can be nil! \ No newline at end of file diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index c14f7eaeb..8b1090498 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -15,7 +15,6 @@ mcl_dye = {} local S = minetest.get_translator(minetest.get_current_modname()) -local math = math local string = string -- Base color groups: @@ -115,328 +114,23 @@ for _, row in pairs(dyes) do }) end --- Bone meal code to be moved into its own mod. +-- Legacy support for things now in mcl_bone_meal. +-- These shims will at some time in the future be removed. -- function mcl_dye.add_bone_meal_particle(pos, def) - if not def then - def = {} + minetest.log("warning", "mcl_dye.add_bone_meal_particles() is deprecated. Read mcl_bone_meal/API.md!") + local lines = string.split(debug.traceback(),"\n") + for _,line in ipairs(lines) do + minetest.log("warning",line) end - minetest.add_particlespawner({ - amount = def.amount or 10, - time = def.time or 0.1, - minpos = def.minpos or vector.subtract(pos, 0.5), - maxpos = def.maxpos or vector.add(pos, 0.5), - minvel = def.minvel or vector.new(-0.01, 0.01, -0.01), - maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01), - minacc = def.minacc or vector.new(0, 0, 0), - maxacc = def.maxacc or vector.new(0, 0, 0), - minexptime = def.minexptime or 1, - maxexptime = def.maxexptime or 4, - minsize = def.minsize or 0.7, - maxsize = def.maxsize or 2.4, - texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color - glow = def.glow or 1, - }) + mcl_bone_meal.add_bone_meal_particle(pos, def) end -mcl_dye.bone_meal_callbacks = {} - function mcl_dye.register_on_bone_meal_apply(func) - table.insert(mcl_dye.bone_meal_callbacks, func) + minetest.log("warning", "mcl_dye.register_on_bone_meal_apply() is deprecated. Read mcl_bone_meal/API.md!") + mcl_bone_meal.register_on_bone_meal_apply(func) end -local function apply_bone_meal(pointed_thing, user) - -- Bone meal currently spawns all flowers found in the plains. - local flowers_table_plains = { - "mcl_flowers:dandelion", - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - - "mcl_flowers:oxeye_daisy", - "mcl_flowers:tulip_orange", - "mcl_flowers:tulip_red", - "mcl_flowers:tulip_white", - "mcl_flowers:tulip_pink", - "mcl_flowers:azure_bluet", - } - local flowers_table_simple = { - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - } - local flowers_table_swampland = { - "mcl_flowers:blue_orchid", - } - local flowers_table_flower_forest = { - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - "mcl_flowers:oxeye_daisy", - "mcl_flowers:tulip_orange", - "mcl_flowers:tulip_red", - "mcl_flowers:tulip_white", - "mcl_flowers:tulip_pink", - "mcl_flowers:azure_bluet", - "mcl_flowers:allium", - } - - local pos = pointed_thing.under - local n = minetest.get_node(pos) - if n.name == "" then return false end - - if mcl_util.check_area_protection(pos, pointed_thing.above, user) then - return false - end - - for _, func in pairs(mcl_dye.bone_meal_callbacks) do - if func(pointed_thing, user) then - return true - end - end - - if minetest.get_item_group(n.name, "sapling") >= 1 then - mcl_dye.add_bone_meal_particle(pos) - -- Saplings: 45% chance to advance growth stage - if math.random(1, 100) <= 45 then - if n.name == "mcl_cherry_blossom:cherrysapling" then - return mcl_cherry_blossom.generate_cherry_tree(pos) -- If cherry blossom sapling, run that callback instead. - else - return mcl_core.grow_sapling(pos, n) - end - end - elseif minetest.get_item_group(n.name, "mushroom") == 1 then - mcl_dye.add_bone_meal_particle(pos) - -- Try to grow huge mushroom - - -- Must be on a dirt-type block - local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}) - if below.name ~= "mcl_core:mycelium" and below.name ~= "mcl_core:dirt" and minetest.get_item_group(below.name, "grass_block") ~= 1 and below.name ~= "mcl_core:coarse_dirt" and below.name ~= "mcl_core:podzol" then - return false - end - - -- Select schematic - local schematic, offset, height - if n.name == "mcl_mushrooms:mushroom_brown" then - schematic = minetest.get_modpath("mcl_mushrooms").."/schematics/mcl_mushrooms_huge_brown.mts" - offset = { x = -3, y = -1, z = -3 } - height = 8 - elseif n.name == "mcl_mushrooms:mushroom_red" then - schematic = minetest.get_modpath("mcl_mushrooms").."/schematics/mcl_mushrooms_huge_red.mts" - offset = { x = -2, y = -1, z = -2 } - height = 8 - else - return false - end - -- 40% chance - if math.random(1, 100) <= 40 then - -- Check space requirements - for i=1,3 do - local cpos = vector.add(pos, {x=0, y=i, z=0}) - if minetest.get_node(cpos).name ~= "air" then - return false - end - end - local yoff = 3 - local minp, maxp = {x=pos.x-3, y=pos.y+yoff, z=pos.z-3}, {x=pos.x+3, y=pos.y+yoff+(height-3), z=pos.z+3} - local diff = vector.subtract(maxp, minp) - diff = vector.add(diff, {x=1,y=1,z=1}) - local totalnodes = diff.x * diff.y * diff.z - local goodnodes = minetest.find_nodes_in_area(minp, maxp, {"air", "group:leaves"}) - if #goodnodes < totalnodes then - return false - end - - -- Place the huge mushroom - minetest.remove_node(pos) - local place_pos = vector.add(pos, offset) - local ok = minetest.place_schematic(place_pos, schematic, 0, nil, false) - return ok ~= nil - end - return false - -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages - elseif string.find(n.name, "mcl_farming:wheat_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:potato_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_potato", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:carrot_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:pumpkin_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:melontige_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:beetroot_") then - mcl_dye.add_bone_meal_particle(pos) - -- Beetroot: 75% chance to advance to next stage - if math.random(1, 100) <= 75 then - return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true) - end - elseif string.find(n.name, "mcl_farming:sweet_berry_bush_") then - mcl_dye.add_bone_meal_particle(pos) - if n.name == "mcl_farming:sweet_berry_bush_3" then - return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry") - else - return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 0, true) - end - elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then - mcl_dye.add_bone_meal_particle(pos) - -- Cocoa: Advance by 1 stage - mcl_cocoas.grow(pos) - return true - elseif minetest.get_item_group(n.name, "grass_block") == 1 then - -- Grass Block: Generate tall grass and random flowers all over the place - for i = -7, 7 do - for j = -7, 7 do - for y = -1, 1 do - pos = vector.offset(pointed_thing.above, i, y, j) - n = minetest.get_node(pos) - local n2 = minetest.get_node(vector.offset(pos, 0, -1, 0)) - - if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then - -- Randomly generate flowers, tall grass or nothing - if math.random(1, 100) <= 90 / ((math.abs(i) + math.abs(j)) / 2)then - -- 90% tall grass, 10% flower - mcl_dye.add_bone_meal_particle(pos, {amount = 4}) - if math.random(1,100) <= 90 then - local col = n2.param2 - minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=col}) - else - local flowers_table - if mg_name == "v6" then - flowers_table = flowers_table_plains - else - local biome = minetest.get_biome_name(minetest.get_biome_data(pos).biome) - if biome == "Swampland" or biome == "Swampland_shore" or biome == "Swampland_ocean" or biome == "Swampland_deep_ocean" or biome == "Swampland_underground" then - flowers_table = flowers_table_swampland - elseif biome == "FlowerForest" or biome == "FlowerForest_beach" or biome == "FlowerForest_ocean" or biome == "FlowerForest_deep_ocean" or biome == "FlowerForest_underground" then - flowers_table = flowers_table_flower_forest - elseif biome == "Plains" or biome == "Plains_beach" or biome == "Plains_ocean" or biome == "Plains_deep_ocean" or biome == "Plains_underground" or biome == "SunflowerPlains" or biome == "SunflowerPlains_ocean" or biome == "SunflowerPlains_deep_ocean" or biome == "SunflowerPlains_underground" then - flowers_table = flowers_table_plains - else - flowers_table = flowers_table_simple - end - end - minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]}) - end - end - end - end - end - end - return true - - -- Double flowers: Drop corresponding item - elseif n.name == "mcl_flowers:rose_bush" or n.name == "mcl_flowers:rose_bush_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:rose_bush") - return true - elseif n.name == "mcl_flowers:peony" or n.name == "mcl_flowers:peony_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:peony") - return true - elseif n.name == "mcl_flowers:lilac" or n.name == "mcl_flowers:lilac_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:lilac") - return true - elseif n.name == "mcl_flowers:sunflower" or n.name == "mcl_flowers:sunflower_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:sunflower") - return true - - elseif n.name == "mcl_flowers:tallgrass" then - mcl_dye.add_bone_meal_particle(pos) - -- Tall Grass: Grow into double tallgrass - local toppos = { x=pos.x, y=pos.y+1, z=pos.z } - local topnode = minetest.get_node(toppos) - if minetest.registered_nodes[topnode.name].buildable_to then - minetest.set_node(pos, { name = "mcl_flowers:double_grass", param2 = n.param2 }) - minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top", param2 = n.param2 }) - return true - end - ---[[ - Here for when Bonemeal becomes an api, there's code if needed for handling applying to bamboo. - -- Handle applying bonemeal to bamboo. - elseif mcl_bamboo.is_bamboo(n.name) then - local success = mcl_bamboo.grow_bamboo(pos, true) - if success then - mcl_dye.add_bone_meal_particle(pos) - end - return success ---]] - elseif n.name == "mcl_flowers:fern" then - mcl_dye.add_bone_meal_particle(pos) - -- Fern: Grow into large fern - local toppos = { x=pos.x, y=pos.y+1, z=pos.z } - local topnode = minetest.get_node(toppos) - if minetest.registered_nodes[topnode.name].buildable_to then - minetest.set_node(pos, { name = "mcl_flowers:double_fern", param2 = n.param2 }) - minetest.set_node(toppos, { name = "mcl_flowers:double_fern_top", param2 = n.param2 }) - return true - end - end - - return false -end - -mcl_dye.apply_bone_meal = apply_bone_meal - --- Bone meal item registration. --- --- To be moved into its own mod. --- -minetest.register_craftitem(":mcl_bone_meal:bone_meal", { - inventory_image = "mcl_bone_meal_bone_meal.png", - description = S("Bone Meal"), - _tt_help = S("Speeds up plant growth"), - _doc_items_longdesc = S("Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants."), - _doc_items_usagehelp = S("Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place."), - stack_max = 64, - on_place = function(itemstack, user, pointed_thing) - -- Use pointed node's on_rightclick function first, if present - local node = minetest.get_node(pointed_thing.under) - if user and not user:get_player_control().sneak then - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then - return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack - end - end - - -- Use the bone meal on the ground - if (apply_bone_meal(pointed_thing, user) and (not minetest.is_creative_enabled(user:get_player_name()))) then - itemstack:take_item() - end - return itemstack - end, - _on_dispense = function(stack, pos, droppos, dropnode, dropdir) - -- Apply bone meal, if possible - local pointed_thing - if dropnode.name == "air" then - pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } } - else - pointed_thing = { above = pos, under = droppos } - end - local success = apply_bone_meal(pointed_thing, nil) - if success then - stack:take_item() - end - return stack - end, - _dispense_into_walkable = true -}) - -minetest.register_craft({ - output = "mcl_bone_meal:bone_meal 3", - recipe = {{"mcl_mobitems:bone"}}, -}) - - -- Dye creation recipes. -- minetest.register_craft({ @@ -609,19 +303,16 @@ minetest.register_craft({ output = "mcl_dye:magenta 2", recipe = {"mcl_dye:violet", "mcl_dye:pink"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:pink 2", recipe = {"mcl_dye:red", "mcl_dye:white"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:cyan 2", recipe = {"mcl_dye:blue", "mcl_dye:dark_green"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:violet 2", diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr index affe4cb8a..2069d4d76 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr @@ -11,17 +11,9 @@ Green Dye=Grüner Farbstoff Lime Dye=Lindgrüner Farbstoff Yellow Dye=Gelber Farbstoff Brown Dye=Brauner Farbstoff -Orange Dye=Orange Farbstoff +Orange Dye=Oranger Farbstoff Red Dye=Roter Farbstoff Magenta Dye=Magenta Farbstoff Pink Dye=Rosa Farbstoff This item is a dye which is used for dyeing and crafting.=Dieser Gegenstand ist ein Farbstoff, der zum Einfärben und in der Herstellung benutzt werden kann. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Rechtsklicken Sie auf ein Schaf, um seine Wolle zu färben. Andere Dinge werden mit der Fertigung eingefärbt. -Bone Meal=Knochenmehl -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Knochenmehl ist ein weißer Farbstoff und auch nützlich als Dünger, um das Wachstum vieler Pflanzen zu beschleunigen. -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Rechtsklicken Sie auf ein Schaf, um die Wolle weiß einzufärben. Rechtsklicken Sie auf eine Pflanze, um ihr Wachstum zu beschleunigen. Beachten Sie, dass nicht alle Pflanzen darauf ansprechen. Benutzen Sie es auf einem Grasblock, wächst viel hohes Gras und vielleicht auch ein paar Blumen. -Cocoa beans are a brown dye and can be used to plant cocoas.=Kakaobohnen sind ein brauner Farbstoff und werden benutzt, um Kakao anzupflanzen. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie auf ein Schaf, um die Wolle braun einzufärben. Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen. -Cocoa Beans=Kakaobohnen -Grows at the side of jungle trees=Wächst an der Seite von Dschungelbäumen -Speeds up plant growth=Beschleunigt Pflanzenwachstum diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr index a829d5386..542e367f9 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr @@ -17,9 +17,3 @@ Magenta Dye=Tinte magenta Pink Dye=Tinte rosado This item is a dye which is used for dyeing and crafting.=Este artículo es un tinte que se utiliza para teñir y elaborar. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Haga clic derecho sobre una oveja para teñir su lana. Otras cosas pueden ser teñidas mediante la elaboración. -Bone Meal=Harina de hueso -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas. -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar. -Cocoa beans are a brown dye and can be used to plant cocoas.=Los granos de cacao son un tinte marrón y se pueden usar para plantar cacao. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de jungla para plantar un cacao joven. -Cocoa Beans=Granos de cacao diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr index 761511c5b..eddd5edf4 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr @@ -17,11 +17,3 @@ Magenta Dye=Teinture Magenta Pink Dye=Teinture Rose This item is a dye which is used for dyeing and crafting.=Cet objet est un colorant utilisé pour la teinture et l'artisanat. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Clic droit sur un mouton pour teindre sa laine. D'autres choses sont teintes par l'artisanat. -Bone Meal=Farine d'Os -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et également utile comme engrais pour accélérer la croissance de nombreuses plantes. -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Notez que toutes les plantes ne peuvent pas être fertilisées comme ça. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent partout. -Cocoa beans are a brown dye and can be used to plant cocoas.=Les fèves de cacao ont une teinture brune et peuvent être utilisées pour planter du cacao. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Faites un clic droit sur un mouton pour brunir sa laine. Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacao. -Cocoa Beans=Fèves de Cacao -Grows at the side of jungle trees=Pousse à côté des arbres de la jungle -Speeds up plant growth=Accélère la croissance des plantes diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr index 85e5b9605..c665b2b43 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr @@ -17,11 +17,3 @@ Magenta Dye=Karmazynowa farba Pink Dye=Różowa farba This item is a dye which is used for dyeing and crafting.=Ten przedmiot to farba wykorzystywana to farbowania i wytwarzania. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Kliknij prawym na owcę aby zafarbować jej wełnę. Inne rzeczy mogą być zafarbowane przy wytwarzaniu. -Bone Meal=Mączka kostna -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Mączka kostna to biała farba i przydatny nawóz, który przyspiesza rośnięcie wielu roślin. -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Kliknij prawym na owcę, aby wybielić jej wełnę. Kliknij prawym na roślinę aby przyspieszyć jej wzrost. Zważ, że nie na wszystkie rośliny to tak działa. Gdy klikniesz prawym na blok trawy, wysoka trawa wyrośnie wokół. -Cocoa beans are a brown dye and can be used to plant cocoas.=Ziarna kakaowe mogą być wykorzystane do sadzenia kakao. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym aby zafarbować wełnę owcy na brązowo. Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao. -Cocoa Beans=Ziarna kakaowe -Grows at the side of jungle trees=Rośnie na boku tropikalnych drzew -Speeds up plant growth=Przyspiesza wzrost roślin diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr index d595bb6a1..fa1d031c4 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr @@ -22,6 +22,3 @@ Bone meal is a white dye and also useful as a fertilizer to speed up the growth Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Кликните правой по овце, чтобы сделать её шерсть белой. Кликните правой по растению, чтобы ускорить его рост. Имейте в виду, что не все растения можно удобрять таким способом. Если вы кликнете по травяному блоку, то на этом месте вырастет высокая трава и цветы. Cocoa beans are a brown dye and can be used to plant cocoas.=Какао-бобы являются коричневым красителем. Их также можно использовать, чтобы посадить какао. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по овце, чтобы сделать её шерсть коричневой. Кликните правой по боковой части ствола тропического дерева, чтобы посадить молодое какао. -Cocoa Beans=Какао-бобы -Grows at the side of jungle trees=Растут на стволах тропических деревьев -Speeds up plant growth=Ускоряет рост растений diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr index 86dc708e2..7ea308119 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr @@ -17,9 +17,3 @@ Magenta Dye=洋紅色染料 Pink Dye=粉紅色染料 This item is a dye which is used for dyeing and crafting.=這個物品是一種用於染色和合成的染料。 Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=右鍵單擊綿羊以染它的毛。其他東西是通過合成染色的。 -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=骨粉是一種白色染料,也可作為肥料,加速許多植物的生長。 -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=右鍵點擊一隻羊,使其羊毛變白。右鍵點擊一株植物以加快其生長速度。注意,不是所有的植物都能像這樣施肥。當你右鍵點擊一個草方時,高高的草和花會到處生長。 -Cocoa beans are a brown dye and can be used to plant cocoas.=可可豆是一種棕色染料,也可用於種植可可。 -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊一隻羊,使其羊毛變成褐色。右鍵點擊叢林木的一側,可以種植一個可可。 -Grows at the side of jungle trees=在叢林木側生長 -Speeds up plant growth=加速植物生長 diff --git a/mods/ITEMS/mcl_dye/locale/template.txt b/mods/ITEMS/mcl_dye/locale/template.txt index 84bac96af..e07f6ef54 100644 --- a/mods/ITEMS/mcl_dye/locale/template.txt +++ b/mods/ITEMS/mcl_dye/locale/template.txt @@ -17,11 +17,3 @@ Magenta Dye= Pink Dye= This item is a dye which is used for dyeing and crafting.= Rightclick on a sheep to dye its wool. Other things are dyed by crafting.= -Bone Meal= -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.= -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.= -Cocoa beans are a brown dye and can be used to plant cocoas.= -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.= -Cocoa Beans= -Grows at the side of jungle trees= -Speeds up plant growth= diff --git a/mods/ITEMS/mcl_dye/mod.conf b/mods/ITEMS/mcl_dye/mod.conf index fe93278fc..f570211b2 100644 --- a/mods/ITEMS/mcl_dye/mod.conf +++ b/mods/ITEMS/mcl_dye/mod.conf @@ -1,2 +1,3 @@ name = mcl_dye -depends = mcl_core, mcl_flowers, mcl_mobitems, mcl_cocoas +description = Adds color to your world! +depends = mcl_bone_meal, mcl_cocoas diff --git a/mods/ITEMS/mcl_enchanting/enchantments.lua b/mods/ITEMS/mcl_enchanting/enchantments.lua index 44b3a5bd6..64fe2ac09 100644 --- a/mods/ITEMS/mcl_enchanting/enchantments.lua +++ b/mods/ITEMS/mcl_enchanting/enchantments.lua @@ -691,7 +691,7 @@ mcl_enchanting.enchantments.soul_speed = { disallow = {non_combat_armor = true}, incompatible = {frost_walker = true}, weight = 2, - description = S("Increases walking speed on soul sand."), + description = S("Increases walking speed on soul sand and soul soil."), curse = false, on_enchant = function() end, requires_tool = false, diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr index ecc08b5dc..d8d97a677 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr @@ -68,7 +68,7 @@ Mined blocks drop themselves.=Abgebaute Blöcke werfen sich selbst ab. Smite=Qual Increases damage to undead mobs.=Erhöht Schaden für untote Mobs. Soul Speed=Schnelle Seele -Increases walking speed on soul sand.=Erhöht Gehgeschwindigkeit auf Seelensand. +Increases walking speed on soul sand and soul soil.=Erhöht Gehgeschwindigkeit auf Seelensand. Sweeping Edge=Schwungklinge Increases sweeping attack damage.=Erhöht Schwungangriffsschaden. Thorns=Dornen diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr index a977e8fe6..2b76b8af6 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr @@ -36,7 +36,7 @@ Increases mob loot.=Incrementa el botín de los enemigos. Increases rate of good loot (enchanting books, etc.)=Incrementa la probabilidad de encontrar tesoros. Increases sweeping attack damage.=Incrementa el daño de efecto area. Increases underwater movement speed.=Incrementa la velocidad de nado bajo el agua. -Increases walking speed on soul sand.=Incrementa la velocidad al caminar sobre arena de Almas. +Increases walking speed on soul sand and soul soil.=Incrementa la velocidad al caminar sobre arena de Almas. Infinity=Infinidad Item destroyed on death.=El objeto se destruye tras tu muerte. Knockback=Empuje diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr index 23cf257da..e05a91fd7 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr @@ -36,7 +36,7 @@ Increases mob loot.=Augmente le butin des mobs. Increases rate of good loot (enchanting books, etc.)=Augmente le taux de bon butin (livres enchanteurs, etc.) Increases sweeping attack damage.=Augmente les dégâts de l'épée Increases underwater movement speed.=Augmente la vitesse de déplacement sous l'eau. -Increases walking speed on soul sand.=Augmente la vitesse de marche sur le sable des âmes. +Increases walking speed on soul sand and soul soil.=Augmente la vitesse de marche sur le sable des âmes. Infinity=Infinité Item destroyed on death.=Objet détruit à la mort. Knockback=Recul diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr index 1983ec4d4..d539c35a1 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr @@ -36,7 +36,7 @@ Increases mob loot.=MOBの戦利品が増加します。 Increases rate of good loot (enchanting books, etc.)=釣果の質が良くなります(エンチャントの本など)。 Increases sweeping attack damage.=なぎ払い攻撃のダメージが増加します。 Increases underwater movement speed.=水中での横移動速度が増加します。 -Increases walking speed on soul sand.=ソウルサンドとソウルソイルの上を歩く速度が増加します。 +Increases walking speed on soul sand and soul soil.=ソウルサンドとソウルソイルの上を歩く速度が増加します。 Infinity=無限 Item destroyed on death.=死亡時にアイテムが消滅します。 Knockback=ノックバック diff --git a/mods/ITEMS/mcl_enchanting/locale/template.txt b/mods/ITEMS/mcl_enchanting/locale/template.txt index 2a0890d91..99dca7a55 100644 --- a/mods/ITEMS/mcl_enchanting/locale/template.txt +++ b/mods/ITEMS/mcl_enchanting/locale/template.txt @@ -36,7 +36,7 @@ Increases mob loot.= Increases rate of good loot (enchanting books, etc.)= Increases sweeping attack damage.= Increases underwater movement speed.= -Increases walking speed on soul sand.= +Increases walking speed on soul sand and soul soil.= Infinity= Item destroyed on death.= Knockback= diff --git a/mods/ITEMS/mcl_end/chorus_plant.lua b/mods/ITEMS/mcl_end/chorus_plant.lua index 7f2064a3e..7e6530192 100644 --- a/mods/ITEMS/mcl_end/chorus_plant.lua +++ b/mods/ITEMS/mcl_end/chorus_plant.lua @@ -230,7 +230,7 @@ minetest.register_node("mcl_end:chorus_flower_dead", { groups = {handy=1,axey=1, deco_block = 1, dig_by_piston = 1, destroy_by_lava_flow = 1,chorus_plant = 1, not_in_creative_inventory=1}, after_dig_node = mcl_end.check_detach_chorus_plant, on_blast = mcl_end.check_blast_chorus_plant, - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 0.4, _mcl_hardness = 0.4, }) @@ -309,7 +309,7 @@ minetest.register_node("mcl_end:chorus_plant", { end, after_dig_node = mcl_end.check_detach_chorus_plant, on_blast = mcl_end.check_blast_chorus_plant, - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 0.4, _mcl_hardness = 0.4, }) diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index f32b2bf8e..66d47d461 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -13,78 +13,44 @@ minetest.register_craftitem("mcl_farming:beetroot_seeds", { end }) -minetest.register_node("mcl_farming:beetroot_0", { - description = S("Premature Beetroot Plant (Stage 1)"), - _doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."), - _doc_items_entry_name = S("Premature Beetroot Plant"), - paramtype = "light", - paramtype2 = "meshoptions", - sunlight_propagates = true, - place_param2 = 3, - walkable = false, - drawtype = "plantlike", - drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_0.png"}, - inventory_image = "mcl_farming_beetroot_0.png", - wield_image = "mcl_farming_beetroot_0.png", - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} - }, - }, - groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, - sounds = mcl_sounds.node_sound_leaves_defaults(), - _mcl_blast_resistance = 0, -}) +local size = {[0]=-5, -4, -3} -minetest.register_node("mcl_farming:beetroot_1", { - description = S("Premature Beetroot Plant (Stage 2)"), - _doc_items_create_entry = false, - paramtype = "light", - paramtype2 = "meshoptions", - sunlight_propagates = true, - place_param2 = 3, - walkable = false, - drawtype = "plantlike", - drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_1.png"}, - inventory_image = "mcl_farming_beetroot_1.png", - wield_image = "mcl_farming_beetroot_1.png", - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -4/16, 0.5} +for i = 0, 2 do + minetest.register_node("mcl_farming:beetroot_".. i, { + description = S("Premature Beetroot Plant (Stage ".. i + 1 ..")"), + _doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."), + _doc_items_entry_name = S("Premature Beetroot Plant"), + paramtype = "light", + paramtype2 = "meshoptions", + sunlight_propagates = true, + place_param2 = 3, + walkable = false, + drawtype = "plantlike", + drop = "mcl_farming:beetroot_seeds", + tiles = {"mcl_farming_beetroot_".. i ..".png"}, + inventory_image = "mcl_farming_beetroot_".. i ..".png", + wield_image = "mcl_farming_beetroot_".. i ..".png", + selection_box = { + type = "fixed", + fixed = { {-0.5, -0.5, -0.5, 0.5, size[i]/16, 0.5} }, }, - }, - groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, - sounds = mcl_sounds.node_sound_leaves_defaults(), - _mcl_blast_resistance = 0, -}) - -minetest.register_node("mcl_farming:beetroot_2", { - description = S("Premature Beetroot Plant (Stage 3)"), - _doc_items_create_entry = false, - paramtype = "light", - paramtype2 = "meshoptions", - sunlight_propagates = true, - place_param2 = 3, - walkable = false, - drawtype = "plantlike", - drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_2.png"}, - inventory_image = "mcl_farming_beetroot_2.png", - wield_image = "mcl_farming_beetroot_2.png", - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -3/16, 0.5} + groups = { + dig_immediate=3, not_in_creative_inventory=1, + plant=1, attached_node=1, dig_by_water=1, + destroy_by_lava_flow=1,dig_by_piston=1 }, - }, - groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, - sounds = mcl_sounds.node_sound_leaves_defaults(), - _mcl_blast_resistance = 0, -}) + sounds = mcl_sounds.node_sound_leaves_defaults(), + _mcl_blast_resistance = 0, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + -- 75% chance to advance to next stage + if math.random(1, 100) <= 75 then + return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true) + end + end + }) +end minetest.register_node("mcl_farming:beetroot", { description = S("Mature Beetroot Plant"), @@ -119,6 +85,7 @@ minetest.register_node("mcl_farming:beetroot", { _mcl_fortune_drop = { discrete_uniform_distribution = true, items = {"mcl_farming:beetroot_seeds"}, + drop_without_fortune = {"mcl_farming:beetroot_item"}, min_count = 1, max_count = 3, cap = 5, @@ -170,7 +137,8 @@ minetest.register_craft({ }, }) -mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 68, 3) +-- beetroots grow at 2/3rd of the default speed +mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 8.7012, 35) if minetest.get_modpath("doc") then for i = 1, 2 do diff --git a/mods/ITEMS/mcl_farming/carrots.lua b/mods/ITEMS/mcl_farming/carrots.lua index e8e295d8b..119d108af 100644 --- a/mods/ITEMS/mcl_farming/carrots.lua +++ b/mods/ITEMS/mcl_farming/carrots.lua @@ -45,6 +45,12 @@ for i=1, 7 do groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true) + end }) end @@ -118,7 +124,7 @@ minetest.register_craft({ } }) -mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 25, 20) +mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 5.8013, 35) if minetest.get_modpath("doc") then for i=2,7 do diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr index 54b356306..959585964 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Junger Kürbisstängel (@1. Stufe) Mature Pumpkin Stem=Ausgewachsener Kürbisstängel A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Ein ausgewachsener Kürbisstängel versucht, auf einem seiner vier benachbarten Blöcke einen Kürbis wachsen zu lassen. Ein Kürbis kann nur auf Ackerboden, Erde oder einem Grasblock wachsen. Wenn sich ein Kürbis neben einem Kürbisstängel befindet, verbiegt sich der Kürbisstängel und verbindet sich mit dem Kürbis. Solange der Stängel verbunden ist, kann aus ihm kein neuer Kürbis wachsen. Wenn alle Kürbisse um den Kürbisstängel entfernt wurden, verliert er die Verbindung und aus ihm kann ein weiterer Kürbis wachsen. -Faceless Pumpkin=Gesichtsloser Kürbis -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Ein gesichtsloser Kürbis ist ein dekorativer Block. Mit einer Schere kann man in ihm ein Muster schnitzen, um Kürbissamen zu erhalten. Pumpkin=Kürbis -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Einen Kürbis kann zum Spaß als Helm getragen werden, aber er bietet keinen Schutz. Kürbisse wachsen aus Kürbisstängeln, welche wiederum aus Kürbissamen wachsen. +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Ein Kürbis ist ein dekorativer Block. Mit einer Schere kann man in ihm ein Muster schnitzen, um einen Geschnitzter Kürbis und Kürbissamen zu erhalten. +Carved Pumpkin=Geschnitzter Kürbis +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Ein Geschnitzter Kürbis ist ein dekorativer Block, der kann benützt werden, um Schnee- oder Eisengolem zu beschwören, oder zum Spaß als Helm getragen werden, aber er bietet keinen Schutz. Man erhaltet diesen Block, indem man einen Kürbis schnitzt. Jack o'Lantern=Kürbislaterne A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Eine Kürbislaterne ist eine traditionelle Dekoration für Halloween. Sie leuchtet hell. Pumpkin Pie=Kürbiskuchen @@ -89,7 +89,7 @@ Cookie=Keks Bread=Brot Hay Bale=Heuballen Hay bales are decorative blocks made from wheat.=Heuballen sind dekorative Blöcke, die aus Weizen gemacht sind. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Um ein Gesicht in den Kürbis zu schnitzen, benutzen Sie die Schere an der Seite, die Sie schnitzen wollen. +To carve a pumpkin, use the shears on the side you want the face to appear.=Um ein Gesicht in den Kürbis zu schnitzen, benutzen Sie die Schere an der Seite, die Sie schnitzen wollen. Use the “Place” key on an animal to try to feed it wheat.=Benutzen Sie die „Platzieren“-Taste auf einem Tier, um zu versuchen, es zu füttern. Grows on farmland=Wächst auf Ackerboden Turns block into farmland=Macht Block zu Ackerboden diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr index 8366e8252..40d9deb1f 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Tallo de calabaza prematuro (Etapa @1) Mature Pumpkin Stem=Tallo maduro de calabaza A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Un tallo maduro de calabaza intenta cultivar una calabaza en uno de sus cuatro bloques adyacentes. Una calabaza solo puede crecer sobre tierras de cultivo, tierra o un bloque de hierba. Cuando una calabaza está al lado de un tallo de calabaza, el tallo de la calabaza se dobla inmediatamente y se conecta a la calabaza. Un tallo de calabaza conectado no puede cultivar otra calabaza. Tan pronto como se hayan eliminado todas las calabazas alrededor del tallo, pierde la conexión y está lista para cultivar otra calabaza. -Faceless Pumpkin=Calabaza sin rostro -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Una calabaza sin rostro es un bloque decorativo. Se puede tallar con tijeras para obtener semillas de calabaza. -Pumpkin=Calabaza -A pumpkin can be worn as a helmet for fun, but it doesn't offer any protection. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Una calabaza se puede usar como casco por diversión, pero no ofrece ninguna protección. Las calabazas crecen de tallos de calabaza, que a su vez crecen de semillas de calabaza. +Pumpkin=Calabaza sin rostro +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Una calabaza sin rostro es un bloque decorativo. Se puede tallar con tijeras para obtener semillas de calabaza. +Carved Pumpkin=Calabaza +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Una calabaza se puede usar como casco por diversión, pero no ofrece ninguna protección. Las calabazas crecen de tallos de calabaza, que a su vez crecen de semillas de calabaza. Jack o'Lantern=Calabaza de Halloween A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=La calabaza de Halloween es una decoración tradicional de Halloween hecha de una calabaza. Brilla intensamente. Pumpkin Pie=Tarta de calabaza @@ -89,5 +89,5 @@ Cookie=Galleta Bread=Pan Hay Bale=Fardo de heno Hay bales are decorative blocks made from wheat.=Las balas de heno son bloques decorativos hechos de trigo. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Para tallar una cara en la calabaza, use las tijeras en el lado que desea tallar. +To carve a pumpkin, use the shears on the side you want the face to appear.=Para tallar una cara en la calabaza, use las tijeras en el lado que desea tallar. Use the “Place” key on an animal to try to feed it wheat.=Use la tecla "Colocar" en un animal para tratar de alimentarlo con trigo. diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr index f7746b6ad..dd6170d98 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Tige de citrouille prématurée (étape @1) Mature Pumpkin Stem=Tige de citrouille mature A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Une tige de citrouille mature tente de faire pousser une citrouille dans l'un de ses quatre blocs adjacents. Une citrouille ne peut pousser que sur des terres agricoles, de la terre ou un bloc d'herbe. Lorsqu'une citrouille est à côté d'une tige de citrouille, la tige de citrouille se plie immédiatement et se connecte à la citrouille. Une tige de citrouille connectée ne peut pas faire pousser une autre citrouille. Dès que toutes les citrouilles autour de la tige ont été retirées, elle perd la connexion et est prête à faire pousser une autre citrouille. -Faceless Pumpkin=Citrouille sans visage -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Une citrouille sans visage est un bloc décoratif. Il peut être sculpté avec une cisaille pour obtenir des graines de citrouille. -Pumpkin=Citrouille -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Une citrouille peut être portée comme un casque. Les citrouilles poussent à partir de tiges de citrouille, qui à leur tour poussent à partir de graines de citrouille. +Pumpkin=Citrouille sans visage +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Une citrouille sans visage est un bloc décoratif. Il peut être sculpté avec une cisaille pour obtenir des graines de citrouille. +Carved Pumpkin=Citrouille +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Une citrouille peut être portée comme un casque. Les citrouilles poussent à partir de tiges de citrouille, qui à leur tour poussent à partir de graines de citrouille. Jack o'Lantern=Citrouille-lanterne A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Une citrouille-lanterne est une décoration traditionnelle d'Halloween à base de citrouille. Elle brille de mille feux. Pumpkin Pie=Tarte à la citrouille @@ -93,10 +93,10 @@ Cookie=Cookie Bread=Pain Hay Bale=Balle de foin Hay bales are decorative blocks made from wheat.=Les balles de foin sont des blocs décoratifs en blé. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Pour sculpter un visage dans la citrouille, utilisez les cisailles du côté que vous souhaitez sculpter. +To carve a pumpkin, use the shears on the side you want the face to appear.=Pour sculpter un visage dans la citrouille, utilisez les cisailles du côté que vous souhaitez sculpter. Use the “Place” key on an animal to try to feed it wheat.=Utilisez la touche "Placer" sur un animal pour essayer de le nourrir de blé. Grows on farmland=Pousse sur les terres agricoles -Turns block into farmland=Transforme un bloc en terre agricole +Turns block into farmland=Transforme un bloc en terres agricoles 60% chance of poisoning=60% de chances d'empoisonnement Surface for crops=Surface pour les cultures Can become wet=Peut devenir humide diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr index d50c49911..78b0334a7 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=未成熟なカボチャの茎(@1段階目) Mature Pumpkin Stem=成熟したカボチャの茎 A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=成熟したカボチャの茎は、隣接する4つのブロックのいずれかでカボチャを実らせようとします。実るのは、耕地、土、草原の上だけです。カボチャの茎の隣にカボチャがあると、茎はすぐに曲がってカボチャにつながります。つながっている間は、他のカボチャを実らせられません。茎の周りのカボチャをすべて取り除くと、接続が切れて次のカボチャが実るようになります。 -Faceless Pumpkin=顔のないカボチャ -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=顔のないカボチャは装飾ブロックです。これをハサミで彫ると、カボチャの種が得られます。 -Pumpkin=カボチャ -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=カボチャは、カボチャの種から育つ茎を経て実ります。ハサミで彫るとヘルメットとして被る事もできます。 +Pumpkin=顔のないカボチャ +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=顔のないカボチャは装飾ブロックです。これをハサミで彫ると、カボチャの種が得られます。 +Carved Pumpkin=カボチャ +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=カボチャは、カボチャの種から育つ茎を経て実ります。ハサミで彫るとヘルメットとして被る事もできます。 Jack o'Lantern=ジャック・オー・ランタン A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=ジャック・オー・ランタンとは、カボチャから作られるハロウィンの伝統的な飾りです。明るく光ります。 Pumpkin Pie=パンプキンパイ @@ -89,7 +89,7 @@ Cookie=クッキー Bread=パン Hay Bale=干草の俵 Hay bales are decorative blocks made from wheat.=干草の俵とは、小麦から作られた装飾ブロックのことです。 -To carve a face into the pumpkin, use the shears on the side you want to carve.=カボチャに顔を彫るには、彫りたい方の面にハサミを使います。 +To carve a pumpkin, use the shears on the side you want the face to appear.=カボチャに顔を彫るには、彫りたい方の面にハサミを使います。 Use the “Place” key on an animal to try to feed it wheat.=動物に「配置」キーを使って、小麦を与えてみましょう。 Grows on farmland=耕地に生育 Turns block into farmland=ブロックを耕地にする diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr index 3f8d0fc6c..3461a2d8f 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Niedojrzała łodyga dyni (etap @1) Mature Pumpkin Stem=Dojrzała łodyga dyni A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Dojrzała łodyga dyni próbuje postawić dynię na jednym z czterech sąsiadujących bloków. Dynia może wyrosnąć tylko na polu uprawnym, ziemi lub bloku trawy. Gdy dynia jest obok łodygi dyni, ugina się ona i łączy z dynią. Z połączonej łodygi dyni nie może wyrosnąć kolejna dynia. Jak tylko wszystkie pobliskie dynie są usunięte, traci ona połączenie i może z niej wyrosnąć następna dynia. -Faceless Pumpkin=Dynia bez twarzy -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Dynia bez twarzy jest blokiem dekoracyjnym. Może być pokrojona nożycami aby otrzymać nasiona dyni. Pumpkin=Dynia -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Dynia może być noszona jak hełm. Dynie rosną z łodygi dyni, która z kolei rośnie z nasion dyni. +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Dynia jest blokiem dekoracyjnym. Może być pokrojona nożycami aby otrzymać wydrążoną dynię i nasiona dyni. +Carved Pumpkin=Wydrążona dynia +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Wydrążona dynia jest blokiem dekoracyjnym, który może być użyty do przywołania śnieżnych i żelaznych golemów. Może być też noszona jak hełm. Jest otrzymywana poprzez wydrążenie zwykłej dyni nożycami. Jack o'Lantern=Świecąca dynia A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Świecąca dynia jest tradycyjną dekoracją Halloween wykonaną z dyni, która jasno świeci. Pumpkin Pie=Ciasto z dyni @@ -90,7 +90,7 @@ Cookie=Ciastko Bread=Chleb Hay Bale=Bela siana Hay bales are decorative blocks made from wheat.=Bele siana są blokami dekoracyjnymi wytwarzanymi ze zboża. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Aby wyrzeźbić twarz w dyni, użyj nożyc na boku w którym chcesz wyrzeźbić. +To carve a pumpkin, use the shears on the side you want the face to appear.=Aby wyrzeźbić twarz w dyni, użyj nożyc na boku w którym chcesz wyrzeźbić. Use the “Place” key on an animal to try to feed it wheat.=Użyj przycisku "Umieść" na zwierzęciu, aby spróbować je nakarmić. Grows on farmland=Rośnie na polu uprawnym Turns block into farmland=Zamienia blok w pole uprawne diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr index 467761f0e..3ec6644b8 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Молодой стебель тыквы (стадия @1) Mature Pumpkin Stem=Созревший тыквенный стебель A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Зрелый стебель тыквы пытается вырастить тыкву на одном из четырех соседних блоков. Тыква может расти только на грядках, грязи или на травяном блоке. Когда тыква находится рядом со стеблем, он сразу же изгибается и соединяется с ней. При этом стебель не может выращивать другую тыкву. И только когда все тыквы вокруг стебля убраны, он будет готов вырастить другую тыкву. -Faceless Pumpkin=Тыква -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Тыква это декоративный блок. Её можно разрезать ножницами для получения семян тыквы. -Pumpkin=Вырезанная тыква -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Вырезанную тыкву можно носить как шлем. Тыквы растут из тыквенных стеблей, которые растут из семян тыквы. +Pumpkin=Тыква +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Тыква это декоративный блок. Её можно разрезать ножницами для получения семян тыквы. +Carved Pumpkin=Вырезанная тыква +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Вырезанную тыкву можно носить как шлем. Тыквы растут из тыквенных стеблей, которые растут из семян тыквы. Jack o'Lantern=Светильник Джека A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Светильник Джека это традиционное украшение на Хеллоуин, изготавливаемое из тыквы. Он ярко светит. Pumpkin Pie=Тыквенный пирог @@ -93,7 +93,7 @@ Cookie=Печенье Bread=Хлеб Hay Bale=Сноп сена Hay bales are decorative blocks made from wheat.=Сноп сена - декоративный блок сделанный из пшеницы. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Чтобы вырезать лицо на тыкве примените ножницы к выбранной стороне тыквы. +To carve a pumpkin, use the shears on the side you want the face to appear.=Чтобы вырезать лицо на тыкве примените ножницы к выбранной стороне тыквы. Use the “Place” key on an animal to try to feed it wheat.=Нажмите клавишу [Использовать] на животном, чтобы попытаться покормить его пшеницей. Grows on farmland=Прорастает на грядке Turns block into farmland=Делает из блока грядку diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr index 7017f7852..f8e79f98b 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=成長中的南瓜莖(第@1階段) Mature Pumpkin Stem=成熟的南瓜莖 A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=一個成熟的南瓜莖試圖在其四個相鄰的區塊之一長出一個南瓜。南瓜只能生長在農田、泥土或草塊的上面。當南瓜挨著南瓜莖時,南瓜莖會立即彎曲並連接到該南瓜上。連接的南瓜莖不能再長出另一個南瓜。只要南瓜莖周圍的所有南瓜都被移走,它就失去了連接,可以再長出一個南瓜。 -Faceless Pumpkin=南瓜 -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=南瓜是一種裝飾方塊。它可以用剪刀進行雕刻,以獲得南瓜種子。 -Pumpkin=雕刻過的南瓜 -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=南瓜可以作為頭盔佩戴。南瓜由南瓜莖生長,而南瓜莖又由南瓜種子生長。 +Pumpkin=南瓜 +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=南瓜是一種裝飾方塊。它可以用剪刀進行雕刻,以獲得南瓜種子。 +Carved Pumpkin=雕刻過的南瓜 +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=南瓜可以作為頭盔佩戴。南瓜由南瓜莖生長,而南瓜莖又由南瓜種子生長。 Jack o'Lantern=南瓜燈 A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=南瓜燈是由南瓜製成的傳統萬聖節裝飾。它發出明亮的光芒。 Pumpkin Pie=南瓜派 @@ -89,7 +89,7 @@ Cookie=餅乾 Bread=面包 Hay Bale=乾草捆 Hay bales are decorative blocks made from wheat.=乾草捆是用小麥製成的裝飾方塊。 -To carve a face into the pumpkin, use the shears on the side you want to carve.=要在南瓜上雕刻,請將剪刀放在你要雕刻的一側。 +To carve a pumpkin, use the shears on the side you want the face to appear.=要在南瓜上雕刻,請將剪刀放在你要雕刻的一側。 Use the “Place” key on an animal to try to feed it wheat.=在動物身上使用「放置」鍵以嘗試給它餵食小麥。 Grows on farmland=在農田上生長 Turns block into farmland=把方塊變成農田 diff --git a/mods/ITEMS/mcl_farming/locale/template.txt b/mods/ITEMS/mcl_farming/locale/template.txt index bc81acce1..b14d8f644 100644 --- a/mods/ITEMS/mcl_farming/locale/template.txt +++ b/mods/ITEMS/mcl_farming/locale/template.txt @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)= Mature Pumpkin Stem= A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.= -Faceless Pumpkin= -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.= Pumpkin= -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.= +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.= +Carved Pumpkin= +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.= Jack o'Lantern= A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.= Pumpkin Pie= @@ -93,7 +93,7 @@ Cookie= Bread= Hay Bale= Hay bales are decorative blocks made from wheat.= -To carve a face into the pumpkin, use the shears on the side you want to carve.= +To carve a pumpkin, use the shears on the side you want the face to appear.= Use the “Place” key on an animal to try to feed it wheat.= Grows on farmland= Turns block into farmland= diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index d62288333..2dcaaf835 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -109,6 +109,12 @@ for s=1,7 do groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true) + end }) end @@ -123,10 +129,10 @@ local stem_def = { } -- Register stem growth -mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 30, 5) +mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 5.8014, 35) -- Register actual melon, connected stems and stem-to-melon growth -mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 25, 15, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127") +mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 5.8015, 35, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127") -- Items and crafting minetest.register_craftitem("mcl_farming:melon_item", { diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index 66c5169c4..eae52abcd 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -49,6 +49,12 @@ for i=1, 7 do groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_potato", pos, n, stages, true) + end }) end @@ -135,7 +141,7 @@ minetest.register_craft({ cooktime = 10, }) -mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 19.75, 20) +mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 5.8016, 35) minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index fe437f5cf..998a82c18 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -79,6 +79,12 @@ for s=1,7 do groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true) + end }) end @@ -93,9 +99,9 @@ local stem_def = { -- Template for pumpkin local pumpkin_base_def = { - description = S("Faceless Pumpkin"), - _doc_items_longdesc = S("A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds."), - _doc_items_usagehelp = S("To carve a face into the pumpkin, use the shears on the side you want to carve."), + description = S("Pumpkin"), + _doc_items_longdesc = S("A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds."), + _doc_items_usagehelp = S("To carve a pumpkin, use the shears on the side you want the face to appear."), stack_max = 64, paramtype2 = "facedir", tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"}, @@ -110,8 +116,8 @@ local pumpkin_base_def = { } local pumpkin_face_base_def = table.copy(pumpkin_base_def) -pumpkin_face_base_def.description = S("Pumpkin") -pumpkin_face_base_def._doc_items_longdesc = S("A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.") +pumpkin_face_base_def.description = S("Carved Pumpkin") +pumpkin_face_base_def._doc_items_longdesc = S("A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.") pumpkin_face_base_def._doc_items_usagehelp = nil pumpkin_face_base_def.tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"} pumpkin_face_base_def.groups.armor=1 @@ -180,10 +186,10 @@ if minetest.get_modpath("mcl_armor") then end -- Register stem growth -mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5) +mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 5.8017, 35) -- Register actual pumpkin, connected stems and stem-to-pumpkin growth -mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") +mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 5.8018, 35, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") -- Steal function to properly disconnect a carved pumpkin pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index f597e786a..2cf5514a2 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -1,81 +1,105 @@ +-- Possible future improvements: +-- * rewrite to use node timers instead of ABMs, but needs benchmarking +-- * redesign the catch-up logic +-- * switch to exponentially-weighted moving average for light instead using a single variable to conserve IO +-- local math = math -local tostring = tostring - -mcl_farming.plant_lists = {} +local vector = vector +local random = math.random +local floor = math.floor local plant_lists = {} +mcl_farming.plant_lists = plant_lists -- export +local plant_nodename_to_id = {} -- map nodes to plants +local plant_step_from_name = {} -- map nodes to growth steps -local plant_nodename_to_id_list = {} +local growth_factor = tonumber(minetest.settings:get("vl_plant_growth")) or 1.0 -local function get_intervals_counter(pos, interval, chance) - local meta = minetest.get_meta(pos) - local time_speed = tonumber(minetest.settings:get("time_speed") or 72) - local current_game_time - if time_speed == nil then - return 1 +-- wetness of the surroundings +-- dry farmland = 1 point +-- wet farmland = 3 points +-- center point gives + 1 point, so 2 resp. 4 +-- neighbors only 25% +local function get_moisture_level(pos) + local n = vector.offset(pos, 0, -1, 0) + local totalm = 1 + for z = -1,1 do + n.z = pos.z + z + for x = -1,1 do + n.x = pos.x + x + local ndef = minetest.registered_nodes[minetest.get_node(n).name] + local soil = ndef and ndef.groups.soil + if soil and soil >= 2 then + local m = soil > 2 and 3 or 1 + -- corners have less weight + if x ~= 0 or z ~= 0 then m = m * 0.25 end + totalm = totalm + m + end + end end - if (time_speed < 0.1) then - return 1 - end - local time_multiplier = 86400 / time_speed - current_game_time = .0 + ((minetest.get_day_count() + minetest.get_timeofday()) * time_multiplier) - - local approx_interval = math.max(interval, 1) * math.max(chance, 1) - - local last_game_time = meta:get_string("last_gametime") - if last_game_time then - last_game_time = tonumber(last_game_time) - end - if not last_game_time or last_game_time < 1 then - last_game_time = current_game_time - approx_interval / 10 - elseif last_game_time == current_game_time then - current_game_time = current_game_time + approx_interval - end - - local elapsed_game_time = .0 + current_game_time - last_game_time - - meta:set_string("last_gametime", tostring(current_game_time)) - - return elapsed_game_time / approx_interval + return totalm end -local function get_avg_light_level(pos) - local node_light = tonumber(minetest.get_node_light(pos) or 0) - local meta = minetest.get_meta(pos) - local counter = meta:get_int("avg_light_count") - local summary = meta:get_int("avg_light_summary") - if counter > 99 then - counter = 51 - summary = math.ceil((summary + 0.0) / 2.0) - else - counter = counter + 1 +-- moisture penalty function: +-- 0.5 if both on the x axis and the z axis at least one of the same plants grows +-- 0.5 if at least one diagonal neighbor is the same +-- 1.0 otherwise +-- we cannot use the names directly, because growth is encoded in the names +local function get_same_crop_penalty(pos) + local name = minetest.get_node(pos).name + local plant = plant_nodename_to_id[name] + if not plant then return 1 end + local n = vector.copy(pos) + -- check adjacent positions, avoid vector allocations and reduce node accesses + n.x = pos.x - 1 + local dx = plant_nodename_to_id[minetest.get_node(n).name] == plant + n.x = pos.x + 1 + dx = dx or plant_nodename_to_id[minetest.get_node(n).name] == plant + if dx then -- no need to check z otherwise + n.x = pos.x + n.z = pos.z - 1 + local dz = plant_nodename_to_id[minetest.get_node(n).name] == plant + n.z = pos.z + 1 + dz = dz or plant_nodename_to_id[minetest.get_node(n).name] == plant + if dz then return 0.5 end end - summary = summary + node_light - meta:set_int("avg_light_count", counter) - meta:set_int("avg_light_summary", summary) - return math.ceil((summary + 0.0) / counter) + -- check diagonals, clockwise + n.x, n.z = pos.x - 1, pos.z - 1 + if plant_nodename_to_id[minetest.get_node(n).name] == plant then return 0.5 end + n.x = pos.x + 1 + if plant_nodename_to_id[minetest.get_node(n).name] == plant then return 0.5 end + n.z = pos.z + 1 + if plant_nodename_to_id[minetest.get_node(n).name] == plant then return 0.5 end + n.x = pos.x - 1 + if plant_nodename_to_id[minetest.get_node(n).name] == plant then return 0.5 end + return 1 end function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) - mcl_farming.plant_lists[identifier] = {} - mcl_farming.plant_lists[identifier].full_grown = full_grown - mcl_farming.plant_lists[identifier].names = names - mcl_farming.plant_lists[identifier].interval = interval - mcl_farming.plant_lists[identifier].chance = chance - plant_lists = mcl_farming.plant_lists --provide local copy of plant lists (performances) + interval = growth_factor > 0 and (interval / growth_factor) or 0 + local plant_info = {} + plant_info.full_grown = full_grown + plant_info.names = names + plant_info.interval = interval + plant_info.chance = chance + plant_nodename_to_id[full_grown] = identifier + for _, nodename in pairs(names) do + plant_nodename_to_id[nodename] = identifier + end + for i, name in ipairs(names) do + plant_step_from_name[name] = i + end + plant_lists[identifier] = plant_info + if interval == 0 then return end -- growth disabled minetest.register_abm({ label = string.format("Farming plant growth (%s)", identifier), nodenames = names, interval = interval, chance = chance, action = function(pos, node) - local low_speed = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }).name ~= "mcl_farming:soil_wet" - mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed) + mcl_farming:grow_plant(identifier, pos, node, 1, false) end, }) - for _, nodename in pairs(names) do - plant_nodename_to_id_list[nodename] = identifier - end end -- Attempts to advance a plant at pos by one or more growth stages (if possible) @@ -83,71 +107,36 @@ end -- pos: Position -- node: Node table -- stages: Number of stages to advance (optional, defaults to 1) --- ignore_light: if true, ignore light requirements for growing - +-- ignore_light_water: if true, ignore light and water requirements for growing -- Returns true if plant has been grown by 1 or more stages. -- Returns false if nothing changed. -function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light, low_speed) - local average_light_level = get_avg_light_level(pos) +function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_water) + -- number of missed interval ticks, for catch-up in block loading local plant_info = plant_lists[identifier] - local intervals_counter = get_intervals_counter(pos, plant_info.interval, plant_info.chance) - local low_speed = low_speed or false - if low_speed then - if intervals_counter < 1.01 and math.random(0, 9) > 0 then - return - else - intervals_counter = intervals_counter / 10 - end - end - if not minetest.get_node_light(pos) and not ignore_light and intervals_counter < 1.5 then - return false - end - if minetest.get_node_light(pos) < 10 and not ignore_light and intervals_counter < 1.5 then - return false - end - - if intervals_counter >= 1.5 then - if average_light_level < 0.1 then - return false - end - if average_light_level < 10 then - intervals_counter = intervals_counter * average_light_level / 10 + if not plant_info then return end + if not ignore_light_water then + if (minetest.get_node_light(pos, 0.5) or 0) < 0 then return false end -- day light + local odds = floor(25 / (get_moisture_level(pos) * get_same_crop_penalty(pos))) + 1 + for i = 1,stages do + -- compared to info from the MC wiki, our ABM runs a third as often, hence we use triple the chance + if random() * odds >= 3 then stages = stages - 1 end end end - local step = nil - - for i, name in ipairs(plant_info.names) do - if name == node.name then - step = i - break - end - end - if step == nil then - return false - end - if not stages then - stages = 1 - end - stages = stages + math.ceil(intervals_counter) - local new_node = { name = plant_info.names[step + stages] } - if new_node.name == nil then - new_node.name = plant_info.full_grown - end - new_node.param = node.param - new_node.param2 = node.param2 - minetest.set_node(pos, new_node) + if stages == 0 then return false end + local step = plant_step_from_name[node.name] + if step == nil then return false end + minetest.set_node(pos, { + name = plant_info.names[step + stages] or plant_info.full_grown, + param = node.param, + param2 = node.param2, + }) return true end function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) local pt = pointed_thing - if not pt then - return - end - if pt.type ~= "node" then - return - end + if not pt or pt.type ~= "node" then return end -- Use pointed node's on_rightclick function first, if present local node = minetest.get_node(pt.under) @@ -157,22 +146,13 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) end end - local pos = { x = pt.above.x, y = pt.above.y - 1, z = pt.above.z } - local farmland = minetest.get_node(pos) - pos = { x = pt.above.x, y = pt.above.y, z = pt.above.z } - local place_s = minetest.get_node(pos) + if minetest.get_node(pt.above).name ~= "air" then return end + local farmland = minetest.registered_nodes[minetest.get_node(vector.offset(pt.above, 0, -1, 0)).name] + if not farmland or (farmland.groups.soil or 0) < 2 then return end + minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, { pos = pt.above }, true) + minetest.add_node(pt.above, { name = plantname, param2 = minetest.registered_nodes[plantname].place_param2 }) - if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then - minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, { pos = pos }, true) - minetest.add_node(pos, { name = plantname, param2 = minetest.registered_nodes[plantname].place_param2 }) - --local intervals_counter = get_intervals_counter(pos, 1, 1) - else - return - end - - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end + if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end return itemstack end @@ -189,77 +169,38 @@ end - grow_interval: Will attempt to grow a gourd periodically at this interval in seconds - grow_chance: Chance of 1/grow_chance to grow a gourd next to the full unconnected stem after grow_interval has passed. Must be a natural number - connected_stem_texture: Texture of the connected stem -- gourd_on_construct_extra: Custom on_construct extra function for the gourd. Will be called after the stem check code ]] -function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, stem_itemstring, stem_def, stem_drop, gourd_itemstring, gourd_def, grow_interval, grow_chance, connected_stem_texture, gourd_on_construct_extra) +function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, stem_itemstring, stem_def, stem_drop, gourd_itemstring, gourd_def, grow_interval, grow_chance, connected_stem_texture) + grow_interval = growth_factor > 0 and (grow_interval / growth_factor) or 0 local connected_stem_names = { connected_stem_basename .. "_r", connected_stem_basename .. "_l", connected_stem_basename .. "_t", - connected_stem_basename .. "_b", - } - - local neighbors = { - { x = -1, y = 0, z = 0 }, - { x = 1, y = 0, z = 0 }, - { x = 0, y = 0, z = -1 }, - { x = 0, y = 0, z = 1 }, - } - - -- Connect the stem at stempos to the first neighboring gourd block. - -- No-op if not a stem or no gourd block found - local function try_connect_stem(stempos) - local stem = minetest.get_node(stempos) - if stem.name ~= full_unconnected_stem then - return false - end - for n = 1, #neighbors do - local offset = neighbors[n] - local blockpos = vector.add(stempos, offset) - local block = minetest.get_node(blockpos) - if block.name == gourd_itemstring then - if offset.x == 1 then - minetest.set_node(stempos, { name = connected_stem_names[1] }) - elseif offset.x == -1 then - minetest.set_node(stempos, { name = connected_stem_names[2] }) - elseif offset.z == 1 then - minetest.set_node(stempos, { name = connected_stem_names[3] }) - elseif offset.z == -1 then - minetest.set_node(stempos, { name = connected_stem_names[4] }) - end - return true - end - end - end + connected_stem_basename .. "_b" } -- Register gourd if not gourd_def.after_destruct then gourd_def.after_destruct = function(blockpos, oldnode) -- Disconnect any connected stems, turning them back to normal stems - for n = 1, #neighbors do - local offset = neighbors[n] - local expected_stem = connected_stem_names[n] - local stempos = vector.add(blockpos, offset) - local stem = minetest.get_node(stempos) - if stem.name == expected_stem then - minetest.add_node(stempos, { name = full_unconnected_stem }) - try_connect_stem(stempos) - end + -- four directions, but avoid using a table + -- opposite directions to above, as we go from groud to stem now! + local stempos = vector.offset(blockpos, -1, 0, 0) + if minetest.get_node(stempos).name == connected_stem_names[1] then + minetest.swap_node(stempos, { name = full_unconnected_stem }) end - end - end - if not gourd_def.on_construct then - function gourd_def.on_construct(blockpos) - -- Connect all unconnected stems at full size - for n = 1, #neighbors do - local stempos = vector.add(blockpos, neighbors[n]) - try_connect_stem(stempos) + local stempos = vector.offset(blockpos, 1, 0, 0) + if minetest.get_node(stempos).name == connected_stem_names[2] then + minetest.swap_node(stempos, { name = full_unconnected_stem }) end - -- Call custom on_construct - if gourd_on_construct_extra then - gourd_on_construct_extra(blockpos) + local stempos = vector.offset(blockpos, 0, 0, -1) + if minetest.get_node(stempos).name == connected_stem_names[3] then + minetest.swap_node(stempos, { name = full_unconnected_stem }) + end + local stempos = vector.offset(blockpos, 0, 0, 1) + if minetest.get_node(stempos).name == connected_stem_names[4] then + minetest.swap_node(stempos, { name = full_unconnected_stem }) end end end @@ -269,72 +210,47 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s -- Default values for the stem definition if not stem_def.selection_box then - stem_def.selection_box = { - type = "fixed", - fixed = { - { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 } - }, - } - end - if not stem_def.paramtype then - stem_def.paramtype = "light" - end - if not stem_def.drawtype then - stem_def.drawtype = "plantlike" - end - if stem_def.walkable == nil then - stem_def.walkable = false - end - if stem_def.sunlight_propagates == nil then - stem_def.sunlight_propagates = true - end - if stem_def.drop == nil then - stem_def.drop = stem_drop - end - if stem_def.groups == nil then - stem_def.groups = { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1, } - end - if stem_def.sounds == nil then - stem_def.sounds = mcl_sounds.node_sound_leaves_defaults() - end - - if not stem_def.on_construct then - function stem_def.on_construct(stempos) - -- Connect stem to gourd (if possible) - try_connect_stem(stempos) - end + stem_def.selection_box = { type = "fixed", fixed = { { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 } } } end + stem_def.paramtype = stem_def.paramtype or "light" + stem_def.drawtype = stem_def.drawtype or "plantlike" + stem_def.walkable = stem_def.walkable or false + stem_def.sunlight_propagates = stem_def.sunlight_propagates == nil or stem_def.sunlight_propagates + stem_def.drop = stem_def.drop or stem_drop + stem_def.groups = stem_def.groups or { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1 } + stem_def.sounds = stem_def.sounds or mcl_sounds.node_sound_leaves_defaults() minetest.register_node(stem_itemstring, stem_def) + plant_nodename_to_id[stem_itemstring] = stem_itemstring -- Register connected stems local connected_stem_tiles = { - { "blank.png", --top + { "blank.png", -- top "blank.png", -- bottom "blank.png", -- right "blank.png", -- left connected_stem_texture, -- back - connected_stem_texture .. "^[transformFX" --front + connected_stem_texture .. "^[transformFX" -- front }, - { "blank.png", --top + { "blank.png", -- top "blank.png", -- bottom "blank.png", -- right "blank.png", -- left - connected_stem_texture .. "^[transformFX", --back + connected_stem_texture .. "^[transformFX", -- back connected_stem_texture, -- front }, - { "blank.png", --top + { "blank.png", -- top "blank.png", -- bottom connected_stem_texture .. "^[transformFX", -- right connected_stem_texture, -- left - "blank.png", --back + "blank.png", -- back "blank.png", -- front }, - { "blank.png", --top + { "blank.png", -- top "blank.png", -- bottom connected_stem_texture, -- right connected_stem_texture .. "^[transformFX", -- left - "blank.png", --back + "blank.png", -- back "blank.png", -- front } } @@ -359,26 +275,22 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s walkable = false, drop = stem_drop, drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = connected_stem_nodebox[i] - }, - selection_box = { - type = "fixed", - fixed = connected_stem_selectionbox[i] - }, + node_box = { type = "fixed", fixed = connected_stem_nodebox[i] }, + selection_box = { type = "fixed", fixed = connected_stem_selectionbox[i] }, tiles = connected_stem_tiles[i], use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, - groups = { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1, }, + groups = { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1 }, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, }) + plant_nodename_to_id[connected_stem_names[i]] = stem_itemstring if minetest.get_modpath("doc") then doc.add_entry_alias("nodes", full_unconnected_stem, "nodes", connected_stem_names[i]) end end + if grow_interval == 0 then return end minetest.register_abm({ label = "Grow gourd stem to gourd (" .. full_unconnected_stem .. " → " .. gourd_itemstring .. ")", nodenames = { full_unconnected_stem }, @@ -386,67 +298,37 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s interval = grow_interval, chance = grow_chance, action = function(stempos) - local light = minetest.get_node_light(stempos) - if light and light > 10 then - -- Check the four neighbors and filter out neighbors where gourds can't grow - local neighbors = { - { x = -1, y = 0, z = 0 }, - { x = 1, y = 0, z = 0 }, - { x = 0, y = 0, z = -1 }, - { x = 0, y = 0, z = 1 }, - } - local floorpos, floor - for n = #neighbors, 1, -1 do - local offset = neighbors[n] - local blockpos = vector.add(stempos, offset) - floorpos = vector.offset (blockpos, 0, -1,0) -- replaces { x = blockpos.x, y = blockpos.y - 1, z = blockpos.z } - floor = minetest.get_node(floorpos) - local block = minetest.get_node(blockpos) - local soilgroup = minetest.get_item_group(floor.name, "soil") - if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name == "mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then - table.remove(neighbors, n) - end - end + local light = minetest.get_node_light(stempos, 0.5) + if not light or light < 9 then return end + -- Pick one neighbor and check if it can be used to grow + local dir = random(1, 4) -- pick direction at random + local neighbor = (dir == 1 and vector.offset(stempos, 1, 0, 0)) + or (dir == 2 and vector.offset(stempos, -1, 0, 0)) + or (dir == 3 and vector.offset(stempos, 0, 0, 1)) + or vector.offset(stempos, 0, 0, -1) + if minetest.get_node(neighbor).name ~= "air" then return end -- occupied + -- check for suitable floor -- in contrast to MC, we think everything solid is fine + local floorpos = vector.offset(neighbor, 0, -1, 0) + local floorname = minetest.get_node(floorpos).name + local floordef = minetest.registered_nodes[floorname] + if not floordef or not floordef.walkable then return end - -- Gourd needs at least 1 free neighbor to grow - if #neighbors > 0 then - -- From the remaining neighbors, grow randomly - local r = math.random(1, #neighbors) - local offset = neighbors[r] - local blockpos = vector.add(stempos, offset) - local p2 - if offset.x == 1 then - minetest.set_node(stempos, { name = connected_stem_names[1] }) - p2 = 3 - elseif offset.x == -1 then - minetest.set_node(stempos, { name = connected_stem_names[2] }) - p2 = 1 - elseif offset.z == 1 then - minetest.set_node(stempos, { name = connected_stem_names[3] }) - p2 = 2 - elseif offset.z == -1 then - minetest.set_node(stempos, { name = connected_stem_names[4] }) - p2 = 0 - end - -- Place the gourd - if gourd_def.paramtype2 == "facedir" then - minetest.add_node(blockpos, { name = gourd_itemstring, param2 = p2 }) - else - minetest.add_node(blockpos, { name = gourd_itemstring }) - end + -- check moisture level + local odds = floor(25 / (get_moisture_level(stempos) * get_same_crop_penalty(stempos))) + 1 + -- we triple the odds, and rather call the ABM less often + if random() * odds >= 3 then return end - -- Reset farmland, etc. to dirt when the gourd grows on top + minetest.swap_node(stempos, { name = connected_stem_names[dir] }) + if gourd_def.paramtype2 == "facedir" then + local p2 = (dir == 1 and 3) or (dir == 2 and 1) or (dir == 3 and 2) or 0 + minetest.add_node(neighbor, { name = gourd_itemstring, param2 = p2 }) + else + minetest.add_node(neighbor, { name = gourd_itemstring }) + end - -- FIXED: The following 2 lines were missing, and wasn't being set (outside of the above loop that - -- finds the neighbors.) - -- FYI - don't factor this out thinking that the loop above is setting the positions correctly. - floorpos = vector.offset (blockpos, 0, -1,0) -- replaces { x = blockpos.x, y = blockpos.y - 1, z = blockpos.z } - floor = minetest.get_node(floorpos) - -- END OF FIX ------------------------------------- - if minetest.get_item_group(floor.name, "dirtifies_below_solid") == 1 then - minetest.set_node(floorpos, { name = "mcl_core:dirt" }) - end - end + -- Reset farmland, etc. to dirt when the gourd grows on top + if (floordef.groups.dirtifies_below_solid or 0) > 0 then + minetest.set_node(floorpos, { name = "mcl_core:dirt" }) end end, }) @@ -458,15 +340,11 @@ end -- * step: The nth growth step. Counting starts at 1 -- * step_count: The number of total growth steps function mcl_farming:stem_color(startcolor, endcolor, step, step_count) - local color = {} - local function get_component(startt, endd, step, step_count) - return math.floor(math.max(0, math.min(255, (startt + (((step - 1) / step_count) * endd))))) - end - color.r = get_component(startcolor.r, endcolor.r, step, step_count) - color.g = get_component(startcolor.g, endcolor.g, step, step_count) - color.b = get_component(startcolor.b, endcolor.b, step, step_count) - local colorstring = string.format("#%02X%02X%02X", color.r, color.g, color.b) - return colorstring + local mix = (step - 1) / (step_count - 1) + return string.format("#%02X%02X%02X", + math.max(0, math.min(255, math.round((1 - mix) * startcolor.r + mix * endcolor.r))), + math.max(0, math.min(255, math.round((1 - mix) * startcolor.g + mix * endcolor.g))), + math.max(0, math.min(255, math.round((1 - mix) * startcolor.b + mix * endcolor.b)))) end --[[Get a callback that either eats the item or plants it. @@ -475,12 +353,8 @@ Used for on_place callbacks for craft items which are seeds that can also be con ]] function mcl_farming:get_seed_or_eat_callback(plantname, hp_change) return function(itemstack, placer, pointed_thing) - local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) - if new then - return new - else - return minetest.do_item_eat(hp_change, nil, itemstack, placer, pointed_thing) - end + return mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) + or minetest.do_item_eat(hp_change, nil, itemstack, placer, pointed_thing) end end @@ -489,12 +363,22 @@ minetest.register_lbm({ name = "mcl_farming:growth", nodenames = { "group:plant" }, run_at_every_load = true, - action = function(pos, node) - local identifier = plant_nodename_to_id_list[node.name] - if not identifier then - return + action = function(pos, node, dtime_s) + local identifier = plant_nodename_to_id[node.name] + if not identifier then return end + + local plant_info = plant_lists[identifier] + if not plant_info then return end + local rolls = floor(dtime_s / plant_info.interval) + if rolls <= 0 then return end + -- simulate how often the block will be ticked + local stages = 0 + for i = 1,rolls do + if random(1, plant_info.chance) == 1 then stages = stages + 1 end + end + if stages > 0 then + mcl_farming:grow_plant(identifier, pos, node, stages, false) end - local low_speed = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }).name ~= "mcl_farming:soil_wet" - mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed) end, }) + diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua index a6721cc26..6196f5286 100644 --- a/mods/ITEMS/mcl_farming/soil.lua +++ b/mods/ITEMS/mcl_farming/soil.lua @@ -15,10 +15,6 @@ minetest.register_node("mcl_farming:soil", { {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, } }, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_int("wet", 0) - end, groups = {handy=1,shovely=1, dirtifies_below_solid=1, dirtifier=1, soil=2, soil_sapling=1, deco_block=1 }, sounds = mcl_sounds.node_sound_dirt_defaults(), _mcl_blast_resistance = 0.6, @@ -38,88 +34,63 @@ minetest.register_node("mcl_farming:soil_wet", { {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, } }, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_int("wet", 7) - end, groups = {handy=1,shovely=1, not_in_creative_inventory=1, dirtifies_below_solid=1, dirtifier=1, soil=3, soil_sapling=1 }, sounds = mcl_sounds.node_sound_dirt_defaults(), - _mcl_blast_resistance = 0.5, + _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, }) minetest.register_abm({ label = "Farmland hydration", nodenames = {"mcl_farming:soil", "mcl_farming:soil_wet"}, - interval = 15, - chance = 4, + interval = 2.73, + chance = 25, action = function(pos, node) - -- Get wetness value - local meta = minetest.get_meta(pos) - local wet = meta:get_int("wet") - if not wet then - if node.name == "mcl_farming:soil" then - wet = 0 - else - wet = 7 - end - end - -- Turn back into dirt when covered by solid node - local above_node = minetest.get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z}) - if above_node then - if minetest.get_item_group(above_node.name, "solid") ~= 0 then - node.name = "mcl_core:dirt" - minetest.set_node(pos, node) - return - end + local above_node = minetest.get_node_or_nil(vector.offset(pos, 0, 1, 0)) + if above_node and minetest.get_item_group(above_node.name, "solid") ~= 0 then + node.name = "mcl_core:dirt" + minetest.set_node(pos, node) + return end - -- Check an area of 9×2×9 around the node for nodename (9×9 on same level and 9×9 below) - local function check_surroundings(pos, nodename) - local nodes = minetest.find_nodes_in_area({x=pos.x-4,y=pos.y,z=pos.z-4}, {x=pos.x+4,y=pos.y+1,z=pos.z+4}, {nodename}) - return #nodes > 0 - end - - if check_surroundings(pos, "group:water") then - if node.name ~= "mcl_farming:soil_wet" then - -- Make it wet + -- in rain, become wet, do not decay + if mcl_weather and mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then + if node.name == "mcl_farming:soil" then node.name = "mcl_farming:soil_wet" minetest.set_node(pos, node) end - else -- No water nearby. - -- The decay branch (make farmland dry or turn back to dirt) + return + end - -- Don't decay while it's raining - if mcl_weather.rain.raining then - if mcl_weather.is_outdoor(pos) then - return - end - end - -- No decay near unloaded areas since these might include water. - if not check_surroundings(pos, "ignore") then - if wet <= 0 then - --local n_def = minetest.registered_nodes[node.name] or nil - local nn = minetest.get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z}) - if not nn or not nn.name then - return - end - local nn_def = minetest.registered_nodes[nn.name] or nil + -- Check an area of 9x2x9 around the node for nodename (9x9 on same level and 9x9 above) + -- include "ignore" to detect unloaded blocks + local nodes, counts = minetest.find_nodes_in_area(vector.offset(pos, -4, 0, -4), vector.offset(pos, 4, 1, 4), {"group:water", "ignore"}) + local ignore = counts.ignore or 0 + local has_water, fully_loaded = #nodes > ignore, ignore == 0 - if nn_def and minetest.get_item_group(nn.name, "plant") == 0 then - node.name = "mcl_core:dirt" - minetest.set_node(pos, node) - return - end - else - if wet == 7 then - node.name = "mcl_farming:soil" - minetest.swap_node(pos, node) - end - -- Slowly count down wetness - meta:set_int("wet", wet-1) - end + -- Hydrate by rain or water, do not decay + if has_water then + if node.name == "mcl_farming:soil" then + node.name = "mcl_farming:soil_wet" + minetest.set_node(pos, node) end + return + end + -- No decay near unloaded areas (ignore) since these might include water. + if not fully_loaded then return end + + -- Decay: make wet farmland dry up + if node.name == "mcl_farming:soil_wet" then + node.name = "mcl_farming:soil" + minetest.set_node(pos, node) + return + end + -- Revert to dirt if wetness is 0, and no plant above + local above = minetest.get_node_or_nil(vector.offset(pos, 0, 1, 0)) + if minetest.get_item_group(above.name, "plant") == 0 then + node.name = "mcl_core:dirt" + minetest.set_node(pos, node) end end, }) diff --git a/mods/ITEMS/mcl_farming/sweet_berry.lua b/mods/ITEMS/mcl_farming/sweet_berry.lua index fdcc460df..769e7b6cf 100644 --- a/mods/ITEMS/mcl_farming/sweet_berry.lua +++ b/mods/ITEMS/mcl_farming/sweet_berry.lua @@ -12,6 +12,25 @@ for i=0, 3 do local drop_berries = (i >= 2) local berries_to_drop = drop_berries and {i - 1, i} or nil + local on_bonemealing = nil + local function do_berry_drop(pos) + for j=1, berries_to_drop[math.random(2)] do + minetest.add_item(pos, "mcl_farming:sweet_berry") + end + minetest.swap_node(pos, {name = "mcl_farming:sweet_berry_bush_1"}) + end + if i ~= 3 then + on_bonemealing = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local node = minetest.get_node(pos) + return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, node, 0, true) + end + else + on_bonemealing = function(itemstack, placer, pointed_thing) + do_berry_drop(pointed_thing.under) + end + end + minetest.register_node(node_name, { drawtype = "plantlike", tiles = {texture}, @@ -45,6 +64,7 @@ for i=0, 3 do sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, _mcl_hardness = 0, + _on_bone_meal = on_bonemealing, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local pn = clicker:get_player_name() if clicker:is_player() and minetest.is_protected(pos, pn) then @@ -60,11 +80,13 @@ for i=0, 3 do return end - if drop_berries then - for j=1, berries_to_drop[math.random(2)] do - minetest.add_item(pos, "mcl_farming:sweet_berry") + if i >= 2 then + do_berry_drop(pos) + else + -- Use bonemeal + if mcl_bone_meal and clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then + return mcl_bone_meal.use_bone_meal(itemstack, clicker, pointed_thing) end - minetest.swap_node(pos, {name = "mcl_farming:sweet_berry_bush_1"}) end return itemstack end, @@ -99,8 +121,8 @@ minetest.register_craftitem("mcl_farming:sweet_berry", { }) minetest.register_alias("mcl_sweet_berry:sweet_berry", "mcl_farming:sweet_berry") --- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages. -mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 68, 3) +-- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages, 2/3rd of the default. +mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 8.7019, 35) local function berry_damage_check(obj) local p = obj:get_pos() diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index 676cc1301..c0013e2ce 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -60,6 +60,12 @@ for i=1,7 do dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true) + end }) end @@ -92,13 +98,14 @@ minetest.register_node("mcl_farming:wheat", { _mcl_fortune_drop = { discrete_uniform_distribution = true, items = {"mcl_farming:wheat_seeds"}, + drop_without_fortune = {"mcl_farming:wheat_item"}, min_count = 1, max_count = 6, cap = 7 } }) -mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 25, 20) +mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 5.8020, 35) minetest.register_craftitem("mcl_farming:wheat_item", { description = S("Wheat"), diff --git a/mods/ITEMS/mcl_fences/mod.conf b/mods/ITEMS/mcl_fences/mod.conf index 8b20dd169..aba4a33c3 100644 --- a/mods/ITEMS/mcl_fences/mod.conf +++ b/mods/ITEMS/mcl_fences/mod.conf @@ -1,3 +1,3 @@ name = mcl_fences -depends = mcl_core, mcl_sounds +depends = mcl_core, mcl_nether, mcl_sounds optional_depends = doc, screwdriver diff --git a/mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr b/mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr index b80c186c1..bbdc847a3 100644 --- a/mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr +++ b/mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr @@ -4,11 +4,11 @@ Fishing rods can be used to catch fish.=Mit Angeln fängt man Fische. Rightclick to launch the bobber. When it sinks right-click again to reel in an item. Who knows what you're going to catch?=Rechtsklicken, um den Schwimmer auszuwerfen. Wenn er sinkt, erneut rechtsklicken, um etwas zu fangen. Wer weiß, was Sie fangen werden? Raw Fish=Roher Fisch Raw fish is obtained by fishing and is a food item which can be eaten safely. Cooking it improves its nutritional value.=Rohen Fisch kann man mit Angeln fangen. Er ist ein Lebensmittel, den man sicher verzehren kann. Er kann gekocht werden, um seinen Nährwert zu erhöhen. -Cooked Fish=Gekochter Fisch +Cooked Fish=Gebratener Fisch Mmh, fish! This is a healthy food item.=Mhh, Fisch! Ein gesundes Lebensmittel. Raw Salmon=Roher Lachs Raw salmon is obtained by fishing and is a food item which can be eaten safely. Cooking it improves its nutritional value.=Rohen Lachs erhält man beim Angeln. Er ist ein Lebensmittel, das sicher verzehrt werden kann. -Cooked Salmon=Gekochter Lachs +Cooked Salmon=Gebratener Lachs This is a healthy food item which can be eaten.=Ein gesundes essbares Lebensmittel. Clownfish=Clownfisch Clownfish may be obtained by fishing (and luck) and is a food item which can be eaten safely.=Einen Clownfisch kann man beim Angeln mit etwas Glück fangen. Er ist ein Lebensmittel, das sicher verzehrt werden kann. diff --git a/mods/ITEMS/mcl_fletching_table/locale/mcl_fletching_table.de.tr b/mods/ITEMS/mcl_fletching_table/locale/mcl_fletching_table.de.tr new file mode 100644 index 000000000..b792fece0 --- /dev/null +++ b/mods/ITEMS/mcl_fletching_table/locale/mcl_fletching_table.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_fletching_table +Fletching Table=Bognertisch diff --git a/mods/ITEMS/mcl_flowers/bonemealing.lua b/mods/ITEMS/mcl_flowers/bonemealing.lua new file mode 100644 index 000000000..44bce6eef --- /dev/null +++ b/mods/ITEMS/mcl_flowers/bonemealing.lua @@ -0,0 +1,136 @@ +-- bonemealing grass nodes +-- +-- When bonemealing "mcl_core:dirt_with_grass", it spawns grass and flowers +-- over a 7x7 patch of adjacent grassy nodes. +-- +-- Because of potential dependency complications it is not advisable to add +-- callbacks to mcl_core that create dependencies on mods that depend on +-- mcl_core, such as mcl_flowers. +-- +-- To work around this restriction, the bonemealing callback is defined here +-- and the _on_bone_meal callback in "mcl_core:dirt_with_grass" node +-- definition is overwritten with it. + +local mg_name = minetest.get_mapgen_setting("mg_name") + +local flowers_table_simple = { + "mcl_flowers:dandelion", + "mcl_flowers:poppy", +} +local flowers_table_plains = { + "mcl_flowers:dandelion", + "mcl_flowers:dandelion", + "mcl_flowers:poppy", + "mcl_flowers:oxeye_daisy", + "mcl_flowers:tulip_orange", + "mcl_flowers:tulip_red", + "mcl_flowers:tulip_white", + "mcl_flowers:tulip_pink", + "mcl_flowers:azure_bluet", +} +local flowers_table_swampland = { + "mcl_flowers:blue_orchid", +} +local flowers_table_flower_forest = { + "mcl_flowers:dandelion", + "mcl_flowers:poppy", + "mcl_flowers:oxeye_daisy", + "mcl_flowers:tulip_orange", + "mcl_flowers:tulip_red", + "mcl_flowers:tulip_white", + "mcl_flowers:tulip_pink", + "mcl_flowers:azure_bluet", + "mcl_flowers:allium", +} + +local biome_flowers_tables = { + ["Plains"] = flowers_table_plains, + ["Plains_beach"] = flowers_table_plains, + ["Plains_ocean"] = flowers_table_plains, + ["Plains_deep_ocean"] = flowers_table_plains, + ["Plains_underground"] = flowers_table_plains, + ["SunflowerPlains"] = flowers_table_plains, + ["SunflowerPlains_ocean"] = flowers_table_plains, + ["SunflowerPlains_deep_ocean"] = flowers_table_plains, + ["SunflowerPlains_underground"] = flowers_table_plains, + ["Swampland"] = flowers_table_swampland, + ["Swampland_shore"] = flowers_table_swampland, + ["Swampland_ocean"] = flowers_table_swampland, + ["Swampland_deep_ocean"] = flowers_table_swampland, + ["Swampland_underground"] = flowers_table_swampland, + ["FlowerForest"] = flowers_table_flower_forest, + ["FlowerForest_beach"] = flowers_table_flower_forest, + ["FlowerForest_ocean"] = flowers_table_flower_forest, + ["FlowerForest_deep_ocean"] = flowers_table_flower_forest, + ["FlowerForest_underground"] = flowers_table_flower_forest, +} + +-- Randomly generate flowers, tall grass or nothing +-- pos: node to place into +-- color: param2 value for tall grass +-- +local function add_random_flower(pos, color) + -- 90% tall grass, 10% flower + local rnd = math.random(1,100) + if rnd <= 60 then + minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=color}) + elseif rnd <= 80 then + -- double tallgrass + local toppos = vector.offset(pos, 0, 1, 0) + local topnode = minetest.get_node(toppos) + if minetest.registered_nodes[topnode.name].buildable_to then + minetest.set_node(pos, { name = "mcl_flowers:double_grass", param2 = color }) + minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top", param2 = color }) + return true + end + else + local flowers_table + if mg_name == "v6" then + flowers_table = flowers_table_plains + else + local biome = minetest.get_biome_name(minetest.get_biome_data(pos).biome) + flowers_table = biome_flowers_tables[biome] or flowers_table_simple + end + minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]}) + end +end + +--- Generate tall grass and random flowers in a 7x7 area +-- Bonemealing callback handler for "mcl_core:dirt_with_grass" +-- +local function bonemeal_grass(pointed_thing, placer) + local pos, below, r, color + for i = -7, 7 do for j = -7, 7 do for y = -1, 1 do + pos = vector.offset(pointed_thing.above, i, y, j) + if minetest.get_node(pos).name == "air" then + below = minetest.get_node(vector.offset(pos, 0, -1, 0)) + r = ((math.abs(i) + math.abs(j)) / 2) + if (minetest.get_item_group(below.name, "grass_block_no_snow") == 1) and + math.random(1, 100) <= 90 / r then + color = below.param2 + add_random_flower(pos, color) + if math.random(1,5) == 1 then + mcl_bone_meal.add_bone_meal_particle(pos) + end + end + end + end end end + return true +end + +-- Override "mcl_core:dirt_with_grass" bonemealing handler. +local nodename = "mcl_core:dirt_with_grass" +local olddef = minetest.registered_nodes[nodename] +if not olddef then + minetest.log("warning", "'mcl_core:dirt_with_grass' not registered, cannot add override!") +else + local oldhandler = olddef._on_bone_meal + local newhandler = function(itemstack, placer, pointed_thing) + local res = bonemeal_grass(pointed_thing, placer) + if oldhandler then + res = oldhandler(itemstack, placer, pointed_thing) or res + end + return res + end + minetest.override_item(nodename, {_on_bone_meal = newhandler}) +end diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 85a65a165..311b7d8ce 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -162,6 +162,18 @@ local def_tallgrass = { _mcl_fortune_drop = fortune_wheat_seed_drop, node_placement_prediction = "", on_place = on_place_flower, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + -- Grow into double tallgrass + local toppos = vector.offset(pos, 0, 1, 0) + local topnode = minetest.get_node(toppos) + if minetest.registered_nodes[topnode.name].buildable_to then + minetest.set_node(pos, { name = "mcl_flowers:double_grass", param2 = n.param2 }) + minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top", param2 = n.param2 }) + return true + end + end, _mcl_blast_resistance = 0, _mcl_hardness = 0, } @@ -180,6 +192,18 @@ def_fern.selection_box = { fixed = { -6/16, -0.5, -6/16, 6/16, 5/16, 6/16 }, } def_fern.groups.compostability = 65 +def_fern._on_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + -- Grow into double fern. + local toppos = vector.offset(pos, 0, 1, 0) + local topnode = minetest.get_node(toppos) + if minetest.registered_nodes[topnode.name].buildable_to then + minetest.set_node(pos, { name = "mcl_flowers:double_fern", param2 = n.param2 }) + minetest.set_node(toppos, { name = "mcl_flowers:double_fern_top", param2 = n.param2 }) + return true + end + end minetest.register_node("mcl_flowers:fern", def_fern) @@ -243,10 +267,16 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im if name == "double_grass" then bottom_groups.compostability = 50 end + local on_bonemealing if is_flower then bottom_groups.flower = 1 bottom_groups.place_flowerlike = 1 bottom_groups.dig_immediate = 3 + on_bonemealing = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + minetest.add_item(pos, "mcl_flowers:"..name) + return true + end else bottom_groups.place_flowerlike = 2 bottom_groups.handy = 1 @@ -381,6 +411,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im minetest.remove_node(top) end end, + _on_bone_meal = on_bonemealing, groups = bottom_groups, sounds = mcl_sounds.node_sound_leaves_defaults(), mesh = mesh @@ -419,6 +450,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im minetest.remove_node(bottom) end end, + _on_bone_meal = on_bonemealing, groups = top_groups, sounds = mcl_sounds.node_sound_leaves_defaults(), }) @@ -572,3 +604,6 @@ if mod_mcimport and mg_name == "singlenode" and fix_doubleplants == true then end dofile(modpath.."/register.lua") + +-- Bonemealing handler and override for "mcl_core:dirt_with_grass": +dofile(modpath.."/bonemealing.lua") diff --git a/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr b/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr index 0e1262e3c..e59698136 100644 --- a/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr +++ b/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr @@ -15,6 +15,8 @@ Tall Grass=Hohes Gras Tall grass is a small plant which often occurs on the surface of grasslands. It can be harvested for wheat seeds. By using bone meal, tall grass can be turned into double tallgrass which is two blocks high.=Hohes Gras ist eine kleine Pflanze, die oft auf Wiesenflächen wächst. Es kann für Weizensamen abgeerntet werden. Mit Knochenmehl lässt sich hohes Gras zu doppelhohem Gras verwandeln. Fern=Farn Ferns are small plants which occur naturally in jungles and taigas. They can be harvested for wheat seeds. By using bone meal, a fern can be turned into a large fern which is two blocks high.=Farne sind kleine Pflanzen, die oft in Dschungeln und Taigas vorkommen. Sie können für Weizensamen abgeerntet werden. Mit Knochenmehl lässt sich ein Farn zu einem großen Farn, der zwei Blöcke hoch ist, verwandeln. +Clover=Kleeblatt +Four-leaf Clover=Vierblättriges Kleeblatt (Top Part)=(Oberseite) Peony=Pfingstrose A peony is a large plant which occupies two blocks. It is mainly used in dye production.=Eine Pfingstrose ist eine große Pflanze, die zwei Blöcke hoch ist. Sie wird hauptsächlich für die Farbenproduktion gebraucht. diff --git a/mods/ITEMS/mcl_flowers/locale/template.txt b/mods/ITEMS/mcl_flowers/locale/template.txt index 0d84093de..935124446 100644 --- a/mods/ITEMS/mcl_flowers/locale/template.txt +++ b/mods/ITEMS/mcl_flowers/locale/template.txt @@ -18,6 +18,9 @@ Tall Grass= Tall grass is a small plant which often occurs on the surface of grasslands. It can be harvested for wheat seeds. By using bone meal, tall grass can be turned into double tallgrass which is two blocks high.= Fern= Ferns are small plants which occur naturally in jungles and taigas. They can be harvested for wheat seeds. By using bone meal, a fern can be turned into a large fern which is two blocks high.= +Clover= +Clovers are small plants which occur naturally in plains and other temperate biomes. They can be picked up and planted again.= +Four-leaf Clover= (Top Part)= Peony= A peony is a large plant which occupies two blocks. It is mainly used in dye production.= diff --git a/mods/ITEMS/mcl_flowers/mod.conf b/mods/ITEMS/mcl_flowers/mod.conf index b309ac22e..cd67070da 100644 --- a/mods/ITEMS/mcl_flowers/mod.conf +++ b/mods/ITEMS/mcl_flowers/mod.conf @@ -1,3 +1,3 @@ name=mcl_flowers -depends=mcl_core, mcl_util, mcl_sounds -optional_depends=screwdriver, doc, mcl_flowerpots \ No newline at end of file +depends=mcl_core, mcl_util, mcl_sounds, mcl_bone_meal +optional_depends=screwdriver, doc, mcl_flowerpots diff --git a/mods/ITEMS/mcl_grindstone/locale/mcl_grindstone.de.tr b/mods/ITEMS/mcl_grindstone/locale/mcl_grindstone.de.tr new file mode 100644 index 000000000..5cadd1c6c --- /dev/null +++ b/mods/ITEMS/mcl_grindstone/locale/mcl_grindstone.de.tr @@ -0,0 +1,11 @@ +# textdomain: mcl_grindstone +Inventory= +Repair & Disenchant= +Grindstone=Schleifstein +Used to disenchant/fix tools= +Grindstone disenchants tools and armour except for curses, and repairs two items of the same type it is also the weapon smith's work station.= +To use the grindstone, rightclick it, Two input slots (on the left) and a single output slot.= +To disenchant an item place enchanted item in one of the input slots and take the disenchanted item from the output.= +To repair a tool you need a tool of the same type and material, put both items in the input slot and the output slot will combine two items durabilities with 5% bonus.= +If both items have enchantments the player will get xp from both items from the disenchant.= +Curses cannot be removed and will be transfered to the new repaired item, if both items have a different curse the curses will be combined.= diff --git a/mods/ITEMS/mcl_grindstone/mod.conf b/mods/ITEMS/mcl_grindstone/mod.conf index 66773c57f..42f792ef9 100644 --- a/mods/ITEMS/mcl_grindstone/mod.conf +++ b/mods/ITEMS/mcl_grindstone/mod.conf @@ -1,4 +1,4 @@ name = mcl_grindstone author = TheRandomLegoBrick, ChrisPHP -depends = mcl_experience, mcl_sounds +depends = mcl_experience, mcl_formspec, mcl_sounds description = Add block that disenchants tools and armour except for curses, and repairs two items of the same type it is also the weapon smith's work station. diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index 5409f21c4..373802cfa 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -21,8 +21,13 @@ mcl_heads.FLOOR_BOX = { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, } --- node definition template for floor mod heads mcl_heads.deftemplate_floor = { - drawtype = "nodebox", - node_box = { + drawtype = "mesh", + mesh = "mcl_heads_floor.obj", + selection_box = { + type = "fixed", + fixed = mcl_heads.FLOOR_BOX, + }, + collision_box = { type = "fixed", fixed = mcl_heads.FLOOR_BOX, }, @@ -38,7 +43,7 @@ mcl_heads.deftemplate_floor = { }, use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "degrotate", stack_max = 64, sunlight_propagates = true, sounds = mcl_sounds.node_sound_defaults{ @@ -53,39 +58,8 @@ mcl_heads.deftemplate_floor = { on_secondary_use = equip_armor, } -mcl_heads.deftemplate_floor_angled = { - drawtype = "mesh", - selection_box = { - type = "fixed", - fixed = mcl_heads.FLOOR_BOX, - }, - collision_box = { - type = "fixed", - fixed = mcl_heads.FLOOR_BOX, - }, - groups = { - handy = 1, - head = 1, - deco_block = 1, - dig_by_piston = 1, - not_in_creative_inventory = 1, - }, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - paramtype = "light", - paramtype2 = "facedir", - stack_max = 64, - sunlight_propagates = true, - sounds = mcl_sounds.node_sound_defaults{ - footstep = {name="default_hard_footstep", gain=0.3}, - }, - is_ground_content = false, - - _doc_items_create_entry = false, - _mcl_blast_resistance = 1, - _mcl_hardness = 1, -} - function mcl_heads.deftemplate_floor.on_rotate(pos, node, user, mode, new_param2) + if not (user and user:is_player()) then return end if mode == screwdriver.ROTATE_AXIS then node.name = node.name .. "_wall" node.param2 = minetest.dir_to_wallmounted(minetest.facedir_to_dir(node.param2)) @@ -125,19 +99,9 @@ function mcl_heads.deftemplate_floor.on_place(itemstack, placer, pointed_thing) -- place floor head node (floor and ceiling) else - local fdir = minetest.dir_to_facedir(dir) - -- determine the head node rotation based on player's yaw (in cw direction from North/Z+) - local yaw = placer:get_look_horizontal() - yaw = wdir == 1 and math.pi*2 - yaw or yaw - - local rotation_level = math.min(math.max(math.round((yaw / (math.pi*2)) * 16), 0), 15) - placestack:set_name(itemstring ..mcl_heads.FLOOR_DEGREES[rotation_level % 4]) - - -- determine the head node face direction based on rotation level - fdir = math.floor(rotation_level / 4) + (wdir == 1 and 0 or 20) - - itemstack = minetest.item_place(placestack, placer, pointed_thing, fdir) + local rotate_level = math.round(placer:get_look_horizontal() * 8/math.pi) + itemstack = minetest.item_place(placestack, placer, pointed_thing, rotate_level*15) end -- restore item from angled and wall head nodes @@ -179,6 +143,7 @@ mcl_heads.deftemplate_wall = { } function mcl_heads.deftemplate_wall.on_rotate(pos, node, user, mode, new_param2) + if not (user and user:is_player()) then return end if mode == screwdriver.ROTATE_AXIS then node.name = string.sub(node.name, 1, string.len(node.name)-5) node.param2 = minetest.dir_to_facedir(minetest.wallmounted_to_dir(node.param2)) @@ -207,33 +172,13 @@ function mcl_heads.register_head(head_def) description = head_def.description, _doc_items_longdesc = head_def.longdesc, - -- The head textures are based off the textures of an actual mob. - tiles = { - -- Note: bottom texture is overlaid over top texture to get rid of possible transparency. - -- This is required for skeleton skull and wither skeleton skull. - -- Note: -x coords go right per-pixel, -y coords go down per-pixel - "[combine:16x16:-36,4=" ..head_def.texture, -- top - "([combine:16x16:-36,4=" ..head_def.texture..")^([combine:16x16:-44,4="..head_def.texture..")", -- bottom - "[combine:16x16:-28,0=" ..head_def.texture, -- left - "[combine:16x16:-44,0=" ..head_def.texture, -- right - "[combine:16x16:-52,0=" ..head_def.texture, -- back - "[combine:16x16:-36,0=" ..head_def.texture, -- front - }, + tiles = { head_def.texture }, _mcl_armor_mob_range_mob = head_def.range_mob, _mcl_armor_mob_range_factor = head_def.range_factor, _mcl_armor_texture = head_def.texture })) - -- register the angled floor head nodes - for i, d in ipairs(mcl_heads.FLOOR_DEGREES) do - minetest.register_node(name ..d, table.update(table.copy(mcl_heads.deftemplate_floor_angled), { - mesh = "mcl_heads_floor" ..d ..".obj", - tiles = { head_def.texture }, - drop = name, - })) - end - -- register the wall head node minetest.register_node(name .."_wall", table.update(table.copy(mcl_heads.deftemplate_wall), { -- The head textures are based off the textures of an actual mob. @@ -295,3 +240,49 @@ mcl_heads.register_head{ description = S("Wither Skeleton Skull"), longdesc = S("A wither skeleton skull is a small decorative block which resembles the skull of a wither skeleton. It can also be worn as a helmet for fun, but does not offer any protection."), } + +-- Alias old creeper heads +minetest.register_alias("mcl_heads:creeper_wall", "mcl_heads:stalker_wall") +minetest.register_alias("mcl_heads:creeper", "mcl_heads:stalker") + +-- Register LBM updates for old floor heads +local old_heads_all = {"mcl_heads:zombie", "mcl_heads:creeper", "mcl_heads:stalker", "mcl_heads:steve", "mcl_heads:skeleton", "mcl_heads:wither_skeleton"} +local old_heads_angled = {} +for i=1,#old_heads_all do + for j=1,#mcl_heads.FLOOR_DEGREES do + old_heads_angled[#old_heads_angled+1] = old_heads_all[i]..mcl_heads.FLOOR_DEGREES[j] + end +end +-- add the angled heads to old_heads_all +for i=1,#old_heads_angled do + old_heads_all[#old_heads_all+1] = old_heads_angled[i] +end + +local facedir_to_degrotate = {0, 180, 120, 60} +minetest.register_lbm({ + name = "mcl_heads:heads_update_angled", + nodenames = old_heads_all, + action = function(pos, node) + local degrotate = 0 + + if node.name:sub(-4) == "22_5" then + node.name = node.name:sub(1, #node.name-4) + degrotate = ((4 - node.param2) * 90 - 22.5) / 1.5 + elseif node.name:sub(-4) == "67_5" then + node.name = node.name:sub(1, #node.name-4) + degrotate = ((4 - node.param2) * 90 - 67.5) / 1.5 + elseif node.name:sub(-2) == "45" then + node.name = node.name:sub(1, #node.name-2) + degrotate = ((4 - node.param2) * 90 - 45) / 1.5 + else + degrotate = facedir_to_degrotate[node.param2+1] + end + + if not degrotate then + return + end + + node.param2 = degrotate + minetest.set_node(pos, node) + end, +}) diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor.obj new file mode 100644 index 000000000..53bb522d4 --- /dev/null +++ b/mods/ITEMS/mcl_heads/models/mcl_heads_floor.obj @@ -0,0 +1,41 @@ +# Blender 4.2.1 LTS +# www.blender.org +mtllib mcl_head.mtl +g Cube.002_Cube.002 +v -0.250000 -0.500000 0.250000 +v -0.250000 0.000000 0.250000 +v -0.250000 -0.500000 -0.250000 +v -0.250000 -0.000000 -0.250000 +v 0.250000 -0.500000 0.250000 +v 0.250000 0.000000 0.250000 +v 0.250000 -0.500000 -0.250000 +v 0.250000 0.000000 -0.250000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 1.0000 +vn -0.0000 -1.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vt 0.875000 0.500000 +vt 0.875000 0.750000 +vt 0.750000 0.750000 +vt 0.750000 0.500000 +vt 0.625000 0.750000 +vt 0.625000 0.500000 +vt 0.500000 0.750000 +vt 0.500000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 0.750000 +vt 0.875000 1.000000 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +s 0 +g off +g Cube.002_Material.002 +usemtl Material.002 +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/4/2 4/3/2 8/5/2 7/6/2 +f 7/6/3 8/5/3 6/7/3 5/8/3 +f 5/9/4 6/10/4 2/2/4 1/1/4 +f 3/2/5 7/11/5 5/12/5 1/3/5 +f 8/5/6 4/3/6 2/12/6 6/13/6 diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj deleted file mode 100644 index 8e48015fc..000000000 --- a/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj +++ /dev/null @@ -1,42 +0,0 @@ -# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' -# www.blender.org -mtllib mcl_heads_floor22_5.mtl -o Cube.001 -v -0.326641 -0.500000 0.135299 -v -0.326641 0.000000 0.135299 -v -0.135299 -0.500000 -0.326641 -v -0.135299 0.000000 -0.326641 -v 0.135299 -0.500000 0.326641 -v 0.135299 0.000000 0.326641 -v 0.326641 -0.500000 -0.135299 -v 0.326641 0.000000 -0.135299 -vt 0.875000 0.500000 -vt 0.875000 0.750000 -vt 0.750000 0.750000 -vt 0.750000 0.500000 -vt 0.625000 0.750000 -vt 0.625000 0.500000 -vt 0.500000 0.750000 -vt 0.500000 0.500000 -vt 1.000000 0.500000 -vt 1.000000 0.750000 -vt 0.875000 0.750000 -vt 0.875000 1.000000 -vt 0.750000 1.000000 -vt 0.750000 0.750000 -vt 0.750000 1.000000 -vt 0.625000 1.000000 -vn -0.9239 0.0000 -0.3827 -vn 0.3827 0.0000 -0.9239 -vn 0.9239 0.0000 0.3827 -vn -0.3827 0.0000 0.9239 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -usemtl Material.001 -s off -f 1/1/1 2/2/1 4/3/1 3/4/1 -f 3/4/2 4/3/2 8/5/2 7/6/2 -f 7/6/3 8/5/3 6/7/3 5/8/3 -f 5/9/4 6/10/4 2/2/4 1/1/4 -f 3/11/5 7/12/5 5/13/5 1/14/5 -f 8/5/6 4/3/6 2/15/6 6/16/6 diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj deleted file mode 100644 index 6300d4484..000000000 --- a/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj +++ /dev/null @@ -1,42 +0,0 @@ -# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' -# www.blender.org -mtllib mcl_heads_floor45.mtl -o Cube.002 -v -0.353553 -0.500000 0.000000 -v -0.353553 0.000000 0.000000 -v 0.000000 -0.500000 -0.353553 -v 0.000000 0.000000 -0.353553 -v 0.000000 -0.500000 0.353553 -v 0.000000 0.000000 0.353553 -v 0.353553 -0.500000 0.000000 -v 0.353553 0.000000 0.000000 -vt 0.875000 0.500000 -vt 0.875000 0.750000 -vt 0.750000 0.750000 -vt 0.750000 0.500000 -vt 0.625000 0.750000 -vt 0.625000 0.500000 -vt 0.500000 0.750000 -vt 0.500000 0.500000 -vt 1.000000 0.500000 -vt 1.000000 0.750000 -vt 0.875000 0.750000 -vt 0.875000 1.000000 -vt 0.750000 1.000000 -vt 0.750000 0.750000 -vt 0.750000 1.000000 -vt 0.625000 1.000000 -vn -0.7071 0.0000 -0.7071 -vn 0.7071 0.0000 -0.7071 -vn 0.7071 0.0000 0.7071 -vn -0.7071 0.0000 0.7071 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -usemtl Material.002 -s off -f 1/1/1 2/2/1 4/3/1 3/4/1 -f 3/4/2 4/3/2 8/5/2 7/6/2 -f 7/6/3 8/5/3 6/7/3 5/8/3 -f 5/9/4 6/10/4 2/2/4 1/1/4 -f 3/11/5 7/12/5 5/13/5 1/14/5 -f 8/5/6 4/3/6 2/15/6 6/16/6 diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj deleted file mode 100644 index 0fe5567e3..000000000 --- a/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj +++ /dev/null @@ -1,42 +0,0 @@ -# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' -# www.blender.org -mtllib mcl_heads_floor67_5.mtl -o Cube.003 -v -0.326641 -0.500000 -0.135299 -v -0.326641 0.000000 -0.135299 -v 0.135299 -0.500000 -0.326641 -v 0.135299 0.000000 -0.326641 -v -0.135299 -0.500000 0.326641 -v -0.135299 0.000000 0.326641 -v 0.326641 -0.500000 0.135299 -v 0.326641 0.000000 0.135299 -vt 0.875000 0.500000 -vt 0.875000 0.750000 -vt 0.750000 0.750000 -vt 0.750000 0.500000 -vt 0.625000 0.750000 -vt 0.625000 0.500000 -vt 0.500000 0.750000 -vt 0.500000 0.500000 -vt 1.000000 0.500000 -vt 1.000000 0.750000 -vt 0.875000 0.750000 -vt 0.875000 1.000000 -vt 0.750000 1.000000 -vt 0.750000 0.750000 -vt 0.750000 1.000000 -vt 0.625000 1.000000 -vn -0.3827 0.0000 -0.9239 -vn 0.9239 0.0000 -0.3827 -vn 0.3827 0.0000 0.9239 -vn -0.9239 0.0000 0.3827 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -usemtl Material.003 -s off -f 1/1/1 2/2/1 4/3/1 3/4/1 -f 3/4/2 4/3/2 8/5/2 7/6/2 -f 7/6/3 8/5/3 6/7/3 5/8/3 -f 5/9/4 6/10/4 2/2/4 1/1/4 -f 3/11/5 7/12/5 5/13/5 1/14/5 -f 8/5/6 4/3/6 2/15/6 6/16/6 diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index a870e7c08..9aa5167f5 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -15,13 +15,13 @@ function mcl_honey.wax_block(pos, node, player, itemstack) end local def = minetest.registered_nodes[node.name] + if not def then return end - if def and def._mcl_waxed_variant then - node.name = def._mcl_waxed_variant - else - return - end + -- Handle right-clicking nodes + local new_stack = mcl_util.call_on_rightclick(itemstack, player, {type = "node", under = pos}) + if new_stack and new_stack ~= itemstack then return end + if not def._mcl_waxed_variant then return end node.name = def._mcl_waxed_variant minetest.set_node(pos, node) awards.unlock(player:get_player_name(), "mcl:wax_on") diff --git a/mods/ITEMS/mcl_honey/locale/mcl_honey.de.tr b/mods/ITEMS/mcl_honey/locale/mcl_honey.de.tr new file mode 100644 index 000000000..21132da07 --- /dev/null +++ b/mods/ITEMS/mcl_honey/locale/mcl_honey.de.tr @@ -0,0 +1,11 @@ +# textdomain: mcl_honey +Honeycomb= +Used to craft beehives and protect copper blocks from further oxidation.= +Use on copper blocks to prevent further oxidation.= +Honeycomb Block=Honigwabenblock +Honeycomb Block. Used as a decoration.= +Honey Bottle=Honigflasche +Honey Bottle is used to craft honey blocks and to restore hunger points.= +Drinking will restore 6 hunger points. Can also be used to craft honey blocks.= +Honey Block=Honigblock +Honey Block. Used as a decoration and in redstone. Is sticky on some sides.= diff --git a/mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr b/mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr index b9bf40e1a..bb76515ea 100644 --- a/mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr +++ b/mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr @@ -1,5 +1,5 @@ # textdomain: mcl_itemframes -Item Frame=Artikel Rahmen +Item Frame=Gegenstandsrahmen Item frames are decorative blocks in which items can be placed.=Artikelrahmen sind dekorative Blöcke, in denen Artikel platziert werden können. Just place any item on the item frame. Use the item frame again to retrieve the item.=Platzieren Sie einfach einen beliebigen Gegenstand auf dem Gegenstandsrahmen. Verwenden Sie den Artikelrahmen erneut, um den Artikel abzurufen. Can hold an item.=Kann einen Gegenstand halten. diff --git a/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr b/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr new file mode 100644 index 000000000..099e7f33f --- /dev/null +++ b/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_lanterns +Lantern=Laterne +Soul Lantern=Seelenlaterne +Chain=Kette diff --git a/mods/ITEMS/mcl_lectern/init.lua b/mods/ITEMS/mcl_lectern/init.lua index e98422249..2f6018a12 100644 --- a/mods/ITEMS/mcl_lectern/init.lua +++ b/mods/ITEMS/mcl_lectern/init.lua @@ -31,8 +31,8 @@ local lectern_def = { walkable = true, is_ground_content = false, node_placement_prediction = "", - _mcl_blast_resistance = 3, - _mcl_hardness = 2, + _mcl_blast_resistance = 2.5, + _mcl_hardness = 2.5, selection_box = { type = "fixed", fixed = { diff --git a/mods/ITEMS/mcl_lightning_rods/init.lua b/mods/ITEMS/mcl_lightning_rods/init.lua index 3cd2dc1dc..b7d10e090 100644 --- a/mods/ITEMS/mcl_lightning_rods/init.lua +++ b/mods/ITEMS/mcl_lightning_rods/init.lua @@ -60,7 +60,8 @@ local rod_def = { return minetest.item_place(itemstack, placer, pointed_thing, param2) end, - _mcl_blast_resistance = 0, + _mcl_blast_resistance = 6, + _mcl_hardness = 3, } minetest.register_node("mcl_lightning_rods:rod", rod_def) diff --git a/mods/ITEMS/mcl_lightning_rods/locale/mcl_lightning_rods.de.tr b/mods/ITEMS/mcl_lightning_rods/locale/mcl_lightning_rods.de.tr new file mode 100644 index 000000000..1b09ffd9a --- /dev/null +++ b/mods/ITEMS/mcl_lightning_rods/locale/mcl_lightning_rods.de.tr @@ -0,0 +1,3 @@ +# textdomain: mcl_lightning_rods +Lightning Rod=Blitzableiterstab +A block that attracts lightning= diff --git a/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr b/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr new file mode 100644 index 000000000..20b64fa60 --- /dev/null +++ b/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_loom +Loom=Webstuhl diff --git a/mods/ITEMS/mcl_mangrove/init.lua b/mods/ITEMS/mcl_mangrove/init.lua index a8ab01370..a192b2ffc 100644 --- a/mods/ITEMS/mcl_mangrove/init.lua +++ b/mods/ITEMS/mcl_mangrove/init.lua @@ -221,7 +221,7 @@ local wlroots = { liquids_pointable = true, drop = "mcl_mangrove:mangrove_roots", groups = { - handy = 1, hoey = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, waterlogged = 1, not_in_creative_inventory=1 }, + handy = 1, hoey = 1, water=4, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 }, _mcl_blast_resistance = 100, _mcl_hardness = -1, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode on_construct = function(pos) @@ -322,14 +322,14 @@ mcl_stairs.register_stair("mangrove_wood", "mcl_mangrove:mangrove_wood", {handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {"mcl_mangrove_planks.png"}, S("Mangrove Wood Stairs"), - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab("mangrove_wood", "mcl_mangrove:mangrove_wood", {handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {"mcl_mangrove_planks.png"}, S("Mangrove Wood Slab"), - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, S("Double Mangrove Wood Slab")) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index 4d92c2d43..a3155b13c 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -155,6 +155,7 @@ local function drink_milk_delayed(itemstack, player, pointed_thing) mcl_hunger.stop_poison(player) end mcl_potions._reset_effects(player) + mcl_weather.skycolor.update_player_sky_color(player) end -- Wrapper for handling mcl_hunger delayed eating diff --git a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr index c1278ad36..1dab0d80b 100644 --- a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr +++ b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr @@ -25,7 +25,7 @@ Cooked Chicken=Gebratenes Hühnchen A cooked chicken is a healthy food item which can be eaten.=Ein gebratenes Hühnchen ist ein gesundes essbares Lebensmittel. Raw Porkchop=Rohes Schweinefleisch -A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value.=Ein rohes Stück Schweinefleisch kann bedenkenlos gegessen werden. Man kann es braten, um seinen Nährwert stark zu erhöhen. +A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value.=Ein rohes Stück Schweinefleisch kann bedenkenlos gegessen werden. Man kann es braten, um seinen Nährwert stark zu erhöhen. Cooked Porkchop=Gebratenes Schweinefleisch Cooked porkchop is the cooked flesh of a pig and is used as food.=Ein gebratenes Stück Schweinefleisch ist ein gutes Lebensmittel. @@ -57,6 +57,9 @@ This item is dropped by dead squids. Squid ink can be used to as an ingredient String=Faden Strings are used in crafting.=Fäden sind nützlich in der Fertigung. +Spectre Membrane=Geistermembrane +This is a crafting component dropped from dead spectres.= +Crystalline Drop=Kristallträne Blaze Rod=Lohenrute This is a crafting component dropped from dead blazes.=Dies ist eine Fertigungskomponente, die von toten Lohen abgeworfen wird. Blaze Powder=Lohenstaub @@ -96,6 +99,17 @@ A carrot on a stick can be used on saddled pigs to ride them.=Eine Karottenrute Place it on a saddled pig to mount it. You can now ride the pig like a horse. Pigs will also walk towards you when you just wield the carrot on a stick.=Platzieren Sie sie auf einem Schwein mit Sattel, um sich aufzusatteln. Sie können nun das Schwein wie ein Pferd reiten. Schweine werden auch auf Sie zugehen, wenn Sie einfach nur die Karottenrute halten. +Warped fungus on a Stick= +Lets you ride a strider= +A warped fungus on a stick can be used on saddled striders to ride them.= +Place it on a saddled strider to mount it. You can now ride the strider like a horse. Striders will also walk towards you when you just wield the fungus on a stick.= + +Nautilus Shell= +Used to craft a conduit= +The Nautilus Shell is used to craft a conduit. They can be obtained by fishing or killing a drowned that is wielding a shell.= +Heart of the Sea= +The Heart of the Sea is used to craft a conduit. They can be obtained by finding them in a buried treasure chest.= + Iron Horse Armor=Eisenpferderüstung Iron horse armor can be worn by horses to increase their protection from harm a bit.=Eine Eisenpferderüstung kann von Pferden getragen werden, um ihren Schutz vor Schaden etwas zu erhöhen. Golden Horse Armor=Goldpferderüstung @@ -103,3 +117,8 @@ Golden horse armor can be worn by horses to increase their protection from harm. Diamond Horse Armor=Diamantpferderüstung Diamond horse armor can be worn by horses to greatly increase their protection from harm.=Eine Diamantpferderüstung kann von Pferden getragen werden, um ihren Schutz vor Schaden beträchtlich zu erhöhen. Place it on a horse to put on the horse armor. Donkeys and mules can't wear horse armor.=Platzieren Sie es auf einem Pferd, um die Pferderüstung aufzusetzen. Esel und Maultiere können keine Pferderüstung tragen. + +Glow Ink Sac= +Use it to craft the Glow Item Frame.= +Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame.= + diff --git a/mods/ITEMS/mcl_mobitems/locale/template.txt b/mods/ITEMS/mcl_mobitems/locale/template.txt index dd97fa0dd..7b1895f34 100644 --- a/mods/ITEMS/mcl_mobitems/locale/template.txt +++ b/mods/ITEMS/mcl_mobitems/locale/template.txt @@ -57,6 +57,9 @@ This item is dropped by dead squids. Squid ink can be used to as an ingredient String= Strings are used in crafting.= +Spectre Membrane= +This is a crafting component dropped from dead spectres.= +Crystalline Drop= Blaze Rod= This is a crafting component dropped from dead blazes.= Blaze Powder= diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index 83c03804e..5c934a819 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -147,20 +147,14 @@ local function spawn_mobs(pos, elapsed) -- get meta local meta = minetest.get_meta(pos) - -- get settings - local mob = meta:get_string("Mob") - local mlig = meta:get_int("MinLight") - local xlig = meta:get_int("MaxLight") - local num = meta:get_int("MaxMobsInArea") - local pla = meta:get_int("PlayerDistance") - local yof = meta:get_int("YOffset") - -- if amount is 0 then do nothing + local num = meta:get_int("MaxMobsInArea") if num == 0 then return end -- are we spawning a registered mob? + local mob = meta:get_string("Mob") if not mcl_mobs.spawning_mobs[mob] then minetest.log("error", "[mcl_mobspawners] Mob Spawner: Mob doesn't exist: "..mob) return @@ -174,17 +168,14 @@ local function spawn_mobs(pos, elapsed) local timer = minetest.get_node_timer(pos) -- spawn mob if player detected and in range + local pla = meta:get_int("PlayerDistance") if pla > 0 then - local in_range = 0 local objs = minetest.get_objects_inside_radius(pos, pla) for _,oir in pairs(objs) do - if oir:is_player() then - in_range = 1 - break end end @@ -213,7 +204,6 @@ local function spawn_mobs(pos, elapsed) -- count mob objects of same type in area for k, obj in ipairs(objs) do - ent = obj:get_luaentity() if ent and ent.name and ent.name == mob then @@ -228,39 +218,33 @@ local function spawn_mobs(pos, elapsed) end -- find air blocks within 8×3×8 nodes of spawner + local yof = meta:get_int("YOffset") local air = minetest.find_nodes_in_area( {x = pos.x - 4, y = pos.y - 1 + yof, z = pos.z - 4}, {x = pos.x + 4, y = pos.y + 1 + yof, z = pos.z + 4}, {"air"}) - -- spawn up to 4 mobs in random air blocks + -- spawn mobs in random air blocks. Default max of 4 if air then - local max = 4 - if spawn_count_overrides[mob] then - max = spawn_count_overrides[mob] - end - for a=1, max do - if #air <= 0 then - -- We're out of space! Stop spawning - break - end - local air_index = math.random(#air) - local pos2 = air[air_index] - local lig = minetest.get_node_light(pos2) or 0 - - pos2.y = pos2.y + 0.5 + local num_to_spawn = spawn_count_overrides[mob] or 4 + local mlig = meta:get_int("MinLight") + local xlig = meta:get_int("MaxLight") + while #air > 0 do + local pos2 = table.remove_random_element(air) -- only if light levels are within range + local lig = minetest.get_node_light(pos2) or 0 if lig >= mlig and lig <= xlig then - minetest.add_entity(pos2, mob) + if mcl_mobs.spawn(pos2, mob) then + num_to_spawn = num_to_spawn - 1 + if num_to_spawn == 0 then break end + end end - table.remove(air, air_index) end end -- Spawn attempt done. Next spawn attempt much later - timer:start(math.random(10, 39.95)) - + timer:start(math.random() * 29.95 + 10) end -- The mob spawner node. @@ -402,7 +386,7 @@ minetest.register_lbm({ minetest.register_on_mods_loaded(function() for name,mobinfo in pairs(minetest.registered_entities) do - if ( mobinfo.is_mob or name:find("mobs_mc") ) and not ( mobinfo.visual_size or mobinfo._convert_to ) then + if mobinfo.is_mob and not ( mobinfo.visual_size or mobinfo._convert_to ) then minetest.log("warning", "Definition for "..tostring(name).." is missing field 'visual_size', mob spawners will not work properly") end end diff --git a/mods/ITEMS/mcl_monster_eggs/init.lua b/mods/ITEMS/mcl_monster_eggs/init.lua index f58717d04..42db03c8f 100644 --- a/mods/ITEMS/mcl_monster_eggs/init.lua +++ b/mods/ITEMS/mcl_monster_eggs/init.lua @@ -10,10 +10,15 @@ local function spawn_silverfish(pos, oldnode, oldmetadata, digger) end -- Template function for registering monster egg blocks -local function register_block(subname, description, tiles, is_ground_content) +local function register_block(subname, description, tiles, is_ground_content, hardness_override) if is_ground_content == nil then is_ground_content = false end + -- Default hardness matches for stone and stone brick variants; cobble has 1.0 + local hardness = 0.75 + if hardness_override then + hardness = hardness_override + end minetest.register_node("mcl_monster_eggs:monster_egg_"..subname, { description = description, tiles = tiles, @@ -24,14 +29,14 @@ local function register_block(subname, description, tiles, is_ground_content) after_dig_node = spawn_silverfish, _tt_help = S("Hides a silverfish"), _doc_items_longdesc = S("An infested block is a block from which a silverfish will pop out when it is broken. It looks identical to its normal counterpart."), - _mcl_hardness = 0, - _mcl_blast_resistance = 0.5, + _mcl_hardness = hardness, + _mcl_blast_resistance = 0.75, }) end -- Register all the monster egg blocks register_block("stone", S("Infested Stone"), {"default_stone.png"}, true) -register_block("cobble", S("Infested Cobblestone"), {"default_cobble.png"}) +register_block("cobble", S("Infested Cobblestone"), {"default_cobble.png"}, nil, 1.0) register_block("stonebrick", S("Infested Stone Bricks"), {"default_stone_brick.png"}) register_block("stonebrickcracked", S("Infested Cracked Stone Bricks"), {"mcl_core_stonebrick_cracked.png"}) register_block("stonebrickmossy", S("Infested Mossy Stone Bricks"), {"mcl_core_stonebrick_mossy.png"}) diff --git a/mods/ITEMS/mcl_mushrooms/small.lua b/mods/ITEMS/mcl_mushrooms/small.lua index 4d1ffa2f5..a32507e78 100644 --- a/mods/ITEMS/mcl_mushrooms/small.lua +++ b/mods/ITEMS/mcl_mushrooms/small.lua @@ -1,5 +1,8 @@ local S = minetest.get_translator(minetest.get_current_modname()) +local modpath = minetest.get_modpath(minetest.get_current_modname()) +local schempath = modpath .. "/schematics/" + local on_place = mcl_util.generate_on_place_plant_function(function(place_pos, place_node) local soil_node = minetest.get_node_or_nil({x=place_pos.x, y=place_pos.y-1, z=place_pos.z}) if not soil_node then return false end @@ -16,6 +19,40 @@ local on_place = mcl_util.generate_on_place_plant_function(function(place_pos, p return ((snn == "mcl_core:podzol" or snn == "mcl_core:podzol_snow" or snn == "mcl_core:mycelium" or snn == "mcl_core:mycelium_snow") or (light_ok and minetest.get_item_group(snn, "solid") == 1 and minetest.get_item_group(snn, "opaque") == 1)) end) +-- Try to grow huge mushroom +local function apply_bonemeal(pos, schematic, offset) + -- Must be on a dirt-type block + local below = minetest.get_node(vector.offset(pos, 0, -1, 0)) + if minetest.get_item_group(below.name, "grass_block") ~= 1 + and below.name ~= "mcl_core:mycelium" + and below.name ~= "mcl_core:dirt" + and below.name ~= "mcl_core:coarse_dirt" + and below.name ~= "mcl_core:podzol" then + return false + end + -- 40% chance + if math.random(1, 100) <= 40 then + -- Check space requirements + for i= 1, 3 do + local cpos = vector.offset(pos, 0, i, 0) + if minetest.get_node(cpos).name ~= "air" then + return false + end + end + local minp = vector.offset(pos, -3, 3, -3) + local maxp = vector.offset(pos, 3, 8, 3) + local diff = maxp - minp + local goodnodes = minetest.find_nodes_in_area(minp, maxp, {"air", "group:leaves"}) + if #goodnodes < (diff.x + 1) * (diff.y + 1) * (diff.z + 1) then + return false + end + -- Place the huge mushroom + minetest.remove_node(pos) + return minetest.place_schematic(pos + offset, schematic, 0, nil, false) + end + return false +end + local longdesc_intro_brown = S("Brown mushrooms are fungi which grow and spread in darkness, but are sensitive to light. They are inedible as such, but they can be used to craft food items.") local longdesc_intro_red = S("Red mushrooms are fungi which grow and spread in darkness, but are sensitive to light. They are inedible as such, but they can be used to craft food items.") @@ -51,6 +88,11 @@ minetest.register_node("mcl_mushrooms:mushroom_brown", { }, node_placement_prediction = "", on_place = on_place, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local schematic = schempath .. "mcl_mushrooms_huge_brown.mts" + local offset = vector.new(-3, -1, -3) + return apply_bonemeal(pointed_thing.under, schematic, offset) + end, _mcl_blast_resistance = 0, }) @@ -78,6 +120,11 @@ minetest.register_node("mcl_mushrooms:mushroom_red", { }, node_placement_prediction = "", on_place = on_place, + _on_bone_meal = function(itemstack, placer, pointed_thing) + local schematic = schempath .. "mcl_mushrooms_huge_red.mts" + local offset = vector.new(-2, -1, -2) + return apply_bonemeal(pointed_thing.under, schematic, offset) + end, _mcl_blast_resistance = 0, }) diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua index b69355d5d..da0bd47f2 100644 --- a/mods/ITEMS/mcl_nether/init.lua +++ b/mods/ITEMS/mcl_nether/init.lua @@ -259,8 +259,8 @@ minetest.register_node("mcl_nether:quartz_smooth", { tiles = {"mcl_nether_quartz_block_bottom.png"}, groups = {pickaxey=1, quartz_block=1,building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 0.8, - _mcl_hardness = 0.8, + _mcl_blast_resistance = 6, + _mcl_hardness = 2, }) minetest.register_craftitem("mcl_nether:glowstone_dust", { diff --git a/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr b/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr index f81f381e2..2f2dbda04 100644 --- a/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr +++ b/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr @@ -3,10 +3,11 @@ Glowstone=Leuchtstein Glowstone is a naturally-glowing block which is home to the Nether.=Leuchtstein ist ein Block aus dem Nether. Er leuchtet von Natur aus hell. Nether Quartz Ore=Nether-Quarzerz Nether quartz ore is an ore containing nether quartz. It is commonly found around netherrack in the Nether.=Nether-Quarzerz ist ein Erz, das Nethererz enthält. Es wird oft zwischen Netherrack im Nether gefunden. -Netherrack=Netherrack +Netherrack=Nethergestein Netherrack is a stone-like block home to the Nether. Starting a fire on this block will create an eternal fire.=Netherrack ist ein gesteinsartiger Block aus dem Nether. Auf diesem Block wird ein Feuer immer ein ewiges Feuer sein. Magma Block=Magmablock Magma blocks are hot solid blocks which hurt anyone standing on it, unless they have fire resistance. Starting a fire on this block will create an eternal fire.=Magmablöcke sind heiße feste Blöcke, die jeden, der auf ihm steht, verletzen, es sei denn, sie sind gegen Feuer immun. Auf diesem Block wird ein Feuer immer ein ewiges Feuer sein. +@1 stood too long on a magma block.=@1 stand zu lange auf einem Magmablock. Soul Sand=Seelensand Soul sand is a block from the Nether. One can only slowly walk on soul sand. The slowing effect is amplified when the soul sand is on top of ice, packed ice or a slime block.=Seelensand ist ein Block aus dem Nether. Man kann auf ihm nur langsam gehen. Die Verlangsamung ist verstärkt, wenn sich der Seelensand auf Eis, Packeis oder einem Schleimblock befindet. Nether Brick Block=Netherziegelblock @@ -25,7 +26,6 @@ Nether Brick=Netherziegel Nether bricks are the main crafting ingredient for crafting nether brick blocks and nether fences.=Netherziegel werden hauptsächlich zur Fertigung von Netherziegelblöcken und Netherzäunen benutzt. Nether Lava Source=Netherlavaquelle Flowing Nether Lava=Fließende Netherlava -@1 stood too long on a magma block.=@1 stand zu lange auf einem Magmablock. Premature Nether Wart (Stage 1)=Junger Netherwurz (1. Stufe) A premature nether wart has just recently been planted on soul sand. Nether wart slowly grows on soul sand in 4 stages (the second and third stages look identical). Although nether wart is home to the Nether, it grows in any dimension.=Ein junger Netherwurz wurde erst kürzlich auf Seelensand gepflanzt. Netherwurz wächst langsam auf Seelensand in 4 Stufen (die 2. und 3. Stufe sehen identisch aus). Obwohl Netherwurz im Nether beheimatet ist, wächst er in jeder Dimension. Premature Nether Wart (Stage 2)=Junger Netherwurz (2. Stufe) @@ -38,3 +38,9 @@ Place this item on soul sand to plant it and watch it grow.=Platzieren Sie den G Burns your feet=Verbrennt Ihre Füße Grows on soul sand=Wächst auf Seelensand Reduces walking speed=Reduziert das Schritttempo +Netherite Scrap=Nethitschrott +Netherite Ingot=Netheritbarren +Ancient Debris= +Ancient debris can be found in the nether and is very very rare.= +Netherite Block= +Netherite block is very hard and can be made of 9 netherite ingots.= diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 530d96093..e51466145 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -81,7 +81,8 @@ end -- Is this water? -- Returns the liquidtype, if indeed water. function kelp.is_submerged(node) - if mt_get_item_group(node.name, "water") ~= 0 then + local g = mt_get_item_group(node.name, "water") + if g > 0 and g <= 3 then -- Expected only "source" and "flowing" from water liquids return mt_registered_nodes[node.name].liquidtype end @@ -195,7 +196,7 @@ function kelp.find_unsubmerged(pos, node, height) for i=1,height do walk_pos.y = y + i local walk_node = mt_get_node(walk_pos) - if not kelp.is_submerged(walk_node) then + if walk_node.name ~= "ignore" and not kelp.is_submerged(walk_node) then return walk_pos, walk_node, height, i end end @@ -267,8 +268,7 @@ function kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flow -- Flowing liquid: Grow 1 step, but also turn the tip node into a liquid source. if downward_flowing then local alt_liq = mt_registered_nodes[node_tip.name].liquid_alternative_source - local alt_liq_accessible = mt_get_item_group(node_tip.name,"waterlogged") -- returns 0 if it isn't waterlogged. - if alt_liq and not alt_liq_accessible then + if alt_liq and mt_registered_nodes[alt_liq] then mt_set_node(pos_tip, {name=alt_liq}) end end diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index a1c838814..b3aa232ba 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -492,7 +492,7 @@ mcl_potions.register_effect({ end, on_step = function(dtime, object, factor, duration) if object:get_meta():get_int("night_vision") ~= 1 then - local flash = EF.darkness[object].flash + local flash = EF.darkness[object].flash or 0 if flash < 0.2 then EF.darkness[object].flashdir = true elseif flash > 0.6 then EF.darkness[object].flashdir = false end flash = EF.darkness[object].flashdir and (flash + dtime) or (flash - dtime) @@ -1260,7 +1260,11 @@ local function potions_init_icons(player) }) table.insert(icon_ids[name], id) end - hb.init_hudbar(player, "absorption") + + -- Absorption bar in damage disabled server is unneccessary + if minetest.settings:get_bool("enable_damage") == true then + hb.init_hudbar(player, "absorption") + end end local function potions_set_icons(player) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 446f6ef16..3d00d2801 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -61,10 +61,9 @@ minetest.register_craftitem("mcl_potions:glass_bottle", { local def = minetest.registered_nodes[node.name] -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) + if new_stack and new_stack ~= itemstack then + return new_stack end -- Try to fill glass bottle with water @@ -226,10 +225,9 @@ local function water_bottle_on_place(itemstack, placer, pointed_thing) local def = minetest.registered_nodes[node.name] -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) + if new_stack and new_stack ~= itemstack then + return new_stack end local cauldron = nil @@ -239,11 +237,10 @@ local function water_bottle_on_place(itemstack, placer, pointed_thing) cauldron = fill_cauldron(node.name, "mclx_core:river_water_source") end - if cauldron then - set_node_empty_bottle(itemstack, placer, pointed_thing, cauldron) + return set_node_empty_bottle(itemstack, placer, pointed_thing, cauldron) elseif node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then - set_node_empty_bottle(itemstack, placer, pointed_thing, "mcl_mud:mud") + return set_node_empty_bottle(itemstack, placer, pointed_thing, "mcl_mud:mud") end end diff --git a/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr b/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr new file mode 100644 index 000000000..9ebf1ce03 --- /dev/null +++ b/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr @@ -0,0 +1,9 @@ +# textdomain: mcl_raw_ores +Raw Iron=Roheisen +Raw Gold=Rohgold +Raw iron. Mine an iron ore to get it.= +Raw gold. Mine a gold ore to get it.= +Block of Raw Iron=Roheisenblock +Block of Raw Gold=Rohgoldblock +A block of raw iron is mostly a decorative block but also useful as a compact storage of raw iron.= +A block of raw gold is mostly a decorative block but also useful as a compact storage of raw gold.= diff --git a/mods/ITEMS/mcl_sculk/init.lua b/mods/ITEMS/mcl_sculk/init.lua index 4af60178e..2bedfef24 100644 --- a/mods/ITEMS/mcl_sculk/init.lua +++ b/mods/ITEMS/mcl_sculk/init.lua @@ -194,7 +194,7 @@ minetest.register_node("mcl_sculk:sculk", { is_ground_content = false, on_destruct = sculk_on_destruct, _mcl_blast_resistance = 0.2, - _mcl_hardness = 0.6, + _mcl_hardness = 0.2, _mcl_silk_touch_drop = true, }) diff --git a/mods/ITEMS/mcl_shepherd/locale/mcl_shepherd.de.tr b/mods/ITEMS/mcl_shepherd/locale/mcl_shepherd.de.tr new file mode 100644 index 000000000..60158fcc9 --- /dev/null +++ b/mods/ITEMS/mcl_shepherd/locale/mcl_shepherd.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_shepherd +Shepherd Staff=Hirtenstab diff --git a/mods/ITEMS/mcl_shepherd/locale/template.txt b/mods/ITEMS/mcl_shepherd/locale/template.txt new file mode 100644 index 000000000..5df8b7df0 --- /dev/null +++ b/mods/ITEMS/mcl_shepherd/locale/template.txt @@ -0,0 +1,2 @@ +# textdomain: mcl_shepherd +Shepherd Staff= diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 6edee7e89..e1b790049 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -211,16 +211,37 @@ local function set_interact(player, interact) return end local meta = player:get_meta() - if meta:get_int("mcl_privs:interact_revoked") ~= 1 then - privs.interact = interact - minetest.set_player_privs(player_name, privs) - meta:set_int("mcl_privs:interact_revoked",0) + + if interact and meta:get_int("mcl_shields:interact_revoked") ~= 0 then + meta:set_int("mcl_shields:interact_revoked", 0) + privs.interact = true + elseif not interact then + meta:set_int("mcl_shields:interact_revoked", privs.interact and 1 or 0) + privs.interact = nil end + + minetest.set_player_privs(player_name, privs) end +-- Prevent player from being able to circumvent interact privilage removal by +-- using shield. +minetest.register_on_priv_revoke(function(name, revoker, priv) + if priv == "interact" and revoker then + local player = minetest.get_player_by_name(name) + if not player then + return + end + local meta = player:get_meta() + meta:set_int("mcl_shields:interact_revoked", 0) + end +end) + local shield_hud = {} local function remove_shield_hud(player) + set_interact(player, true) + playerphysics.remove_physics_factor(player, "speed", "shield_speed") + if not shield_hud[player] then return end --this function takes a long time. only run it when necessary player:hud_remove(shield_hud[player]) shield_hud[player] = nil @@ -231,9 +252,6 @@ local function remove_shield_hud(player) if not hf.wielditem then player:hud_set_flags({wielditem = true}) end - - playerphysics.remove_physics_factor(player, "speed", "shield_speed") - set_interact(player, true) end local function add_shield_entity(player, i) @@ -251,6 +269,11 @@ local function remove_shield_entity(player, i) end end +local function is_rmb_conflicting_node(nodename) + local nodedef = minetest.registered_nodes[nodename] or {} + return nodedef.on_rightclick +end + local function handle_blocking(player) local player_shield = mcl_shields.players[player] local rmb = player:get_player_control().RMB @@ -259,14 +282,25 @@ local function handle_blocking(player) return end + local pointed_thing = mcl_util.get_pointed_thing(player, true) + local wielded_stack = player:get_wielded_item() + local shield_in_offhand = mcl_shields.wielding_shield(player, 1) local shield_in_hand = mcl_shields.wielding_shield(player) local not_blocking = player_shield.blocking == 0 - local pos = player:get_pos() + if pointed_thing and pointed_thing.type == "node" then + local pointed_node = minetest.get_node(pointed_thing.under) + if minetest.get_item_group(pointed_node.name, "container") > 1 + or is_rmb_conflicting_node(pointed_node.name) + or wielded_stack:get_definition().type == "node" then + return + end + end + if shield_in_hand then if not_blocking then - minetest.after(0.25, function() + minetest.after(0.05, function() if (not_blocking or not shield_in_offhand) and shield_in_hand and rmb then player_shield.blocking = 2 set_shield(player, true, 2) @@ -276,22 +310,15 @@ local function handle_blocking(player) player_shield.blocking = 2 end elseif shield_in_offhand then - local pointed_thing = mcl_util.get_pointed_thing(player, true) - local offhand_can_block = (wielded_item(player) == "" or not pointed_thing) - and (minetest.get_item_group(wielded_item(player), "bow") ~= 1 and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1) - - if pointed_thing and pointed_thing.type == "node" then - if minetest.get_item_group(minetest.get_node(pointed_thing.under).name, "container") > 1 then - return - end - end + local offhand_can_block = minetest.get_item_group(wielded_item(player), "cannot_block") ~= 1 if not offhand_can_block then return end if not_blocking then - minetest.after(0.25, function() - if (not_blocking or not shield_in_hand) and shield_in_offhand and rmb and offhand_can_block then + minetest.after(0.05, function() + if (not_blocking or not shield_in_hand) and shield_in_offhand + and rmb and offhand_can_block then player_shield.blocking = 1 set_shield(player, true, 1) end @@ -344,7 +371,7 @@ local function add_shield_hud(shieldstack, player, blocking) z_index = -200, }) playerphysics.add_physics_factor(player, "speed", "shield_speed", 0.5) - set_interact(player, nil) + set_interact(player, false) end local function update_shield_hud(player, blocking, shieldstack) diff --git a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr index 323e90364..775b4830e 100644 --- a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr +++ b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr @@ -1,5 +1,5 @@ # textdomain: mcl_signs -Sign=Zeichen / Schild +Sign=Schild Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them.=Schilder können beschrieben werden und kommen in zwei Varianten: Wandschild und stehendes Schild. Sie können auf und an den Seiten von anderen Blöclen platziert werden, aber nicht unter ihnen. After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow.=Nachdem das Schild platziert wurde, kann man etwas darauf schreiben. 4 Zeilen mit je 15 Zeichen pro Zeile sind verfügbar, alles darüber geht verloren. Es werden nicht alle Zeichen unterstützt. Der Text kann nicht geändert werden, sobald er geschrieben wurde; man muss das Schild erneut platzieren. Kann gefärbt und zum Leuchten gebracht werden. Enter sign text:=Schildtext eingeben: @@ -8,11 +8,11 @@ Maximum lines: 4=Maximale Zeilen: 4 Done=Fertig Can be written=Kann beschriftet werden Oak Sign=Eichezeichen -Birch Sign=Birke Zeichen +Birch Sign=Birkenholzschild Spruce Sign=Fichtenzeichen Dark Oak Sign=Dunkles Eichenschild -Jungle Sign=Dschungelzeichen +Jungle Sign=Dschungelholzschild Acacia Sign=Akazienzeichen Mangrove Sign=Mangroven-Zeichen -Warped Hyphae Sign=Verzerrtes Hyphen-Zeichen -Crimson Hyphae Sign=Hochrotes Hyphen-Zeichen +Warped Hyphae Sign=Wirrhyphenholzschild +Crimson Hyphae Sign=Karmesinhyphenholzschild diff --git a/mods/ITEMS/mcl_signs/mod.conf b/mods/ITEMS/mcl_signs/mod.conf index e2fe9d40a..878d8d2f7 100644 --- a/mods/ITEMS/mcl_signs/mod.conf +++ b/mods/ITEMS/mcl_signs/mod.conf @@ -1,4 +1,4 @@ name = mcl_signs description = New and Improved signs - can be colored and made to glow. -depends = mcl_core, mcl_sounds, mcl_dye, mcl_colors, mcl_util +depends = mcl_core, mcl_sounds, mcl_dye, mcl_colors, mcl_util, mesecons_mvps optional_depends = doc diff --git a/mods/ITEMS/mcl_smithing_table/init.lua b/mods/ITEMS/mcl_smithing_table/init.lua index 1294c2c52..29d59b152 100755 --- a/mods/ITEMS/mcl_smithing_table/init.lua +++ b/mods/ITEMS/mcl_smithing_table/init.lua @@ -167,6 +167,12 @@ minetest.register_node("mcl_smithing_table:table", { end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return 0 + end + local stackname = stack:get_name() local def = stack:get_definition() if @@ -187,6 +193,16 @@ minetest.register_node("mcl_smithing_table:table", { return 0 end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return 0 + else + return stack:get_count() + end + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) return 0 end, diff --git a/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr b/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr new file mode 100644 index 000000000..b3e9817e7 --- /dev/null +++ b/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_smithing_table +Smithing table=Schmiedetisch diff --git a/mods/ITEMS/mcl_smoker/locale/mcl_smoker.de.tr b/mods/ITEMS/mcl_smoker/locale/mcl_smoker.de.tr new file mode 100644 index 000000000..77b4ccc6e --- /dev/null +++ b/mods/ITEMS/mcl_smoker/locale/mcl_smoker.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_smoker +Smoker=Räucherofen diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua index 87f40e3ae..e9755479b 100644 --- a/mods/ITEMS/mcl_sponges/init.lua +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -155,7 +155,7 @@ minetest.register_node("mcl_sponges:sponge_wet", { buildable_to = false, stack_max = 64, sounds = mcl_sounds.node_sound_dirt_defaults(), - groups = {handy=1, hoey=1, waterlogged = 1, building_block=1}, + groups = {handy=1, hoey=1, building_block=1}, on_place = place_wet_sponge, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, @@ -175,7 +175,7 @@ if minetest.get_modpath("mclx_core") then buildable_to = false, stack_max = 64, sounds = mcl_sounds.node_sound_dirt_defaults(), - groups = {handy=1, waterlogged = 1, building_block=1}, + groups = {handy=1, building_block=1}, on_place = place_wet_sponge, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, diff --git a/mods/ITEMS/mcl_spyglass/init.lua b/mods/ITEMS/mcl_spyglass/init.lua index afa7adaf4..c0854d3b6 100644 --- a/mods/ITEMS/mcl_spyglass/init.lua +++ b/mods/ITEMS/mcl_spyglass/init.lua @@ -6,6 +6,7 @@ minetest.register_tool("mcl_spyglass:spyglass",{ inventory_image = "mcl_spyglass.png", stack_max = 1, _mcl_toollike_wield = true, + touch_interaction = "short_dig_long_place", }) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_spyglass/locale/mcl_spyglass.de.tr b/mods/ITEMS/mcl_spyglass/locale/mcl_spyglass.de.tr new file mode 100644 index 000000000..127225237 --- /dev/null +++ b/mods/ITEMS/mcl_spyglass/locale/mcl_spyglass.de.tr @@ -0,0 +1,3 @@ +# textdomain: mcl_spyglass +Spyglass=Fernrohr +A spyglass is an item that can be used for zooming in on specific locations.= diff --git a/mods/ITEMS/mcl_stairs/API.md b/mods/ITEMS/mcl_stairs/API.md index 6c91754b7..5b142d85b 100644 --- a/mods/ITEMS/mcl_stairs/API.md +++ b/mods/ITEMS/mcl_stairs/API.md @@ -11,7 +11,8 @@ mcl_stairs.register_stair_and_slab_simple("platinum", "example:platinum", "Plati ``` ## `mcl_stairs.register_stair_and_slab_simple(subname, sourcenode, desc_stair, desc_slab, double_description, corner_stair_texture_override)` -Register a simple stair and a slab. The stair and slab will inherit all attributes from `sourcenode`. The `sourcenode` is also used as the item for crafting recipes. +Register a simple stair and a slab. The stair and slab will inherit all attributes from `sourcenode`. The `sourcenode` is also used as the item for crafting recipes. If multiple nodes should craft into the same stairs/slab, see +`mcl_stairs.register_craft_stairs` or `mcl_stairs.register_craft_slab` This function is meant for simple nodes; if you need more flexibility, use one of the other functions instead. @@ -44,7 +45,7 @@ The itemstrings for the registered nodes will be of the form: ### Parameters * `subname`: Name fragment for node itemstrings (see above) -* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead +* `recipeitem`: Item for crafting recipe and attribute inheritance. Do not use `group:` prefix here, alternative recipes can be registered using `mcl_stairs.register_craft_stairs(subname, recipeitem_or_group)`. * `groups`: Groups used for stair * `images`: Textures * `description`: Stair description/tooltip @@ -81,3 +82,35 @@ The itemstrings for the registered nodes will be of the form: * `double_description`: Node description/tooltip for double slab * Other parameters: Same as for `register_stair` +## `mcl_stairs.register_craft_stairs(subname, recipeitem)` +Just registers a recipe for `mcl_stairs:stair_`. +Useful if a node variant should craft the same stairs as the base node, since the above functions use the same +parameter for crafting material and attribute inheritance. +e.g. 6 Purpur Pillar -> 4 Purpur Stairs is an alternate recipe. + +Creates staircase recipes with 6 input items, both left-facing and right-facing. Outputs 4 stairs. + +The itemstring for the output node will be of the form: + +* `mcl_stairs:stair_`: Normal stair + +### Parameters +* `subname`: Name fragment for node itemstring (see above) +* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead + +## `mcl_stairs.register_craft_slab(subname, recipeitem)` +Just registers a recipe for `mcl_stairs:slab_`. +Useful if a node variant should craft the same stairs as the base node, since the above functions use the same +parameter for crafting material and attribute inheritance. +e.g. 3 Quartz Pillar -> 6 Quartz Slab is an alternate recipe. + +Creates slab recipe with 3 input items in any horizontal line. Outputs 6 slabs. + +The itemstring for the output node will be of the form: + +* `mcl_stairs:slab_`: Slab + +### Parameters +* `subname`: Name fragment for node itemstring (see above) +* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead + diff --git a/mods/ITEMS/mcl_stairs/api.lua b/mods/ITEMS/mcl_stairs/api.lua index 390461c6c..f63d8daa1 100644 --- a/mods/ITEMS/mcl_stairs/api.lua +++ b/mods/ITEMS/mcl_stairs/api.lua @@ -93,17 +93,29 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript groups.stair = 1 groups.building_block = 1 + local image_table = {} + for i, image in ipairs(images) do + image_table[i] = type(image) == "string" and { name = image } or table.copy(image) + image_table[i].align_style = "world" + end + minetest.register_node(":mcl_stairs:stair_" .. subname, { description = description, _doc_items_longdesc = S("Stairs are useful to reach higher places by walking over them; jumping is not required. Placing stairs in a corner pattern will create corner stairs. Stairs placed on the ceiling or at the upper half of the side of a block will be placed upside down."), - drawtype = "mesh", - mesh = "stairs_stair.obj", - tiles = images, + drawtype = "nodebox", + tiles = image_table, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, groups = groups, sounds = sounds, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, selection_box = { type = "fixed", fixed = { diff --git a/mods/ITEMS/mcl_stairs/cornerstair.lua b/mods/ITEMS/mcl_stairs/cornerstair.lua index ae3eb4ea3..03f8aacca 100644 --- a/mods/ITEMS/mcl_stairs/cornerstair.lua +++ b/mods/ITEMS/mcl_stairs/cornerstair.lua @@ -207,31 +207,12 @@ function mcl_stairs.cornerstair.add(name, stairtiles) local node_def = minetest.registered_nodes[name] local outer_tiles local inner_tiles - if stairtiles == "woodlike" then - outer_tiles = table.copy(node_def.tiles) - inner_tiles = table.copy(node_def.tiles) - for i=2,6 do - if outer_tiles[i] == nil then - outer_tiles[i] = outer_tiles[i-1] - end - if inner_tiles[i] == nil then - inner_tiles[i] = inner_tiles[i-1] - end - end - local t = node_def.tiles[1] - outer_tiles[1] = t.."^("..t.."^[transformR90^mcl_stairs_turntexture.png^[makealpha:255,0,255)" - outer_tiles[2] = t.."^("..t.."^mcl_stairs_turntexture.png^[transformR270^[makealpha:255,0,255)" - outer_tiles[3] = t - inner_tiles[1] = t.."^("..t.."^[transformR90^(mcl_stairs_turntexture.png^[transformR180)^[makealpha:255,0,255)" - inner_tiles[2] = t.."^("..t.."^[transformR270^(mcl_stairs_turntexture.png^[transformR90)^[makealpha:255,0,255)" - inner_tiles[3] = t - elseif stairtiles == nil or stairtiles == "default" then - outer_tiles = node_def.tiles - inner_tiles = node_def.tiles - else + if stairtiles ~= nil and stairtiles ~= "default" and stairtiles ~= "woodlike" then outer_tiles = stairtiles[1] inner_tiles = stairtiles[2] end + if inner_tiles == nil then inner_tiles = node_def.tiles end + if outer_tiles == nil then outer_tiles = node_def.tiles end local outer_groups = table.copy(node_def.groups) outer_groups.not_in_creative_inventory = 1 local inner_groups = table.copy(outer_groups) diff --git a/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr b/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr index 8b53d8d13..3f68f1a92 100644 --- a/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr +++ b/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr @@ -39,8 +39,8 @@ Double Diorite Slab=Doppeldioritplatte Cobblestone Stairs=Kopfsteinpflastertreppe Cobblestone Slab=Kopfsteinpflasterplatte Double Cobblestone Slab=Doppelkopfsteinpflasterplatte -Mossy Cobblestone Slab=Moosige Kopfsteinpflasterplatte Mossy Cobblestone Stairs=Moosige Kopfsteinpflastertreppe +Mossy Cobblestone Slab=Moosige Kopfsteinpflasterplatte Double Mossy Cobblestone Slab=Doppelte moosige Kopfsteinpflasterplatte Brick Stairs=Ziegeltreppe Brick Slab=Ziegelplatte @@ -69,8 +69,8 @@ Double Smooth Quartz Slab=Doppelte glatte Quarzplatte Nether Brick Stairs=Netherziegeltreppe Nether Brick Slab=Netherziegelplatte Double Nether Brick Slab=Doppelte Netherziegelplatte -Red Nether Brick Stairs=Rote Netherbricktreppe -Red Nether Brick Slab=Rote Netherbrickplatte +Red Nether Brick Stairs=Rote Netherziegeltreppe +Red Nether Brick Slab=Rote Netherziegelplatte Double Red Nether Brick Slab=Doppelte rote Netherbricktreppe End Stone Brick Stairs=Endsteinziegeltreppe End Stone Brick Slab=Endsteinziegelplatte @@ -99,3 +99,6 @@ Polished Diorite Stairs=Polierte Diorittreppe Mossy Stone Brick Stairs=Moosige Steinziegeltreppe Mossy Stone Brick Slab=Moosige Steinziegelplatte Double Mossy Stone Brick Slab=Doppelte moosige Steinziegelplatte +Mud Brick Stair= +Mud Brick Slab= +Double Mud Brick Slab= diff --git a/mods/ITEMS/mcl_stairs/register.lua b/mods/ITEMS/mcl_stairs/register.lua index b59880e48..e254d4977 100644 --- a/mods/ITEMS/mcl_stairs/register.lua +++ b/mods/ITEMS/mcl_stairs/register.lua @@ -1,10 +1,39 @@ -- Register all Minecraft stairs and slabs --- Note about hardness: For some reason, the hardness of slabs and stairs don't always match nicely, so that some --- slabs actually take slightly longer to be dug than their stair counterparts. --- Note sure if it is a good idea to preserve this oddity. local S = minetest.get_translator(minetest.get_current_modname()) +-- Cut Sandstone Stairs do not exist, and register_stair_and_slab does not allow multiple recipes +-- (e.g. using group:node) if we try to copy the properties of the node at the same parameter. +-- The missing recipes can be added separately via these: +function mcl_stairs.register_craft_stairs(subname, recipeitem) + minetest.register_craft({ + output = "mcl_stairs:stair_" .. subname .. " 4", + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + -- Flipped recipe + minetest.register_craft({ + output = "mcl_stairs:stair_" .. subname .. " 4", + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + +function mcl_stairs.register_craft_slab(subname, recipeitem) + minetest.register_craft({ + output = "mcl_stairs:slab_" .. subname .. " 6", + recipe = { + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + local woods = { { "wood", "default_wood.png", S("Oak Wood Stairs"), S("Oak Wood Slab"), S("Double Oak Wood Slab") }, { "junglewood", "default_junglewood.png", S("Jungle Wood Stairs"), S("Jungle Wood Slab"), S("Double Jungle Wood Slab") }, @@ -20,13 +49,13 @@ for w=1, #woods do {handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {wood[2]}, wood[3], - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab(wood[1], "mcl_core:"..wood[1], {handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {wood[2]}, wood[4], - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, wood[5]) end @@ -47,7 +76,7 @@ mcl_stairs.register_slab("stone", "mcl_core:stone_smooth", {pickaxey=1, material_stone=1}, {"mcl_stairs_stone_slab_top.png", "mcl_stairs_stone_slab_top.png", "mcl_stairs_stone_slab_side.png"}, S("Polished Stone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Polished Stone Slab")) mcl_stairs.register_stair("andesite", "mcl_core:andesite", @@ -86,118 +115,95 @@ mcl_stairs.register_slab("diorite", "mcl_core:diorite", mcl_sounds.node_sound_stone_defaults(), 6, 2, S("Double Diorite Slab")) -mcl_stairs.register_stair("cobble", "mcl_core:cobble", +mcl_stairs.register_stair_and_slab("cobble", "mcl_core:cobble", {pickaxey=1, material_stone=1}, {"default_cobble.png"}, S("Cobblestone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("cobble", "mcl_core:cobble", - {pickaxey=1, material_stone=1}, - {"default_cobble.png"}, S("Cobblestone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Cobblestone Slab")) -mcl_stairs.register_stair("mossycobble", "mcl_core:mossycobble", +mcl_stairs.register_stair_and_slab("mossycobble", "mcl_core:mossycobble", {pickaxey=1, material_stone=1}, {"default_mossycobble.png"}, S("Mossy Cobblestone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("mossycobble", "mcl_core:mossycobble", - {pickaxey=1, material_stone=1}, - {"default_mossycobble.png"}, S("Mossy Cobblestone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Mossy Cobblestone Slab")) -mcl_stairs.register_stair("brick_block", "mcl_core:brick_block", +mcl_stairs.register_stair_and_slab("brick_block", "mcl_core:brick_block", {pickaxey=1, material_stone=1}, {"default_brick.png"}, S("Brick Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("brick_block", "mcl_core:brick_block", - {pickaxey=1, material_stone=1}, - {"default_brick.png"}, S("Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Brick Slab")) -mcl_stairs.register_stair("sandstone", "mcl_core:sandstone", +mcl_stairs.register_stair_and_slab("sandstone", "mcl_core:sandstone", {pickaxey=1, material_stone=1}, {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"}, S("Sandstone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8, - nil, "mcl_core:sandstone") --fixme: extra parameter from previous release -mcl_stairs.register_slab("sandstone", "mcl_core:sandstone", - {pickaxey=1, material_stone=1}, - {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"}, S("Sandstone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Sandstone Slab"), "mcl_core:sandstone") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Sandstone Slab")) +mcl_stairs.register_craft_stairs("sandstone", "mcl_core:sandstonesmooth") -- Comment this line out if Cut Sandstone Stairs are implemented +mcl_stairs.register_craft_stairs("sandstone", "mcl_core:sandstonecarved") +mcl_stairs.register_craft_slab("sandstone", "mcl_core:sandstonecarved") -mcl_stairs.register_stair("sandstonesmooth2", "mcl_core:sandstonesmooth2", - {pickaxey=1, material_stone=1}, - {"mcl_core_sandstone_top.png"}, - S("Smooth Sandstone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("sandstonesmooth2", "mcl_core:sandstonesmooth2", - {pickaxey=1, material_stone=1}, - {"mcl_core_sandstone_top.png"}, - S("Smooth Sandstone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Smooth Sandstone Slab")) +-- mcl_stairs.register_stair_and_slab("sandstonesmooth", "mcl_core:sandstonesmooth", +-- {pickaxey=1, material_stone=1}, +-- {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_smooth.png"}, +-- S("Cut Sandstone Stairs"), S("Cut Sandstone Slab"), +-- mcl_sounds.node_sound_stone_defaults(), nil, nil, +-- S("Double Cut Sandstone Slab")) -mcl_stairs.register_stair("redsandstone", "mcl_core:redsandstone", +mcl_stairs.register_stair_and_slab_simple("sandstonesmooth2", "mcl_core:sandstonesmooth2", S("Smooth Sandstone Stairs"), S("Smooth Sandstone Slab"), S("Double Smooth Sandstone Slab")) + +mcl_stairs.register_stair_and_slab("redsandstone", "mcl_core:redsandstone", {pickaxey=1, material_stone=1}, {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_normal.png"}, S("Red Sandstone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8, - nil, "mcl_core:redsandstone") --fixme: extra parameter from previous release -mcl_stairs.register_slab("redsandstone", "mcl_core:redsandstone", - {pickaxey=1, material_stone=1}, - {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_normal.png"}, S("Red Sandstone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Red Sandstone Slab"), "mcl_core:redsandstone") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Red Sandstone Slab")) +mcl_stairs.register_craft_stairs("redsandstone", "mcl_core:redsandstonesmooth") -- Comment this line out if Cut Red Sandstone Stairs are implemented +mcl_stairs.register_craft_stairs("redsandstone", "mcl_core:redsandstonecarved") +mcl_stairs.register_craft_slab("redsandstone", "mcl_core:redsandstonecarved") -mcl_stairs.register_stair("redsandstonesmooth2", "mcl_core:redsandstonesmooth2", - {pickaxey=1, material_stone=1}, - {"mcl_core_red_sandstone_top.png"}, - S("Smooth Red Sandstone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("redsandstonesmooth2", "mcl_core:redsandstonesmooth2", - {pickaxey=1, material_stone=1}, - {"mcl_core_red_sandstone_top.png"}, - S("Smooth Red Sandstone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Smooth Red Sandstone Slab")) +-- mcl_stairs.register_stair_and_slab("redsandstonesmooth", "mcl_core:redsandstonesmooth", +-- {pickaxey=1, material_stone=1}, +-- {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_smooth.png"}, +-- S("Cut Red Sandstone Stairs"), S("Cut Red Sandstone Slab"), +-- mcl_sounds.node_sound_stone_defaults(), nil, nil, +-- S("Double Cut Red Sandstone Slab")) + +mcl_stairs.register_stair_and_slab_simple("redsandstonesmooth2", "mcl_core:redsandstonesmooth2", S("Smooth Red Sandstone Stairs"), S("Smooth Red Sandstone Slab"), S("Double Smooth Red Sandstone Slab")) -- Intentionally not group:stonebrick because of mclx_stairs mcl_stairs.register_stair("stonebrick", "mcl_core:stonebrick", {pickaxey=1, material_stone=1}, {"default_stone_brick.png"}, S("Stone Bricks Stairs"), - mcl_sounds.node_sound_stone_defaults(), 6, 1.5, - nil, "mcl_core:stonebrick") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + nil) mcl_stairs.register_slab("stonebrick", "mcl_core:stonebrick", {pickaxey=1, material_stone=1}, {"default_stone_brick.png"}, S("Stone Bricks Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Stone Bricks Slab"), "mcl_core:stonebrick") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Stone Bricks Slab")) -mcl_stairs.register_stair("quartzblock", "mcl_nether:quartz_block", +mcl_stairs.register_stair_and_slab("quartzblock", "mcl_nether:quartz_block", {pickaxey=1, material_stone=1}, {"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"}, S("Quartz Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8, - nil, "mcl_nether:quartz_block") --fixme: extra parameter from previous release -mcl_stairs.register_slab("quartzblock", "mcl_nether:quartz_block", - {pickaxey=1, material_stone=1}, - {"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"}, S("Quartz Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Quartz Slab"), "mcl_nether:quartz_block") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Quartz Slab")) +mcl_stairs.register_craft_stairs("quartzblock", "mcl_nether:quartz_pillar") +mcl_stairs.register_craft_stairs("quartzblock", "mcl_nether:quartz_chiseled") +mcl_stairs.register_craft_slab("quartzblock", "mcl_nether:quartz_pillar") +mcl_stairs.register_craft_slab("quartzblock", "mcl_nether:quartz_chiseled") mcl_stairs.register_stair("quartz_smooth", "mcl_nether:quartz_smooth", {pickaxey=1, material_stone=1}, @@ -216,14 +222,14 @@ mcl_stairs.register_stair_and_slab("nether_brick", "mcl_nether:nether_brick", {"mcl_nether_nether_brick.png"}, S("Nether Brick Stairs"), S("Nether Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Nether Brick Slab"), nil) mcl_stairs.register_stair_and_slab("red_nether_brick", "mcl_nether:red_nether_brick", {pickaxey=1, material_stone=1}, {"mcl_nether_red_nether_brick.png"}, S("Red Nether Brick Stairs"), S("Red Nether Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Red Nether Brick Slab"), nil) mcl_stairs.register_stair_and_slab("end_bricks", "mcl_end:end_bricks", @@ -234,18 +240,15 @@ mcl_stairs.register_stair_and_slab("end_bricks", "mcl_end:end_bricks", mcl_sounds.node_sound_stone_defaults(), 6, 2, S("Double End Stone Brick Slab"), nil) -mcl_stairs.register_stair("purpur_block", "mcl_end:purpur_block", +mcl_stairs.register_stair_and_slab("purpur_block", "mcl_end:purpur_block", {pickaxey=1, material_stone=1}, {"mcl_end_purpur_block.png"}, S("Purpur Stairs"), - mcl_sounds.node_sound_stone_defaults(), 6, 1.5, - nil) -mcl_stairs.register_slab("purpur_block", "mcl_end:purpur_block", - {pickaxey=1, material_stone=1}, - {"mcl_end_purpur_block.png"}, S("Purpur Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Purpur Slab")) +mcl_stairs.register_craft_stairs("purpur_block", "mcl_end:purpur_pillar") +mcl_stairs.register_craft_slab("purpur_block", "mcl_end:purpur_pillar") mcl_stairs.register_stair("prismarine", "mcl_ocean:prismarine", {pickaxey=1, material_stone=1}, @@ -263,20 +266,20 @@ mcl_stairs.register_slab("prismarine", "mcl_ocean:prismarine", mcl_stairs.register_stair("prismarine_brick", "mcl_ocean:prismarine_brick", {pickaxey=1, material_stone=1}, {"mcl_ocean_prismarine_bricks.png"}, - S("prismarine Brick Stairs"), + S("Prismarine Brick Stairs"), mcl_sounds.node_sound_stone_defaults(), 6, 1.5, nil) mcl_stairs.register_slab("prismarine_brick", "mcl_ocean:prismarine_brick", {pickaxey=1, material_stone=1}, {"mcl_ocean_prismarine_bricks.png"}, - S("prismarine Brick Slab"), + S("Prismarine Brick Slab"), mcl_sounds.node_sound_stone_defaults(), 6, 2, S("Double prismarine_brick Slab")) mcl_stairs.register_stair("prismarine_dark", "mcl_ocean:prismarine_dark", {pickaxey=1, material_stone=1}, {"mcl_ocean_prismarine_dark.png"}, - S("prismarine Brick Stairs"), + S("Prismarine Brick Stairs"), mcl_sounds.node_sound_stone_defaults(), 6, 1.5, nil) mcl_stairs.register_slab("prismarine_dark", "mcl_ocean:prismarine_dark", @@ -298,52 +301,52 @@ mcl_stairs.register_slab("andesite_smooth", "mcl_core:andesite_smooth", {pickaxey=1}, {"mcl_core_andesite_smooth.png", "mcl_core_andesite_smooth.png", "mcl_stairs_andesite_smooth_slab.png"}, S("Polished Andesite Slab"), - nil, 6, nil, + nil, nil, nil, S("Double Polished Andesite Slab")) mcl_stairs.register_stair("andesite_smooth", "mcl_core:andesite_smooth", {pickaxey=1}, {"mcl_stairs_andesite_smooth_slab.png", "mcl_core_andesite_smooth.png", "mcl_core_andesite_smooth.png", "mcl_core_andesite_smooth.png", "mcl_core_andesite_smooth.png", "mcl_stairs_andesite_smooth_slab.png"}, S("Polished Andesite Stairs"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_slab("granite_smooth", "mcl_core:granite_smooth", {pickaxey=1}, {"mcl_core_granite_smooth.png", "mcl_core_granite_smooth.png", "mcl_stairs_granite_smooth_slab.png"}, S("Polished Granite Slab"), - nil, 6, nil, + nil, nil, nil, S("Double Polished Granite Slab")) mcl_stairs.register_stair("granite_smooth", "mcl_core:granite_smooth", {pickaxey=1}, {"mcl_stairs_granite_smooth_slab.png", "mcl_core_granite_smooth.png", "mcl_core_granite_smooth.png", "mcl_core_granite_smooth.png", "mcl_core_granite_smooth.png", "mcl_stairs_granite_smooth_slab.png"}, S("Polished Granite Stairs"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_slab("diorite_smooth", "mcl_core:diorite_smooth", {pickaxey=1}, {"mcl_core_diorite_smooth.png", "mcl_core_diorite_smooth.png", "mcl_stairs_diorite_smooth_slab.png"}, S("Polished Diorite Slab"), - nil, 6, nil, + nil, nil, nil, S("Double Polished Diorite Slab")) mcl_stairs.register_stair("diorite_smooth", "mcl_core:diorite_smooth", {pickaxey=1}, {"mcl_stairs_diorite_smooth_slab.png", "mcl_core_diorite_smooth.png", "mcl_core_diorite_smooth.png", "mcl_core_diorite_smooth.png", "mcl_core_diorite_smooth.png", "mcl_stairs_diorite_smooth_slab.png"}, S("Polished Diorite Stairs"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("stonebrickmossy", "mcl_core:stonebrickmossy", {pickaxey=1}, {"mcl_core_stonebrick_mossy.png"}, S("Mossy Stone Brick Stairs"), - mcl_sounds.node_sound_stone_defaults(), 6, 1.5, + mcl_sounds.node_sound_stone_defaults(), nil, nil, nil) mcl_stairs.register_slab("stonebrickmossy", "mcl_core:stonebrickmossy", {pickaxey=1}, {"mcl_core_stonebrick_mossy.png"}, S("Mossy Stone Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Mossy Stone Brick Slab"), "mcl_core:stonebrickmossy") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Mossy Stone Brick Slab")) diff --git a/mods/ITEMS/mcl_stonecutter/init.lua b/mods/ITEMS/mcl_stonecutter/init.lua index 0b2f6f166..2bba9528a 100644 --- a/mods/ITEMS/mcl_stonecutter/init.lua +++ b/mods/ITEMS/mcl_stonecutter/init.lua @@ -279,7 +279,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) for field_name, value in pairs(fields) do if field_name ~= "scroll" then local itemname = fieldname_to_itemname(field_name) - player:get_meta():set_string("mcl_stonecutter:selected", itemname) set_selected_item(player, itemname) update_stonecutter_slots(player) mcl_stonecutter.show_stonecutter_form(player) diff --git a/mods/ITEMS/mcl_sus_stew/locale/mcl_sus_stew.de.tr b/mods/ITEMS/mcl_sus_stew/locale/mcl_sus_stew.de.tr new file mode 100644 index 000000000..afd4bb556 --- /dev/null +++ b/mods/ITEMS/mcl_sus_stew/locale/mcl_sus_stew.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_sus_stew +Suspicious Stew=Ominöse Suppe diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 4d7be3125..a839611b9 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -116,6 +116,7 @@ minetest.register_node("mcl_tnt:tnt", { local TNT = { -- Static definition physical = true, -- Collides with things + collide_with_objects = false, --weight = -100, collisionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, visual = "cube", diff --git a/mods/ITEMS/mclx_stairs/init.lua b/mods/ITEMS/mclx_stairs/init.lua index effa87f13..65dd59431 100644 --- a/mods/ITEMS/mclx_stairs/init.lua +++ b/mods/ITEMS/mclx_stairs/init.lua @@ -22,13 +22,13 @@ for b=1, #barks do {handy=1,axey=1, flammable=3, bark_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, {minetest.registered_nodes[id].tiles[3]}, bark[2], - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab(sub, id, {handy=1,axey=1, flammable=3, bark_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, {minetest.registered_nodes[id].tiles[3]}, bark[3], - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, bark[4]) end @@ -42,7 +42,7 @@ mcl_stairs.register_stair("lapisblock", "mcl_core:lapisblock", {pickaxey=3}, {"mcl_stairs_lapis_block_slab.png", "mcl_core_lapis_block.png", "mcl_core_lapis_block.png", "mcl_core_lapis_block.png", "mcl_core_lapis_block.png", "mcl_stairs_lapis_block_slab.png"}, S("Lapis Lazuli Stairs"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_slab("goldblock", "mcl_core:goldblock", @@ -55,7 +55,7 @@ mcl_stairs.register_stair("goldblock", "mcl_core:goldblock", {pickaxey=4}, {"mcl_stairs_gold_block_slab.png", "default_gold_block.png", "default_gold_block.png", "default_gold_block.png", "default_gold_block.png", "mcl_stairs_gold_block_slab.png"}, S("Stairs of Gold"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_slab("ironblock", "mcl_core:ironblock", @@ -68,21 +68,21 @@ mcl_stairs.register_stair("ironblock", "mcl_core:ironblock", {pickaxey=2}, {"mcl_stairs_iron_block_slab.png", "default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "mcl_stairs_iron_block_slab.png"}, S("Stairs of Iron"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("stonebrickcracked", "mcl_core:stonebrickcracked", {pickaxey=1}, {"mcl_core_stonebrick_cracked.png"}, S("Cracked Stone Brick Stairs"), - mcl_sounds.node_sound_stone_defaults(), 6, 1.5, + mcl_sounds.node_sound_stone_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab("stonebrickcracked", "mcl_core:stonebrickcracked", {pickaxey=1}, {"mcl_core_stonebrick_cracked.png"}, S("Cracked Stone Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Cracked Stone Brick Slab")) local block = {} diff --git a/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr b/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr new file mode 100644 index 000000000..83eec629f --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr @@ -0,0 +1,22 @@ +# textdomain: mcl_hollow_logs +Hollow Acacia Log=Ausgehöhlter Akazienstamm +Hollow Birch Log= +Hollow Cherry Log=Ausgehöhlter Kirschstamm +Hollow Birch Log=Hohler Birkenstamm +Hollow Dark Oak Log=Hohler Schwarzeichenstamm +Hollow Spruce Log=Hohler Fichtenstamm +Hollow Oak Log= +Hollow Spruce Log= +Hollow Crimson Stem=Ausgehöhlter Karmesinholzstamm +Hollow Warped Stem=Ausgehöhlter Dschungelbaumstamm +Hollow Jungle Log=Ausgehöhlter Dschungelbaumstamm +Stripped Hollow Acacia Log= +Stripped Hollow Birch Log= +Stripped Hollow Cherry Log= +Stripped Hollow Dark Oak Log= +Stripped Hollow Jungle Log= +Stripped Hollow Mangrove Log= +Stripped Hollow Oak Log= +Stripped Hollow Spruce Log=Entrindeter ausgehöhlter Fichtenstamm +Stripped Hollow Crimson Stem= +Stripped Hollow Warped Stem= diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index b3b825071..9ac37eac5 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -19,8 +19,6 @@ local mg_seed = minetest.get_mapgen_setting("seed") -- Some mapgen settings local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true" -local generate_fallen_logs = minetest.settings:get_bool("mcl_generate_fallen_logs", false) - local mod_mcl_structures = minetest.get_modpath("mcl_structures") local mod_mcl_core = minetest.get_modpath("mcl_core") local mod_mcl_mushrooms = minetest.get_modpath("mcl_mushrooms") @@ -4027,7 +4025,7 @@ local function register_decorations() rotation = "random", }) minetest.register_decoration({ - name = "mcl_biomes:mangrove_tree_4", + name = "mcl_biomes:mangrove_tree_5", deco_type = "schematic", place_on = {"mcl_mud:mud"}, sidelen = 80, @@ -4040,6 +4038,7 @@ local function register_decorations() rotation = "random", }) minetest.register_decoration({ + name = "mcl_biomes:mangrove_bee_nest", deco_type = "schematic", place_on = {"mcl_mud:mud"}, sidelen = 80, @@ -4655,9 +4654,9 @@ local function register_decorations() place_on = {"group:sand"}, sidelen = 16, noise_params = { - offset = -0.012, + offset = -0.01, scale = 0.024, - spread = {x = 100, y = 100, z = 100}, + spread = vector.new(100, 100, 100), seed = 257, octaves = 3, persist = 0.6 @@ -4671,6 +4670,9 @@ local function register_decorations() "MesaPlateauFM", "MesaPlateauFM_sandlevel"}, height = 1, height_max = 3, + spawn_by = "air", + check_offset = 1, + num_spawn_by = 16 }) -- Sugar canes @@ -4967,170 +4969,6 @@ local function register_decorations() register_doubletall_grass(-0.0005, -0.3, {"BambooJungle", "BambooJungleM", "BambooJungleEdge"}) register_grass_decoration("tallgrass", -0.03, 1, {"BambooJungle", "BambooJungleM", "BambooJungleEdge"}) - ----------------- - -- Fallen logs - -- These fallen logs are not really good yet. They must be longer and also have one upright block. - -- Note the decortion API does not like wide schematics, they are likely to overhang. - if generate_fallen_logs then - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block_no_snow", "mcl_core:podzol", "mcl_core:coarse_dirt"}, - sidelen = 80, - noise_params = { - offset = 0.00018, - scale = 0.00011, - spread = {x = 250, y = 250, z = 250}, - seed = 2, - octaves = 3, - persist = 0.66 - }, - biomes = {"MegaTaiga", "MegaSpruceTaiga", "Taiga"}, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:sprucetree", param2 = 12, prob = 127}, - {name = "mcl_core:sprucetree", param2 = 12}, - {name = "mcl_core:sprucetree", param2 = 12}, - {name = "air", prob = 0}, - {name = "mcl_mushrooms:mushroom_brown", prob = 160}, - {name = "mcl_mushrooms:mushroom_red", prob = 160}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block", "mcl_core:podzol", "mcl_core:podzol_snow", "mcl_core:coarse_dirt"}, - sidelen = 80, - noise_params = { - offset = 0.00018, - scale = 0.00011, - spread = {x = 250, y = 250, z = 250}, - seed = 2, - octaves = 3, - persist = 0.66 - }, - biomes = {"ColdTaiga"}, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:sprucetree", param2 = 12, prob = 127}, - {name = "mcl_core:sprucetree", param2 = 12}, - {name = "mcl_core:sprucetree", param2 = 12}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block_no_snow"}, - sidelen = 16, - noise_params = { - offset = 0.0, - scale = -0.00008, - spread = {x = 250, y = 250, z = 250}, - seed = 2, - octaves = 3, - persist = 0.66 - }, - biomes = {"BirchForest", "BirchForestM", }, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:birchtree", param2 = 12}, - {name = "mcl_core:birchtree", param2 = 12}, - {name = "mcl_core:birchtree", param2 = 12, prob = 127}, - {name = "mcl_mushrooms:mushroom_red", prob = 100}, - {name = "mcl_mushrooms:mushroom_brown", prob = 10}, - {name = "air", prob = 0}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, - sidelen = 80, - fill_ratio = 0.005, - biomes = {"Jungle", "JungleM"}, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:jungletree", param2 = 12}, - {name = "mcl_core:jungletree", param2 = 12}, - {name = "mcl_core:jungletree", param2 = 12, prob = 127}, - {name = "air", prob = 0}, - {name = "mcl_mushrooms:mushroom_brown", prob = 50}, - {name = "air", prob = 0}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block_no_snow"}, - sidelen = 16, - noise_params = { - offset = 0.00018, - scale = 0.00011, - spread = {x = 250, y = 250, z = 250}, - seed = 2, - octaves = 3, - persist = 0.66 - }, - biomes = {"Forest"}, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:tree", param2 = 12, prob = 127}, - {name = "mcl_core:tree", param2 = 12}, - {name = "mcl_core:tree", param2 = 12}, - {name = "air", prob = 0}, - {name = "mcl_mushrooms:mushroom_brown", prob = 96}, - {name = "mcl_mushrooms:mushroom_red", prob = 96}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - end - -- Lily pad local lily_schem = { @@ -6099,6 +5937,9 @@ if mg_name ~= "singlenode" then minetest.get_decoration_id("mcl_biomes:mangrove_tree_1"), minetest.get_decoration_id("mcl_biomes:mangrove_tree_2"), minetest.get_decoration_id("mcl_biomes:mangrove_tree_3"), + minetest.get_decoration_id("mcl_biomes:mangrove_tree_4"), + minetest.get_decoration_id("mcl_biomes:mangrove_tree_5"), + minetest.get_decoration_id("mcl_biomes:mangrove_bee_nest"), } for _, f in pairs(deco_ids_fungus) do minetest.set_gen_notify({decoration = true}, {f}) @@ -6158,29 +5999,20 @@ if mg_name ~= "singlenode" then if not (maxp.y < mcl_vars.mg_overworld_min or minp.y > mcl_vars.mg_overworld_max) then local biomemap = minetest.get_mapgen_object("biomemap") - --minetest.log("mangrove stuff: " .. dump(biomemap)) local swamp_biome_id = minetest.get_biome_id("MangroveSwamp") local swamp_shore_id = minetest.get_biome_id("MangroveSwamp_shore") local is_swamp = table.indexof(biomemap, swamp_biome_id) ~= -1 local is_swamp_shore = table.indexof(biomemap, swamp_shore_id) ~= -1 - if is_swamp or is_swamp_shore then - --minetest.log("Mangrove swamp biomes...") - --minetest.log("is_swamp: " .. dump(is_swamp)) - --minetest.log("is_swamp_shore: " .. dump(is_swamp_shore)) mangrove_roots_gen(gennotify, pr) - else - --minetest.log("is not mangrove swamp biomes...") end end if not (maxp.y < mcl_vars.mg_end_min or minp.y > mcl_vars.mg_end_max) then - --minetest.log("chorus stuff") chorus_gen(gennotify, pr) end if not (maxp.y < mcl_vars.mg_nether_min or minp.y > mcl_vars.mg_nether_max) then - --minetest.log("nether stuff") crimson_warped_gen(gennotify) end end) diff --git a/mods/MAPGEN/mcl_dungeons/init.lua b/mods/MAPGEN/mcl_dungeons/init.lua index 479052d2c..b9a7a270a 100644 --- a/mods/MAPGEN/mcl_dungeons/init.lua +++ b/mods/MAPGEN/mcl_dungeons/init.lua @@ -3,11 +3,8 @@ mcl_dungeons = {} local mg_name = minetest.get_mapgen_setting("mg_name") - -- Are dungeons disabled? -if mcl_vars.mg_dungeons == false or mg_name == "singlenode" then - return -end +if mcl_vars.mg_dungeons == false or mg_name == "singlenode" then return end --lua locals --minetest @@ -19,6 +16,7 @@ local get_meta = minetest.get_meta local emerge_area = minetest.emerge_area --vector +local vector_new = vector.new local vector_add = vector.add local vector_subtract = vector.subtract @@ -43,24 +41,17 @@ local max_y = mcl_vars.mg_overworld_max - 1 local attempts = math_ceil(((mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE) ^ 3) / 8192) -- 63 = 80*80*80/8192 local dungeonsizes = { - { x=5, y=4, z=5}, - { x=5, y=4, z=7}, - { x=7, y=4, z=5}, - { x=7, y=4, z=7}, + vector_new(5, 4, 5), + vector_new(5, 4, 7), + vector_new(7, 4, 5), + vector_new(7, 4, 7), } ---[[local dirs = { - { x= 1, y=0, z= 0 }, - { x= 0, y=0, z= 1 }, - { x=-1, y=0, z= 0 }, - { x= 0, y=0, z=-1 }, -}]] - local surround_vectors = { - { x=-1, y=0, z=0 }, - { x=1, y=0, z=0 }, - { x=0, y=0, z=-1 }, - { x=0, y=0, z=1 }, + vector_new(-1, 0, 0), + vector_new( 1, 0, 0), + vector_new( 0, 0, -1), + vector_new( 0, 0, 1), } local loottable = @@ -138,8 +129,8 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) if check then for tx = x+1, x+dim.x do for tz = z+1, z+dim.z do - local fdef = registered_nodes[get_node({x = tx, y = y_floor , z = tz}).name] - local cdef = registered_nodes[get_node({x = tx, y = y_ceiling, z = tz}).name] + local fdef = registered_nodes[get_node(vector_new(tx, y_floor , tz)).name] + local cdef = registered_nodes[get_node(vector_new(tx, y_ceiling, tz)).name] if not fdef or not fdef.walkable or not cdef or not cdef.walkable then return false end end end @@ -155,25 +146,25 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) local x2,z2 = x+dim.x+1, z+dim.z+1 - if get_node({x=x, y=y+1, z=z}).name == "air" and get_node({x=x, y=y+2, z=z}).name == "air" then + if get_node(vector_new(x, y+1, z)).name == "air" and get_node(vector_new(x, y+2, z)).name == "air" then openings_counter = openings_counter + 1 if not openings[x] then openings[x]={} end openings[x][z] = true table_insert(corners, {x=x, z=z}) end - if get_node({x=x2, y=y+1, z=z}).name == "air" and get_node({x=x2, y=y+2, z=z}).name == "air" then + if get_node(vector_new(x2, y+1, z)).name == "air" and get_node(vector_new(x2, y+2, z)).name == "air" then openings_counter = openings_counter + 1 if not openings[x2] then openings[x2]={} end openings[x2][z] = true table_insert(corners, {x=x2, z=z}) end - if get_node({x=x, y=y+1, z=z2}).name == "air" and get_node({x=x, y=y+2, z=z2}).name == "air" then + if get_node(vector_new(x, y+1, z2)).name == "air" and get_node(vector_new(x, y+2, z2)).name == "air" then openings_counter = openings_counter + 1 if not openings[x] then openings[x]={} end openings[x][z2] = true table_insert(corners, {x=x, z=z2}) end - if get_node({x=x2, y=y+1, z=z2}).name == "air" and get_node({x=x2, y=y+2, z=z2}).name == "air" then + if get_node(vector_new(x2, y+1, z2)).name == "air" and get_node(vector_new(x2, y+2, z2)).name == "air" then openings_counter = openings_counter + 1 if not openings[x2] then openings[x2]={} end openings[x2][z2] = true @@ -181,13 +172,13 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) end for wx = x+1, x+dim.x do - if get_node({x=wx, y=y+1, z=z}).name == "air" and get_node({x=wx, y=y+2, z=z}).name == "air" then + if get_node(vector_new(wx, y+1, z)).name == "air" and get_node(vector_new(wx, y+2, z)).name == "air" then openings_counter = openings_counter + 1 if check and openings_counter > 5 then return end if not openings[wx] then openings[wx]={} end openings[wx][z] = true end - if get_node({x=wx, y=y+1, z=z2}).name == "air" and get_node({x=wx, y=y+2, z=z2}).name == "air" then + if get_node(vector_new(wx, y+1, z2)).name == "air" and get_node(vector_new(wx, y+2, z2)).name == "air" then openings_counter = openings_counter + 1 if check and openings_counter > 5 then return end if not openings[wx] then openings[wx]={} end @@ -195,13 +186,13 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) end end for wz = z+1, z+dim.z do - if get_node({x=x, y=y+1, z=wz}).name == "air" and get_node({x=x, y=y+2, z=wz}).name == "air" then + if get_node(vector_new(x, y+1, wz)).name == "air" and get_node(vector_new(x, y+2, wz)).name == "air" then openings_counter = openings_counter + 1 if check and openings_counter > 5 then return end if not openings[x] then openings[x]={} end openings[x][wz] = true end - if get_node({x=x2, y=y+1, z=wz}).name == "air" and get_node({x=x2, y=y+2, z=wz}).name == "air" then + if get_node(vector_new(x2, y+1, wz)).name == "air" and get_node(vector_new(x2, y+2, wz)).name == "air" then openings_counter = openings_counter + 1 if check and openings_counter > 5 then return end if not openings[x2] then openings[x2]={} end @@ -243,7 +234,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) -- Check conditions. If okay, start generating if check and (openings_counter < 1 or openings_counter > 5) then return end - minetest.log("action","[mcl_dungeons] Placing new dungeon at "..minetest.pos_to_string({x=x,y=y,z=z})) + minetest.log("action","[mcl_dungeons] Placing new dungeon at "..minetest.pos_to_string(vector_new(x, y, z))) -- Okay! Spawning starts! -- Remember spawner chest positions to set metadata later @@ -276,7 +267,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) local currentChest = 1 -- Calculate the mob spawner position, to be re-used for later - local sp = {x = x + math_ceil(dim.x/2), y = y+1, z = z + math_ceil(dim.z/2)} + local sp = vector_new(x + math_ceil(dim.x/2), y+1, z + math_ceil(dim.z/2)) local rn = registered_nodes[get_node(sp).name] if rn and rn.is_ground_content then table_insert(spawner_posses, sp) @@ -288,7 +279,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) for tx = x, maxx do for tz = z, maxz do for ty = y, maxy do - local p = {x = tx, y=ty, z=tz} + local p = vector_new(tx, ty, tz) -- Do not overwrite nodes with is_ground_content == false (e.g. bedrock) -- Exceptions: cobblestone and mossy cobblestone so neighborings dungeons nicely connect to each other @@ -327,7 +318,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) else if (ty==y+1) and (tx==x+1 or tx==maxx-1 or tz==z+1 or tz==maxz-1) and (currentChest < totalChests + 1) and (chestSlots[currentChest] == chestSlotCounter) then currentChest = currentChest + 1 - table_insert(chests, {x=tx, y=ty, z=tz}) + table_insert(chests, vector_new(tx, ty, tz)) else swap_node(p, {name = "air"}) end @@ -337,7 +328,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) -- Place next chest at the wall (if it was its chosen wall slot) if forChest and (currentChest < totalChests + 1) and (chestSlots[currentChest] == chestSlotCounter) then currentChest = currentChest + 1 - table_insert(chests, {x=tx, y=ty, z=tz}) + table_insert(chests, vector_new(tx, ty, tz)) -- else --swap_node(p, {name = "air"}) end @@ -411,8 +402,8 @@ local function dungeons_nodes(minp, maxp, blockseed) local x = pr:next(minp.x, maxp.x-dim.x-1) local y = pr:next(ymin , ymax -dim.y-1) local z = pr:next(minp.z, maxp.z-dim.z-1) - local p1 = {x=x,y=y,z=z} - local p2 = {x = x+dim.x+1, y = y+dim.y+1, z = z+dim.z+1} + local p1 = vector_new(x, y, z) + local p2 = vector_new(x+dim.x+1, y+dim.y+1, z+dim.z+1) minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2)) emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr}) end @@ -422,7 +413,7 @@ end function mcl_dungeons.spawn_dungeon(p1, _, pr) if not p1 or not pr or not p1.x or not p1.y or not p1.z then return end local dim = dungeonsizes[pr:next(1, #dungeonsizes)] - local p2 = {x = p1.x+dim.x+1, y = p1.y+dim.y+1, z = p1.z+dim.z+1} + local p2 = vector_new(p1.x+dim.x+1, p1.y+dim.y+1, p1.z+dim.z+1) minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2)) emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true}) end diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index dfea4f3ce..7f6413fb8 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -136,37 +136,6 @@ if string.len(mg_flags_str) > 0 then end minetest.set_mapgen_setting("mg_flags", mg_flags_str, true) -local function between(x, y, z) -- x is between y and z (inclusive) - return y <= x and x <= z -end - -local function in_cube(tpos,wpos1,wpos2) - local xmax=wpos2.x - local xmin=wpos1.x - - local ymax=wpos2.y - local ymin=wpos1.y - - local zmax=wpos2.z - local zmin=wpos1.z - if wpos1.x > wpos2.x then - xmax=wpos1.x - xmin=wpos2.x - end - if wpos1.y > wpos2.y then - ymax=wpos1.y - ymin=wpos2.y - end - if wpos1.z > wpos2.z then - zmax=wpos1.z - zmin=wpos2.z - end - if between(tpos.x,xmin,xmax) and between(tpos.y,ymin,ymax) and between(tpos.z,zmin,zmax) then - return true - end - return false -end - -- Helper function for converting a MC probability to MT, with -- regards to MapBlocks. -- Some MC generated structures are generated on per-chunk @@ -484,24 +453,20 @@ end -- This should be moved to mcl_structures eventually if the dependencies can be sorted out. mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blockseed) local gennotify = minetest.get_mapgen_object("gennotify") - local has_struct = {} local has = false local poshash = minetest.hash_node_position(minp) for _,struct in pairs(mcl_structures.registered_structures) do local pr = PseudoRandom(blockseed + 42) if struct.deco_id then for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do - local realpos = vector.offset(pos,0,1,0) - minetest.remove_node(realpos) - minetest.fix_light(vector.offset(pos,-1,-1,-1),vector.offset(pos,1,3,1)) if struct.chunk_probability == nil or (not has and pr:next(1,struct.chunk_probability) == 1 ) then - mcl_structures.place_structure(realpos,struct,pr,blockseed) + mcl_structures.place_structure(vector.offset(pos,0,1,0),struct,pr,blockseed) has=true end end elseif struct.static_pos then for _,p in pairs(struct.static_pos) do - if in_cube(p,minp,maxp) then + if vector.in_area(p,minp,maxp) then mcl_structures.place_structure(p,struct,pr,blockseed) end end diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index cf47b4e30..a76140e61 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -1,6 +1,5 @@ mcl_structures.registered_structures = {} -local place_queue = {} local disabled_structures = minetest.settings:get("mcl_disabled_structures") if disabled_structures then disabled_structures = disabled_structures:split(",") else disabled_structures = {} end @@ -216,17 +215,6 @@ local function foundation(ground_p1,ground_p2,pos,sidelen) minetest.bulk_set_node(stone,{name=node_stone}) end -local function process_queue() - if #place_queue < 1 then return end - local s = table.remove(place_queue) - mcl_structures.place_schematic(s.pos, s.file, s.rot, nil, true, "place_center_x,place_center_z",function(s) - if s.after_place then - s.after_place(s.pos,s.def,s.pr) - end - end,s.pr) - minetest.after(0.5,process_queue) -end - function mcl_structures.spawn_mobs(mob,spawnon,p1,p2,pr,n,water) n = n or 1 local sp = {} @@ -241,14 +229,14 @@ function mcl_structures.spawn_mobs(mob,spawnon,p1,p2,pr,n,water) sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon) end table.shuffle(sp) - for i,node in pairs(sp) do - if not peaceful and i <= n then - local pos = vector.offset(node,0,1,0) - if pos then - minetest.add_entity(pos,mob) - end + local count = 0 + local mob_def = minetest.registered_entities[mob] + local enabled = (not peaceful) or (mob_def and mob_def.spawn_class ~= "hostile") + for _,node in pairs(sp) do + if enabled and count < n and minetest.add_entity(vector.offset(node, 0, 1, 0), mob) then + count = count + 1 end - minetest.get_meta(node):set_string("spawnblock","yes") + minetest.get_meta(node):set_string("spawnblock", "yes") -- note: also in peaceful mode! end end @@ -337,43 +325,33 @@ function mcl_structures.place_structure(pos, def, pr, blockseed, rot) end end -function mcl_structures.register_structure(name,def,nospawn) --nospawn means it will be placed by another (non-nospawn) structure that contains it's structblock i.e. it will not be placed by mapgen directly - if mcl_structures.is_disabled(name) then return end - local structblock = "mcl_structures:structblock_"..name - local flags = "place_center_x, place_center_z, force_placement" - local y_offset = 0 - local sbgroups = { structblock = 1, not_in_creative_inventory=1 } - if def.flags then flags = def.flags end - def.name = name - if nospawn then - sbgroups.structblock = nil - sbgroups.structblock_lbm = 1 - else - if def.place_on then - minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered - def.deco = minetest.register_decoration({ - name = "mcl_structures:deco_"..name, - decoration = structblock, - deco_type = "simple", - place_on = def.place_on, - spawn_by = def.spawn_by, - num_spawn_by = def.num_spawn_by, - sidelen = 80, - fill_ratio = def.fill_ratio, - noise_params = def.noise_params, - flags = flags, - biomes = def.biomes, - y_max = def.y_max, - y_min = def.y_min - }) - minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups,sunlight_propagates = true,}) - def.structblock = structblock - def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) - minetest.set_gen_notify({decoration=true}, { def.deco_id }) - --catching of gennotify happens in mcl_mapgen_core +local EMPTY_SCHEMATIC = { size = {x = 0, y = 0, z = 0}, data = { } } - end) - end +function mcl_structures.register_structure(name,def,nospawn) --nospawn means it will not be placed by mapgen decoration mechanism + if mcl_structures.is_disabled(name) then return end + flags = def.flags or "place_center_x, place_center_z, force_placement" + def.name = name + if not nospawn and def.place_on then + minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered + def.deco = minetest.register_decoration({ + name = "mcl_structures:deco_"..name, + deco_type = "schematic", + schematic = EMPTY_SCHEMATIC, + place_on = def.place_on, + spawn_by = def.spawn_by, + num_spawn_by = def.num_spawn_by, + sidelen = 80, + fill_ratio = def.fill_ratio, + noise_params = def.noise_params, + flags = flags, + biomes = def.biomes, + y_max = def.y_max, + y_min = def.y_min + }) + def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) + minetest.set_gen_notify({decoration=true}, { def.deco_id }) + --catching of gennotify happens in mcl_mapgen_core + end) end mcl_structures.registered_structures[name] = def end @@ -393,7 +371,12 @@ function mcl_structures.register_structure_spawn(def) if active_object_count_wider > limit + mob_cap_animal then return end if active_object_count_wider > mob_cap_player then return end local p = vector.offset(pos,0,1,0) - if minetest.get_node(p).name ~= "air" then return end + local pname = minetest.get_node(p).name + if def.type_of_spawning == "water" then + if pname ~= "mcl_core:water_source" and pname ~= "mclx_core:river_water_source" then return end + else + if pname ~= "air" then return end + end if minetest.get_meta(pos):get_string("spawnblock") == "" then return end if mg_name ~= "v6" and mg_name ~= "singlenode" and def.biomes then if table.indexof(def.biomes,minetest.get_biome_name(minetest.get_biome_data(p).biome)) == -1 then @@ -407,16 +390,4 @@ function mcl_structures.register_structure_spawn(def) }) end ---lbm for secondary structures (structblock included in base structure) -minetest.register_lbm({ - name = "mcl_structures:struct_lbm", - run_at_every_load = true, - nodenames = {"group:structblock_lbm"}, - action = function(pos, node) - minetest.remove_node(pos) - local name = node.name:gsub("mcl_structures:structblock_","") - local def = mcl_structures.registered_structures[name] - if not def then return end - mcl_structures.place_structure(pos) - end -}) + diff --git a/mods/MAPGEN/mcl_structures/witch_hut.lua b/mods/MAPGEN/mcl_structures/witch_hut.lua index 5ac23b144..ed888db95 100644 --- a/mods/MAPGEN/mcl_structures/witch_hut.lua +++ b/mods/MAPGEN/mcl_structures/witch_hut.lua @@ -40,7 +40,7 @@ local function hut_placement_callback(pos,def,pr) end mcl_structures.register_structure("witch_hut",{ - place_on = {"group:sand","group:grass_block","mcl_core:water_source","group:dirt"}, + place_on = {"mcl_core:water_source","mclx_core:river_water_source"}, fill_ratio = 0.01, flags = "place_center_x, place_center_z, liquid_surface, force_placement", sidelen = 8, diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index eab33e78e..acd40ca0f 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -30,26 +30,21 @@ local function airtower(pos,tbl,h) end local function makelake(pos,size,liquid,placein,border,pr,noair) - local node_under = minetest.get_node(vector.offset(pos,0,-1,0)) - local p1 = vector.offset(pos,-size,-1,-size) - local p2 = vector.offset(pos,size,-1,size) - minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param) + local p1, p2 = vector.offset(pos,-size,-1,-size), vector.offset(pos,size,-1,size) + local e1, e2 = vector.offset(pos,-size,-2,-size), vector.offset(pos,size,15,size) + minetest.emerge_area(e1, e2, function(blockpos, action, calls_remaining, param) if calls_remaining ~= 0 then return end local nn = minetest.find_nodes_in_area(p1,p2,placein) - table.sort(nn,function(a, b) - return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b) - end) if not nn[1] then return end - local y = pos.y - pr:next(1,2) - local lq = {} - local air = {} + table.sort(nn,function(a, b) + return vector.distance(pos, a) < vector.distance(pos, b) + end) + local y = pos.y - 1 + local lq, air = {}, {} local r = pr:next(1,#nn) - if r > #nn then return end for i=1,r do - if nn[i].y == y then - airtower(nn[i],air,55) - table.insert(lq,nn[i]) - end + airtower(nn[i],air,20) + table.insert(lq,nn[i]) end minetest.bulk_set_node(lq,{name=liquid}) minetest.bulk_set_node(air,{name="air"}) @@ -59,7 +54,6 @@ local function makelake(pos,size,liquid,placein,border,pr,noair) for kk,vv in pairs(adjacents) do local pp = vector.add(v,vv) local an = minetest.get_node(pp) - local un = minetest.get_node(vector.offset(pp,0,1,0)) if not border then if minetest.get_item_group(an.name,"solid") > 0 then border = an.name @@ -72,9 +66,11 @@ local function makelake(pos,size,liquid,placein,border,pr,noair) end if not noair and an.name ~= liquid then table.insert(br,pp) + --[[ no need to have air above border: + local un = minetest.get_node(vector.offset(pp,0,1,0)) if un.name ~= liquid then - airtower(pp,air,55) - end + airtower(pp,air,20) + end]]-- end end end @@ -181,7 +177,7 @@ mcl_structures.register_structure("lavapool",{ persist = 0.001, flags = "absvalue", }, - flags = "place_center_x, place_center_z, force_placement", + flags = "place_center_x, place_center_z, all_floors", y_max = mcl_vars.mg_overworld_max, y_min = minetest.get_mapgen_setting("water_level"), place_func = function(pos,def,pr) @@ -201,7 +197,7 @@ mcl_structures.register_structure("water_lake",{ persist = 0.001, flags = "absvalue", }, - flags = "place_center_x, place_center_z, force_placement", + flags = "place_center_x, place_center_z, all_floors", y_max = mcl_vars.mg_overworld_max, y_min = minetest.get_mapgen_setting("water_level"), place_func = function(pos,def,pr) @@ -222,7 +218,7 @@ mcl_structures.register_structure("water_lake_mangrove_swamp",{ persist = 0.001, flags = "absvalue", }, - flags = "place_center_x, place_center_z, force_placement", + flags = "place_center_x, place_center_z, all_floors", y_max = mcl_vars.mg_overworld_max, y_min = minetest.get_mapgen_setting("water_level"), place_func = function(pos,def,pr) @@ -230,14 +226,6 @@ mcl_structures.register_structure("water_lake_mangrove_swamp",{ end }) -local pool_adjacents = { - vector.new(1,0,0), - vector.new(-1,0,0), - vector.new(0,-1,0), - vector.new(0,0,1), - vector.new(0,0,-1), -} - mcl_structures.register_structure("basalt_column",{ place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, terrain_feature = true, diff --git a/mods/MAPGEN/tsm_railcorridors/LICENSE.txt b/mods/MAPGEN/tsm_railcorridors/LICENSE.txt new file mode 100644 index 000000000..dbe77c028 --- /dev/null +++ b/mods/MAPGEN/tsm_railcorridors/LICENSE.txt @@ -0,0 +1,9 @@ +Copyright © 2023 Wuzzy, joz + +The MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/mods/MAPGEN/tsm_railcorridors/README.md b/mods/MAPGEN/tsm_railcorridors/README.md index 3b839573c..431122e1a 100644 --- a/mods/MAPGEN/tsm_railcorridors/README.md +++ b/mods/MAPGEN/tsm_railcorridors/README.md @@ -1,7 +1,7 @@ # Railway corridors [`tsm_railcorridors`] VoxeLibre adaption. NO TREASURER SUPPORT! -* Current version 0.14.0 +* Current version 0.14.5 Minetest mod for adding underground corridors with rails and wood constructions with a few treasure chests now and then. Optional support for the Treasurer mod is available for adding treasures from various mods. @@ -10,7 +10,7 @@ Cobwebs are added if the `mobs_monster` mod is found. Use the advanced settings to finetune the railway corridors. * Forum thread: https://forum.minetest.net/viewtopic.php?t=10339 -* License: MIT License. +* License: MIT License (see `LICENSE.txt`). ## Info for game makers Want to include this mod in a game, but you have problems with the dependencies? diff --git a/mods/MAPGEN/tsm_railcorridors/gameconfig.lua b/mods/MAPGEN/tsm_railcorridors/gameconfig.lua index 4a27586a2..9f924f00b 100644 --- a/mods/MAPGEN/tsm_railcorridors/gameconfig.lua +++ b/mods/MAPGEN/tsm_railcorridors/gameconfig.lua @@ -27,7 +27,7 @@ if mg_name == "v6" then } else -- This generates dark oak wood in mesa biomes and oak wood everywhere else. - function tsm_railcorridors.nodes.corridor_woods_function(pos, node) + function tsm_railcorridors.nodes.corridor_woods_function(_, node) if minetest.get_item_group(node.name, "hardened_clay") ~= 0 then return "mcl_core:darkwood", "mcl_fences:dark_oak_fence" else @@ -36,34 +36,42 @@ else end end +tsm_railcorridors.carts = { + "mcl_minecarts:minecart", "mcl_minecarts:minecart", + "mcl_minecarts:chest_minecart", "mcl_minecarts:chest_minecart", + "mcl_minecarts:tnt_minecart" +} --- TODO: Use minecart with chest instead of normal minecart -tsm_railcorridors.carts = { "mcl_minecarts:minecart" } +-- This is called after a spawner has been placed by the game. +-- Use this to properly set up the metadata and stuff. +-- This is needed for games if they include mob spawners. +-- All spawners spawn cave spiders +function tsm_railcorridors.on_construct_spawner(pos) + mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider", 0, 7) +end -function tsm_railcorridors.on_construct_cart(pos, cart) - -- TODO: Fill cart with treasures - -- This is it? There's this giant hack announced in - -- the other file and I grep for the function and it's - -- a stub? :) - - -- The path here using some minetest.after hackery was - -- deactivated in init.lua - reactivate when this does - -- something the function is called RecheckCartHack. +-- This is called after a cart has been placed by the game. +-- Use this to properly set up entity metadata and stuff. +-- * pos: Position of cart +-- * cart: Cart entity +function tsm_railcorridors.on_construct_cart(_, cart, pr_carts) + local l = cart:get_luaentity() + local inv = mcl_entity_invs.load_inv(l,27) + if inv then -- otherwise probably not a chest minecart + local items = tsm_railcorridors.get_treasures(pr_carts) + mcl_loot.fill_inventory(inv, "main", items, pr_carts) + mcl_entity_invs.save_inv(l) + end end -- Fallback function. Returns a random treasure. This function is called for chests -- only if the Treasurer mod is not found. -- pr: A PseudoRandom object -function tsm_railcorridors.get_default_treasure(pr) +function tsm_railcorridors.get_default_treasure(_) -- UNUSED IN MINECLONE 2! end --- All spawners spawn cave spiders -function tsm_railcorridors.on_construct_spawner(pos) - mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider", 0, 7) -end - -- MineClone 2's treasure function. Gets all treasures for a single chest. -- Based on information from Minecraft Wiki. function tsm_railcorridors.get_treasures(pr) diff --git a/mods/MAPGEN/tsm_railcorridors/init.lua b/mods/MAPGEN/tsm_railcorridors/init.lua index d68c58aa3..9895ab44c 100644 --- a/mods/MAPGEN/tsm_railcorridors/init.lua +++ b/mods/MAPGEN/tsm_railcorridors/init.lua @@ -10,8 +10,7 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/gameconfig.lua") local setting -- Probability function --- TODO: Check if this is correct -local function P(float) +local P = function (float) return math.floor(32767 * float) end @@ -27,8 +26,8 @@ elseif setting then end -- Minimal and maximal value of path length (forks don't look up this value) -local way_min = 4; -local way_max = 7; +local way_min = 4 +local way_max = 7 setting = tonumber(minetest.settings:get("tsm_railcorridors_way_min")) if setting then way_min = setting @@ -74,7 +73,7 @@ if setting then end -- Probability for a rail corridor system to be damaged -local probability_damage = P(1.0) +local probability_damage = P(0.55) setting = tonumber(minetest.settings:get("tsm_railcorridors_probability_damage")) if setting then probability_damage = P(setting) @@ -83,14 +82,14 @@ end -- Enable cobwebs local place_cobwebs = true setting = minetest.settings:get_bool("tsm_railcorridors_place_cobwebs") -if setting then +if setting ~= nil then place_cobwebs = setting end -- Enable mob spawners local place_mob_spawners = true setting = minetest.settings:get_bool("tsm_railcorridors_place_mob_spawners") -if setting then +if setting ~= nil then place_mob_spawners = setting end @@ -153,17 +152,17 @@ local function SetNodeIfCanBuild(pos, node, check_above, can_replace_rail) if check_above then local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name local abovedef = minetest.registered_nodes[abovename] - if abovename == "unknown" or abovename == "ignore" or - (abovedef and abovedef.groups and abovedef.groups.attached_node) or + if (not abovedef) or abovename == "unknown" or abovename == "ignore" or + (abovedef.groups and abovedef.groups.attached_node) or -- This is done because cobwebs are often fake liquids - (abovedef and abovedef.liquidtype ~= "none" and abovename ~= tsm_railcorridors.nodes.cobweb) then + (abovedef.liquidtype ~= "none" and abovename ~= tsm_railcorridors.nodes.cobweb) then return false end end local name = minetest.get_node(pos).name local def = minetest.registered_nodes[name] - if name ~= "unknown" and name ~= "ignore" and - ((def and def.is_ground_content and def.liquidtype == "none") or + if name ~= "unknown" and name ~= "ignore" and def and + ((def.is_ground_content and def.liquidtype == "none") or name == tsm_railcorridors.nodes.cobweb or name == tsm_railcorridors.nodes.torch_wall or name == tsm_railcorridors.nodes.torch_floor or @@ -178,7 +177,7 @@ end -- Tries to place a rail, taking the damage chance into account local function PlaceRail(pos, damage_chance) - if damage_chance and damage_chance > 0 then + if damage_chance ~= nil and damage_chance > 0 then local x = pr:next(0,100) if x <= damage_chance then return false @@ -211,7 +210,7 @@ local function NeedsPlatform(pos) local falling = minetest.get_item_group(node.name, "falling_node") == 1 return -- Node can be replaced if ground content or rail - (node.name ~= "ignore" and node.name ~= "unknown" and nodedef and nodedef.is_ground_content) and + (nodedef and node.name ~= "ignore" and node.name ~= "unknown" and nodedef.is_ground_content) and -- Node needs platform if node below is not walkable. -- Unless 2 nodes below there is dirt: This is a special case for the starter cube. ((nodedef.walkable == false and node2.name ~= tsm_railcorridors.nodes.dirt) or @@ -237,7 +236,7 @@ end local function Cube(p, radius, node, replace_air_only, wood, post) local y_top = p.y+radius local nodedef = minetest.registered_nodes[node.name] - local solid = nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodedef.liquidtype == "none" + local solid = nodedef and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodedef.liquidtype == "none" -- Check if all the nodes could be set local built_all = true @@ -253,7 +252,7 @@ local function Cube(p, radius, node, replace_air_only, wood, post) if yi == y_top then local topnode = minetest.get_node({x=xi,y=yi+1,z=zi}) local topdef = minetest.registered_nodes[topnode.name] - if minetest.get_item_group(topnode.name, "attached_node") ~= 1 and topdef and topdef.liquidtype == "none" then + if topdef and minetest.get_item_group(topnode.name, "attached_node") ~= 1 and topdef.liquidtype == "none" then ok = true end elseif column_last_attached and yi == column_last_attached - 1 then @@ -364,8 +363,7 @@ local function Platform(p, radius, node, node2) if not node2 then node2 = { name = tsm_railcorridors.nodes.dirt } end - local n1 = {} - local n2 = {} + local n1, n2 = {}, {} for zi = p.z-radius, p.z+radius do for xi = p.x-radius, p.x+radius do local np, np2 = NeedsPlatform({x=xi,y=p.y,z=zi}) @@ -394,33 +392,29 @@ local function PlaceChest(pos, param2) end end - -- This function checks if a cart has ACTUALLY been spawned. -- To be calld by minetest.after. -- This is a workaround thanks to the fact that minetest.add_entity is unreliable as fuck -- See: https://github.com/minetest/minetest/issues/4759 -- FIXME: Kill this horrible hack with fire as soon you can. - --- Why did anyone activate it in the first place? It doesn't --- have a function seeing as there are no chest minecarts yet. ---[[ -local function RecheckCartHack(params) +local RecheckCartHack = nil +if not minetest.features.random_state_restore then -- proxy for minetest > 5.9.0, this feature will not be removed +RecheckCartHack = function(params) local pos = params[1] local cart_id = params[2] -- Find cart - for _, obj in pairs(minetest.get_objects_inside_radius(pos, 1)) do - if obj and obj:get_luaentity().name == cart_id then + for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do + if obj ~= nil and obj:get_luaentity().name == cart_id then -- Cart found! We can now safely call the callback func. -- (calling it earlier has the danger of failing) minetest.log("info", "[tsm_railcorridors] Cart spawn succeeded: "..minetest.pos_to_string(pos)) - tsm_railcorridors.on_construct_cart(pos, obj) + tsm_railcorridors.on_construct_cart(pos, obj, pr_carts) return end end minetest.log("info", "[tsm_railcorridors] Cart spawn FAILED: "..minetest.pos_to_string(pos)) end ---]] - +end -- Try to place a cobweb. -- pos: Position of cobweb @@ -627,7 +621,7 @@ local function create_corridor_section(waypoint, axis, sign, up_or_down, up_or_d if sign then segamount = 0-segamount end - local vek = {x=0,y=0,z=0}; + local vek = {x=0,y=0,z=0} local start = table.copy(waypoint) if axis == "x" then vek.x=segamount @@ -714,7 +708,7 @@ local function create_corridor_section(waypoint, axis, sign, up_or_down, up_or_d end if (minetest.get_node({x=p.x,y=p.y-1,z=p.z}).name=="air" and minetest.get_node({x=p.x,y=p.y-3,z=p.z}).name~=tsm_railcorridors.nodes.rail) then - p.y = p.y - 1; + p.y = p.y - 1 if i == chestplace then chestplace = chestplace + 1 end @@ -840,7 +834,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da local s = sign local ud = false -- Up or down local udn = false -- Up or down is next - local udp -- Up or down was previous + local udp = false -- Up or down was previous local up = false -- true if going up local upp = false -- true if was going up previously for i=1,length do @@ -891,7 +885,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da wp, no_spawner = create_corridor_section(wp,a,s, ud, udn, udp, up, wood, post, first_or_final, damage, no_spawner) if wp == false then return end -- Fork in the road? If so, starts 2-3 new corridor lines and terminates the current one. - if pr:next() < probability_fork then + if wp and pr:next() < probability_fork then -- 75% chance to fork off in 3 directions (making a crossing) -- 25% chance to fork off in 2 directions (making a t-junction) local is_crossing = pr:next(0, 3) < 3 @@ -911,7 +905,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da {a2, not s}, -- to the other side {a, s}, -- straight ahead } - for f=1, forks do + for _= 1, forks do local r = pr:next(1, #fork_dirs) create_corridor_line(wp, fork_dirs[r][1], fork_dirs[r][2], pr:next(way_min,way_max), wood, post, damage, no_spawner) table.remove(fork_dirs, r) @@ -928,7 +922,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da a="z" elseif a=="z" then a="x" - end; + end s = pr:next(1, 2) == 1 end end @@ -944,16 +938,17 @@ local function spawn_carts() -- See local cart_id = tsm_railcorridors.carts[cart_type] minetest.log("info", "[tsm_railcorridors] Cart spawn attempt: "..minetest.pos_to_string(cpos)) - minetest.add_entity(cpos, cart_id) + local obj = minetest.add_entity(cpos, cart_id) -- This checks if the cart is actually spawned, it's a giant hack! -- Note that the callback function is also called there. -- TODO: Move callback function to this position when the - -- minetest.add_entity bug has been fixed. - - -- minetest.after(3, RecheckCartHack, {cpos, cart_id}) - -- This whole recheck logic leads to a stub right now - -- it can be reenabled when chest carts are a thing. + -- minetest.add_entity bug has been fixed (supposedly in 5.9.0?) + if RecheckCartHack then + minetest.after(3, RecheckCartHack, {cpos, cart_id}) + else + tsm_railcorridors.on_construct_cart(cpos, obj, pr_carts) + end end end carts_table = {} @@ -1115,7 +1110,7 @@ mcl_structures.register_structure("mineshaft",{ sidelen = 32, y_max = 40, y_min = mcl_vars.mg_overworld_min, - place_func = function(pos,def,pr,blockseed) + place_func = function(pos,_,pr,blockseed) local r = pr:next(-50,-10) local p = vector.offset(pos,0,r,0) if p.y < mcl_vars.mg_overworld_min + 5 then @@ -1123,7 +1118,7 @@ mcl_structures.register_structure("mineshaft",{ end if p.y > -10 then return true end InitRandomizer(blockseed) - create_corridor_system(p, pr) + create_corridor_system(p) return true end, diff --git a/mods/MAPGEN/tsm_railcorridors/mod.conf b/mods/MAPGEN/tsm_railcorridors/mod.conf index d1a9ada4a..56fe9bb94 100644 --- a/mods/MAPGEN/tsm_railcorridors/mod.conf +++ b/mods/MAPGEN/tsm_railcorridors/mod.conf @@ -1,4 +1,5 @@ name = tsm_railcorridors +title = Rail Corridors author = UgnilJoZ description = Adds simple underground mines with railways and occasional treasure chests. depends = mcl_init, mcl_worlds, mcl_core, mcl_mapgen_core, mcl_loot, mcl_tnt, mcl_farming, mcl_mobspawners, mcl_minecarts, mcl_structures diff --git a/mods/MAPGEN/tsm_railcorridors/settingtypes.txt b/mods/MAPGEN/tsm_railcorridors/settingtypes.txt index a28962907..c4a83452c 100644 --- a/mods/MAPGEN/tsm_railcorridors/settingtypes.txt +++ b/mods/MAPGEN/tsm_railcorridors/settingtypes.txt @@ -25,14 +25,14 @@ tsm_railcorridors_probability_chest (Chest probability) float 0.05 0.0 1.0 #of finding a cart in rail corridors with high rail damage will be lower. #NOTE: Due to a bug in Minetest #carts often fail to spawn even if they should. -tsm_railcorridors_probability_cart (Cart probability) float 0.0 0.0 1.0 +tsm_railcorridors_probability_cart (Cart probability) float 0.05 0.0 1.0 #If enabled, cobwebs may be placed in some corridors. #Currently, cobwebs are only supported with the Mobs Redo mod. tsm_railcorridors_place_cobwebs (Cobwebs) bool true #Probability (0.0 to 1.0) for a rail corridor system to have damaged/incomplete railways -tsm_railcorridors_probability_damage (Damaged railway probability) float 1.0 0.0 1.0 +tsm_railcorridors_probability_damage (Damaged railway probability) float 0.55 0.0 1.0 #If enabled, rail corridors continue to generate through obstacles such #as other rail corridors (without destroying them, mostly). This may lead diff --git a/mods/MISC/bonemeal/init.lua b/mods/MISC/bonemeal/init.lua new file mode 100644 index 000000000..13f52e7fe --- /dev/null +++ b/mods/MISC/bonemeal/init.lua @@ -0,0 +1,33 @@ +bonemeal = { + item_list = { + bucket_water = "mcl_buckets:bucket_water", + bucket_empty = "mcl_buckets:bucket_empty", + dirt = "mcl_core:dirt", + torch = "mcl_torches:torch", + coral = "mcl_ocean:dead_horn_coral_block" + } +} + +function bonemeal:on_use(pos, strength, node) + -- Fake itemstack for bone meal + local itemstack = ItemStack("mcl_bone_meal:bone_meal") + + local pointed_thing = { + above = pos, + under = vector.offset(pos, 0, -1, 0) + } + mcl_bone_meal.use_bone_meal(itemstack, nil, pointed_thing) +end + +function bonemeal:is_creative(player_name) + return minetest.is_creative_enabled(player_name) +end + +function bonemeal:add_deco(list) + minetest.log("TODO: implement bonemeal:add_deco("..dump(list).."..)") + for i = 1,#list do + local item = list[i] + end +end + +minetest.register_alias("bonemeal:bone", "mcl_mobitems:bone") diff --git a/mods/MISC/bonemeal/mod.conf b/mods/MISC/bonemeal/mod.conf new file mode 100644 index 000000000..3117bd1ed --- /dev/null +++ b/mods/MISC/bonemeal/mod.conf @@ -0,0 +1,4 @@ +name = bonemeal +author = teknomunk +description = Compatibility shim for WorldEdit-Additions bonemeal support +depends = mcl_bone_meal, mcl_mobitems, mcl_flowers diff --git a/mods/MISC/mcl_privs/init.lua b/mods/MISC/mcl_privs/init.lua index ddca9f946..09239390a 100644 --- a/mods/MISC/mcl_privs/init.lua +++ b/mods/MISC/mcl_privs/init.lua @@ -30,17 +30,5 @@ for _, action in pairs({"grant", "revoke"}) do if priv == "fly" then meta:set_int("mcl_privs:fly_changed", 1) end - - --[[ - so e.g. hackers who have been revoked of the interact privilege - will not automatically get the interact privilege through the mcl shields code back - ]] - if priv == "interact" then - if action == "revoke" then - meta:set_int("mcl_privs:interact_revoked", 1) - else - meta:set_int("mcl_privs:interact_revoked", 0) - end - end end) -end \ No newline at end of file +end diff --git a/mods/MISC/mcl_wip/API.md b/mods/MISC/mcl_wip/API.md index e3439af77..776983783 100644 --- a/mods/MISC/mcl_wip/API.md +++ b/mods/MISC/mcl_wip/API.md @@ -1,16 +1,16 @@ # mcl_wip Used to mark items or nodes as WIP. -## mcl_wip.register_wip_item(itemname) -Register as a WIP item. -If isn't a valid itemname, an error will be shown after mods loaded. +## `mcl_wip.register_wip_item(itemname)` +Register `itemname` as a WIP item. +If `itemname` isn't a valid itemname, an error will be shown after mods loaded. -## mcl_wip.register_experimental_item(itemname) -Register as a experimental item. -If isn't a valid itemname, an error will be shown after mods loaded. +## `mcl_wip.register_experimental_item(itemname)` +Register `itemname` as a experimental item. +If `itemname` isn't a valid itemname, an error will be shown after mods loaded. -## mcl_wip.registered_wip_items +## `mcl_wip.registered_wip_items` Table containing WIP items names. -## mcl_wip.registered_experimental_items -Table containing experimental items names. \ No newline at end of file +## `mcl_wip.registered_experimental_items` +Table containing experimental items names. diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 646030202..a4af9d000 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -280,7 +280,7 @@ minetest.register_globalstep(function(dtime) pos = fly_pos, velocity = vector.zero(), acceleration = vector.zero(), - expirationtime = math.random(0.3, 0.5), + expirationtime = 0.3 + math.random() * 0.2, size = math.random(1, 2), collisiondetection = false, vertical = false, @@ -407,13 +407,23 @@ minetest.register_globalstep(function(dtime) set_bone_pos(player,"Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0)) end - local underwater - if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and underwater ~= true then - mcl_weather.skycolor.update_sky_color() - local underwater = true - elseif get_item_group(mcl_playerinfo[name].node_head, "water") == 0 and underwater == true then - mcl_weather.skycolor.update_sky_color() - local underwater = false + local playerinfo = mcl_playerinfo[name] or {} + local plusinfo = playerinfo.mcl_playerplus + if not plusinfo then + plusinfo = {} + playerinfo.mcl_playerplus = plusinfo + end + + -- Only process if node_head changed + if plusinfo.old_node_head ~= playerinfo.node_head then + local node_head = playerinfo.node_head or "" + local old_node_head = plusinfo.old_node_head or "" + plusinfo.old_node_head = playerinfo.node_head + + -- Update skycolor if moving in or out of water + if (get_item_group(node_head, "water") == 0) ~= (get_item_group(old_node_head, "water") == 0) then + mcl_weather.skycolor.update_sky_color() + end end elytra.last_yaw = player:get_look_horizontal() @@ -504,31 +514,43 @@ minetest.register_globalstep(function(dtime) return end - -- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots) - if node_stand == "mcl_nether:soul_sand" then - -- TODO: Tweak walk speed - -- TODO: Also slow down mobs - -- Slow down even more when soul sand is above certain block - local boots = player:get_inventory():get_stack("armor", 5) - local soul_speed = mcl_enchanting.get_enchantment(boots, "soul_speed") - if soul_speed > 0 then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", soul_speed * 0.105 + 1.3) - else - if node_stand_below == "mcl_core:ice" or node_stand_below == "mcl_core:packed_ice" or node_stand_below == "mcl_core:slimeblock" or node_stand_below == "mcl_core:water_source" then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.1) - else - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4) - end - end - elseif get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then - local boots = player:get_inventory():get_stack("armor", 5) - local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider") + local boots = player:get_inventory():get_stack("armor", 5) + local soul_speed = mcl_enchanting.get_enchantment(boots, "soul_speed") - if depth_strider > 0 then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", (depth_strider / 3) + 0.75) + -- Standing on a soul block? If so, check for speed bonus / penalty + if get_item_group(node_stand, "soul_block") ~= 0 then + + -- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots, then apply bonus) + if node_stand == "mcl_nether:soul_sand" then + -- TODO: Tweak walk speed + -- TODO: Also slow down mobs + -- Slow down even more when soul sand is above certain block + if soul_speed > 0 then + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) + else + if node_stand_below == "mcl_core:ice" or node_stand_below == "mcl_core:packed_ice" or node_stand_below == "mcl_core:slimeblock" or node_stand_below == "mcl_core:water_source" then + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.1) + else + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.4) + end + end + elseif soul_speed > 0 then + -- Standing on a different soul block? If so, apply Soul Speed bonus unconditionally + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) end else - playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface") + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:soul_speed") + end + if get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then + local boots = player:get_inventory():get_stack("armor", 5) + local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider") + if depth_strider > 0 then + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:depth_strider", (depth_strider / 3) + 0.75) + else + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:depth_strider") + end + else + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:depth_strider") end -- Is player suffocating inside node? (Only for solid full opaque cube type nodes @@ -546,22 +568,18 @@ minetest.register_globalstep(function(dtime) and (node_head ~= "ignore") -- Check privilege, too and (not check_player_privs(name, {noclip = true})) then - if player:get_hp() > 0 then - mcl_util.deal_damage(player, 1, {type = "in_wall"}) - end + mcl_util.deal_damage(player, 1, {type = "in_wall"}) end -- Am I near a cactus? - local near = find_node_near(pos, 1, "mcl_core:cactus") - if not near then - near = find_node_near({x=pos.x, y=pos.y-1, z=pos.z}, 1, "mcl_core:cactus") - end - if near then - -- Am I touching the cactus? If so, it hurts - local dist = vector.distance(pos, near) - local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near) - if dist < 1.1 or dist_feet < 1.1 then - if player:get_hp() > 0 then + if node_stand == "mcl_core:cactus" or node_feet == "mcl_core:cactus" or node_head == "mcl_core:cactus" then + mcl_util.deal_damage(player, 1, {type = "cactus"}) + else + local near = find_node_near(pos, 1, "mcl_core:cactus") + if near then + -- Am I touching the cactus? If so, it hurts + local dist = vector.distance(pos, near) + if dist < 1.1 then mcl_util.deal_damage(player, 1, {type = "cactus"}) end end @@ -679,6 +697,8 @@ minetest.register_on_joinplayer(function(player) player:respawn() minetest.log("warning", name .. " joined the game with 0 hp and has been forced to respawn") end + + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface") end) -- clear when player leaves diff --git a/mods/PLAYER/mcl_spawn/init.lua b/mods/PLAYER/mcl_spawn/init.lua index 89ededeed..7bf27b0f9 100644 --- a/mods/PLAYER/mcl_spawn/init.lua +++ b/mods/PLAYER/mcl_spawn/init.lua @@ -453,7 +453,7 @@ function mcl_spawn.set_spawn_pos(player, pos, message) -- Pass in villager as arg. Shouldn't know about villagers if bed_bottom_meta then mcl_log("Removing villager from bed bottom meta") - bed_bottom_meta:set_string("villager", nil) + bed_bottom_meta:set_string("villager", "") else mcl_log("Cannot remove villager from bed bottom meta") end diff --git a/settingtypes.txt b/settingtypes.txt index 30a160427..86c635582 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -45,6 +45,9 @@ mcl_disabled_structures (Disabled structures) string # Comma separated list of disabled event names mcl_disabled_events (Disabled events) string +# Control the relative plant growth speed (default: 1) +vl_plant_growth (Plant growth factor) float 1.0 0 100 + [Players] # If enabled, players respawn at the bed they last lay on instead of normal # spawn. @@ -221,6 +224,13 @@ mcl_mobs_overworld_threshold (Artificial light threshold to stop monster spawns mcl_mobs_overworld_sky_threshold (Skylight threshold to stop monster spawns in the Overworld) int 7 0 14 mcl_mobs_overworld_passive_threshold (Combined light threshold to stop animal and npc spawns in the Overworld) int 7 0 14 +# Slime chunk ratio 1:N, default is 1 in 10, 0 to disable cave slime +slime_ratio (Slime chunk ratio) float 10.0 0.0 +# Use 3d chunking instead of 2d chunking +slime_3d_chunks (Slime chunk placement in 3d) bool false +# Slime chunk maximum light for spawning, default is no limit +slime_max_light (Maximum light level in slime chunks) int 14 0 14 + [Audio] # Enable flame sound. flame_sound (Flame sound) bool true @@ -256,10 +266,6 @@ mcl_buckets_use_select_box (Buckets use select box) bool false # See also: https://github.com/minetest/minetest/issues/95 mcl_translucent_ice (Translucent ice) bool false -# Whether to generate fallen logs in some biomes. -# They might not always look pretty and have strange overhangs. -mcl_generate_fallen_logs (Generate fallen logs) bool false - # If enabled, the “flat” map generator generates a Classic Superflat world: # Completely flat, 1 layer of grass blocks on top of 2 layers of dirt on # top of a final layer of bedrock. No caves, trees or plants. diff --git a/textures/mcl_cocoas_cocoa_beans.png b/textures/mcl_cocoa_beans.png similarity index 100% rename from textures/mcl_cocoas_cocoa_beans.png rename to textures/mcl_cocoa_beans.png diff --git a/textures/mcl_core_charcoal_block.png b/textures/mcl_core_charcoal_block.png new file mode 100644 index 000000000..bd33b910e Binary files /dev/null and b/textures/mcl_core_charcoal_block.png differ