Change: bluestone, throwing, change stack_max for boats, carts and mobs

This commit is contained in:
MoNTE48 2019-06-01 14:43:18 +02:00
parent a68d82bf3f
commit 205e432ef7
12 changed files with 142 additions and 185 deletions

View File

@ -69,7 +69,8 @@ function beds.register_bed(name, def)
minetest.set_node(pos, {name = name, param2 = dir}) minetest.set_node(pos, {name = name, param2 = dir})
if not (creative and creative.is_enabled_for if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then and creative.is_enabled_for(player_name)) or
not minetest.is_singleplayer() then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

View File

@ -54,12 +54,12 @@ minetest.register_craft({
minetest.register_abm( minetest.register_abm(
{nodenames = {"mesecons_solarpanel:solar_panel_off"}, {nodenames = {"mesecons_solarpanel:solar_panel_off"},
interval = 1, interval = 3,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local light = minetest.get_node_light(pos, nil) local light = minetest.get_node_light(pos, nil)
if light >= 12 then if light >= 10 then
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_on", param2=node.param2}) minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_on", param2=node.param2})
mesecon:receptor_on(pos) mesecon:receptor_on(pos)
end end
@ -68,12 +68,12 @@ minetest.register_abm(
minetest.register_abm( minetest.register_abm(
{nodenames = {"mesecons_solarpanel:solar_panel_on"}, {nodenames = {"mesecons_solarpanel:solar_panel_on"},
interval = 1, interval = 3,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local light = minetest.get_node_light(pos, nil) local light = minetest.get_node_light(pos, nil)
if light < 12 then if light < 10 then
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_off", param2=node.param2}) minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_off", param2=node.param2})
mesecon:receptor_off(pos) mesecon:receptor_off(pos)
end end

View File

@ -112,7 +112,7 @@ minetest.register_craft({
} }
}) })
minetest.register_abm({ --[[minetest.register_abm({
nodenames = {"mesecons_torch:mesecon_torch_off","mesecons_torch:mesecon_torch_on"}, nodenames = {"mesecons_torch:mesecon_torch_off","mesecons_torch:mesecon_torch_on"},
interval = 1, interval = 1,
chance = 1, chance = 1,
@ -135,7 +135,7 @@ minetest.register_abm({
mesecon:receptor_on(pos, torch_get_output_rules(node)) mesecon:receptor_on(pos, torch_get_output_rules(node))
end end
end end
}) })]]
-- Param2 Table (Block Attached To) -- Param2 Table (Block Attached To)
-- 5 = z-1 -- 5 = z-1

View File

@ -290,8 +290,8 @@ minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", { minetest.register_craftitem("boats:boat", {
description = "Boat", description = "Boat",
inventory_image = "boats_inventory.png", inventory_image = "boats_inventory.png",
wield_scale = {x = 2, y = 2, z = 1},
liquids_pointable = true, liquids_pointable = true,
stack_max = 1,
groups = {rail = 1, flammable = 2}, groups = {rail = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)

View File

@ -442,6 +442,7 @@ if not boost_cart.mtg_compat then
description = "Cart (Sneak+Click to pick up)", description = "Cart (Sneak+Click to pick up)",
inventory_image = "carts_cart_inv.png", inventory_image = "carts_cart_inv.png",
wield_image = "carts_cart_inv.png", wield_image = "carts_cart_inv.png",
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then if not pointed_thing.type == "node" then
return return

View File

@ -309,7 +309,6 @@ minetest.register_tool("default:pole", {
description = "Fishing Pole", description = "Fishing Pole",
groups = {}, groups = {},
inventory_image = "default_tool_fishing_pole.png", inventory_image = "default_tool_fishing_pole.png",
stack_max = 1,
groups = {tools = 1}, groups = {tools = 1},
liquids_pointable = true, liquids_pointable = true,
on_use = function (itemstack, user, pointed_thing) on_use = function (itemstack, user, pointed_thing)

View File

@ -3826,6 +3826,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
description = desc, description = desc,
inventory_image = invimg, inventory_image = invimg,
groups = grp, groups = grp,
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)

View File

@ -1,88 +1,88 @@
minetest.register_craftitem("throwing:arrow", { minetest.register_craftitem("throwing:arrow", {
description = "Arrow", description = "Arrow",
inventory_image = "throwing_arrow_inv.png", inventory_image = "throwing_arrow_inv.png",
}) })
minetest.register_node("throwing:arrow_box", { minetest.register_node("throwing:arrow_box", {
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
-- Shaft -- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze --Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn --Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
} }
}, },
tiles = {"throwing_arrow.png", "throwing_arrow.png", "throwing_arrow_back.png", "throwing_arrow_front.png", "throwing_arrow_2.png", "throwing_arrow.png"}, tiles = {"throwing_arrow.png", "throwing_arrow.png", "throwing_arrow_back.png", "throwing_arrow_front.png", "throwing_arrow_2.png", "throwing_arrow.png"},
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
}) })
local THROWING_ARROW_ENTITY={ local THROWING_ARROW_ENTITY={
physical = false, physical = false,
timer=0, timer=0,
visual = "wielditem", visual = "wielditem",
visual_size = {x=0.3, y=0.3}, visual_size = {x=0.3, y=0.3},
textures = {"throwing:arrow_box"}, textures = {"throwing:arrow_box"},
lastpos={}, lastpos={},
collisionbox = {0,0,0,0,0,0}, collisionbox = {0,0,0,0,0,0},
} }
THROWING_ARROW_ENTITY.on_step = function(self, dtime) THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime self.timer=self.timer+dtime
local pos = self.object:getpos() local pos = self.object:getpos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if self.timer>0.2 then if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then if obj:get_luaentity().name ~= "throwing:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local damage = 3 local damage = 5
obj:punch(self.object, 1.0, { obj:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
damage_groups={fleshy=damage}, damage_groups={fleshy=damage},
}, nil) }, nil)
self.object:remove() self.object:remove()
end end
else else
local damage = 3 local damage = 5
obj:punch(self.object, 1.0, { obj:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
damage_groups={fleshy=damage}, damage_groups={fleshy=damage},
}, nil) }, nil)
self.object:remove() self.object:remove()
end end
end end
end end
if self.lastpos.x~=nil then if self.lastpos.x~=nil then
if node.name ~= "air" then if node.name ~= "air" then
minetest.add_item(self.lastpos, 'throwing:arrow') minetest.add_item(self.lastpos, 'throwing:arrow')
self.object:remove() self.object:remove()
end end
end end
self.lastpos={x=pos.x, y=pos.y, z=pos.z} self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end end
minetest.register_entity("throwing:arrow_entity", THROWING_ARROW_ENTITY) minetest.register_entity("throwing:arrow_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({ minetest.register_craft({
output = 'throwing:arrow 4', output = 'throwing:arrow 4',
recipe = { recipe = {
{'fire:flint_and_steel'}, {'fire:flint_and_steel'},
{'default:stick'}, {'default:stick'},
{'default:paper'} {'default:paper'}
} }
}) })

