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})
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()
end
return itemstack

View File

@ -54,12 +54,12 @@ minetest.register_craft({
minetest.register_abm(
{nodenames = {"mesecons_solarpanel:solar_panel_off"},
interval = 1,
interval = 3,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
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})
mesecon:receptor_on(pos)
end
@ -68,12 +68,12 @@ minetest.register_abm(
minetest.register_abm(
{nodenames = {"mesecons_solarpanel:solar_panel_on"},
interval = 1,
interval = 3,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
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})
mesecon:receptor_off(pos)
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"},
interval = 1,
chance = 1,
@ -135,7 +135,7 @@ minetest.register_abm({
mesecon:receptor_on(pos, torch_get_output_rules(node))
end
end
})
})]]
-- Param2 Table (Block Attached To)
-- 5 = z-1

View File

@ -290,8 +290,8 @@ minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Boat",
inventory_image = "boats_inventory.png",
wield_scale = {x = 2, y = 2, z = 1},
liquids_pointable = true,
stack_max = 1,
groups = {rail = 1, flammable = 2},
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)",
inventory_image = "carts_cart_inv.png",
wield_image = "carts_cart_inv.png",
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return

View File

@ -309,7 +309,6 @@ minetest.register_tool("default:pole", {
description = "Fishing Pole",
groups = {},
inventory_image = "default_tool_fishing_pole.png",
stack_max = 1,
groups = {tools = 1},
liquids_pointable = true,
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,
inventory_image = invimg,
groups = grp,
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing)

View File

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

View File

@ -1,126 +1,81 @@
arrows = {
{"throwing:arrow", "throwing:arrow_entity"},
{"throwing:arrow", "throwing:arrow_entity"},
}
local creative = minetest.settings:get_bool("creative_mode")
local wear
local throwing_shoot_arrow = function(itemstack, player)
for _,arrow in ipairs(arrows) do
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
for _,arrow in ipairs(arrows) do
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
player:get_inventory():remove_item("main", arrow[1])
player:get_inventory():remove_item("main", arrow[1])
end
local playerpos = player:get_pos()
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2])
local dir = player:get_look_dir()
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:setyaw(player:get_look_yaw()+math.pi)
minetest.sound_play("throwing_sound", {pos=playerpos})
if obj:get_luaentity().player == "" then
obj:get_luaentity().player = player
end
obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name()
return true
end
end
return false
local playerpos = player:get_pos()
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2])
local dir = player:get_look_dir()
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:setyaw(player:get_look_yaw()+math.pi)
minetest.sound_play("throwing_sound", {pos=playerpos})
if obj:get_luaentity().player == "" then
obj:get_luaentity().player = player
end
obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name()
return true
end
end
return false
end
local wear
minetest.register_tool("throwing:bow", {
description = "Bow",
inventory_image = "throwing_bow.png",
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing)
wear = itemstack:get_wear()
itemstack:replace("throwing:bow_0")
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,
description = "Bow",
inventory_image = "throwing_bow.png",
on_use = function(itemstack, user, pointed_thing)
itemstack:replace("throwing:bow_arrow")
return itemstack
end,
})
minetest.register_tool("throwing:bow_0", {
description = "Bow",
inventory_image = "throwing_bow_0.png",
stack_max = 1,
groups = {not_in_creative_inventory=1},
on_place = function(itemstack, placer, pointed_thing)
wear = itemstack:get_wear()
itemstack:replace("throwing:bow_1")
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_1", {
description = "Bow",
inventory_image = "throwing_bow_1.png",
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_tool("throwing:bow_arrow", {
description = "Bow with arrow",
inventory_image = "throwing_bow_arrow.png",
groups = {not_in_creative_inventory=1},
on_place = 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,
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({
output = 'throwing:bow',
recipe = {
{'', 'default:wood', 'farming:string'},
{'default:wood', '', 'farming:string'},
{'', 'default:wood', 'farming:string'},
}
output = 'throwing:bow',
recipe = {
{'', '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")

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