Merge pull request 'Strip trailing whitespace from files' (#2240) from EliasFleckenstein03/MineClone2:fmt into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2240
This commit is contained in:
commit
96dcfb8a62
@ -603,7 +603,7 @@ function mcl_util.get_pointed_thing(player, liquid)
|
|||||||
local look_dir = vector.multiply(player:get_look_dir(), 5)
|
local look_dir = vector.multiply(player:get_look_dir(), 5)
|
||||||
local pos2 = vector.add(pos, look_dir)
|
local pos2 = vector.add(pos, look_dir)
|
||||||
local ray = minetest.raycast(pos, pos2, false, liquid)
|
local ray = minetest.raycast(pos, pos2, false, liquid)
|
||||||
|
|
||||||
if ray then
|
if ray then
|
||||||
for pointed_thing in ray do
|
for pointed_thing in ray do
|
||||||
return pointed_thing
|
return pointed_thing
|
||||||
|
@ -1402,7 +1402,7 @@ end
|
|||||||
-- should mob follow what I'm holding ?
|
-- should mob follow what I'm holding ?
|
||||||
local follow_holding = function(self, clicker)
|
local follow_holding = function(self, clicker)
|
||||||
if self.nofollow then return false end
|
if self.nofollow then return false end
|
||||||
|
|
||||||
if mcl_mobs.invis[clicker:get_player_name()] then
|
if mcl_mobs.invis[clicker:get_player_name()] then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -2307,7 +2307,7 @@ local function check_doors(self)
|
|||||||
else
|
else
|
||||||
if closed then def.on_rightclick(d,n,self) end
|
if closed then def.on_rightclick(d,n,self) end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2316,7 +2316,7 @@ end
|
|||||||
-- returns true if mob has died
|
-- returns true if mob has died
|
||||||
local do_states = function(self, dtime)
|
local do_states = function(self, dtime)
|
||||||
if self.can_open_doors then check_doors(self) end
|
if self.can_open_doors then check_doors(self) end
|
||||||
|
|
||||||
local yaw = self.object:get_yaw() or 0
|
local yaw = self.object:get_yaw() or 0
|
||||||
|
|
||||||
if self.state == "stand" then
|
if self.state == "stand" then
|
||||||
@ -2386,7 +2386,7 @@ local do_states = function(self, dtime)
|
|||||||
elseif self.current_target then
|
elseif self.current_target then
|
||||||
go_to_pos(self,self.current_target)
|
go_to_pos(self,self.current_target)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.current_target and not minetest.line_of_sight(self.object:get_pos(),self.current_target) then
|
if self.current_target and not minetest.line_of_sight(self.object:get_pos(),self.current_target) then
|
||||||
self.waypoints=minetest.find_path(p,self._target,150,1,4)
|
self.waypoints=minetest.find_path(p,self._target,150,1,4)
|
||||||
self.current_target = nil
|
self.current_target = nil
|
||||||
|
@ -293,7 +293,7 @@ local professions = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ { "mcl_core:emerald", 7, 7}, { "mcl_itemframes:item_frame", 1, 1 }},
|
{ { "mcl_core:emerald", 7, 7}, { "mcl_itemframes:item_frame", 1, 1 }},
|
||||||
|
|
||||||
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_white", 1, 1 }},
|
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_white", 1, 1 }},
|
||||||
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_grey", 1, 1 }},
|
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_grey", 1, 1 }},
|
||||||
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_silver", 1, 1 }},
|
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_silver", 1, 1 }},
|
||||||
@ -578,7 +578,7 @@ local function go_home(entity)
|
|||||||
local b=entity._bed
|
local b=entity._bed
|
||||||
if not b then return end
|
if not b then return end
|
||||||
mcl_mobs:gopath(entity,b,function(entity,b)
|
mcl_mobs:gopath(entity,b,function(entity,b)
|
||||||
if vector.distance(entity.object:get_pos(),b) < 2 then
|
if vector.distance(entity.object:get_pos(),b) < 2 then
|
||||||
entity.state = "stand"
|
entity.state = "stand"
|
||||||
set_velocity(entity,0)
|
set_velocity(entity,0)
|
||||||
entity.object:set_pos(b)
|
entity.object:set_pos(b)
|
||||||
@ -589,7 +589,7 @@ local function go_home(entity)
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
----- JOBSITE LOGIC
|
----- JOBSITE LOGIC
|
||||||
@ -1315,7 +1315,7 @@ mcl_mobs:register_mob("mobs_mc:villager", {
|
|||||||
if not self._player_scan_timer then
|
if not self._player_scan_timer then
|
||||||
self._player_scan_timer = 0
|
self._player_scan_timer = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
self._player_scan_timer = self._player_scan_timer + dtime
|
self._player_scan_timer = self._player_scan_timer + dtime
|
||||||
-- Check infrequently to keep CPU load low
|
-- Check infrequently to keep CPU load low
|
||||||
if self._player_scan_timer > PLAYER_SCAN_INTERVAL then
|
if self._player_scan_timer > PLAYER_SCAN_INTERVAL then
|
||||||
|
@ -24,7 +24,7 @@ local function check_player(player)
|
|||||||
local name=player:get_player_name()
|
local name=player:get_player_name()
|
||||||
if mcl_worlds.has_dust(player:get_pos()) and not mcl_weather.nether_dust.particlespawners[name] then
|
if mcl_worlds.has_dust(player:get_pos()) and not mcl_weather.nether_dust.particlespawners[name] then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_weather.nether_dust.add_particlespawners = function(player)
|
mcl_weather.nether_dust.add_particlespawners = function(player)
|
||||||
@ -45,7 +45,7 @@ mcl_weather.nether_dust.delete_particlespawners = function(player)
|
|||||||
for i=1,3 do
|
for i=1,3 do
|
||||||
minetest.delete_particlespawner(mcl_weather.nether_dust.particlespawners[name][i])
|
minetest.delete_particlespawner(mcl_weather.nether_dust.particlespawners[name][i])
|
||||||
end
|
end
|
||||||
mcl_weather.nether_dust.particlespawners[name]=nil
|
mcl_weather.nether_dust.particlespawners[name]=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ function mcl_weather.rain.clear()
|
|||||||
mcl_weather.rain.remove_sound(player)
|
mcl_weather.rain.remove_sound(player)
|
||||||
mcl_weather.rain.remove_player(player)
|
mcl_weather.rain.remove_player(player)
|
||||||
mcl_weather.remove_spawners_player(player)
|
mcl_weather.remove_spawners_player(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
|
@ -26,8 +26,8 @@ local same_id = {
|
|||||||
walls = {
|
walls = {
|
||||||
"andesite", "brick", "cobble", "diorite", "endbricks",
|
"andesite", "brick", "cobble", "diorite", "endbricks",
|
||||||
"granite", "mossycobble", "netherbrick", "prismarine",
|
"granite", "mossycobble", "netherbrick", "prismarine",
|
||||||
"rednetherbrick", "redsandstone", "sandstone",
|
"rednetherbrick", "redsandstone", "sandstone",
|
||||||
"stonebrick", "stonebrickmossy",
|
"stonebrick", "stonebrickmossy",
|
||||||
},
|
},
|
||||||
wool = {
|
wool = {
|
||||||
"black", "blue", "brown", "cyan", "green",
|
"black", "blue", "brown", "cyan", "green",
|
||||||
|
@ -360,7 +360,7 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
|
|||||||
end
|
end
|
||||||
|
|
||||||
local stack_size = get_stack_size(player)
|
local stack_size = get_stack_size(player)
|
||||||
|
|
||||||
-- Survival inventory slots
|
-- Survival inventory slots
|
||||||
main_list = "list[current_player;main;0,3.75;9,3;9]"..
|
main_list = "list[current_player;main;0,3.75;9,3;9]"..
|
||||||
mcl_formspec.get_itemslot_bg(0,3.75,9,3)..
|
mcl_formspec.get_itemslot_bg(0,3.75,9,3)..
|
||||||
@ -394,7 +394,7 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
|
|||||||
-- switch stack size button
|
-- switch stack size button
|
||||||
"image_button[9,5;1,1;default_apple.png;__switch_stack;]"..
|
"image_button[9,5;1,1;default_apple.png;__switch_stack;]"..
|
||||||
"label[9.4,5.4;".. F(C("#FFFFFF", stack_size ~= 1 and stack_size or "")) .."]"..
|
"label[9.4,5.4;".. F(C("#FFFFFF", stack_size ~= 1 and stack_size or "")) .."]"..
|
||||||
"tooltip[__switch_stack;"..F(S("Switch stack size")).."]"
|
"tooltip[__switch_stack;"..F(S("Switch stack size")).."]"
|
||||||
|
|
||||||
-- For shortcuts
|
-- For shortcuts
|
||||||
listrings = listrings ..
|
listrings = listrings ..
|
||||||
|
@ -1,236 +1,236 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
|
|
||||||
mcl_inventory = {}
|
mcl_inventory = {}
|
||||||
|
|
||||||
--local mod_player = minetest.get_modpath("mcl_player")
|
--local mod_player = minetest.get_modpath("mcl_player")
|
||||||
--local mod_craftguide = minetest.get_modpath("mcl_craftguide")
|
--local mod_craftguide = minetest.get_modpath("mcl_craftguide")
|
||||||
|
|
||||||
-- Returns a single itemstack in the given inventory to the main inventory, or drop it when there's no space left
|
-- Returns a single itemstack in the given inventory to the main inventory, or drop it when there's no space left
|
||||||
function return_item(itemstack, dropper, pos, inv)
|
function return_item(itemstack, dropper, pos, inv)
|
||||||
if dropper:is_player() then
|
if dropper:is_player() then
|
||||||
-- Return to main inventory
|
-- Return to main inventory
|
||||||
if inv:room_for_item("main", itemstack) then
|
if inv:room_for_item("main", itemstack) then
|
||||||
inv:add_item("main", itemstack)
|
inv:add_item("main", itemstack)
|
||||||
else
|
else
|
||||||
-- Drop item on the ground
|
-- Drop item on the ground
|
||||||
local v = dropper:get_look_dir()
|
local v = dropper:get_look_dir()
|
||||||
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
||||||
p.x = p.x+(math.random(1,3)*0.2)
|
p.x = p.x+(math.random(1,3)*0.2)
|
||||||
p.z = p.z+(math.random(1,3)*0.2)
|
p.z = p.z+(math.random(1,3)*0.2)
|
||||||
local obj = minetest.add_item(p, itemstack)
|
local obj = minetest.add_item(p, itemstack)
|
||||||
if obj then
|
if obj then
|
||||||
v.x = v.x*4
|
v.x = v.x*4
|
||||||
v.y = v.y*4 + 2
|
v.y = v.y*4 + 2
|
||||||
v.z = v.z*4
|
v.z = v.z*4
|
||||||
obj:set_velocity(v)
|
obj:set_velocity(v)
|
||||||
obj:get_luaentity()._insta_collect = false
|
obj:get_luaentity()._insta_collect = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Fallback for unexpected cases
|
-- Fallback for unexpected cases
|
||||||
minetest.add_item(pos, itemstack)
|
minetest.add_item(pos, itemstack)
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Return items in the given inventory list (name) to the main inventory, or drop them if there is no space left
|
|
||||||
function return_fields(player, name)
|
|
||||||
local inv = player:get_inventory()
|
|
||||||
local list = inv:get_list(name)
|
|
||||||
if not list then return end
|
|
||||||
for i,stack in ipairs(list) do
|
|
||||||
return_item(stack, player, player:get_pos(), inv)
|
|
||||||
stack:clear()
|
|
||||||
inv:set_stack(name, i, stack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function set_inventory(player, armor_change_only)
|
|
||||||
if minetest.is_creative_enabled(player:get_player_name()) then
|
|
||||||
if armor_change_only then
|
|
||||||
-- Stay on survival inventory plage if only the armor has been changed
|
|
||||||
mcl_inventory.set_creative_formspec(player, 0, 0, nil, nil, "inv")
|
|
||||||
else
|
|
||||||
mcl_inventory.set_creative_formspec(player, 0, 1)
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local inv = player:get_inventory()
|
|
||||||
inv:set_width("craft", 2)
|
|
||||||
inv:set_size("craft", 4)
|
|
||||||
|
|
||||||
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
|
||||||
local armor_slot_imgs = ""
|
|
||||||
for a=1,4 do
|
|
||||||
if inv:get_stack("armor", a+1):is_empty() then
|
|
||||||
armor_slot_imgs = armor_slot_imgs .. "image[0,"..(a-1)..";1,1;mcl_inventory_empty_armor_slot_"..armor_slots[a]..".png]"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if inv:get_stack("offhand", 1):is_empty() then
|
|
||||||
armor_slot_imgs = armor_slot_imgs .. "image[3,2;1,1;mcl_inventory_empty_armor_slot_shield.png]"
|
|
||||||
end
|
|
||||||
|
|
||||||
local form = "size[9,8.75]"..
|
|
||||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
|
||||||
mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "")..
|
|
||||||
--armor
|
|
||||||
"list[current_player;armor;0,0;1,1;1]"..
|
|
||||||
"list[current_player;armor;0,1;1,1;2]"..
|
|
||||||
"list[current_player;armor;0,2;1,1;3]"..
|
|
||||||
"list[current_player;armor;0,3;1,1;4]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,0,1,1)..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,1,1,1)..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,2,1,1)..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,3,1,1)..
|
|
||||||
"list[current_player;offhand;3,2;1,1]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(3,2,1,1)..
|
|
||||||
armor_slot_imgs..
|
|
||||||
-- craft and inventory
|
|
||||||
"label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))).."]"..
|
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
|
||||||
"label[4,0.5;"..F(minetest.colorize("#313131", S("Crafting"))).."]"..
|
|
||||||
"list[current_player;craft;4,1;2,2]"..
|
|
||||||
"list[current_player;craftpreview;7,1.5;1,1;]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
|
||||||
mcl_formspec.get_itemslot_bg(4,1,2,2)..
|
|
||||||
mcl_formspec.get_itemslot_bg(7,1.5,1,1)..
|
|
||||||
-- crafting guide button
|
|
||||||
"image_button[4.5,3;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
|
||||||
"tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]"..
|
|
||||||
-- help button
|
|
||||||
"image_button[8,3;1,1;doc_button_icon_lores.png;__mcl_doc;]"..
|
|
||||||
"tooltip[__mcl_doc;"..F(S("Help")).."]"..
|
|
||||||
-- skins button
|
|
||||||
"image_button[3,3;1,1;mcl_skins_button.png;__mcl_skins;]"..
|
|
||||||
"tooltip[__mcl_skins;"..F(S("Select player skin")).."]"..
|
|
||||||
-- achievements button
|
|
||||||
"image_button[7,3;1,1;mcl_achievements_button.png;__mcl_achievements;]"..
|
|
||||||
"tooltip[__mcl_achievements;"..F(S("Achievements")).."]"..
|
|
||||||
-- for shortcuts
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[current_player;armor]"..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
"listring[current_player;craft]" ..
|
|
||||||
"listring[current_player;main]"
|
|
||||||
player:set_inventory_formspec(form)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Drop items in craft grid and reset inventory on closing
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
||||||
if fields.quit then
|
|
||||||
return_fields(player,"craft")
|
|
||||||
return_fields(player,"enchanting_lapis")
|
|
||||||
return_fields(player,"enchanting_item")
|
|
||||||
if not minetest.is_creative_enabled(player:get_player_name()) and (formname == "" or formname == "main") then
|
|
||||||
set_inventory(player)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
if not minetest.is_creative_enabled("") then
|
|
||||||
function mcl_inventory.update_inventory_formspec(player)
|
|
||||||
set_inventory(player)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Drop crafting grid items on leaving
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
|
||||||
return_fields(player, "craft")
|
|
||||||
return_fields(player, "enchanting_lapis")
|
|
||||||
return_fields(player, "enchanting_item")
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
--init inventory
|
|
||||||
local inv = player:get_inventory()
|
|
||||||
inv:set_width("main", 9)
|
|
||||||
inv:set_size("main", 36)
|
|
||||||
inv:set_size("offhand", 1)
|
|
||||||
|
|
||||||
--set hotbar size
|
|
||||||
player:hud_set_hotbar_itemcount(9)
|
|
||||||
--add hotbar images
|
|
||||||
player:hud_set_hotbar_image("mcl_inventory_hotbar.png")
|
|
||||||
player:hud_set_hotbar_selected_image("mcl_inventory_hotbar_selected.png")
|
|
||||||
|
|
||||||
local old_update_player = mcl_armor.update_player
|
|
||||||
function mcl_armor.update_player(player, info)
|
|
||||||
old_update_player(player, info)
|
|
||||||
set_inventory(player, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- In Creative Mode, the initial inventory setup is handled in creative.lua
|
|
||||||
if not minetest.is_creative_enabled(player:get_player_name()) then
|
|
||||||
set_inventory(player)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[ Make sure the crafting grid is empty. Why? Because the player might have
|
|
||||||
items remaining in the crafting grid from the previous join; this is likely
|
|
||||||
when the server has been shutdown and the server didn't clean up the player
|
|
||||||
inventories. ]]
|
|
||||||
return_fields(player, "craft")
|
|
||||||
return_fields(player, "enchanting_item")
|
|
||||||
return_fields(player, "enchanting_lapis")
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/creative.lua")
|
|
||||||
|
|
||||||
local mt_is_creative_enabled = minetest.is_creative_enabled
|
|
||||||
|
|
||||||
function minetest.is_creative_enabled(name)
|
|
||||||
if mt_is_creative_enabled(name) then return true end
|
|
||||||
local p = minetest.get_player_by_name(name)
|
|
||||||
if p then
|
|
||||||
return p:get_meta():get_string("gamemode") == "creative"
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local function in_table(n,h)
|
|
||||||
for k,v in pairs(h) do
|
|
||||||
if v == n then return true end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local gamemodes = {
|
|
||||||
"survival",
|
|
||||||
"creative"
|
|
||||||
}
|
|
||||||
|
|
||||||
function mcl_inventory.player_set_gamemode(p,g)
|
|
||||||
local m = p:get_meta()
|
|
||||||
m:set_string("gamemode",g)
|
|
||||||
set_inventory(p)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_chatcommand("gamemode",{
|
|
||||||
params = S("[<gamemode>] [<player>]"),
|
|
||||||
description = S("Change gamemode (survival/creative) for yourself or player"),
|
|
||||||
privs = { server = true },
|
|
||||||
func = function(n,param)
|
|
||||||
-- Full input validation ( just for @erlehmann <3 )
|
|
||||||
local p = minetest.get_player_by_name(n)
|
|
||||||
local args = param:split(" ")
|
|
||||||
if args[2] ~= nil then
|
|
||||||
p = minetest.get_player_by_name(args[2])
|
|
||||||
end
|
|
||||||
if not p then
|
|
||||||
return false, S("Player not online")
|
|
||||||
end
|
|
||||||
if args[1] ~= nil and not in_table(args[1],gamemodes) then
|
|
||||||
return false, S("Gamemode " .. args[1] .. " does not exist.")
|
|
||||||
elseif args[1] ~= nil then
|
|
||||||
mcl_inventory.player_set_gamemode(p,args[1])
|
|
||||||
end
|
|
||||||
--Result message - show effective game mode
|
|
||||||
local gm = p:get_meta():get_string("gamemode")
|
|
||||||
if gm == "" then gm = gamemodes[1] end
|
|
||||||
return true, S("Gamemode for player ")..n..S(": "..gm)
|
|
||||||
end
|
end
|
||||||
})
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Return items in the given inventory list (name) to the main inventory, or drop them if there is no space left
|
||||||
|
function return_fields(player, name)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local list = inv:get_list(name)
|
||||||
|
if not list then return end
|
||||||
|
for i,stack in ipairs(list) do
|
||||||
|
return_item(stack, player, player:get_pos(), inv)
|
||||||
|
stack:clear()
|
||||||
|
inv:set_stack(name, i, stack)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_inventory(player, armor_change_only)
|
||||||
|
if minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
|
if armor_change_only then
|
||||||
|
-- Stay on survival inventory plage if only the armor has been changed
|
||||||
|
mcl_inventory.set_creative_formspec(player, 0, 0, nil, nil, "inv")
|
||||||
|
else
|
||||||
|
mcl_inventory.set_creative_formspec(player, 0, 1)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
inv:set_width("craft", 2)
|
||||||
|
inv:set_size("craft", 4)
|
||||||
|
|
||||||
|
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
||||||
|
local armor_slot_imgs = ""
|
||||||
|
for a=1,4 do
|
||||||
|
if inv:get_stack("armor", a+1):is_empty() then
|
||||||
|
armor_slot_imgs = armor_slot_imgs .. "image[0,"..(a-1)..";1,1;mcl_inventory_empty_armor_slot_"..armor_slots[a]..".png]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if inv:get_stack("offhand", 1):is_empty() then
|
||||||
|
armor_slot_imgs = armor_slot_imgs .. "image[3,2;1,1;mcl_inventory_empty_armor_slot_shield.png]"
|
||||||
|
end
|
||||||
|
|
||||||
|
local form = "size[9,8.75]"..
|
||||||
|
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
||||||
|
mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "")..
|
||||||
|
--armor
|
||||||
|
"list[current_player;armor;0,0;1,1;1]"..
|
||||||
|
"list[current_player;armor;0,1;1,1;2]"..
|
||||||
|
"list[current_player;armor;0,2;1,1;3]"..
|
||||||
|
"list[current_player;armor;0,3;1,1;4]"..
|
||||||
|
mcl_formspec.get_itemslot_bg(0,0,1,1)..
|
||||||
|
mcl_formspec.get_itemslot_bg(0,1,1,1)..
|
||||||
|
mcl_formspec.get_itemslot_bg(0,2,1,1)..
|
||||||
|
mcl_formspec.get_itemslot_bg(0,3,1,1)..
|
||||||
|
"list[current_player;offhand;3,2;1,1]"..
|
||||||
|
mcl_formspec.get_itemslot_bg(3,2,1,1)..
|
||||||
|
armor_slot_imgs..
|
||||||
|
-- craft and inventory
|
||||||
|
"label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||||
|
"list[current_player;main;0,4.5;9,3;9]"..
|
||||||
|
"list[current_player;main;0,7.74;9,1;]"..
|
||||||
|
"label[4,0.5;"..F(minetest.colorize("#313131", S("Crafting"))).."]"..
|
||||||
|
"list[current_player;craft;4,1;2,2]"..
|
||||||
|
"list[current_player;craftpreview;7,1.5;1,1;]"..
|
||||||
|
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||||
|
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||||
|
mcl_formspec.get_itemslot_bg(4,1,2,2)..
|
||||||
|
mcl_formspec.get_itemslot_bg(7,1.5,1,1)..
|
||||||
|
-- crafting guide button
|
||||||
|
"image_button[4.5,3;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
||||||
|
"tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]"..
|
||||||
|
-- help button
|
||||||
|
"image_button[8,3;1,1;doc_button_icon_lores.png;__mcl_doc;]"..
|
||||||
|
"tooltip[__mcl_doc;"..F(S("Help")).."]"..
|
||||||
|
-- skins button
|
||||||
|
"image_button[3,3;1,1;mcl_skins_button.png;__mcl_skins;]"..
|
||||||
|
"tooltip[__mcl_skins;"..F(S("Select player skin")).."]"..
|
||||||
|
-- achievements button
|
||||||
|
"image_button[7,3;1,1;mcl_achievements_button.png;__mcl_achievements;]"..
|
||||||
|
"tooltip[__mcl_achievements;"..F(S("Achievements")).."]"..
|
||||||
|
-- for shortcuts
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[current_player;armor]"..
|
||||||
|
"listring[current_player;main]" ..
|
||||||
|
"listring[current_player;craft]" ..
|
||||||
|
"listring[current_player;main]"
|
||||||
|
player:set_inventory_formspec(form)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Drop items in craft grid and reset inventory on closing
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if fields.quit then
|
||||||
|
return_fields(player,"craft")
|
||||||
|
return_fields(player,"enchanting_lapis")
|
||||||
|
return_fields(player,"enchanting_item")
|
||||||
|
if not minetest.is_creative_enabled(player:get_player_name()) and (formname == "" or formname == "main") then
|
||||||
|
set_inventory(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not minetest.is_creative_enabled("") then
|
||||||
|
function mcl_inventory.update_inventory_formspec(player)
|
||||||
|
set_inventory(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Drop crafting grid items on leaving
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
return_fields(player, "craft")
|
||||||
|
return_fields(player, "enchanting_lapis")
|
||||||
|
return_fields(player, "enchanting_item")
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
--init inventory
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
inv:set_width("main", 9)
|
||||||
|
inv:set_size("main", 36)
|
||||||
|
inv:set_size("offhand", 1)
|
||||||
|
|
||||||
|
--set hotbar size
|
||||||
|
player:hud_set_hotbar_itemcount(9)
|
||||||
|
--add hotbar images
|
||||||
|
player:hud_set_hotbar_image("mcl_inventory_hotbar.png")
|
||||||
|
player:hud_set_hotbar_selected_image("mcl_inventory_hotbar_selected.png")
|
||||||
|
|
||||||
|
local old_update_player = mcl_armor.update_player
|
||||||
|
function mcl_armor.update_player(player, info)
|
||||||
|
old_update_player(player, info)
|
||||||
|
set_inventory(player, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- In Creative Mode, the initial inventory setup is handled in creative.lua
|
||||||
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
|
set_inventory(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[ Make sure the crafting grid is empty. Why? Because the player might have
|
||||||
|
items remaining in the crafting grid from the previous join; this is likely
|
||||||
|
when the server has been shutdown and the server didn't clean up the player
|
||||||
|
inventories. ]]
|
||||||
|
return_fields(player, "craft")
|
||||||
|
return_fields(player, "enchanting_item")
|
||||||
|
return_fields(player, "enchanting_lapis")
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()).."/creative.lua")
|
||||||
|
|
||||||
|
local mt_is_creative_enabled = minetest.is_creative_enabled
|
||||||
|
|
||||||
|
function minetest.is_creative_enabled(name)
|
||||||
|
if mt_is_creative_enabled(name) then return true end
|
||||||
|
local p = minetest.get_player_by_name(name)
|
||||||
|
if p then
|
||||||
|
return p:get_meta():get_string("gamemode") == "creative"
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function in_table(n,h)
|
||||||
|
for k,v in pairs(h) do
|
||||||
|
if v == n then return true end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local gamemodes = {
|
||||||
|
"survival",
|
||||||
|
"creative"
|
||||||
|
}
|
||||||
|
|
||||||
|
function mcl_inventory.player_set_gamemode(p,g)
|
||||||
|
local m = p:get_meta()
|
||||||
|
m:set_string("gamemode",g)
|
||||||
|
set_inventory(p)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand("gamemode",{
|
||||||
|
params = S("[<gamemode>] [<player>]"),
|
||||||
|
description = S("Change gamemode (survival/creative) for yourself or player"),
|
||||||
|
privs = { server = true },
|
||||||
|
func = function(n,param)
|
||||||
|
-- Full input validation ( just for @erlehmann <3 )
|
||||||
|
local p = minetest.get_player_by_name(n)
|
||||||
|
local args = param:split(" ")
|
||||||
|
if args[2] ~= nil then
|
||||||
|
p = minetest.get_player_by_name(args[2])
|
||||||
|
end
|
||||||
|
if not p then
|
||||||
|
return false, S("Player not online")
|
||||||
|
end
|
||||||
|
if args[1] ~= nil and not in_table(args[1],gamemodes) then
|
||||||
|
return false, S("Gamemode " .. args[1] .. " does not exist.")
|
||||||
|
elseif args[1] ~= nil then
|
||||||
|
mcl_inventory.player_set_gamemode(p,args[1])
|
||||||
|
end
|
||||||
|
--Result message - show effective game mode
|
||||||
|
local gm = p:get_meta():get_string("gamemode")
|
||||||
|
if gm == "" then gm = gamemodes[1] end
|
||||||
|
return true, S("Gamemode for player ")..n..S(": "..gm)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
@ -133,7 +133,7 @@ local dispenserdef = {
|
|||||||
if not stackdef then
|
if not stackdef then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local iname = stack:get_name()
|
local iname = stack:get_name()
|
||||||
local igroups = stackdef.groups
|
local igroups = stackdef.groups
|
||||||
|
|
||||||
|
@ -90,9 +90,9 @@ for i=0,4 do
|
|||||||
|
|
||||||
minetest.register_craft({ --TODO: Please change this crafting recipe once crying obsidian is implemented!
|
minetest.register_craft({ --TODO: Please change this crafting recipe once crying obsidian is implemented!
|
||||||
output = "mcl_beds:respawn_anchor",
|
output = "mcl_beds:respawn_anchor",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"},
|
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"},
|
||||||
{"mcl_nether:glowstone", "mcl_nether:glowstone", "mcl_nether:glowstone"},
|
{"mcl_nether:glowstone", "mcl_nether:glowstone", "mcl_nether:glowstone"},
|
||||||
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"}
|
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -314,7 +314,7 @@ controls.register_on_press(function(player, key)
|
|||||||
end
|
end
|
||||||
wielded_item = on_place_bucket(wielded_item, player, pointed_thing, def)
|
wielded_item = on_place_bucket(wielded_item, player, pointed_thing, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
player:set_wielded_item(wielded_item)
|
player:set_wielded_item(wielded_item)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -1,156 +1,156 @@
|
|||||||
--[[
|
--[[
|
||||||
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
|
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
|
||||||
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
|
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
local CAKE_HUNGER_POINTS = 2
|
local CAKE_HUNGER_POINTS = 2
|
||||||
|
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
local cake_texture = {"cake_top.png","cake_bottom.png","cake_inner.png","cake_side.png","cake_side.png","cake_side.png"}
|
local cake_texture = {"cake_top.png","cake_bottom.png","cake_inner.png","cake_side.png","cake_side.png","cake_side.png"}
|
||||||
local slice_1 = { -7/16, -8/16, -7/16, -5/16, 0/16, 7/16}
|
local slice_1 = { -7/16, -8/16, -7/16, -5/16, 0/16, 7/16}
|
||||||
local slice_2 = { -7/16, -8/16, -7/16, -3/16, 0/16, 7/16}
|
local slice_2 = { -7/16, -8/16, -7/16, -3/16, 0/16, 7/16}
|
||||||
local slice_3 = { -7/16, -8/16, -7/16, -1/16, 0/16, 7/16}
|
local slice_3 = { -7/16, -8/16, -7/16, -1/16, 0/16, 7/16}
|
||||||
local slice_4 = { -7/16, -8/16, -7/16, 1/16, 0/16, 7/16}
|
local slice_4 = { -7/16, -8/16, -7/16, 1/16, 0/16, 7/16}
|
||||||
local slice_5 = { -7/16, -8/16, -7/16, 3/16, 0/16, 7/16}
|
local slice_5 = { -7/16, -8/16, -7/16, 3/16, 0/16, 7/16}
|
||||||
local slice_6 = { -7/16, -8/16, -7/16, 5/16, 0/16, 7/16}
|
local slice_6 = { -7/16, -8/16, -7/16, 5/16, 0/16, 7/16}
|
||||||
|
|
||||||
local full_cake = { -7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
|
local full_cake = { -7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_cake:cake",
|
output = "mcl_cake:cake",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_mobitems:milk_bucket", "mcl_mobitems:milk_bucket", "mcl_mobitems:milk_bucket"},
|
{"mcl_mobitems:milk_bucket", "mcl_mobitems:milk_bucket", "mcl_mobitems:milk_bucket"},
|
||||||
{"mcl_core:sugar", "mcl_throwing:egg", "mcl_core:sugar"},
|
{"mcl_core:sugar", "mcl_throwing:egg", "mcl_core:sugar"},
|
||||||
{"mcl_farming:wheat_item", "mcl_farming:wheat_item", "mcl_farming:wheat_item"},
|
{"mcl_farming:wheat_item", "mcl_farming:wheat_item", "mcl_farming:wheat_item"},
|
||||||
},
|
},
|
||||||
replacements = {
|
replacements = {
|
||||||
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
|
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
|
||||||
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
|
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
|
||||||
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
|
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("mcl_cake:cake", {
|
minetest.register_node("mcl_cake:cake", {
|
||||||
description = S("Cake"),
|
description = S("Cake"),
|
||||||
_tt_help = S("With 7 tasty slices!").."\n"..S("Hunger points: +@1 per slice", CAKE_HUNGER_POINTS),
|
_tt_help = S("With 7 tasty slices!").."\n"..S("Hunger points: +@1 per slice", CAKE_HUNGER_POINTS),
|
||||||
_doc_items_longdesc = S("Cakes can be placed and eaten to restore hunger points. A cake has 7 slices. Each slice restores 2 hunger points and 0.4 saturation points. Cakes will be destroyed when dug or when the block below them is broken."),
|
_doc_items_longdesc = S("Cakes can be placed and eaten to restore hunger points. A cake has 7 slices. Each slice restores 2 hunger points and 0.4 saturation points. Cakes will be destroyed when dug or when the block below them is broken."),
|
||||||
_doc_items_usagehelp = S("Place the cake anywhere, then rightclick it to eat a single slice. You can't eat from the cake when your hunger bar is full."),
|
_doc_items_usagehelp = S("Place the cake anywhere, then rightclick it to eat a single slice. You can't eat from the cake when your hunger bar is full."),
|
||||||
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
|
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||||
inventory_image = "cake.png",
|
inventory_image = "cake.png",
|
||||||
wield_image = "cake.png",
|
wield_image = "cake.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = full_cake
|
fixed = full_cake
|
||||||
},
|
},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = full_cake
|
fixed = full_cake
|
||||||
},
|
},
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
groups = {
|
groups = {
|
||||||
handy = 1, attached_node = 1, dig_by_piston = 1, comparator_signal = 14,
|
handy = 1, attached_node = 1, dig_by_piston = 1, comparator_signal = 14,
|
||||||
cake = 7, food = 2, no_eat_delay = 1, compostability = 100
|
cake = 7, food = 2, no_eat_delay = 1, compostability = 100
|
||||||
},
|
},
|
||||||
drop = "",
|
drop = "",
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
-- Cake is subject to protection
|
-- Cake is subject to protection
|
||||||
local name = clicker:get_player_name()
|
local name = clicker:get_player_name()
|
||||||
if minetest.is_protected(pos, name) then
|
if minetest.is_protected(pos, name) then
|
||||||
minetest.record_protection_violation(pos, name)
|
minetest.record_protection_violation(pos, name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local newcake = minetest.do_item_eat(2, ItemStack("mcl_cake:cake_6"), ItemStack("mcl_cake:cake"), clicker, {type="nothing"})
|
local newcake = minetest.do_item_eat(2, ItemStack("mcl_cake:cake_6"), ItemStack("mcl_cake:cake"), clicker, {type="nothing"})
|
||||||
-- Check if we were allowed to eat
|
-- Check if we were allowed to eat
|
||||||
if newcake:get_name() ~= "mcl_cake:cake" or minetest.is_creative_enabled(clicker:get_player_name()) then
|
if newcake:get_name() ~= "mcl_cake:cake" or minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
minetest.add_node(pos,{type="node",name="mcl_cake:cake_6",param2=0})
|
minetest.add_node(pos,{type="node",name="mcl_cake:cake_6",param2=0})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
_food_particles = false,
|
_food_particles = false,
|
||||||
_mcl_saturation = 0.4,
|
_mcl_saturation = 0.4,
|
||||||
_mcl_blast_resistance = 0.5,
|
_mcl_blast_resistance = 0.5,
|
||||||
_mcl_hardness = 0.5,
|
_mcl_hardness = 0.5,
|
||||||
})
|
})
|
||||||
|
|
||||||
local register_slice = function(level, nodebox, desc)
|
local register_slice = function(level, nodebox, desc)
|
||||||
local this = "mcl_cake:cake_"..level
|
local this = "mcl_cake:cake_"..level
|
||||||
local after_eat = "mcl_cake:cake_"..(level-1)
|
local after_eat = "mcl_cake:cake_"..(level-1)
|
||||||
local on_rightclick
|
local on_rightclick
|
||||||
if level > 1 then
|
if level > 1 then
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local name = clicker:get_player_name()
|
local name = clicker:get_player_name()
|
||||||
if minetest.is_protected(pos, name) then
|
if minetest.is_protected(pos, name) then
|
||||||
minetest.record_protection_violation(pos, name)
|
minetest.record_protection_violation(pos, name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack(after_eat), ItemStack(this), clicker, {type="nothing"})
|
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack(after_eat), ItemStack(this), clicker, {type="nothing"})
|
||||||
-- Check if we were allowed to eat
|
-- Check if we were allowed to eat
|
||||||
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
|
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
minetest.add_node(pos,{type="node",name=after_eat,param2=0})
|
minetest.add_node(pos,{type="node",name=after_eat,param2=0})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Last slice
|
-- Last slice
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local name = clicker:get_player_name()
|
local name = clicker:get_player_name()
|
||||||
if minetest.is_protected(pos, name) then
|
if minetest.is_protected(pos, name) then
|
||||||
minetest.record_protection_violation(pos, name)
|
minetest.record_protection_violation(pos, name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack("mcl:cake:cake 0"), ItemStack("mcl_cake:cake_1"), clicker, {type="nothing"})
|
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack("mcl:cake:cake 0"), ItemStack("mcl_cake:cake_1"), clicker, {type="nothing"})
|
||||||
-- Check if we were allowed to eat
|
-- Check if we were allowed to eat
|
||||||
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
|
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
minetest.check_for_falling(pos)
|
minetest.check_for_falling(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(this, {
|
minetest.register_node(this, {
|
||||||
description = desc,
|
description = desc,
|
||||||
_doc_items_create_entry = false,
|
_doc_items_create_entry = false,
|
||||||
tiles = cake_texture,
|
tiles = cake_texture,
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = nodebox,
|
fixed = nodebox,
|
||||||
},
|
},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = nodebox,
|
fixed = nodebox,
|
||||||
},
|
},
|
||||||
groups = {
|
groups = {
|
||||||
handy = 1, attached_node = 1, not_in_creative_inventory = 1,
|
handy = 1, attached_node = 1, not_in_creative_inventory = 1,
|
||||||
dig_by_piston = 1, cake = level, comparator_signal = level * 2,
|
dig_by_piston = 1, cake = level, comparator_signal = level * 2,
|
||||||
food = 2, no_eat_delay = 1
|
food = 2, no_eat_delay = 1
|
||||||
},
|
},
|
||||||
drop = "",
|
drop = "",
|
||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
_food_particles = false,
|
_food_particles = false,
|
||||||
_mcl_saturation = 0.4,
|
_mcl_saturation = 0.4,
|
||||||
_mcl_blast_resistance = 0.5,
|
_mcl_blast_resistance = 0.5,
|
||||||
_mcl_hardness = 0.5,
|
_mcl_hardness = 0.5,
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.get_modpath("doc") then
|
if minetest.get_modpath("doc") then
|
||||||
doc.add_entry_alias("nodes", "mcl_cake:cake", "nodes", "mcl_cake:cake_"..level)
|
doc.add_entry_alias("nodes", "mcl_cake:cake", "nodes", "mcl_cake:cake_"..level)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
register_slice(6, slice_6, S("Cake (6 Slices Left)"))
|
register_slice(6, slice_6, S("Cake (6 Slices Left)"))
|
||||||
register_slice(5, slice_5, S("Cake (5 Slices Left)"))
|
register_slice(5, slice_5, S("Cake (5 Slices Left)"))
|
||||||
register_slice(4, slice_4, S("Cake (4 Slices Left)"))
|
register_slice(4, slice_4, S("Cake (4 Slices Left)"))
|
||||||
register_slice(3, slice_3, S("Cake (3 Slices Left)"))
|
register_slice(3, slice_3, S("Cake (3 Slices Left)"))
|
||||||
register_slice(2, slice_2, S("Cake (2 Slices Left)"))
|
register_slice(2, slice_2, S("Cake (2 Slices Left)"))
|
||||||
register_slice(1, slice_1, S("Cake (1 Slice Left)"))
|
register_slice(1, slice_1, S("Cake (1 Slice Left)"))
|
||||||
|
@ -1,70 +1,70 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local formspec_escape = minetest.formspec_escape
|
local formspec_escape = minetest.formspec_escape
|
||||||
local show_formspec = minetest.show_formspec
|
local show_formspec = minetest.show_formspec
|
||||||
local C = minetest.colorize
|
local C = minetest.colorize
|
||||||
local text_color = "#313131"
|
local text_color = "#313131"
|
||||||
local itemslot_bg = mcl_formspec.get_itemslot_bg
|
local itemslot_bg = mcl_formspec.get_itemslot_bg
|
||||||
|
|
||||||
mcl_crafting_table = {}
|
mcl_crafting_table = {}
|
||||||
|
|
||||||
function mcl_crafting_table.show_crafting_form(player)
|
function mcl_crafting_table.show_crafting_form(player)
|
||||||
player:get_inventory():set_width("craft", 3)
|
player:get_inventory():set_width("craft", 3)
|
||||||
player:get_inventory():set_size("craft", 9)
|
player:get_inventory():set_size("craft", 9)
|
||||||
|
|
||||||
show_formspec(player:get_player_name(), "main",
|
show_formspec(player:get_player_name(), "main",
|
||||||
"size[9,8.75]"..
|
"size[9,8.75]"..
|
||||||
"image[4.7,1.5;1.5,1;gui_crafting_arrow.png]"..
|
"image[4.7,1.5;1.5,1;gui_crafting_arrow.png]"..
|
||||||
"label[0,4;"..formspec_escape(C(text_color, S("Inventory"))).."]"..
|
"label[0,4;"..formspec_escape(C(text_color, S("Inventory"))).."]"..
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
"list[current_player;main;0,4.5;9,3;9]"..
|
||||||
itemslot_bg(0,4.5,9,3)..
|
itemslot_bg(0,4.5,9,3)..
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
"list[current_player;main;0,7.74;9,1;]"..
|
||||||
itemslot_bg(0,7.74,9,1)..
|
itemslot_bg(0,7.74,9,1)..
|
||||||
"label[1.75,0;"..formspec_escape(C(text_color, S("Crafting"))).."]"..
|
"label[1.75,0;"..formspec_escape(C(text_color, S("Crafting"))).."]"..
|
||||||
"list[current_player;craft;1.75,0.5;3,3;]"..
|
"list[current_player;craft;1.75,0.5;3,3;]"..
|
||||||
itemslot_bg(1.75,0.5,3,3)..
|
itemslot_bg(1.75,0.5,3,3)..
|
||||||
"list[current_player;craftpreview;6.1,1.5;1,1;]"..
|
"list[current_player;craftpreview;6.1,1.5;1,1;]"..
|
||||||
itemslot_bg(6.1,1.5,1,1)..
|
itemslot_bg(6.1,1.5,1,1)..
|
||||||
"image_button[0.75,1.5;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
"image_button[0.75,1.5;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
||||||
"tooltip[__mcl_craftguide;"..formspec_escape(S("Recipe book")).."]"..
|
"tooltip[__mcl_craftguide;"..formspec_escape(S("Recipe book")).."]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[current_player;craft]"
|
"listring[current_player;craft]"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("mcl_crafting_table:crafting_table", {
|
minetest.register_node("mcl_crafting_table:crafting_table", {
|
||||||
description = S("Crafting Table"),
|
description = S("Crafting Table"),
|
||||||
_tt_help = S("3×3 crafting grid"),
|
_tt_help = S("3×3 crafting grid"),
|
||||||
_doc_items_longdesc = S("A crafting table is a block which grants you access to a 3×3 crafting grid which allows you to perform advanced crafts."),
|
_doc_items_longdesc = S("A crafting table is a block which grants you access to a 3×3 crafting grid which allows you to perform advanced crafts."),
|
||||||
_doc_items_usagehelp = S("Rightclick the crafting table to access the 3×3 crafting grid."),
|
_doc_items_usagehelp = S("Rightclick the crafting table to access the 3×3 crafting grid."),
|
||||||
_doc_items_hidden = false,
|
_doc_items_hidden = false,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
|
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
|
||||||
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
|
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {handy=1,axey=1, deco_block=1, material_wood=1,flammable=-1},
|
groups = {handy=1,axey=1, deco_block=1, material_wood=1,flammable=-1},
|
||||||
on_rightclick = function(pos, node, player, itemstack)
|
on_rightclick = function(pos, node, player, itemstack)
|
||||||
if not player:get_player_control().sneak then
|
if not player:get_player_control().sneak then
|
||||||
mcl_crafting_table.show_crafting_form(player)
|
mcl_crafting_table.show_crafting_form(player)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
_mcl_blast_resistance = 2.5,
|
_mcl_blast_resistance = 2.5,
|
||||||
_mcl_hardness = 2.5,
|
_mcl_hardness = 2.5,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_crafting_table:crafting_table",
|
output = "mcl_crafting_table:crafting_table",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:wood", "group:wood"},
|
{"group:wood", "group:wood"},
|
||||||
{"group:wood", "group:wood"}
|
{"group:wood", "group:wood"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_crafting_table:crafting_table",
|
recipe = "mcl_crafting_table:crafting_table",
|
||||||
burntime = 15,
|
burntime = 15,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_alias("crafting:workbench", "mcl_crafting_table:crafting_table")
|
minetest.register_alias("crafting:workbench", "mcl_crafting_table:crafting_table")
|
||||||
minetest.register_alias("mcl_inventory:workbench", "mcl_crafting_table:crafting_table")
|
minetest.register_alias("mcl_inventory:workbench", "mcl_crafting_table:crafting_table")
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,231 +1,231 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
-- Wrapper around mintest.pointed_thing_to_face_pos.
|
-- Wrapper around mintest.pointed_thing_to_face_pos.
|
||||||
local function get_fpos(placer, pointed_thing)
|
local function get_fpos(placer, pointed_thing)
|
||||||
local fpos
|
local fpos
|
||||||
-- Workaround: minetest.pointed_thing_to_face_pos crashes in MT 0.4.16 if
|
-- Workaround: minetest.pointed_thing_to_face_pos crashes in MT 0.4.16 if
|
||||||
-- pointed_thing.under and pointed_thing.above are equal
|
-- pointed_thing.under and pointed_thing.above are equal
|
||||||
-- FIXME: Remove this when MT got fixed.
|
-- FIXME: Remove this when MT got fixed.
|
||||||
if not vector.equals(pointed_thing.under, pointed_thing.above) then
|
if not vector.equals(pointed_thing.under, pointed_thing.above) then
|
||||||
-- The happy case: Everything is normal
|
-- The happy case: Everything is normal
|
||||||
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
|
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
|
||||||
fpos = finepos.y % 1
|
fpos = finepos.y % 1
|
||||||
else
|
else
|
||||||
-- Fallback if both above and under are equal
|
-- Fallback if both above and under are equal
|
||||||
fpos = 0
|
fpos = 0
|
||||||
end
|
end
|
||||||
return fpos
|
return fpos
|
||||||
end
|
end
|
||||||
|
|
||||||
---- Trapdoor ----
|
---- Trapdoor ----
|
||||||
|
|
||||||
local on_rotate
|
local on_rotate
|
||||||
if minetest.get_modpath("screwdriver") then
|
if minetest.get_modpath("screwdriver") then
|
||||||
on_rotate = function(pos, node, user, mode, param2)
|
on_rotate = function(pos, node, user, mode, param2)
|
||||||
-- Flip trapdoor vertically
|
-- Flip trapdoor vertically
|
||||||
if mode == screwdriver.ROTATE_AXIS then
|
if mode == screwdriver.ROTATE_AXIS then
|
||||||
local minor = node.param2
|
local minor = node.param2
|
||||||
if node.param2 >= 20 then
|
if node.param2 >= 20 then
|
||||||
minor = node.param2 - 20
|
minor = node.param2 - 20
|
||||||
if minor == 3 then
|
if minor == 3 then
|
||||||
minor = 1
|
minor = 1
|
||||||
elseif minor == 1 then
|
elseif minor == 1 then
|
||||||
minor = 3
|
minor = 3
|
||||||
end
|
end
|
||||||
node.param2 = minor
|
node.param2 = minor
|
||||||
else
|
else
|
||||||
if minor == 3 then
|
if minor == 3 then
|
||||||
minor = 1
|
minor = 1
|
||||||
elseif minor == 1 then
|
elseif minor == 1 then
|
||||||
minor = 3
|
minor = 3
|
||||||
end
|
end
|
||||||
node.param2 = minor
|
node.param2 = minor
|
||||||
node.param2 = node.param2 + 20
|
node.param2 = node.param2 + 20
|
||||||
end
|
end
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_doors:register_trapdoor(name, def)
|
function mcl_doors:register_trapdoor(name, def)
|
||||||
local groups = table.copy(def.groups)
|
local groups = table.copy(def.groups)
|
||||||
if groups == nil then
|
if groups == nil then
|
||||||
groups = {}
|
groups = {}
|
||||||
end
|
end
|
||||||
groups.mesecon_ignore_opaque_dig = 1
|
groups.mesecon_ignore_opaque_dig = 1
|
||||||
|
|
||||||
if not def.sound_open then
|
if not def.sound_open then
|
||||||
def.sound_open = "doors_door_open"
|
def.sound_open = "doors_door_open"
|
||||||
end
|
end
|
||||||
if not def.sound_close then
|
if not def.sound_close then
|
||||||
def.sound_close = "doors_door_close"
|
def.sound_close = "doors_door_close"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function punch(pos)
|
local function punch(pos)
|
||||||
local me = minetest.get_node(pos)
|
local me = minetest.get_node(pos)
|
||||||
local tmp_node
|
local tmp_node
|
||||||
-- Close
|
-- Close
|
||||||
if minetest.get_item_group(me.name, "trapdoor") == 2 then
|
if minetest.get_item_group(me.name, "trapdoor") == 2 then
|
||||||
minetest.sound_play(def.sound_close, {pos = pos, gain = 0.3, max_hear_distance = 16}, true)
|
minetest.sound_play(def.sound_close, {pos = pos, gain = 0.3, max_hear_distance = 16}, true)
|
||||||
tmp_node = {name=name, param1=me.param1, param2=me.param2}
|
tmp_node = {name=name, param1=me.param1, param2=me.param2}
|
||||||
-- Open
|
-- Open
|
||||||
else
|
else
|
||||||
minetest.sound_play(def.sound_open, {pos = pos, gain = 0.3, max_hear_distance = 16}, true)
|
minetest.sound_play(def.sound_open, {pos = pos, gain = 0.3, max_hear_distance = 16}, true)
|
||||||
tmp_node = {name=name.."_open", param1=me.param1, param2=me.param2}
|
tmp_node = {name=name.."_open", param1=me.param1, param2=me.param2}
|
||||||
end
|
end
|
||||||
minetest.set_node(pos, tmp_node)
|
minetest.set_node(pos, tmp_node)
|
||||||
end
|
end
|
||||||
|
|
||||||
local on_rightclick
|
local on_rightclick
|
||||||
if not def.only_redstone_can_open then
|
if not def.only_redstone_can_open then
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
punch(pos)
|
punch(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Default help texts
|
-- Default help texts
|
||||||
local longdesc, usagehelp, tt_help
|
local longdesc, usagehelp, tt_help
|
||||||
longdesc = def._doc_items_longdesc
|
longdesc = def._doc_items_longdesc
|
||||||
if not longdesc then
|
if not longdesc then
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
longdesc = S("Trapdoors are horizontal barriers which can be opened or closed and climbed like a ladder when open. They occupy the upper or lower part of a block, depending on how they have been placed. This trapdoor can only be opened or closed by redstone power.")
|
longdesc = S("Trapdoors are horizontal barriers which can be opened or closed and climbed like a ladder when open. They occupy the upper or lower part of a block, depending on how they have been placed. This trapdoor can only be opened or closed by redstone power.")
|
||||||
else
|
else
|
||||||
longdesc = S("Trapdoors are horizontal barriers which can be opened or closed and climbed like a ladder when open. They occupy the upper or lower part of a block, depending on how they have been placed. This trapdoor can be opened or closed by hand or redstone power.")
|
longdesc = S("Trapdoors are horizontal barriers which can be opened or closed and climbed like a ladder when open. They occupy the upper or lower part of a block, depending on how they have been placed. This trapdoor can be opened or closed by hand or redstone power.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
usagehelp = def._doc_items_usagehelp
|
usagehelp = def._doc_items_usagehelp
|
||||||
if not usagehelp and not def.only_redstone_can_open then
|
if not usagehelp and not def.only_redstone_can_open then
|
||||||
usagehelp = S("To open or close this trapdoor, rightclick it or send a redstone signal to it.")
|
usagehelp = S("To open or close this trapdoor, rightclick it or send a redstone signal to it.")
|
||||||
end
|
end
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
tt_help = S("Openable by redstone power")
|
tt_help = S("Openable by redstone power")
|
||||||
else
|
else
|
||||||
tt_help = S("Openable by players and redstone power")
|
tt_help = S("Openable by players and redstone power")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Closed trapdoor
|
-- Closed trapdoor
|
||||||
|
|
||||||
local tile_front = def.tile_front
|
local tile_front = def.tile_front
|
||||||
local tile_side = def.tile_side
|
local tile_side = def.tile_side
|
||||||
if not tile_side then
|
if not tile_side then
|
||||||
tile_side = tile_front
|
tile_side = tile_front
|
||||||
end
|
end
|
||||||
local tiles_closed = {
|
local tiles_closed = {
|
||||||
tile_front,
|
tile_front,
|
||||||
tile_front .. "^[transformFY",
|
tile_front .. "^[transformFY",
|
||||||
tile_side, tile_side,
|
tile_side, tile_side,
|
||||||
tile_side, tile_side,
|
tile_side, tile_side,
|
||||||
}
|
}
|
||||||
|
|
||||||
local groups_closed = groups
|
local groups_closed = groups
|
||||||
groups_closed.trapdoor = 1
|
groups_closed.trapdoor = 1
|
||||||
groups_closed.deco_block = 1
|
groups_closed.deco_block = 1
|
||||||
minetest.register_node(name, {
|
minetest.register_node(name, {
|
||||||
description = def.description,
|
description = def.description,
|
||||||
_tt_help = tt_help,
|
_tt_help = tt_help,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
_doc_items_usagehelp = usagehelp,
|
_doc_items_usagehelp = usagehelp,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = tiles_closed,
|
tiles = tiles_closed,
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
inventory_image = def.inventory_image,
|
inventory_image = def.inventory_image,
|
||||||
wield_image = def.wield_image,
|
wield_image = def.wield_image,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
groups = groups_closed,
|
groups = groups_closed,
|
||||||
_mcl_hardness = def._mcl_hardness,
|
_mcl_hardness = def._mcl_hardness,
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
_mcl_blast_resistance = def._mcl_blast_resistance,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-8/16, -8/16, -8/16, 8/16, -5/16, 8/16},},
|
{-8/16, -8/16, -8/16, 8/16, -5/16, 8/16},},
|
||||||
},
|
},
|
||||||
mesecons = {effector = {
|
mesecons = {effector = {
|
||||||
action_on = (function(pos, node)
|
action_on = (function(pos, node)
|
||||||
punch(pos)
|
punch(pos)
|
||||||
end),
|
end),
|
||||||
}},
|
}},
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local p0 = pointed_thing.under
|
local p0 = pointed_thing.under
|
||||||
local p1 = pointed_thing.above
|
local p1 = pointed_thing.above
|
||||||
local param2 = 0
|
local param2 = 0
|
||||||
|
|
||||||
local placer_pos = placer:get_pos()
|
local placer_pos = placer:get_pos()
|
||||||
if placer_pos then
|
if placer_pos then
|
||||||
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
|
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
|
||||||
end
|
end
|
||||||
|
|
||||||
local fpos = get_fpos(placer, pointed_thing)
|
local fpos = get_fpos(placer, pointed_thing)
|
||||||
|
|
||||||
--local origname = itemstack:get_name()
|
--local origname = itemstack:get_name()
|
||||||
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
|
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
|
||||||
or (fpos < -0.5 and fpos > -0.999999999) then
|
or (fpos < -0.5 and fpos > -0.999999999) then
|
||||||
param2 = param2 + 20
|
param2 = param2 + 20
|
||||||
if param2 == 21 then
|
if param2 == 21 then
|
||||||
param2 = 23
|
param2 = 23
|
||||||
elseif param2 == 23 then
|
elseif param2 == 23 then
|
||||||
param2 = 21
|
param2 = 21
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
end,
|
end,
|
||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
on_rotate = on_rotate,
|
on_rotate = on_rotate,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Open trapdoor
|
-- Open trapdoor
|
||||||
|
|
||||||
local groups_open = table.copy(groups)
|
local groups_open = table.copy(groups)
|
||||||
|
|
||||||
local tiles_open = {
|
local tiles_open = {
|
||||||
tile_side,
|
tile_side,
|
||||||
tile_side .. "^[transformR180",
|
tile_side .. "^[transformR180",
|
||||||
tile_side .. "^[transformR270",
|
tile_side .. "^[transformR270",
|
||||||
tile_side .. "^[transformR90",
|
tile_side .. "^[transformR90",
|
||||||
tile_front .. "^[transform46",
|
tile_front .. "^[transform46",
|
||||||
tile_front .. "^[transformFY",
|
tile_front .. "^[transformFY",
|
||||||
}
|
}
|
||||||
|
|
||||||
groups_open.trapdoor = 2
|
groups_open.trapdoor = 2
|
||||||
groups_open.not_in_creative_inventory = 1
|
groups_open.not_in_creative_inventory = 1
|
||||||
minetest.register_node(name.."_open", {
|
minetest.register_node(name.."_open", {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = tiles_open,
|
tiles = tiles_open,
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
-- TODO: Implement Minecraft behaviour: Climbable if directly above
|
-- TODO: Implement Minecraft behaviour: Climbable if directly above
|
||||||
-- ladder w/ matching orientation.
|
-- ladder w/ matching orientation.
|
||||||
-- Current behavour: Always climbable
|
-- Current behavour: Always climbable
|
||||||
climbable = true,
|
climbable = true,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
pointable = true,
|
pointable = true,
|
||||||
groups = groups_open,
|
groups = groups_open,
|
||||||
_mcl_hardness = def._mcl_hardness,
|
_mcl_hardness = def._mcl_hardness,
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
_mcl_blast_resistance = def._mcl_blast_resistance,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
drop = name,
|
drop = name,
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, 5/16, 0.5, 0.5, 0.5}
|
fixed = {-0.5, -0.5, 5/16, 0.5, 0.5, 0.5}
|
||||||
},
|
},
|
||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
mesecons = {effector = {
|
mesecons = {effector = {
|
||||||
action_off = (function(pos, node)
|
action_off = (function(pos, node)
|
||||||
punch(pos)
|
punch(pos)
|
||||||
end),
|
end),
|
||||||
}},
|
}},
|
||||||
on_rotate = on_rotate,
|
on_rotate = on_rotate,
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.get_modpath("doc") then
|
if minetest.get_modpath("doc") then
|
||||||
doc.add_entry_alias("nodes", name, "nodes", name.."_open")
|
doc.add_entry_alias("nodes", name, "nodes", name.."_open")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
mcl_doors = {}
|
mcl_doors = {}
|
||||||
|
|
||||||
local this = minetest.get_current_modname()
|
local this = minetest.get_current_modname()
|
||||||
local path = minetest.get_modpath(this)
|
local path = minetest.get_modpath(this)
|
||||||
|
|
||||||
dofile(path.."/api_doors.lua") -- Doors API
|
dofile(path.."/api_doors.lua") -- Doors API
|
||||||
dofile(path.."/api_trapdoors.lua") -- Trapdoors API
|
dofile(path.."/api_trapdoors.lua") -- Trapdoors API
|
||||||
dofile(path.."/register.lua") -- Register builtin doors and trapdoors
|
dofile(path.."/register.lua") -- Register builtin doors and trapdoors
|
||||||
dofile(path.."/alias.lua") -- Legacy aliases
|
dofile(path.."/alias.lua") -- Legacy aliases
|
||||||
|
@ -1,275 +1,275 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
local function create_soil(pos, inv)
|
local function create_soil(pos, inv)
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local name = node.name
|
local name = node.name
|
||||||
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||||
if minetest.get_item_group(name, "cultivatable") == 2 then
|
if minetest.get_item_group(name, "cultivatable") == 2 then
|
||||||
if above.name == "air" then
|
if above.name == "air" then
|
||||||
node.name = "mcl_farming:soil"
|
node.name = "mcl_farming:soil"
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.5 }, true)
|
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.5 }, true)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
elseif minetest.get_item_group(name, "cultivatable") == 1 then
|
elseif minetest.get_item_group(name, "cultivatable") == 1 then
|
||||||
if above.name == "air" then
|
if above.name == "air" then
|
||||||
node.name = "mcl_core:dirt"
|
node.name = "mcl_core:dirt"
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.6 }, true)
|
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.6 }, true)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local hoe_on_place_function = function(wear_divisor)
|
local hoe_on_place_function = function(wear_divisor)
|
||||||
return function(itemstack, user, pointed_thing)
|
return function(itemstack, user, pointed_thing)
|
||||||
-- Call on_rightclick if the pointed node defines it
|
-- Call on_rightclick if the pointed node defines it
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
if user and not user:get_player_control().sneak then
|
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
|
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
|
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||||
minetest.record_protection_violation(pointed_thing.under, user:get_player_name())
|
minetest.record_protection_violation(pointed_thing.under, user:get_player_name())
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
if create_soil(pointed_thing.under, user:get_inventory()) then
|
if create_soil(pointed_thing.under, user:get_inventory()) then
|
||||||
if not minetest.is_creative_enabled(user:get_player_name()) then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
itemstack:add_wear(65535/wear_divisor)
|
itemstack:add_wear(65535/wear_divisor)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local uses = {
|
local uses = {
|
||||||
wood = 60,
|
wood = 60,
|
||||||
stone = 132,
|
stone = 132,
|
||||||
iron = 251,
|
iron = 251,
|
||||||
gold = 33,
|
gold = 33,
|
||||||
diamond = 1562,
|
diamond = 1562,
|
||||||
}
|
}
|
||||||
|
|
||||||
local hoe_tt = S("Turns block into farmland")
|
local hoe_tt = S("Turns block into farmland")
|
||||||
local hoe_longdesc = S("Hoes are essential tools for growing crops. They are used to create farmland in order to plant seeds on it. Hoes can also be used as very weak weapons in a pinch.")
|
local hoe_longdesc = S("Hoes are essential tools for growing crops. They are used to create farmland in order to plant seeds on it. Hoes can also be used as very weak weapons in a pinch.")
|
||||||
local hoe_usagehelp = S("Use the hoe on a cultivatable block (by rightclicking it) to turn it into farmland. Dirt, grass blocks and grass paths are cultivatable blocks. Using a hoe on coarse dirt turns it into dirt.")
|
local hoe_usagehelp = S("Use the hoe on a cultivatable block (by rightclicking it) to turn it into farmland. Dirt, grass blocks and grass paths are cultivatable blocks. Using a hoe on coarse dirt turns it into dirt.")
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_wood", {
|
minetest.register_tool("mcl_farming:hoe_wood", {
|
||||||
description = S("Wood Hoe"),
|
description = S("Wood Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.wood),
|
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.wood),
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
_doc_items_hidden = false,
|
_doc_items_hidden = false,
|
||||||
inventory_image = "farming_tool_woodhoe.png",
|
inventory_image = "farming_tool_woodhoe.png",
|
||||||
wield_scale = mcl_vars.tool_wield_scale,
|
wield_scale = mcl_vars.tool_wield_scale,
|
||||||
on_place = hoe_on_place_function(uses.wood),
|
on_place = hoe_on_place_function(uses.wood),
|
||||||
groups = { tool=1, hoe=1, enchantability=15 },
|
groups = { tool=1, hoe=1, enchantability=15 },
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1,
|
full_punch_interval = 1,
|
||||||
damage_groups = { fleshy = 1, },
|
damage_groups = { fleshy = 1, },
|
||||||
punch_attack_uses = uses.wood,
|
punch_attack_uses = uses.wood,
|
||||||
},
|
},
|
||||||
_repair_material = "group:wood",
|
_repair_material = "group:wood",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
_mcl_diggroups = {
|
_mcl_diggroups = {
|
||||||
hoey = { speed = 2, level = 1, uses = 60 }
|
hoey = { speed = 2, level = 1, uses = 60 }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_wood",
|
output = "mcl_farming:hoe_wood",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:wood", "group:wood"},
|
{"group:wood", "group:wood"},
|
||||||
{"", "mcl_core:stick"},
|
{"", "mcl_core:stick"},
|
||||||
{"", "mcl_core:stick"}
|
{"", "mcl_core:stick"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_wood",
|
output = "mcl_farming:hoe_wood",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:wood", "group:wood"},
|
{"group:wood", "group:wood"},
|
||||||
{"mcl_core:stick", ""},
|
{"mcl_core:stick", ""},
|
||||||
{"mcl_core:stick", ""}
|
{"mcl_core:stick", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_farming:hoe_wood",
|
recipe = "mcl_farming:hoe_wood",
|
||||||
burntime = 10,
|
burntime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_stone", {
|
minetest.register_tool("mcl_farming:hoe_stone", {
|
||||||
description = S("Stone Hoe"),
|
description = S("Stone Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.stone),
|
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.stone),
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_stonehoe.png",
|
inventory_image = "farming_tool_stonehoe.png",
|
||||||
wield_scale = mcl_vars.tool_wield_scale,
|
wield_scale = mcl_vars.tool_wield_scale,
|
||||||
on_place = hoe_on_place_function(uses.stone),
|
on_place = hoe_on_place_function(uses.stone),
|
||||||
groups = { tool=1, hoe=1, enchantability=5 },
|
groups = { tool=1, hoe=1, enchantability=5 },
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 0.5,
|
full_punch_interval = 0.5,
|
||||||
damage_groups = { fleshy = 1, },
|
damage_groups = { fleshy = 1, },
|
||||||
punch_attack_uses = uses.stone,
|
punch_attack_uses = uses.stone,
|
||||||
},
|
},
|
||||||
_repair_material = "group:cobble",
|
_repair_material = "group:cobble",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
_mcl_diggroups = {
|
_mcl_diggroups = {
|
||||||
hoey = { speed = 4, level = 3, uses = 132 }
|
hoey = { speed = 4, level = 3, uses = 132 }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_stone",
|
output = "mcl_farming:hoe_stone",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:cobble", "group:cobble"},
|
{"group:cobble", "group:cobble"},
|
||||||
{"", "mcl_core:stick"},
|
{"", "mcl_core:stick"},
|
||||||
{"", "mcl_core:stick"}
|
{"", "mcl_core:stick"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_stone",
|
output = "mcl_farming:hoe_stone",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:cobble", "group:cobble"},
|
{"group:cobble", "group:cobble"},
|
||||||
{"mcl_core:stick", ""},
|
{"mcl_core:stick", ""},
|
||||||
{"mcl_core:stick", ""}
|
{"mcl_core:stick", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_iron", {
|
minetest.register_tool("mcl_farming:hoe_iron", {
|
||||||
description = S("Iron Hoe"),
|
description = S("Iron Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.iron),
|
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.iron),
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_steelhoe.png",
|
inventory_image = "farming_tool_steelhoe.png",
|
||||||
wield_scale = mcl_vars.tool_wield_scale,
|
wield_scale = mcl_vars.tool_wield_scale,
|
||||||
on_place = hoe_on_place_function(uses.iron),
|
on_place = hoe_on_place_function(uses.iron),
|
||||||
groups = { tool=1, hoe=1, enchantability=14 },
|
groups = { tool=1, hoe=1, enchantability=14 },
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
-- 1/3
|
-- 1/3
|
||||||
full_punch_interval = 0.33333333,
|
full_punch_interval = 0.33333333,
|
||||||
damage_groups = { fleshy = 1, },
|
damage_groups = { fleshy = 1, },
|
||||||
punch_attack_uses = uses.iron,
|
punch_attack_uses = uses.iron,
|
||||||
},
|
},
|
||||||
_repair_material = "mcl_core:iron_ingot",
|
_repair_material = "mcl_core:iron_ingot",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
_mcl_diggroups = {
|
_mcl_diggroups = {
|
||||||
hoey = { speed = 6, level = 4, uses = 251 }
|
hoey = { speed = 6, level = 4, uses = 251 }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_iron",
|
output = "mcl_farming:hoe_iron",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
{"mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
||||||
{"", "mcl_core:stick"},
|
{"", "mcl_core:stick"},
|
||||||
{"", "mcl_core:stick"}
|
{"", "mcl_core:stick"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_iron",
|
output = "mcl_farming:hoe_iron",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
{"mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
||||||
{"mcl_core:stick", ""},
|
{"mcl_core:stick", ""},
|
||||||
{"mcl_core:stick", ""}
|
{"mcl_core:stick", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mcl_core:iron_nugget",
|
output = "mcl_core:iron_nugget",
|
||||||
recipe = "mcl_farming:hoe_iron",
|
recipe = "mcl_farming:hoe_iron",
|
||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_gold", {
|
minetest.register_tool("mcl_farming:hoe_gold", {
|
||||||
description = S("Golden Hoe"),
|
description = S("Golden Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.gold),
|
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.gold),
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_goldhoe.png",
|
inventory_image = "farming_tool_goldhoe.png",
|
||||||
wield_scale = mcl_vars.tool_wield_scale,
|
wield_scale = mcl_vars.tool_wield_scale,
|
||||||
on_place = hoe_on_place_function(uses.gold),
|
on_place = hoe_on_place_function(uses.gold),
|
||||||
groups = { tool=1, hoe=1, enchantability=22 },
|
groups = { tool=1, hoe=1, enchantability=22 },
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1,
|
full_punch_interval = 1,
|
||||||
damage_groups = { fleshy = 1, },
|
damage_groups = { fleshy = 1, },
|
||||||
punch_attack_uses = uses.gold,
|
punch_attack_uses = uses.gold,
|
||||||
},
|
},
|
||||||
_repair_material = "mcl_core:gold_ingot",
|
_repair_material = "mcl_core:gold_ingot",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
_mcl_diggroups = {
|
_mcl_diggroups = {
|
||||||
hoey = { speed = 12, level = 2, uses = 33 }
|
hoey = { speed = 12, level = 2, uses = 33 }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_gold",
|
output = "mcl_farming:hoe_gold",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
{"mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
||||||
{"", "mcl_core:stick"},
|
{"", "mcl_core:stick"},
|
||||||
{"", "mcl_core:stick"}
|
{"", "mcl_core:stick"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_gold",
|
output = "mcl_farming:hoe_gold",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
{"mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
||||||
{"mcl_core:stick", ""},
|
{"mcl_core:stick", ""},
|
||||||
{"mcl_core:stick", ""}
|
{"mcl_core:stick", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mcl_core:gold_nugget",
|
output = "mcl_core:gold_nugget",
|
||||||
recipe = "mcl_farming:hoe_gold",
|
recipe = "mcl_farming:hoe_gold",
|
||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_diamond", {
|
minetest.register_tool("mcl_farming:hoe_diamond", {
|
||||||
description = S("Diamond Hoe"),
|
description = S("Diamond Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.diamond),
|
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.diamond),
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_diamondhoe.png",
|
inventory_image = "farming_tool_diamondhoe.png",
|
||||||
wield_scale = mcl_vars.tool_wield_scale,
|
wield_scale = mcl_vars.tool_wield_scale,
|
||||||
on_place = hoe_on_place_function(uses.diamond),
|
on_place = hoe_on_place_function(uses.diamond),
|
||||||
groups = { tool=1, hoe=1, enchantability=10 },
|
groups = { tool=1, hoe=1, enchantability=10 },
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 0.25,
|
full_punch_interval = 0.25,
|
||||||
damage_groups = { fleshy = 1, },
|
damage_groups = { fleshy = 1, },
|
||||||
punch_attack_uses = uses.diamond,
|
punch_attack_uses = uses.diamond,
|
||||||
},
|
},
|
||||||
_repair_material = "mcl_core:diamond",
|
_repair_material = "mcl_core:diamond",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
_mcl_diggroups = {
|
_mcl_diggroups = {
|
||||||
hoey = { speed = 8, level = 5, uses = 1562 }
|
hoey = { speed = 8, level = 5, uses = 1562 }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_diamond",
|
output = "mcl_farming:hoe_diamond",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_core:diamond", "mcl_core:diamond"},
|
{"mcl_core:diamond", "mcl_core:diamond"},
|
||||||
{"", "mcl_core:stick"},
|
{"", "mcl_core:stick"},
|
||||||
{"", "mcl_core:stick"}
|
{"", "mcl_core:stick"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_farming:hoe_diamond",
|
output = "mcl_farming:hoe_diamond",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_core:diamond", "mcl_core:diamond"},
|
{"mcl_core:diamond", "mcl_core:diamond"},
|
||||||
{"mcl_core:stick", ""},
|
{"mcl_core:stick", ""},
|
||||||
{"mcl_core:stick", ""}
|
{"mcl_core:stick", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,306 +1,306 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
-- Node box
|
-- Node box
|
||||||
local p = {-2/16, -0.5, -2/16, 2/16, 0.5, 2/16}
|
local p = {-2/16, -0.5, -2/16, 2/16, 0.5, 2/16}
|
||||||
local x1 = {-0.5, 4/16, -1/16, -2/16, 7/16, 1/16} --oben(quer) -x
|
local x1 = {-0.5, 4/16, -1/16, -2/16, 7/16, 1/16} --oben(quer) -x
|
||||||
local x12 = {-0.5, -2/16, -1/16, -2/16, 1/16, 1/16} --unten(quer) -x
|
local x12 = {-0.5, -2/16, -1/16, -2/16, 1/16, 1/16} --unten(quer) -x
|
||||||
local x2 = {2/16, 4/16, -1/16, 0.5, 7/16, 1/16} --oben(quer) x
|
local x2 = {2/16, 4/16, -1/16, 0.5, 7/16, 1/16} --oben(quer) x
|
||||||
local x22 = {2/16, -2/16, -1/16, 0.5, 1/16, 1/16} --unten(quer) x
|
local x22 = {2/16, -2/16, -1/16, 0.5, 1/16, 1/16} --unten(quer) x
|
||||||
local z1 = {-1/16, 4/16, -0.5, 1/16, 7/16, -2/16} --oben(quer) -z
|
local z1 = {-1/16, 4/16, -0.5, 1/16, 7/16, -2/16} --oben(quer) -z
|
||||||
local z12 = {-1/16, -2/16, -0.5, 1/16, 1/16, -2/16} --unten(quer) -z
|
local z12 = {-1/16, -2/16, -0.5, 1/16, 1/16, -2/16} --unten(quer) -z
|
||||||
local z2 = {-1/16, 4/16, 2/16, 1/16, 7/16, 0.5} --oben(quer) z
|
local z2 = {-1/16, 4/16, 2/16, 1/16, 7/16, 0.5} --oben(quer) z
|
||||||
local z22 = {-1/16, -2/16, 2/16, 1/16, 1/16, 0.5} --unten(quer) z
|
local z22 = {-1/16, -2/16, 2/16, 1/16, 1/16, 0.5} --unten(quer) z
|
||||||
|
|
||||||
-- Collision box
|
-- Collision box
|
||||||
local cp = {-2/16, -0.5, -2/16, 2/16, 1.01, 2/16}
|
local cp = {-2/16, -0.5, -2/16, 2/16, 1.01, 2/16}
|
||||||
local cx1 = {-0.5, -0.5, -2/16, -2/16, 1.01, 2/16} --unten(quer) -x
|
local cx1 = {-0.5, -0.5, -2/16, -2/16, 1.01, 2/16} --unten(quer) -x
|
||||||
local cx2 = {2/16, -0.5, -2/16, 0.5, 1.01, 2/16} --unten(quer) x
|
local cx2 = {2/16, -0.5, -2/16, 0.5, 1.01, 2/16} --unten(quer) x
|
||||||
local cz1 = {-2/16, -0.5, -0.5, 2/16, 1.01, -2/16} --unten(quer) -z
|
local cz1 = {-2/16, -0.5, -0.5, 2/16, 1.01, -2/16} --unten(quer) -z
|
||||||
local cz2 = {-2/16, -0.5, 2/16, 2/16, 1.01, 0.5} --unten(quer) z
|
local cz2 = {-2/16, -0.5, 2/16, 2/16, 1.01, 0.5} --unten(quer) z
|
||||||
|
|
||||||
mcl_fences = {}
|
mcl_fences = {}
|
||||||
|
|
||||||
function mcl_fences.register_fence(id, fence_name, texture, groups, hardness, blast_resistance, connects_to, sounds)
|
function mcl_fences.register_fence(id, fence_name, texture, groups, hardness, blast_resistance, connects_to, sounds)
|
||||||
local cgroups = table.copy(groups)
|
local cgroups = table.copy(groups)
|
||||||
if cgroups == nil then cgroups = {} end
|
if cgroups == nil then cgroups = {} end
|
||||||
cgroups.fence = 1
|
cgroups.fence = 1
|
||||||
cgroups.deco_block = 1
|
cgroups.deco_block = 1
|
||||||
if connects_to == nil then
|
if connects_to == nil then
|
||||||
connects_to = {}
|
connects_to = {}
|
||||||
else
|
else
|
||||||
connects_to = table.copy(connects_to)
|
connects_to = table.copy(connects_to)
|
||||||
end
|
end
|
||||||
local fence_id = minetest.get_current_modname()..":"..id
|
local fence_id = minetest.get_current_modname()..":"..id
|
||||||
table.insert(connects_to, "group:solid")
|
table.insert(connects_to, "group:solid")
|
||||||
table.insert(connects_to, "group:fence_gate")
|
table.insert(connects_to, "group:fence_gate")
|
||||||
table.insert(connects_to, fence_id)
|
table.insert(connects_to, fence_id)
|
||||||
minetest.register_node(fence_id, {
|
minetest.register_node(fence_id, {
|
||||||
description = fence_name,
|
description = fence_name,
|
||||||
_doc_items_longdesc = S("Fences are structures which block the way. Fences will connect to each other and solid blocks. They cannot be jumped over with a simple jump."),
|
_doc_items_longdesc = S("Fences are structures which block the way. Fences will connect to each other and solid blocks. They cannot be jumped over with a simple jump."),
|
||||||
tiles = {texture},
|
tiles = {texture},
|
||||||
inventory_image = "mcl_fences_fence_mask.png^" .. texture .. "^mcl_fences_fence_mask.png^[makealpha:255,126,126",
|
inventory_image = "mcl_fences_fence_mask.png^" .. texture .. "^mcl_fences_fence_mask.png^[makealpha:255,126,126",
|
||||||
wield_image = "mcl_fences_fence_mask.png^" .. texture .. "^mcl_fences_fence_mask.png^[makealpha:255,126,126",
|
wield_image = "mcl_fences_fence_mask.png^" .. texture .. "^mcl_fences_fence_mask.png^[makealpha:255,126,126",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = cgroups,
|
groups = cgroups,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
connect_sides = { "front", "back", "left", "right" },
|
connect_sides = { "front", "back", "left", "right" },
|
||||||
connects_to = connects_to,
|
connects_to = connects_to,
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "connected",
|
type = "connected",
|
||||||
fixed = {p},
|
fixed = {p},
|
||||||
connect_front = {z1,z12},
|
connect_front = {z1,z12},
|
||||||
connect_back = {z2,z22,},
|
connect_back = {z2,z22,},
|
||||||
connect_left = {x1,x12},
|
connect_left = {x1,x12},
|
||||||
connect_right = {x2,x22},
|
connect_right = {x2,x22},
|
||||||
},
|
},
|
||||||
collision_box = {
|
collision_box = {
|
||||||
type = "connected",
|
type = "connected",
|
||||||
fixed = {cp},
|
fixed = {cp},
|
||||||
connect_front = {cz1},
|
connect_front = {cz1},
|
||||||
connect_back = {cz2,},
|
connect_back = {cz2,},
|
||||||
connect_left = {cx1},
|
connect_left = {cx1},
|
||||||
connect_right = {cx2},
|
connect_right = {cx2},
|
||||||
},
|
},
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
_mcl_blast_resistance = blast_resistance,
|
_mcl_blast_resistance = blast_resistance,
|
||||||
_mcl_hardness = hardness,
|
_mcl_hardness = hardness,
|
||||||
})
|
})
|
||||||
|
|
||||||
return fence_id
|
return fence_id
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_fences.register_fence_gate(id, fence_gate_name, texture, groups, hardness, blast_resistance, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
function mcl_fences.register_fence_gate(id, fence_gate_name, texture, groups, hardness, blast_resistance, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
||||||
local meta2
|
local meta2
|
||||||
local state2 = 0
|
local state2 = 0
|
||||||
|
|
||||||
local function update_gate(pos, node)
|
local function update_gate(pos, node)
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
end
|
end
|
||||||
|
|
||||||
local gate_id = minetest.get_current_modname()..":"..id.."_gate"
|
local gate_id = minetest.get_current_modname()..":"..id.."_gate"
|
||||||
local open_gate_id = gate_id .. "_open"
|
local open_gate_id = gate_id .. "_open"
|
||||||
if not sound_open then
|
if not sound_open then
|
||||||
sound_open = "doors_fencegate_open"
|
sound_open = "doors_fencegate_open"
|
||||||
end
|
end
|
||||||
if not sound_close then
|
if not sound_close then
|
||||||
sound_close = "doors_fencegate_close"
|
sound_close = "doors_fencegate_close"
|
||||||
end
|
end
|
||||||
if not sound_gain_open then
|
if not sound_gain_open then
|
||||||
sound_gain_open = 0.3
|
sound_gain_open = 0.3
|
||||||
end
|
end
|
||||||
if not sound_gain_close then
|
if not sound_gain_close then
|
||||||
sound_gain_close = 0.3
|
sound_gain_close = 0.3
|
||||||
end
|
end
|
||||||
local function punch_gate(pos, node)
|
local function punch_gate(pos, node)
|
||||||
meta2 = minetest.get_meta(pos)
|
meta2 = minetest.get_meta(pos)
|
||||||
state2 = meta2:get_int("state")
|
state2 = meta2:get_int("state")
|
||||||
local tmp_node2
|
local tmp_node2
|
||||||
if state2 == 1 then
|
if state2 == 1 then
|
||||||
state2 = 0
|
state2 = 0
|
||||||
minetest.sound_play(sound_close, {gain = sound_gain_close, max_hear_distance = 10, pos = pos}, true)
|
minetest.sound_play(sound_close, {gain = sound_gain_close, max_hear_distance = 10, pos = pos}, true)
|
||||||
tmp_node2 = {name=gate_id, param1=node.param1, param2=node.param2}
|
tmp_node2 = {name=gate_id, param1=node.param1, param2=node.param2}
|
||||||
else
|
else
|
||||||
state2 = 1
|
state2 = 1
|
||||||
minetest.sound_play(sound_open, {gain = sound_gain_open, max_hear_distance = 10, pos = pos}, true)
|
minetest.sound_play(sound_open, {gain = sound_gain_open, max_hear_distance = 10, pos = pos}, true)
|
||||||
tmp_node2 = {name=open_gate_id, param1=node.param1, param2=node.param2}
|
tmp_node2 = {name=open_gate_id, param1=node.param1, param2=node.param2}
|
||||||
end
|
end
|
||||||
update_gate(pos, tmp_node2)
|
update_gate(pos, tmp_node2)
|
||||||
meta2:set_int("state", state2)
|
meta2:set_int("state", state2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local on_rotate
|
local on_rotate
|
||||||
if minetest.get_modpath("screwdriver") then
|
if minetest.get_modpath("screwdriver") then
|
||||||
on_rotate = screwdriver.rotate_simple
|
on_rotate = screwdriver.rotate_simple
|
||||||
end
|
end
|
||||||
|
|
||||||
local cgroups = table.copy(groups)
|
local cgroups = table.copy(groups)
|
||||||
if cgroups == nil then cgroups = {} end
|
if cgroups == nil then cgroups = {} end
|
||||||
cgroups.fence_gate = 1
|
cgroups.fence_gate = 1
|
||||||
cgroups.deco_block = 1
|
cgroups.deco_block = 1
|
||||||
|
|
||||||
cgroups.mesecon_ignore_opaque_dig = 1
|
cgroups.mesecon_ignore_opaque_dig = 1
|
||||||
cgroups.mesecon_effector_on = 1
|
cgroups.mesecon_effector_on = 1
|
||||||
cgroups.fence_gate = 1
|
cgroups.fence_gate = 1
|
||||||
minetest.register_node(open_gate_id, {
|
minetest.register_node(open_gate_id, {
|
||||||
tiles = {texture},
|
tiles = {texture},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
groups = cgroups,
|
groups = cgroups,
|
||||||
drop = gate_id,
|
drop = gate_id,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -3/16, -1/16, -6/16, 0.5, 1/16}, --links abschluss
|
{-0.5, -3/16, -1/16, -6/16, 0.5, 1/16}, --links abschluss
|
||||||
{6/16, -3/16, -1/16, 0.5, 0.5, 1/16}, --rechts abschluss
|
{6/16, -3/16, -1/16, 0.5, 0.5, 1/16}, --rechts abschluss
|
||||||
{-0.5, 4/16, 1/16, -6/16, 7/16, 6/16}, --oben-links(quer) x
|
{-0.5, 4/16, 1/16, -6/16, 7/16, 6/16}, --oben-links(quer) x
|
||||||
{-0.5, -2/16, 1/16, -6/16, 1/16, 6/16}, --unten-links(quer) x
|
{-0.5, -2/16, 1/16, -6/16, 1/16, 6/16}, --unten-links(quer) x
|
||||||
{6/16, 4/16, 1/16, 0.5, 7/16, 0.5}, --oben-rechts(quer) x
|
{6/16, 4/16, 1/16, 0.5, 7/16, 0.5}, --oben-rechts(quer) x
|
||||||
{6/16, -2/16, 1/16, 0.5, 1/16, 0.5}, --unten-rechts(quer) x
|
{6/16, -2/16, 1/16, 0.5, 1/16, 0.5}, --unten-rechts(quer) x
|
||||||
{-0.5, -2/16, 6/16, -6/16, 7/16, 0.5}, --mitte links
|
{-0.5, -2/16, 6/16, -6/16, 7/16, 0.5}, --mitte links
|
||||||
{6/16, 1/16, 0.5, 0.5, 4/16, 6/16}, --mitte rechts
|
{6/16, 1/16, 0.5, 0.5, 4/16, 6/16}, --mitte rechts
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -3/16, -1/16, 0.5, 0.5, 1/16}, --gate
|
{-0.5, -3/16, -1/16, 0.5, 0.5, 1/16}, --gate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
punch_gate(pos, node)
|
punch_gate(pos, node)
|
||||||
end,
|
end,
|
||||||
mesecons = {effector = {
|
mesecons = {effector = {
|
||||||
action_off = (function(pos, node)
|
action_off = (function(pos, node)
|
||||||
punch_gate(pos, node)
|
punch_gate(pos, node)
|
||||||
end),
|
end),
|
||||||
}},
|
}},
|
||||||
on_rotate = on_rotate,
|
on_rotate = on_rotate,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
_mcl_blast_resistance = blast_resistance,
|
_mcl_blast_resistance = blast_resistance,
|
||||||
_mcl_hardness = hardness,
|
_mcl_hardness = hardness,
|
||||||
})
|
})
|
||||||
|
|
||||||
local cgroups_closed = table.copy(cgroups)
|
local cgroups_closed = table.copy(cgroups)
|
||||||
cgroups_closed.mesecon_effector_on = nil
|
cgroups_closed.mesecon_effector_on = nil
|
||||||
cgroups_closed.mesecon_effector_off = nil
|
cgroups_closed.mesecon_effector_off = nil
|
||||||
minetest.register_node(gate_id, {
|
minetest.register_node(gate_id, {
|
||||||
description = fence_gate_name,
|
description = fence_gate_name,
|
||||||
_tt_help = S("Openable by players and redstone power"),
|
_tt_help = S("Openable by players and redstone power"),
|
||||||
_doc_items_longdesc = S("Fence gates can be opened or closed and can't be jumped over. Fences will connect nicely to fence gates."),
|
_doc_items_longdesc = S("Fence gates can be opened or closed and can't be jumped over. Fences will connect nicely to fence gates."),
|
||||||
_doc_items_usagehelp = S("Right-click the fence gate to open or close it."),
|
_doc_items_usagehelp = S("Right-click the fence gate to open or close it."),
|
||||||
tiles = {texture},
|
tiles = {texture},
|
||||||
inventory_image = "mcl_fences_fence_gate_mask.png^" .. texture .. "^mcl_fences_fence_gate_mask.png^[makealpha:255,126,126",
|
inventory_image = "mcl_fences_fence_gate_mask.png^" .. texture .. "^mcl_fences_fence_gate_mask.png^[makealpha:255,126,126",
|
||||||
wield_image = "mcl_fences_fence_gate_mask.png^" .. texture .. "^mcl_fences_fence_gate_mask.png^[makealpha:255,126,126",
|
wield_image = "mcl_fences_fence_gate_mask.png^" .. texture .. "^mcl_fences_fence_gate_mask.png^[makealpha:255,126,126",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = true,
|
walkable = true,
|
||||||
groups = cgroups_closed,
|
groups = cgroups_closed,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -3/16, -1/16, -6/16, 0.5, 1/16}, --links abschluss
|
{-0.5, -3/16, -1/16, -6/16, 0.5, 1/16}, --links abschluss
|
||||||
{6/16, -3/16, -1/16, 0.5, 0.5, 1/16}, --rechts abschluss
|
{6/16, -3/16, -1/16, 0.5, 0.5, 1/16}, --rechts abschluss
|
||||||
{-2/16, -2/16, -1/16, 0, 7/16, 1/16}, --mitte links
|
{-2/16, -2/16, -1/16, 0, 7/16, 1/16}, --mitte links
|
||||||
{0, -2/16, -1/16, 2/16, 7/16, 1/16}, --mitte rechts
|
{0, -2/16, -1/16, 2/16, 7/16, 1/16}, --mitte rechts
|
||||||
{-0.5, 4/16, -1/16, -2/16, 7/16, 1/16}, --oben(quer) -z
|
{-0.5, 4/16, -1/16, -2/16, 7/16, 1/16}, --oben(quer) -z
|
||||||
{-0.5, -2/16, -1/16, -2/16, 1/16, 1/16}, --unten(quer) -z
|
{-0.5, -2/16, -1/16, -2/16, 1/16, 1/16}, --unten(quer) -z
|
||||||
{2/16, 4/16, -1/16, 0.5, 7/16, 1/16}, --oben(quer) z
|
{2/16, 4/16, -1/16, 0.5, 7/16, 1/16}, --oben(quer) z
|
||||||
{2/16, -2/16, -1/16, 0.5, 1/16, 1/16}, --unten(quer) z
|
{2/16, -2/16, -1/16, 0.5, 1/16, 1/16}, --unten(quer) z
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
collision_box = {
|
collision_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -3/16, -2/16, 0.5, 1, 2/16}, --gate
|
{-0.5, -3/16, -2/16, 0.5, 1, 2/16}, --gate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -3/16, -1/16, 0.5, 0.5, 1/16}, --gate
|
{-0.5, -3/16, -1/16, 0.5, 0.5, 1/16}, --gate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
meta2 = minetest.get_meta(pos)
|
meta2 = minetest.get_meta(pos)
|
||||||
meta2:set_int("state", 0)
|
meta2:set_int("state", 0)
|
||||||
state2 = 0
|
state2 = 0
|
||||||
end,
|
end,
|
||||||
mesecons = {effector = {
|
mesecons = {effector = {
|
||||||
action_on = (function(pos, node)
|
action_on = (function(pos, node)
|
||||||
punch_gate(pos, node)
|
punch_gate(pos, node)
|
||||||
end),
|
end),
|
||||||
}},
|
}},
|
||||||
on_rotate = on_rotate,
|
on_rotate = on_rotate,
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
punch_gate(pos, node)
|
punch_gate(pos, node)
|
||||||
end,
|
end,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
_mcl_blast_resistance = blast_resistance,
|
_mcl_blast_resistance = blast_resistance,
|
||||||
_mcl_hardness = hardness,
|
_mcl_hardness = hardness,
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.get_modpath("doc") then
|
if minetest.get_modpath("doc") then
|
||||||
doc.add_entry_alias("nodes", gate_id, "nodes", open_gate_id)
|
doc.add_entry_alias("nodes", gate_id, "nodes", open_gate_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
return gate_id, open_gate_id
|
return gate_id, open_gate_id
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_fences.register_fence_and_fence_gate(id, fence_name, fence_gate_name, texture_fence, groups, hardness, blast_resistance, connects_to, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close, texture_fence_gate)
|
function mcl_fences.register_fence_and_fence_gate(id, fence_name, fence_gate_name, texture_fence, groups, hardness, blast_resistance, connects_to, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close, texture_fence_gate)
|
||||||
if texture_fence_gate == nil then
|
if texture_fence_gate == nil then
|
||||||
texture_fence_gate = texture_fence
|
texture_fence_gate = texture_fence
|
||||||
end
|
end
|
||||||
local fence_id = mcl_fences.register_fence(id, fence_name, texture_fence, groups, hardness, blast_resistance, connects_to, sounds)
|
local fence_id = mcl_fences.register_fence(id, fence_name, texture_fence, groups, hardness, blast_resistance, connects_to, sounds)
|
||||||
local gate_id, open_gate_id = mcl_fences.register_fence_gate(id, fence_gate_name, texture_fence_gate, groups, hardness, blast_resistance, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
local gate_id, open_gate_id = mcl_fences.register_fence_gate(id, fence_gate_name, texture_fence_gate, groups, hardness, blast_resistance, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
||||||
return fence_id, gate_id, open_gate_id
|
return fence_id, gate_id, open_gate_id
|
||||||
end
|
end
|
||||||
|
|
||||||
local wood_groups = {handy=1,axey=1, flammable=2,fence_wood=1, fire_encouragement=5, fire_flammability=20}
|
local wood_groups = {handy=1,axey=1, flammable=2,fence_wood=1, fire_encouragement=5, fire_flammability=20}
|
||||||
local wood_connect = {"group:fence_wood"}
|
local wood_connect = {"group:fence_wood"}
|
||||||
local wood_sounds = mcl_sounds.node_sound_wood_defaults()
|
local wood_sounds = mcl_sounds.node_sound_wood_defaults()
|
||||||
|
|
||||||
local woods = {
|
local woods = {
|
||||||
{"", S("Oak Fence"), S("Oak Fence Gate"), "mcl_fences_fence_oak.png", "mcl_fences_fence_gate_oak.png", "mcl_core:wood"},
|
{"", S("Oak Fence"), S("Oak Fence Gate"), "mcl_fences_fence_oak.png", "mcl_fences_fence_gate_oak.png", "mcl_core:wood"},
|
||||||
{"spruce", S("Spruce Fence"), S("Spruce Fence Gate"), "mcl_fences_fence_spruce.png", "mcl_fences_fence_gate_spruce.png", "mcl_core:sprucewood"},
|
{"spruce", S("Spruce Fence"), S("Spruce Fence Gate"), "mcl_fences_fence_spruce.png", "mcl_fences_fence_gate_spruce.png", "mcl_core:sprucewood"},
|
||||||
{"birch", S("Birch Fence"), S("Birch Fence Gate"), "mcl_fences_fence_birch.png", "mcl_fences_fence_gate_birch.png", "mcl_core:birchwood"},
|
{"birch", S("Birch Fence"), S("Birch Fence Gate"), "mcl_fences_fence_birch.png", "mcl_fences_fence_gate_birch.png", "mcl_core:birchwood"},
|
||||||
{"jungle", S("Jungle Fence"), S("Jungle Fence Gate"), "mcl_fences_fence_jungle.png", "mcl_fences_fence_gate_jungle.png", "mcl_core:junglewood"},
|
{"jungle", S("Jungle Fence"), S("Jungle Fence Gate"), "mcl_fences_fence_jungle.png", "mcl_fences_fence_gate_jungle.png", "mcl_core:junglewood"},
|
||||||
{"dark_oak", S("Dark Oak Fence"), S("Dark Oak Fence Gate"), "mcl_fences_fence_big_oak.png", "mcl_fences_fence_gate_big_oak.png", "mcl_core:darkwood"},
|
{"dark_oak", S("Dark Oak Fence"), S("Dark Oak Fence Gate"), "mcl_fences_fence_big_oak.png", "mcl_fences_fence_gate_big_oak.png", "mcl_core:darkwood"},
|
||||||
{"acacia", S("Acacia Fence"), S("Acacia Fence Gate"), "mcl_fences_fence_acacia.png", "mcl_fences_fence_gate_acacia.png", "mcl_core:acaciawood"},
|
{"acacia", S("Acacia Fence"), S("Acacia Fence Gate"), "mcl_fences_fence_acacia.png", "mcl_fences_fence_gate_acacia.png", "mcl_core:acaciawood"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for w=1, #woods do
|
for w=1, #woods do
|
||||||
local wood = woods[w]
|
local wood = woods[w]
|
||||||
local id, id_gate
|
local id, id_gate
|
||||||
if wood[1] == "" then
|
if wood[1] == "" then
|
||||||
id = "fence"
|
id = "fence"
|
||||||
id_gate = "fence_gate"
|
id_gate = "fence_gate"
|
||||||
else
|
else
|
||||||
id = wood[1].."_fence"
|
id = wood[1].."_fence"
|
||||||
id_gate = wood[1].."_fence_gate"
|
id_gate = wood[1].."_fence_gate"
|
||||||
end
|
end
|
||||||
mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood_groups, 2, 15, wood_connect, wood_sounds)
|
mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood_groups, 2, 15, wood_connect, wood_sounds)
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_fences:"..id.." 3",
|
output = "mcl_fences:"..id.." 3",
|
||||||
recipe = {
|
recipe = {
|
||||||
{wood[6], "mcl_core:stick", wood[6]},
|
{wood[6], "mcl_core:stick", wood[6]},
|
||||||
{wood[6], "mcl_core:stick", wood[6]},
|
{wood[6], "mcl_core:stick", wood[6]},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_fences:"..id_gate,
|
output = "mcl_fences:"..id_gate,
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_core:stick", wood[6], "mcl_core:stick"},
|
{"mcl_core:stick", wood[6], "mcl_core:stick"},
|
||||||
{"mcl_core:stick", wood[6], "mcl_core:stick"},
|
{"mcl_core:stick", wood[6], "mcl_core:stick"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Nether Brick Fence (without fence gate!)
|
-- Nether Brick Fence (without fence gate!)
|
||||||
mcl_fences.register_fence("nether_brick_fence", S("Nether Brick Fence"), "mcl_fences_fence_nether_brick.png", {pickaxey=1, deco_block=1, fence_nether_brick=1}, 2, 30, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults())
|
mcl_fences.register_fence("nether_brick_fence", S("Nether Brick Fence"), "mcl_fences_fence_nether_brick.png", {pickaxey=1, deco_block=1, fence_nether_brick=1}, 2, 30, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults())
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_fences:nether_brick_fence 6",
|
output = "mcl_fences:nether_brick_fence 6",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_nether:nether_brick", "mcl_nether:netherbrick", "mcl_nether:nether_brick"},
|
{"mcl_nether:nether_brick", "mcl_nether:netherbrick", "mcl_nether:nether_brick"},
|
||||||
{"mcl_nether:nether_brick", "mcl_nether:netherbrick", "mcl_nether:nether_brick"},
|
{"mcl_nether:nether_brick", "mcl_nether:netherbrick", "mcl_nether:nether_brick"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "group:fence_wood",
|
recipe = "group:fence_wood",
|
||||||
burntime = 15,
|
burntime = 15,
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
-- Loom Code. Used to craft banner designs easier. Still needs a GUI. https://minecraft.fandom.com/wiki/Loom
|
-- Loom Code. Used to craft banner designs easier. Still needs a GUI. https://minecraft.fandom.com/wiki/Loom
|
||||||
|
|
||||||
minetest.register_node("mcl_loom:loom", {
|
minetest.register_node("mcl_loom:loom", {
|
||||||
description = S("Loom"),
|
description = S("Loom"),
|
||||||
_tt_help = S("Used to create banner designs"),
|
_tt_help = S("Used to create banner designs"),
|
||||||
@ -13,7 +13,7 @@ minetest.register_node("mcl_loom:loom", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {choppy=1, deco_block=1, material_wood=1, flammable=1}
|
groups = {choppy=1, deco_block=1, material_wood=1, flammable=1}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_loom:loom",
|
output = "mcl_loom:loom",
|
||||||
|
@ -1,447 +1,447 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:rotten_flesh", {
|
minetest.register_craftitem("mcl_mobitems:rotten_flesh", {
|
||||||
description = S("Rotten Flesh"),
|
description = S("Rotten Flesh"),
|
||||||
_tt_help = minetest.colorize(mcl_colors.YELLOW, S("80% chance of food poisoning")),
|
_tt_help = minetest.colorize(mcl_colors.YELLOW, S("80% chance of food poisoning")),
|
||||||
_doc_items_longdesc = S("Yuck! This piece of flesh clearly has seen better days. If you're really desperate, you can eat it to restore a few hunger points, but there's a 80% chance it causes food poisoning, which increases your hunger for a while."),
|
_doc_items_longdesc = S("Yuck! This piece of flesh clearly has seen better days. If you're really desperate, you can eat it to restore a few hunger points, but there's a 80% chance it causes food poisoning, which increases your hunger for a while."),
|
||||||
inventory_image = "mcl_mobitems_rotten_flesh.png",
|
inventory_image = "mcl_mobitems_rotten_flesh.png",
|
||||||
wield_image = "mcl_mobitems_rotten_flesh.png",
|
wield_image = "mcl_mobitems_rotten_flesh.png",
|
||||||
on_place = minetest.item_eat(4),
|
on_place = minetest.item_eat(4),
|
||||||
on_secondary_use = minetest.item_eat(4),
|
on_secondary_use = minetest.item_eat(4),
|
||||||
groups = { food = 2, eatable = 4 },
|
groups = { food = 2, eatable = 4 },
|
||||||
_mcl_saturation = 0.8,
|
_mcl_saturation = 0.8,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:mutton", {
|
minetest.register_craftitem("mcl_mobitems:mutton", {
|
||||||
description = S("Raw Mutton"),
|
description = S("Raw Mutton"),
|
||||||
_doc_items_longdesc = S("Raw mutton is the flesh from a sheep and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
_doc_items_longdesc = S("Raw mutton is the flesh from a sheep and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
||||||
inventory_image = "mcl_mobitems_mutton_raw.png",
|
inventory_image = "mcl_mobitems_mutton_raw.png",
|
||||||
wield_image = "mcl_mobitems_mutton_raw.png",
|
wield_image = "mcl_mobitems_mutton_raw.png",
|
||||||
on_place = minetest.item_eat(2),
|
on_place = minetest.item_eat(2),
|
||||||
on_secondary_use = minetest.item_eat(2),
|
on_secondary_use = minetest.item_eat(2),
|
||||||
groups = { food = 2, eatable = 2, smoker_cookable = 1 },
|
groups = { food = 2, eatable = 2, smoker_cookable = 1 },
|
||||||
_mcl_saturation = 1.2,
|
_mcl_saturation = 1.2,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:cooked_mutton", {
|
minetest.register_craftitem("mcl_mobitems:cooked_mutton", {
|
||||||
description = S("Cooked Mutton"),
|
description = S("Cooked Mutton"),
|
||||||
_doc_items_longdesc = S("Cooked mutton is the cooked flesh from a sheep and is used as food."),
|
_doc_items_longdesc = S("Cooked mutton is the cooked flesh from a sheep and is used as food."),
|
||||||
inventory_image = "mcl_mobitems_mutton_cooked.png",
|
inventory_image = "mcl_mobitems_mutton_cooked.png",
|
||||||
wield_image = "mcl_mobitems_mutton_cooked.png",
|
wield_image = "mcl_mobitems_mutton_cooked.png",
|
||||||
on_place = minetest.item_eat(6),
|
on_place = minetest.item_eat(6),
|
||||||
on_secondary_use = minetest.item_eat(6),
|
on_secondary_use = minetest.item_eat(6),
|
||||||
groups = { food = 2, eatable = 6 },
|
groups = { food = 2, eatable = 6 },
|
||||||
_mcl_saturation = 9.6,
|
_mcl_saturation = 9.6,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:beef", {
|
minetest.register_craftitem("mcl_mobitems:beef", {
|
||||||
description = S("Raw Beef"),
|
description = S("Raw Beef"),
|
||||||
_doc_items_longdesc = S("Raw beef is the flesh from cows and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
_doc_items_longdesc = S("Raw beef is the flesh from cows and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
||||||
inventory_image = "mcl_mobitems_beef_raw.png",
|
inventory_image = "mcl_mobitems_beef_raw.png",
|
||||||
wield_image = "mcl_mobitems_beef_raw.png",
|
wield_image = "mcl_mobitems_beef_raw.png",
|
||||||
on_place = minetest.item_eat(3),
|
on_place = minetest.item_eat(3),
|
||||||
on_secondary_use = minetest.item_eat(3),
|
on_secondary_use = minetest.item_eat(3),
|
||||||
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
|
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
|
||||||
_mcl_saturation = 1.8,
|
_mcl_saturation = 1.8,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:cooked_beef", {
|
minetest.register_craftitem("mcl_mobitems:cooked_beef", {
|
||||||
description = S("Steak"),
|
description = S("Steak"),
|
||||||
_doc_items_longdesc = S("Steak is cooked beef from cows and can be eaten."),
|
_doc_items_longdesc = S("Steak is cooked beef from cows and can be eaten."),
|
||||||
inventory_image = "mcl_mobitems_beef_cooked.png",
|
inventory_image = "mcl_mobitems_beef_cooked.png",
|
||||||
wield_image = "mcl_mobitems_beef_cooked.png",
|
wield_image = "mcl_mobitems_beef_cooked.png",
|
||||||
on_place = minetest.item_eat(8),
|
on_place = minetest.item_eat(8),
|
||||||
on_secondary_use = minetest.item_eat(8),
|
on_secondary_use = minetest.item_eat(8),
|
||||||
groups = { food = 2, eatable = 8 },
|
groups = { food = 2, eatable = 8 },
|
||||||
_mcl_saturation = 12.8,
|
_mcl_saturation = 12.8,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:chicken", {
|
minetest.register_craftitem("mcl_mobitems:chicken", {
|
||||||
description = S("Raw Chicken"),
|
description = S("Raw Chicken"),
|
||||||
_tt_help = minetest.colorize(mcl_colors.YELLOW, S("30% chance of food poisoning")),
|
_tt_help = minetest.colorize(mcl_colors.YELLOW, S("30% chance of food poisoning")),
|
||||||
_doc_items_longdesc = S("Raw chicken is a food item which is not safe to consume. You can eat it to restore a few hunger points, but there's a 30% chance to suffer from food poisoning, which increases your hunger rate for a while. Cooking raw chicken will make it safe to eat and increases its nutritional value."),
|
_doc_items_longdesc = S("Raw chicken is a food item which is not safe to consume. You can eat it to restore a few hunger points, but there's a 30% chance to suffer from food poisoning, which increases your hunger rate for a while. Cooking raw chicken will make it safe to eat and increases its nutritional value."),
|
||||||
inventory_image = "mcl_mobitems_chicken_raw.png",
|
inventory_image = "mcl_mobitems_chicken_raw.png",
|
||||||
wield_image = "mcl_mobitems_chicken_raw.png",
|
wield_image = "mcl_mobitems_chicken_raw.png",
|
||||||
on_place = minetest.item_eat(2),
|
on_place = minetest.item_eat(2),
|
||||||
on_secondary_use = minetest.item_eat(2),
|
on_secondary_use = minetest.item_eat(2),
|
||||||
groups = { food = 2, eatable = 2, smoker_cookable = 1 },
|
groups = { food = 2, eatable = 2, smoker_cookable = 1 },
|
||||||
_mcl_saturation = 1.2,
|
_mcl_saturation = 1.2,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:cooked_chicken", {
|
minetest.register_craftitem("mcl_mobitems:cooked_chicken", {
|
||||||
description = S("Cooked Chicken"),
|
description = S("Cooked Chicken"),
|
||||||
_doc_items_longdesc = S("A cooked chicken is a healthy food item which can be eaten."),
|
_doc_items_longdesc = S("A cooked chicken is a healthy food item which can be eaten."),
|
||||||
inventory_image = "mcl_mobitems_chicken_cooked.png",
|
inventory_image = "mcl_mobitems_chicken_cooked.png",
|
||||||
wield_image = "mcl_mobitems_chicken_cooked.png",
|
wield_image = "mcl_mobitems_chicken_cooked.png",
|
||||||
on_place = minetest.item_eat(6),
|
on_place = minetest.item_eat(6),
|
||||||
on_secondary_use = minetest.item_eat(6),
|
on_secondary_use = minetest.item_eat(6),
|
||||||
groups = { food = 2, eatable = 6 },
|
groups = { food = 2, eatable = 6 },
|
||||||
_mcl_saturation = 7.2,
|
_mcl_saturation = 7.2,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:porkchop", {
|
minetest.register_craftitem("mcl_mobitems:porkchop", {
|
||||||
description = S("Raw Porkchop"),
|
description = S("Raw Porkchop"),
|
||||||
_doc_items_longdesc = S("A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
_doc_items_longdesc = S("A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
||||||
inventory_image = "mcl_mobitems_porkchop_raw.png",
|
inventory_image = "mcl_mobitems_porkchop_raw.png",
|
||||||
wield_image = "mcl_mobitems_porkchop_raw.png",
|
wield_image = "mcl_mobitems_porkchop_raw.png",
|
||||||
on_place = minetest.item_eat(3),
|
on_place = minetest.item_eat(3),
|
||||||
on_secondary_use = minetest.item_eat(3),
|
on_secondary_use = minetest.item_eat(3),
|
||||||
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
|
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
|
||||||
_mcl_saturation = 1.8,
|
_mcl_saturation = 1.8,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:cooked_porkchop", {
|
minetest.register_craftitem("mcl_mobitems:cooked_porkchop", {
|
||||||
description = S("Cooked Porkchop"),
|
description = S("Cooked Porkchop"),
|
||||||
_doc_items_longdesc = S("Cooked porkchop is the cooked flesh of a pig and is used as food."),
|
_doc_items_longdesc = S("Cooked porkchop is the cooked flesh of a pig and is used as food."),
|
||||||
inventory_image = "mcl_mobitems_porkchop_cooked.png",
|
inventory_image = "mcl_mobitems_porkchop_cooked.png",
|
||||||
wield_image = "mcl_mobitems_porkchop_cooked.png",
|
wield_image = "mcl_mobitems_porkchop_cooked.png",
|
||||||
on_place = minetest.item_eat(8),
|
on_place = minetest.item_eat(8),
|
||||||
on_secondary_use = minetest.item_eat(8),
|
on_secondary_use = minetest.item_eat(8),
|
||||||
groups = { food = 2, eatable = 8 },
|
groups = { food = 2, eatable = 8 },
|
||||||
_mcl_saturation = 12.8,
|
_mcl_saturation = 12.8,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:rabbit", {
|
minetest.register_craftitem("mcl_mobitems:rabbit", {
|
||||||
description = S("Raw Rabbit"),
|
description = S("Raw Rabbit"),
|
||||||
_doc_items_longdesc = S("Raw rabbit is a food item from a dead rabbit. It can be eaten safely. Cooking it will increase its nutritional value."),
|
_doc_items_longdesc = S("Raw rabbit is a food item from a dead rabbit. It can be eaten safely. Cooking it will increase its nutritional value."),
|
||||||
inventory_image = "mcl_mobitems_rabbit_raw.png",
|
inventory_image = "mcl_mobitems_rabbit_raw.png",
|
||||||
wield_image = "mcl_mobitems_rabbit_raw.png",
|
wield_image = "mcl_mobitems_rabbit_raw.png",
|
||||||
on_place = minetest.item_eat(3),
|
on_place = minetest.item_eat(3),
|
||||||
on_secondary_use = minetest.item_eat(3),
|
on_secondary_use = minetest.item_eat(3),
|
||||||
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
|
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
|
||||||
_mcl_saturation = 1.8,
|
_mcl_saturation = 1.8,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:cooked_rabbit", {
|
minetest.register_craftitem("mcl_mobitems:cooked_rabbit", {
|
||||||
description = S("Cooked Rabbit"),
|
description = S("Cooked Rabbit"),
|
||||||
_doc_items_longdesc = S("This is a food item which can be eaten."),
|
_doc_items_longdesc = S("This is a food item which can be eaten."),
|
||||||
inventory_image = "mcl_mobitems_rabbit_cooked.png",
|
inventory_image = "mcl_mobitems_rabbit_cooked.png",
|
||||||
wield_image = "mcl_mobitems_rabbit_cooked.png",
|
wield_image = "mcl_mobitems_rabbit_cooked.png",
|
||||||
on_place = minetest.item_eat(5),
|
on_place = minetest.item_eat(5),
|
||||||
on_secondary_use = minetest.item_eat(5),
|
on_secondary_use = minetest.item_eat(5),
|
||||||
groups = { food = 2, eatable = 5 },
|
groups = { food = 2, eatable = 5 },
|
||||||
_mcl_saturation = 6.0,
|
_mcl_saturation = 6.0,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Reset food poisoning and status effects
|
-- Reset food poisoning and status effects
|
||||||
local function drink_milk(itemstack, player, pointed_thing)
|
local function drink_milk(itemstack, player, pointed_thing)
|
||||||
local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing)
|
local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing)
|
||||||
-- Check if we were allowed to drink this (eat delay check)
|
-- Check if we were allowed to drink this (eat delay check)
|
||||||
if mcl_hunger.active and (bucket:get_name() ~= "mcl_mobitems:milk_bucket" or minetest.is_creative_enabled(player:get_player_name())) then
|
if mcl_hunger.active and (bucket:get_name() ~= "mcl_mobitems:milk_bucket" or minetest.is_creative_enabled(player:get_player_name())) then
|
||||||
mcl_hunger.stop_poison(player)
|
mcl_hunger.stop_poison(player)
|
||||||
end
|
end
|
||||||
mcl_potions._reset_player_effects(player)
|
mcl_potions._reset_player_effects(player)
|
||||||
return bucket
|
return bucket
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:milk_bucket", {
|
minetest.register_craftitem("mcl_mobitems:milk_bucket", {
|
||||||
description = S("Milk"),
|
description = S("Milk"),
|
||||||
_tt_help = minetest.colorize(mcl_colors.GREEN, S("Removes all status effects")),
|
_tt_help = minetest.colorize(mcl_colors.GREEN, S("Removes all status effects")),
|
||||||
_doc_items_longdesc = S("Milk is very refreshing and can be obtained by using a bucket on a cow. Drinking it will remove all status effects, but restores no hunger points."),
|
_doc_items_longdesc = S("Milk is very refreshing and can be obtained by using a bucket on a cow. Drinking it will remove all status effects, but restores no hunger points."),
|
||||||
_doc_items_usagehelp = S("Use the placement key to drink the milk."),
|
_doc_items_usagehelp = S("Use the placement key to drink the milk."),
|
||||||
inventory_image = "mcl_mobitems_bucket_milk.png",
|
inventory_image = "mcl_mobitems_bucket_milk.png",
|
||||||
wield_image = "mcl_mobitems_bucket_milk.png",
|
wield_image = "mcl_mobitems_bucket_milk.png",
|
||||||
on_place = drink_milk,
|
on_place = drink_milk,
|
||||||
on_secondary_use = drink_milk,
|
on_secondary_use = drink_milk,
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
groups = { food = 3, can_eat_when_full = 1 },
|
groups = { food = 3, can_eat_when_full = 1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:spider_eye", {
|
minetest.register_craftitem("mcl_mobitems:spider_eye", {
|
||||||
description = S("Spider Eye"),
|
description = S("Spider Eye"),
|
||||||
_tt_help = minetest.colorize(mcl_colors.YELLOW, S("Poisonous")),
|
_tt_help = minetest.colorize(mcl_colors.YELLOW, S("Poisonous")),
|
||||||
_doc_items_longdesc = S("Spider eyes are used mainly in crafting. If you're really desperate, you can eat a spider eye, but it will poison you briefly."),
|
_doc_items_longdesc = S("Spider eyes are used mainly in crafting. If you're really desperate, you can eat a spider eye, but it will poison you briefly."),
|
||||||
inventory_image = "mcl_mobitems_spider_eye.png",
|
inventory_image = "mcl_mobitems_spider_eye.png",
|
||||||
wield_image = "mcl_mobitems_spider_eye.png",
|
wield_image = "mcl_mobitems_spider_eye.png",
|
||||||
on_place = minetest.item_eat(2),
|
on_place = minetest.item_eat(2),
|
||||||
on_secondary_use = minetest.item_eat(2),
|
on_secondary_use = minetest.item_eat(2),
|
||||||
groups = { food = 2, eatable = 2, brewitem = 1 },
|
groups = { food = 2, eatable = 2, brewitem = 1 },
|
||||||
_mcl_saturation = 3.2,
|
_mcl_saturation = 3.2,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:bone", {
|
minetest.register_craftitem("mcl_mobitems:bone", {
|
||||||
description = S("Bone"),
|
description = S("Bone"),
|
||||||
_doc_items_longdesc = S("Bones can be used to tame wolves so they will protect you. They are also useful as a crafting ingredient."),
|
_doc_items_longdesc = S("Bones can be used to tame wolves so they will protect you. They are also useful as a crafting ingredient."),
|
||||||
_doc_items_usagehelp = S("Wield the bone near wolves to attract them. Use the “Place” key on the wolf to give it a bone and tame it. You can then give commands to the tamed wolf by using the “Place” key on it."),
|
_doc_items_usagehelp = S("Wield the bone near wolves to attract them. Use the “Place” key on the wolf to give it a bone and tame it. You can then give commands to the tamed wolf by using the “Place” key on it."),
|
||||||
inventory_image = "mcl_mobitems_bone.png",
|
inventory_image = "mcl_mobitems_bone.png",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { craftitem=1 },
|
groups = { craftitem=1 },
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:string",{
|
minetest.register_craftitem("mcl_mobitems:string",{
|
||||||
description = S("String"),
|
description = S("String"),
|
||||||
_doc_items_longdesc = S("Strings are used in crafting."),
|
_doc_items_longdesc = S("Strings are used in crafting."),
|
||||||
inventory_image = "mcl_mobitems_string.png",
|
inventory_image = "mcl_mobitems_string.png",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:blaze_rod", {
|
minetest.register_craftitem("mcl_mobitems:blaze_rod", {
|
||||||
description = S("Blaze Rod"),
|
description = S("Blaze Rod"),
|
||||||
_doc_items_longdesc = S("This is a crafting component dropped from dead blazes."),
|
_doc_items_longdesc = S("This is a crafting component dropped from dead blazes."),
|
||||||
wield_image = "mcl_mobitems_blaze_rod.png",
|
wield_image = "mcl_mobitems_blaze_rod.png",
|
||||||
inventory_image = "mcl_mobitems_blaze_rod.png",
|
inventory_image = "mcl_mobitems_blaze_rod.png",
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:blaze_powder", {
|
minetest.register_craftitem("mcl_mobitems:blaze_powder", {
|
||||||
description = S("Blaze Powder"),
|
description = S("Blaze Powder"),
|
||||||
_doc_items_longdesc = S("This item is mainly used for crafting."),
|
_doc_items_longdesc = S("This item is mainly used for crafting."),
|
||||||
wield_image = "mcl_mobitems_blaze_powder.png",
|
wield_image = "mcl_mobitems_blaze_powder.png",
|
||||||
inventory_image = "mcl_mobitems_blaze_powder.png",
|
inventory_image = "mcl_mobitems_blaze_powder.png",
|
||||||
groups = { craftitem = 1, brewitem = 1 },
|
groups = { craftitem = 1, brewitem = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:magma_cream", {
|
minetest.register_craftitem("mcl_mobitems:magma_cream", {
|
||||||
description = S("Magma Cream"),
|
description = S("Magma Cream"),
|
||||||
_doc_items_longdesc = S("Magma cream is a crafting component."),
|
_doc_items_longdesc = S("Magma cream is a crafting component."),
|
||||||
wield_image = "mcl_mobitems_magma_cream.png",
|
wield_image = "mcl_mobitems_magma_cream.png",
|
||||||
inventory_image = "mcl_mobitems_magma_cream.png",
|
inventory_image = "mcl_mobitems_magma_cream.png",
|
||||||
groups = { craftitem = 1, brewitem = 1 },
|
groups = { craftitem = 1, brewitem = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:ghast_tear", {
|
minetest.register_craftitem("mcl_mobitems:ghast_tear", {
|
||||||
description = S("Ghast Tear"),
|
description = S("Ghast Tear"),
|
||||||
_doc_items_longdesc = S("Place this item in an item frame as decoration."),
|
_doc_items_longdesc = S("Place this item in an item frame as decoration."),
|
||||||
wield_image = "mcl_mobitems_ghast_tear.png",
|
wield_image = "mcl_mobitems_ghast_tear.png",
|
||||||
inventory_image = "mcl_mobitems_ghast_tear.png",
|
inventory_image = "mcl_mobitems_ghast_tear.png",
|
||||||
groups = { brewitem = 1 },
|
groups = { brewitem = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:nether_star", {
|
minetest.register_craftitem("mcl_mobitems:nether_star", {
|
||||||
description = S("Nether Star"),
|
description = S("Nether Star"),
|
||||||
_doc_items_longdesc = S("A nether star is dropped when the Wither dies. Place it in an item frame to show the world how hardcore you are! Or just as decoration."),
|
_doc_items_longdesc = S("A nether star is dropped when the Wither dies. Place it in an item frame to show the world how hardcore you are! Or just as decoration."),
|
||||||
wield_image = "mcl_mobitems_nether_star.png",
|
wield_image = "mcl_mobitems_nether_star.png",
|
||||||
inventory_image = "mcl_mobitems_nether_star.png",
|
inventory_image = "mcl_mobitems_nether_star.png",
|
||||||
-- TODO: Reveal item when it's useful
|
-- TODO: Reveal item when it's useful
|
||||||
groups = { craftitem = 1, not_in_creative_inventory = 1 },
|
groups = { craftitem = 1, not_in_creative_inventory = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:leather", {
|
minetest.register_craftitem("mcl_mobitems:leather", {
|
||||||
description = S("Leather"),
|
description = S("Leather"),
|
||||||
_doc_items_longdesc = S("Leather is a versatile crafting component."),
|
_doc_items_longdesc = S("Leather is a versatile crafting component."),
|
||||||
wield_image = "mcl_mobitems_leather.png",
|
wield_image = "mcl_mobitems_leather.png",
|
||||||
inventory_image = "mcl_mobitems_leather.png",
|
inventory_image = "mcl_mobitems_leather.png",
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:feather", {
|
minetest.register_craftitem("mcl_mobitems:feather", {
|
||||||
description = S("Feather"),
|
description = S("Feather"),
|
||||||
_doc_items_longdesc = S("Feathers are used in crafting and are dropped from chickens."),
|
_doc_items_longdesc = S("Feathers are used in crafting and are dropped from chickens."),
|
||||||
wield_image = "mcl_mobitems_feather.png",
|
wield_image = "mcl_mobitems_feather.png",
|
||||||
inventory_image = "mcl_mobitems_feather.png",
|
inventory_image = "mcl_mobitems_feather.png",
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:rabbit_hide", {
|
minetest.register_craftitem("mcl_mobitems:rabbit_hide", {
|
||||||
description = S("Rabbit Hide"),
|
description = S("Rabbit Hide"),
|
||||||
_doc_items_longdesc = S("Rabbit hide is used to create leather."),
|
_doc_items_longdesc = S("Rabbit hide is used to create leather."),
|
||||||
wield_image = "mcl_mobitems_rabbit_hide.png",
|
wield_image = "mcl_mobitems_rabbit_hide.png",
|
||||||
inventory_image = "mcl_mobitems_rabbit_hide.png",
|
inventory_image = "mcl_mobitems_rabbit_hide.png",
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:rabbit_foot", {
|
minetest.register_craftitem("mcl_mobitems:rabbit_foot", {
|
||||||
description = S("Rabbit's Foot"),
|
description = S("Rabbit's Foot"),
|
||||||
_doc_items_longdesc = S("Must be your lucky day! Place this item in an item frame for decoration."),
|
_doc_items_longdesc = S("Must be your lucky day! Place this item in an item frame for decoration."),
|
||||||
wield_image = "mcl_mobitems_rabbit_foot.png",
|
wield_image = "mcl_mobitems_rabbit_foot.png",
|
||||||
inventory_image = "mcl_mobitems_rabbit_foot.png",
|
inventory_image = "mcl_mobitems_rabbit_foot.png",
|
||||||
groups = { brewitem = 1 },
|
groups = { brewitem = 1 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:saddle", {
|
minetest.register_craftitem("mcl_mobitems:saddle", {
|
||||||
description = S("Saddle"),
|
description = S("Saddle"),
|
||||||
_tt_help = S("Can be placed on animals to ride them"),
|
_tt_help = S("Can be placed on animals to ride them"),
|
||||||
_doc_items_longdesc = S("Saddles can be put on some animals in order to mount them."),
|
_doc_items_longdesc = S("Saddles can be put on some animals in order to mount them."),
|
||||||
_doc_items_usagehelp = S("Use the placement key with the saddle in your hand to try to put on the saddle. Saddles fit on horses, mules, donkeys and pigs. Horses, mules and donkeys need to be tamed first, otherwise they'll reject the saddle. Saddled animals can be mounted by using the placement key on them again."),
|
_doc_items_usagehelp = S("Use the placement key with the saddle in your hand to try to put on the saddle. Saddles fit on horses, mules, donkeys and pigs. Horses, mules and donkeys need to be tamed first, otherwise they'll reject the saddle. Saddled animals can be mounted by using the placement key on them again."),
|
||||||
wield_image = "mcl_mobitems_saddle.png",
|
wield_image = "mcl_mobitems_saddle.png",
|
||||||
inventory_image = "mcl_mobitems_saddle.png",
|
inventory_image = "mcl_mobitems_saddle.png",
|
||||||
groups = { transport = 1 },
|
groups = { transport = 1 },
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:rabbit_stew", {
|
minetest.register_craftitem("mcl_mobitems:rabbit_stew", {
|
||||||
description = S("Rabbit Stew"),
|
description = S("Rabbit Stew"),
|
||||||
_doc_items_longdesc = S("Rabbit stew is a very nutricious food item."),
|
_doc_items_longdesc = S("Rabbit stew is a very nutricious food item."),
|
||||||
wield_image = "mcl_mobitems_rabbit_stew.png",
|
wield_image = "mcl_mobitems_rabbit_stew.png",
|
||||||
inventory_image = "mcl_mobitems_rabbit_stew.png",
|
inventory_image = "mcl_mobitems_rabbit_stew.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_place = minetest.item_eat(10, "mcl_core:bowl"),
|
on_place = minetest.item_eat(10, "mcl_core:bowl"),
|
||||||
on_secondary_use = minetest.item_eat(10, "mcl_core:bowl"),
|
on_secondary_use = minetest.item_eat(10, "mcl_core:bowl"),
|
||||||
groups = { food = 3, eatable = 10 },
|
groups = { food = 3, eatable = 10 },
|
||||||
_mcl_saturation = 12.0,
|
_mcl_saturation = 12.0,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:shulker_shell", {
|
minetest.register_craftitem("mcl_mobitems:shulker_shell", {
|
||||||
description = S("Shulker Shell"),
|
description = S("Shulker Shell"),
|
||||||
_doc_items_longdesc = S("Shulker shells are used in crafting. They are dropped from dead shulkers."),
|
_doc_items_longdesc = S("Shulker shells are used in crafting. They are dropped from dead shulkers."),
|
||||||
inventory_image = "mcl_mobitems_shulker_shell.png",
|
inventory_image = "mcl_mobitems_shulker_shell.png",
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:slimeball", {
|
minetest.register_craftitem("mcl_mobitems:slimeball", {
|
||||||
description = S("Slimeball"),
|
description = S("Slimeball"),
|
||||||
_doc_items_longdesc = S("Slimeballs are used in crafting. They are dropped from slimes."),
|
_doc_items_longdesc = S("Slimeballs are used in crafting. They are dropped from slimes."),
|
||||||
inventory_image = "mcl_mobitems_slimeball.png",
|
inventory_image = "mcl_mobitems_slimeball.png",
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:gunpowder", {
|
minetest.register_craftitem("mcl_mobitems:gunpowder", {
|
||||||
description = S("Gunpowder"),
|
description = S("Gunpowder"),
|
||||||
_doc_items_longdesc = doc.sub.items.temp.craftitem,
|
_doc_items_longdesc = doc.sub.items.temp.craftitem,
|
||||||
inventory_image = "default_gunpowder.png",
|
inventory_image = "default_gunpowder.png",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { craftitem=1, brewitem = 1 },
|
groups = { craftitem=1, brewitem = 1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("mcl_mobitems:carrot_on_a_stick", {
|
minetest.register_tool("mcl_mobitems:carrot_on_a_stick", {
|
||||||
description = S("Carrot on a Stick"),
|
description = S("Carrot on a Stick"),
|
||||||
_tt_help = S("Lets you ride a saddled pig"),
|
_tt_help = S("Lets you ride a saddled pig"),
|
||||||
_doc_items_longdesc = S("A carrot on a stick can be used on saddled pigs to ride them."),
|
_doc_items_longdesc = S("A carrot on a stick can be used on saddled pigs to ride them."),
|
||||||
_doc_items_usagehelp = S("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."),
|
_doc_items_usagehelp = S("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."),
|
||||||
wield_image = "mcl_mobitems_carrot_on_a_stick.png",
|
wield_image = "mcl_mobitems_carrot_on_a_stick.png",
|
||||||
inventory_image = "mcl_mobitems_carrot_on_a_stick.png",
|
inventory_image = "mcl_mobitems_carrot_on_a_stick.png",
|
||||||
groups = { transport = 1 },
|
groups = { transport = 1 },
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
-- Crafting
|
-- Crafting
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_mobitems:leather",
|
output = "mcl_mobitems:leather",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "mcl_mobitems:rabbit_hide", "mcl_mobitems:rabbit_hide" },
|
{ "mcl_mobitems:rabbit_hide", "mcl_mobitems:rabbit_hide" },
|
||||||
{ "mcl_mobitems:rabbit_hide", "mcl_mobitems:rabbit_hide" },
|
{ "mcl_mobitems:rabbit_hide", "mcl_mobitems:rabbit_hide" },
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_mobitems:blaze_powder 2",
|
output = "mcl_mobitems:blaze_powder 2",
|
||||||
recipe = {{"mcl_mobitems:blaze_rod"}},
|
recipe = {{"mcl_mobitems:blaze_rod"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_mobitems:rabbit_stew",
|
output = "mcl_mobitems:rabbit_stew",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "", "mcl_mobitems:cooked_rabbit", "", },
|
{ "", "mcl_mobitems:cooked_rabbit", "", },
|
||||||
{ "group:mushroom", "mcl_farming:potato_item_baked", "mcl_farming:carrot_item", },
|
{ "group:mushroom", "mcl_farming:potato_item_baked", "mcl_farming:carrot_item", },
|
||||||
{ "", "mcl_core:bowl", "", },
|
{ "", "mcl_core:bowl", "", },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_mobitems:rabbit_stew",
|
output = "mcl_mobitems:rabbit_stew",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "", "mcl_mobitems:cooked_rabbit", "", },
|
{ "", "mcl_mobitems:cooked_rabbit", "", },
|
||||||
{ "mcl_farming:carrot_item", "mcl_farming:potato_item_baked", "group:mushroom", },
|
{ "mcl_farming:carrot_item", "mcl_farming:potato_item_baked", "group:mushroom", },
|
||||||
{ "", "mcl_core:bowl", "", },
|
{ "", "mcl_core:bowl", "", },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_mobitems:carrot_on_a_stick",
|
output = "mcl_mobitems:carrot_on_a_stick",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "mcl_fishing:fishing_rod", "", },
|
{ "mcl_fishing:fishing_rod", "", },
|
||||||
{ "", "mcl_farming:carrot_item" },
|
{ "", "mcl_farming:carrot_item" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_mobitems:carrot_on_a_stick",
|
output = "mcl_mobitems:carrot_on_a_stick",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "", "mcl_fishing:fishing_rod", },
|
{ "", "mcl_fishing:fishing_rod", },
|
||||||
{ "mcl_farming:carrot_item", "" },
|
{ "mcl_farming:carrot_item", "" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "mcl_mobitems:magma_cream",
|
output = "mcl_mobitems:magma_cream",
|
||||||
recipe = {"mcl_mobitems:blaze_powder", "mcl_mobitems:slimeball"},
|
recipe = {"mcl_mobitems:blaze_powder", "mcl_mobitems:slimeball"},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mcl_mobitems:cooked_mutton",
|
output = "mcl_mobitems:cooked_mutton",
|
||||||
recipe = "mcl_mobitems:mutton",
|
recipe = "mcl_mobitems:mutton",
|
||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mcl_mobitems:cooked_rabbit",
|
output = "mcl_mobitems:cooked_rabbit",
|
||||||
recipe = "mcl_mobitems:rabbit",
|
recipe = "mcl_mobitems:rabbit",
|
||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mcl_mobitems:cooked_chicken",
|
output = "mcl_mobitems:cooked_chicken",
|
||||||
recipe = "mcl_mobitems:chicken",
|
recipe = "mcl_mobitems:chicken",
|
||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mcl_mobitems:cooked_beef",
|
output = "mcl_mobitems:cooked_beef",
|
||||||
recipe = "mcl_mobitems:beef",
|
recipe = "mcl_mobitems:beef",
|
||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mcl_mobitems:cooked_porkchop",
|
output = "mcl_mobitems:cooked_porkchop",
|
||||||
recipe = "mcl_mobitems:porkchop",
|
recipe = "mcl_mobitems:porkchop",
|
||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_mobitems:blaze_rod",
|
recipe = "mcl_mobitems:blaze_rod",
|
||||||
burntime = 120,
|
burntime = 120,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_mobitems:slimeball 9",
|
output = "mcl_mobitems:slimeball 9",
|
||||||
recipe = {{"mcl_core:slimeblock"}},
|
recipe = {{"mcl_core:slimeblock"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_core:slimeblock",
|
output = "mcl_core:slimeblock",
|
||||||
recipe = {{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",},
|
recipe = {{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",},
|
||||||
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",},
|
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",},
|
||||||
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",}},
|
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",}},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing)
|
minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||||
|
|
||||||
-- poisoning with spider eye
|
-- poisoning with spider eye
|
||||||
if itemstack:get_name() == "mcl_mobitems:spider_eye" then
|
if itemstack:get_name() == "mcl_mobitems:spider_eye" then
|
||||||
mcl_potions.poison_func(user, 1, 4)
|
mcl_potions.poison_func(user, 1, 4)
|
||||||
end
|
end
|
||||||
|
|
||||||
end )
|
end )
|
||||||
|
@ -90,7 +90,7 @@ minetest.register_entity("mcl_shields:shield_entity", {
|
|||||||
local color = minetest.registered_items[item]._shield_color
|
local color = minetest.registered_items[item]._shield_color
|
||||||
if color then
|
if color then
|
||||||
shield_texture = "mcl_shield_base_nopattern.png^(mcl_shield_pattern_base.png^[colorize:" .. color .. ")"
|
shield_texture = "mcl_shield_base_nopattern.png^(mcl_shield_pattern_base.png^[colorize:" .. color .. ")"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ mcl_damage.register_modifier(function(obj, damage, reason)
|
|||||||
local type = reason.type
|
local type = reason.type
|
||||||
local damager = reason.direct
|
local damager = reason.direct
|
||||||
local blocking, shieldstack = mcl_shields.is_blocking(obj)
|
local blocking, shieldstack = mcl_shields.is_blocking(obj)
|
||||||
|
|
||||||
if not (obj:is_player() and blocking and mcl_shields.types[type] and damager) then
|
if not (obj:is_player() and blocking and mcl_shields.types[type] and damager) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -275,7 +275,7 @@ local function handle_blocking(player)
|
|||||||
player_shield.blocking = 2
|
player_shield.blocking = 2
|
||||||
end
|
end
|
||||||
elseif shield_in_offhand then
|
elseif shield_in_offhand then
|
||||||
local offhand_can_block = (wielded_item(player) == "" or not mcl_util.get_pointed_thing(player, true))
|
local offhand_can_block = (wielded_item(player) == "" or not mcl_util.get_pointed_thing(player, true))
|
||||||
and (minetest.get_item_group(wielded_item(player), "bow") ~= 1 and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1)
|
and (minetest.get_item_group(wielded_item(player), "bow") ~= 1 and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1)
|
||||||
|
|
||||||
if not offhand_can_block then
|
if not offhand_can_block then
|
||||||
|
@ -46,7 +46,7 @@ mcl_damage.register_modifier(function(obj, damage, reason)
|
|||||||
|
|
||||||
-- Effects
|
-- Effects
|
||||||
minetest.sound_play({name = "mcl_totems_totem", gain = 1}, {pos=ppos, max_hear_distance = 16}, true)
|
minetest.sound_play({name = "mcl_totems_totem", gain = 1}, {pos=ppos, max_hear_distance = 16}, true)
|
||||||
|
|
||||||
for i = 1, 4 do
|
for i = 1, 4 do
|
||||||
for c = 1, #particle_colors do
|
for c = 1, #particle_colors do
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
|
@ -2096,7 +2096,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
|||||||
lvm_used = true
|
lvm_used = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set param2 (=color) of sugar cane
|
-- Set param2 (=color) of sugar cane
|
||||||
nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:reeds"})
|
nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:reeds"})
|
||||||
for n=1, #nodes do
|
for n=1, #nodes do
|
||||||
|
@ -234,7 +234,7 @@ end
|
|||||||
|
|
||||||
function settlements.place_schematics(settlement_info, pr)
|
function settlements.place_schematics(settlement_info, pr)
|
||||||
local building_all_info
|
local building_all_info
|
||||||
|
|
||||||
--attempt to place one belltower in the center of the village - this doesn't always work out great but it's a lot better than doing it first or last.
|
--attempt to place one belltower in the center of the village - this doesn't always work out great but it's a lot better than doing it first or last.
|
||||||
local belltower = table.remove(settlement_info,math.floor(#settlement_info/2))
|
local belltower = table.remove(settlement_info,math.floor(#settlement_info/2))
|
||||||
if belltower then
|
if belltower then
|
||||||
@ -251,10 +251,10 @@ function settlements.place_schematics(settlement_info, pr)
|
|||||||
pr
|
pr
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, built_house in ipairs(settlement_info) do
|
for i, built_house in ipairs(settlement_info) do
|
||||||
local is_last = i == #settlement_info
|
local is_last = i == #settlement_info
|
||||||
|
|
||||||
for j, schem in ipairs(settlements.schematic_table) do
|
for j, schem in ipairs(settlements.schematic_table) do
|
||||||
if settlement_info[i]["name"] == schem["name"] then
|
if settlement_info[i]["name"] == schem["name"] then
|
||||||
building_all_info = schem
|
building_all_info = schem
|
||||||
|
@ -26,7 +26,7 @@ for _, action in pairs({"grant", "revoke"}) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local meta = player:get_meta()
|
local meta = player:get_meta()
|
||||||
|
|
||||||
if priv == "fly" then
|
if priv == "fly" then
|
||||||
meta:set_int("mcl_privs:fly_changed", 1)
|
meta:set_int("mcl_privs:fly_changed", 1)
|
||||||
end
|
end
|
||||||
|
@ -1,57 +1,57 @@
|
|||||||
local random = math.random
|
local random = math.random
|
||||||
|
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
|
|
||||||
mcl_death_drop = {}
|
mcl_death_drop = {}
|
||||||
|
|
||||||
mcl_death_drop.registered_dropped_lists = {}
|
mcl_death_drop.registered_dropped_lists = {}
|
||||||
|
|
||||||
function mcl_death_drop.register_dropped_list(inv, listname, drop)
|
function mcl_death_drop.register_dropped_list(inv, listname, drop)
|
||||||
table.insert(mcl_death_drop.registered_dropped_lists, {inv = inv, listname = listname, drop = drop})
|
table.insert(mcl_death_drop.registered_dropped_lists, {inv = inv, listname = listname, drop = drop})
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_death_drop.register_dropped_list("PLAYER", "main", true)
|
mcl_death_drop.register_dropped_list("PLAYER", "main", true)
|
||||||
mcl_death_drop.register_dropped_list("PLAYER", "craft", true)
|
mcl_death_drop.register_dropped_list("PLAYER", "craft", true)
|
||||||
mcl_death_drop.register_dropped_list("PLAYER", "armor", true)
|
mcl_death_drop.register_dropped_list("PLAYER", "armor", true)
|
||||||
mcl_death_drop.register_dropped_list("PLAYER", "offhand", true)
|
mcl_death_drop.register_dropped_list("PLAYER", "offhand", true)
|
||||||
|
|
||||||
minetest.register_on_dieplayer(function(player)
|
minetest.register_on_dieplayer(function(player)
|
||||||
local keep = minetest.settings:get_bool("mcl_keepInventory", false)
|
local keep = minetest.settings:get_bool("mcl_keepInventory", false)
|
||||||
if keep == false then
|
if keep == false then
|
||||||
-- Drop inventory, crafting grid and armor
|
-- Drop inventory, crafting grid and armor
|
||||||
local playerinv = player:get_inventory()
|
local playerinv = player:get_inventory()
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
-- No item drop if in deep void
|
-- No item drop if in deep void
|
||||||
local _, void_deadly = mcl_worlds.is_in_void(pos)
|
local _, void_deadly = mcl_worlds.is_in_void(pos)
|
||||||
|
|
||||||
for l=1,#mcl_death_drop.registered_dropped_lists do
|
for l=1,#mcl_death_drop.registered_dropped_lists do
|
||||||
local inv = mcl_death_drop.registered_dropped_lists[l].inv
|
local inv = mcl_death_drop.registered_dropped_lists[l].inv
|
||||||
if inv == "PLAYER" then
|
if inv == "PLAYER" then
|
||||||
inv = playerinv
|
inv = playerinv
|
||||||
elseif type(inv) == "function" then
|
elseif type(inv) == "function" then
|
||||||
inv = inv(player)
|
inv = inv(player)
|
||||||
end
|
end
|
||||||
local listname = mcl_death_drop.registered_dropped_lists[l].listname
|
local listname = mcl_death_drop.registered_dropped_lists[l].listname
|
||||||
local drop = mcl_death_drop.registered_dropped_lists[l].drop
|
local drop = mcl_death_drop.registered_dropped_lists[l].drop
|
||||||
if inv then
|
if inv then
|
||||||
for i, stack in ipairs(inv:get_list(listname)) do
|
for i, stack in ipairs(inv:get_list(listname)) do
|
||||||
local x = random(0, 9)/3
|
local x = random(0, 9)/3
|
||||||
local z = random(0, 9)/3
|
local z = random(0, 9)/3
|
||||||
pos.x = pos.x + x
|
pos.x = pos.x + x
|
||||||
pos.z = pos.z + z
|
pos.z = pos.z + z
|
||||||
if not void_deadly and drop and not mcl_enchanting.has_enchantment(stack, "curse_of_vanishing") then
|
if not void_deadly and drop and not mcl_enchanting.has_enchantment(stack, "curse_of_vanishing") then
|
||||||
local def = minetest.registered_items[stack:get_name()]
|
local def = minetest.registered_items[stack:get_name()]
|
||||||
if def and def.on_drop then
|
if def and def.on_drop then
|
||||||
stack = def.on_drop(stack, player, pos)
|
stack = def.on_drop(stack, player, pos)
|
||||||
end
|
end
|
||||||
minetest.add_item(pos, stack)
|
minetest.add_item(pos, stack)
|
||||||
end
|
end
|
||||||
pos.x = pos.x - x
|
pos.x = pos.x - x
|
||||||
pos.z = pos.z - z
|
pos.z = pos.z - z
|
||||||
end
|
end
|
||||||
inv:set_list(listname, {})
|
inv:set_list(listname, {})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mcl_armor.update(player)
|
mcl_armor.update(player)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -473,10 +473,10 @@ function mcl_spawn.get_player_spawn_pos(player)
|
|||||||
player:get_meta():set_string("mcl_beds:spawn", "")
|
player:get_meta():set_string("mcl_beds:spawn", "")
|
||||||
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!"))
|
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!"))
|
||||||
return mcl_spawn.get_world_spawn_pos(), false
|
return mcl_spawn.get_world_spawn_pos(), false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Find spawning position on/near the bed free of solid or damaging blocks iterating a square spiral 15x15:
|
-- Find spawning position on/near the bed free of solid or damaging blocks iterating a square spiral 15x15:
|
||||||
|
2
tools/strip_trailing_whitespace.sh
Executable file
2
tools/strip_trailing_whitespace.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sed --in-place 's/[[:space:]]\+$//' $(find -name "*.lua")
|
Loading…
Reference in New Issue
Block a user