View File

@ -1,126 +1,81 @@
arrows = { arrows = {
{"throwing:arrow", "throwing:arrow_entity"}, {"throwing:arrow", "throwing:arrow_entity"},
} }
local creative = minetest.settings:get_bool("creative_mode") local creative = minetest.settings:get_bool("creative_mode")
local wear
local throwing_shoot_arrow = function(itemstack, player) local throwing_shoot_arrow = function(itemstack, player)
for _,arrow in ipairs(arrows) do for _,arrow in ipairs(arrows) do
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
if not creative or not minetest.is_singleplayer()then if not creative or not minetest.is_singleplayer()then
player:get_inventory():remove_item("main", arrow[1]) player:get_inventory():remove_item("main", arrow[1])
end end
local playerpos = player:get_pos() local playerpos = player:get_pos()
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2]) local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2])
local dir = player:get_look_dir() local dir = player:get_look_dir()
obj:setvelocity({x=dir.x*19, y=dir.y*19, z=dir.z*19}) obj:setvelocity({x=dir.x*19, y=dir.y*19, z=dir.z*19})
obj:set_acceleration({x=dir.x*-3, y=-10, z=dir.z*-3}) obj:set_acceleration({x=dir.x*-3, y=-10, z=dir.z*-3})
obj:setyaw(player:get_look_yaw()+math.pi) obj:setyaw(player:get_look_yaw()+math.pi)
minetest.sound_play("throwing_sound", {pos=playerpos}) minetest.sound_play("throwing_sound", {pos=playerpos})
if obj:get_luaentity().player == "" then if obj:get_luaentity().player == "" then
obj:get_luaentity().player = player obj:get_luaentity().player = player
end end
obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name() obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name()
return true return true
end end
end end
return false return false
end end
local wear
minetest.register_tool("throwing:bow", { minetest.register_tool("throwing:bow", {
description = "Bow", description = "Bow",
inventory_image = "throwing_bow.png", inventory_image = "throwing_bow.png",
stack_max = 1, on_use = function(itemstack, user, pointed_thing)
on_place = function(itemstack, placer, pointed_thing) itemstack:replace("throwing:bow_arrow")
wear = itemstack:get_wear() return itemstack
itemstack:replace("throwing:bow_0") end,
itemstack:add_wear(wear)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
wear = itemstack:get_wear()
itemstack:add_wear(wear)
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
if not creative then
itemstack:add_wear(65535/385)
end
end
return itemstack
end,
}) })
minetest.register_tool("throwing:bow_0", { minetest.register_tool("throwing:bow_arrow", {
description = "Bow", description = "Bow with arrow",
inventory_image = "throwing_bow_0.png", inventory_image = "throwing_bow_arrow.png",
stack_max = 1, groups = {not_in_creative_inventory=1},
groups = {not_in_creative_inventory=1}, on_place = function(itemstack, user, pointed_thing)
on_place = function(itemstack, placer, pointed_thing) wear = itemstack:get_wear()
wear = itemstack:get_wear() itemstack:replace("throwing:bow")
itemstack:replace("throwing:bow_1") itemstack:add_wear(wear)
itemstack:add_wear(wear) if throwing_shoot_arrow(itemstack, user, pointed_thing) then
return itemstack if not creative then
end, itemstack:add_wear(65535/385)
on_use = function(itemstack, user, pointed_thing) end
wear = itemstack:get_wear() end
itemstack:add_wear(wear) return itemstack
if throwing_shoot_arrow(itemstack, user, pointed_thing) then end,
if not creative then on_use = function(itemstack, user, pointed_thing)
itemstack:add_wear(65535/385) wear = itemstack:get_wear()
end itemstack:replace("throwing:bow")
end itemstack:add_wear(wear)
return itemstack if throwing_shoot_arrow(itemstack, user, pointed_thing) then
end, if not creative then
}) itemstack:add_wear(65535/385)
end
minetest.register_tool("throwing:bow_1", { end
description = "Bow", return itemstack
inventory_image = "throwing_bow_1.png", end,
stack_max = 1,
groups = {not_in_creative_inventory=1},
on_place = function(itemstack, placer, pointed_thing)
wear = itemstack:get_wear()
itemstack:replace("throwing:bow_2")
itemstack:add_wear(wear)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
wear = itemstack:get_wear()
itemstack:add_wear(wear)
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
if not creative then
itemstack:add_wear(65535/385)
end
end
return itemstack
end,
})
minetest.register_tool("throwing:bow_2", {
description = "Bow",
inventory_image = "throwing_bow_2.png",
stack_max = 1,
groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user, pointed_thing)
wear = itemstack:get_wear()
itemstack:replace("throwing:bow")
itemstack:add_wear(wear)
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
if not creative then
itemstack:add_wear(65535/385)
end
end
return itemstack
end,
}) })
minetest.register_craft({ minetest.register_craft({
output = 'throwing:bow', output = 'throwing:bow',
recipe = { recipe = {
{'', 'default:wood', 'farming:string'}, {'', 'default:wood', 'farming:string'},
{'default:wood', '', 'farming:string'}, {'default:wood', '', 'farming:string'},
{'', 'default:wood', 'farming:string'}, {'', 'default:wood', 'farming:string'},
} }
}) })
minetest.register_alias("throwing:bow_0", "throwing:bow_arrow")
minetest.register_alias("throwing:bow_1", "throwing:bow_arrow")
minetest.register_alias("throwing:bow_2", "throwing:bow_arrow")
dofile(minetest.get_modpath("throwing").."/arrow.lua") dofile(minetest.get_modpath("throwing").."/arrow.lua")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

View File

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 566 B