diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 6a90b98eb7..f4ed9df4eb 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -49,13 +49,10 @@ local equals = vector.equals local get_node_force = mesecon.get_node_force -local receptor_get_rules = mesecon.receptor_get_rules local invertRule = mesecon.invertRule local copy, insert = table.copy, table.insert -local registered_nodes -minetest.register_on_mods_loaded(function() - registered_nodes = minetest.registered_nodes -end) +local registered_nodes = minetest.registered_nodes + -- General function mesecon.get_effector(nodename) if registered_nodes[nodename] @@ -137,7 +134,7 @@ function mesecon.is_receptor(nodename) return false end -function mesecon.receptor_get_rules(node) +local function receptor_get_rules(node) local receptor = mesecon.get_receptor(node.name) if receptor then local rules = receptor.rules @@ -150,6 +147,7 @@ function mesecon.receptor_get_rules(node) return mesecon.rules.default end +mesecon.receptor_get_rules = receptor_get_rules -- Effectors -- Nodes that can be powered by mesecons diff --git a/mods/ITEMS/mcl_core/crafting.lua b/mods/ITEMS/mcl_core/crafting.lua index a0ad38a777..7a2b6a5c8a 100644 --- a/mods/ITEMS/mcl_core/crafting.lua +++ b/mods/ITEMS/mcl_core/crafting.lua @@ -46,6 +46,56 @@ minetest.register_craft({ } }) +-- Stripped Bark +minetest.register_craft({ + output = "mcl_core:stripped_oak_bark 3", + recipe = { + { "mcl_core:stripped_oak", "mcl_core:stripped_oak" }, + { "mcl_core:stripped_oak", "mcl_core:stripped_oak" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_acacia_bark 3", + recipe = { + { "mcl_core:stripped_acacia", "mcl_core:stripped_acacia" }, + { "mcl_core:stripped_acacia", "mcl_core:stripped_acacia" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_dark_oak_bark 3", + recipe = { + { "mcl_core:stripped_dark_oak", "mcl_core:stripped_dark_oak" }, + { "mcl_core:stripped_dark_oak", "mcl_core:stripped_dark_oak" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_birch_bark 3", + recipe = { + { "mcl_core:stripped_birch", "mcl_core:stripped_birch" }, + { "mcl_core:stripped_birch", "mcl_core:stripped_birch" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_spruce_bark 3", + recipe = { + { "mcl_core:stripped_spruce", "mcl_core:stripped_spruce" }, + { "mcl_core:stripped_spruce", "mcl_core:stripped_spruce" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_jungle_bark 3", + recipe = { + { "mcl_core:stripped_jungle", "mcl_core:stripped_jungle" }, + { "mcl_core:stripped_jungle", "mcl_core:stripped_jungle" }, + } +}) + + minetest.register_craft({ type = 'shapeless', output = 'mcl_core:mossycobble', diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index 197846ebcc..4af3eef34c 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -1,4 +1,4 @@ --- Tree nodes: Wood, Wooden Planks, Sapling, Leaves +-- Tree nodes: Wood, Wooden Planks, Sapling, Leaves, Stripped Wood local S = minetest.get_translator("mcl_core") local mod_screwdriver = minetest.get_modpath("screwdriver") ~= nil @@ -48,6 +48,166 @@ local register_tree_trunk = function(subname, description_trunk, description_bar }) end +-- Register stripped trunk +minetest.register_node("mcl_core:stripped_oak", { + description = "Stripped Oak Log", + _doc_items_longdesc = "Stripped Oak Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_oak_top.png", "mcl_core_stripped_oak_top.png", "mcl_core_stripped_oak_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_acacia", { + description = "Stripped Acacia Log", + _doc_items_longdesc = "Stripped Acacia Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_acacia_top.png", "mcl_core_stripped_acacia_top.png", "mcl_core_stripped_acacia_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_dark_oak", { + description = "Stripped Dark Oak Log", + _doc_items_longdesc = "Stripped Dark Oak Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_dark_oak_top.png", "mcl_core_stripped_dark_oak_top.png", "mcl_core_stripped_dark_oak_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_birch", { + description = "Stripped Birch Log", + _doc_items_longdesc = "Stripped Birch Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_birch_top.png", "mcl_core_stripped_birch_top.png", "mcl_core_stripped_birch_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_spruce", { + description = "Stripped Spruce Log", + _doc_items_longdesc = "Stripped Spruce Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_spruce_top.png", "mcl_core_stripped_spruce_top.png", "mcl_core_stripped_spruce_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_jungle", { + description = "Stripped Jungle Log", + _doc_items_longdesc = "Stripped Jungle Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_jungle_top.png", "mcl_core_stripped_jungle_top.png", "mcl_core_stripped_jungle_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + + +-- Register stripped bark +minetest.register_node("mcl_core:stripped_oak_bark", { + description = "Stripped Oak Bark", + _doc_items_longdesc = "Stripped Oak Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_oak_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_acacia_bark", { + description = "Stripped Acacia Bark", + _doc_items_longdesc = "Stripped Acacia Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_acacia_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_dark_oak_bark", { + description = "Stripped Dark Oak Bark", + _doc_items_longdesc = "Stripped Dark Oak Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_dark_oak_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_birch_bark", { + description = "Stripped Birch Bark", + _doc_items_longdesc = "Stripped Birch Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_birch_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_spruce_bark", { + description = "Stripped Spruce Bark", + _doc_items_longdesc = "Stripped Spruce Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_spruce_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_jungle_bark", { + description = "Stripped Jungle Bark", + _doc_items_longdesc = "Stripped Jungles Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_jungle_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + + local register_wooden_planks = function(subname, description, tiles) minetest.register_node("mcl_core:"..subname, { description = description, @@ -226,4 +386,4 @@ register_leaves("birchleaves", S("Birch Leaves"), S("Birch leaves are grown from -- Node aliases minetest.register_alias("default:acacia_tree", "mcl_core:acaciatree") -minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves") +minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves") \ No newline at end of file diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_side.png new file mode 100644 index 0000000000..2e2de8dbeb Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_side.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_top.png new file mode 100644 index 0000000000..0746884de9 Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_top.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_side.png new file mode 100644 index 0000000000..a27739c1e6 Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_side.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_top.png new file mode 100644 index 0000000000..e5290422d4 Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_top.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_side.png new file mode 100644 index 0000000000..9345a14dc2 Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_side.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_top.png new file mode 100644 index 0000000000..fbc45938f3 Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_top.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_side.png new file mode 100644 index 0000000000..74f9f03d5e Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_side.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_top.png new file mode 100644 index 0000000000..bfa54d8fe5 Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_top.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_side.png new file mode 100644 index 0000000000..3bdffd76e1 Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_side.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_top.png new file mode 100644 index 0000000000..b07c726135 Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_top.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_side.png new file mode 100644 index 0000000000..11ea15bebb Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_side.png differ diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_top.png new file mode 100644 index 0000000000..7699612b6b Binary files /dev/null and b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_top.png differ diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index b50782ec4c..2d804b9bc7 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -352,6 +352,56 @@ minetest.register_tool("mcl_tools:shovel_diamond", { }) -- Axes + +local make_stripped_trunk = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local pos = minetest.get_pointed_thing_position(pointed_thing) + local node = minetest.get_node(pos) + local node_name = node.name + if placer and not placer: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, placer, itemstack) or itemstack + end + end + if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then + minetest.record_protection_violation(pointed_thing.under, placer:get_player_name()) + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + -- Add wear (as if digging a axey node) + local toolname = itemstack:get_name() + local wear = mcl_autogroup.get_wear(toolname, "axey") + itemstack:add_wear(wear) + end + if node_name == "mcl_core:tree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak"}) + elseif node_name == "mcl_core:darktree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak"}) + elseif node_name == "mcl_core:acaciatree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia"}) + elseif node_name == "mcl_core:birchtree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch"}) + elseif node_name == "mcl_core:sprucetree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce"}) + elseif node_name == "mcl_core:jungletree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle"}) + elseif node_name == "mcl_core:tree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak_bark"}) + elseif node_name == "mcl_core:darktree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak_bark"}) + elseif node_name == "mcl_core:acaciatree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia_bark"}) + elseif node_name == "mcl_core:birchtree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch_bark"}) + elseif node_name == "mcl_core:sprucetree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce_bark"}) + elseif node_name == "mcl_core:jungletree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle_bark"}) + end + end + return itemstack +end + minetest.register_tool("mcl_tools:axe_wood", { description = S("Wooden Axe"), _doc_items_longdesc = axe_longdesc, @@ -365,6 +415,7 @@ minetest.register_tool("mcl_tools:axe_wood", { damage_groups = {fleshy=7}, punch_attack_uses = 30, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "group:wood", _mcl_toollike_wield = true, @@ -384,6 +435,7 @@ minetest.register_tool("mcl_tools:axe_stone", { damage_groups = {fleshy=9}, punch_attack_uses = 66, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:cobble", _mcl_toollike_wield = true, @@ -404,6 +456,7 @@ minetest.register_tool("mcl_tools:axe_iron", { damage_groups = {fleshy=9}, punch_attack_uses = 126, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:iron_ingot", _mcl_toollike_wield = true, @@ -423,6 +476,7 @@ minetest.register_tool("mcl_tools:axe_gold", { damage_groups = {fleshy=7}, punch_attack_uses = 17, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:gold_ingot", _mcl_toollike_wield = true, @@ -442,6 +496,7 @@ minetest.register_tool("mcl_tools:axe_diamond", { damage_groups = {fleshy=9}, punch_attack_uses = 781, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:diamond", _mcl_toollike_wield = true, diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 52c87a5147..a9f6bd5a15 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -22,11 +22,48 @@ local mcl_playerplus_internal = {} local def = {} local time = 0 +local player_collision = function(player) + + local pos = player:get_pos() + local vel = player:get_velocity() + local x = 0 + local z = 0 + local width = .75 + + for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do + + if object:is_player() + or (object:get_luaentity()._cmi_is_mob == true and object ~= player) then + + local pos2 = object:get_pos() + local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z} + local force = (width + 0.5) - vector.distance( + {x = pos.x, y = 0, z = pos.z}, + {x = pos2.x, y = 0, z = pos2.z}) + + x = x + (vec.x * force) + z = z + (vec.z * force) + end + end + + return({x * 5,z * 5}) +end + -- converts yaw to degrees local function degrees(rad) return rad * 180.0 / math.pi end +local pi = math.pi +local atann = math.atan +local atan = function(x) + if not x or x ~= x then + return 0 + else + return atann(x) + end +end + local dir_to_pitch = function(dir) local dir2 = vector.normalize(dir) local xz = math.abs(dir.x) + math.abs(dir.z) @@ -88,6 +125,13 @@ minetest.register_globalstep(function(dtime) for _,player in pairs(get_connected_players()) do + c_x, c_y = unpack(player_collision(player)) + + if player:get_velocity().x + player:get_velocity().y < .5 and c_x + c_y > 0 then + --minetest.chat_send_player(player:get_player_name(), "pushed at " .. c_x + c_y .. " parsecs.") + player:add_velocity({x=c_x, y=0, z=c_y}) + end + --[[ _ _ _ __ _ _ __ (_)_ __ ___ __ _| |_(_) ___ _ __ ___