Inventory sounds, apple growth, more blood

master
D00Med 2018-06-01 17:08:38 +10:00
parent 0c69ab36c1
commit 842209c1a4
18 changed files with 46 additions and 9 deletions

View File

@ -378,11 +378,13 @@ minetest.register_on_joinplayer(function(player)
player:get_inventory():set_stack(listname, index, stack)
armor:set_player_armor(player)
armor:update_inventory(player)
minetest.sound_play("metal_sound", {to_player=player:get_player_name(), gain=1.2, loop=false})
end,
on_take = function(inv, listname, index, stack, player)
player:get_inventory():set_stack(listname, index, nil)
armor:set_player_armor(player)
armor:update_inventory(player)
minetest.sound_play("inventory", {to_player=player:get_player_name(), gain=1.2, loop=false})
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
local plaver_inv = player:get_inventory()
@ -391,6 +393,7 @@ minetest.register_on_joinplayer(function(player)
player_inv:set_stack(from_list, from_index, nil)
armor:set_player_armor(player)
armor:update_inventory(player)
minetest.sound_play("metal_sound", {to_player=player:get_player_name(), gain=1.2, loop=false})
end,
allow_put = function(inv, listname, index, stack, player)
return 1

View File

@ -24,11 +24,14 @@ function creative.init_creative_inventory(player)
return -1
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
minetest.sound_play("take", {to_player=player2:get_player_name(), gain=0.5, loop=false})
end,
on_put = function(inv, listname, index, stack, player2)
minetest.sound_play("put", {to_player=player2:get_player_name(), gain=0.5, loop=false})
end,
on_take = function(inv, listname, index, stack, player2)
if stack and stack:get_count() > 0 then
minetest.sound_play("take", {to_player=player2:get_player_name(), gain=0.5, loop=false})
minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory")
end
end,
@ -126,12 +129,14 @@ function creative.register_tab(name, title, items)
assert(inv)
if fields.creative_clear then
minetest.sound_play("click2_2", {to_player=player_name, gain=1.2, loop=false})
inv.start_i = 0
inv.filter = ""
creative.update_creative_inventory(player_name, items)
sfinv.set_player_inventory_formspec(player, context)
elseif fields.creative_search or
fields.key_enter_field == "creative_filter" then
minetest.sound_play("click2", {to_player=player_name, gain=0.8, loop=false})
inv.start_i = 0
inv.filter = fields.creative_filter:lower()
creative.update_creative_inventory(player_name, items)
@ -140,6 +145,7 @@ function creative.register_tab(name, title, items)
local start_i = inv.start_i or 0
if fields.creative_prev then
minetest.sound_play("click2", {to_player=player_name, gain=0.8, loop=false})
start_i = start_i - 3*8
if start_i < 0 then
start_i = inv.size - (inv.size % (3*8))
@ -148,6 +154,7 @@ function creative.register_tab(name, title, items)
end
end
elseif fields.creative_next then
minetest.sound_play("click2", {to_player=player_name, gain=0.8, loop=false})
start_i = start_i + 3*8
if start_i >= inv.size then
start_i = 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

View File

@ -1970,4 +1970,18 @@ end)
-- if player:get_player_name() == "singleplayer" then
-- minetest.place_schematic({x=0,y=15,z=0}, minetest.get_modpath("hyrule_mapgen").."/schematics/tower_ground.mts", 0, {["hyrule_mapgen:tower_dev"] = "hyrule_mapgen:tower_spawner",}, true)
-- end
-- end)
-- end)
minetest.register_lbm({
name = "hyrule_mapgen:apple_growth",
nodenames = {"default:leaves", "hyrule_mapgen:wild_leaves"},
run_at_every_load = true,
action = function(pos, node)
if math.random(1,200) == 1 and not minetest.find_node_near(pos, 3, {"default:apple"}) then
pos.y = pos.y-1
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name="default:apple"})
end
end
end
})

View File

@ -21,6 +21,17 @@ minetest.register_on_leaveplayer(function(player)
players[name] = nil
end)
--[[
minetest.register_on_player_inventory_action(function(player, inventory, action, inventory_info)
if action == "put" then
minetest.sound_play("put", {to_player=player:get_player_name(), gain=1.2, loop=false})
elseif action == "take" then
minetest.sound_play("take", {to_player=player:get_player_name(), gain=1.2, loop=false})
end
end)]]
minetest.register_entity("hyruletools:gliding_player", {
visual = "mesh",
mesh = "character_gliding.b3d",
@ -683,7 +694,6 @@ end)
--tools
minetest.register_entity("hyruletools:block_dummy", {
visual = "mesh",
mesh = "node.b3d",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 283 B

View File

@ -10,7 +10,7 @@ if mobs.mod and mobs.mod == "redo" then
hp_min = 7,
hp_max = 12,
armor = 130,
collisionbox = {-0.1,-0.1,-0.1, 0.1,0.1,0.1},
collisionbox = {-0.15,-0.15,-0.15, 0.15,0.15,0.15},
visual = "mesh",
glow = 12,
mesh = "fairy2.b3d",

View File

@ -212,15 +212,17 @@ function mobs.allow_take(inv, listname, index, stack, player)
end
end
function mobs.on_put(inv, listname, index, stack)
function mobs.on_put(inv, listname, index, stack, player)
if listname ~= "main" then
minetest.sound_play("put", {to_player=player:get_player_name(), gain=0.5, loop=false})
end
if listname == "payment" then
mobs.update_takeaway(inv)
end
end
function mobs.on_take(inv, listname, count, index, stack, player)
function mobs.on_take(inv, listname, index, stack, player)
minetest.sound_play("take", {to_player=player:get_player_name(), gain=0.5, loop=false})
if listname == "takeaway" then
local amount = inv:get_stack("payment", 1):get_count()
@ -234,7 +236,6 @@ function mobs.on_take(inv, listname, count, index, stack, player)
end
if listname == "payment" then
if mobs.check_pay(inv, false) then
local selection = inv.get_stack(inv, "selection", 1)
@ -346,6 +347,7 @@ function mobs_trader(self, clicker, entity, race)
if from_list == "goods"
and to_list == "selection" then
minetest.sound_play("take", {to_player=player:get_player_name(), gain=0.5, loop=false})
local inv = inventory
local moved = inv.get_stack(inv,to_list, to_index)

View File

@ -2052,7 +2052,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5
effect(pos, self.blood_amount, self.blood_texture, nil, nil, 1, nil)
effect(pos, self.blood_amount*4, self.blood_texture, nil, 1.2, (self.collisionbox[4]-self.collisionbox[1])*2.2, -5)
end
-- do damage

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 150 B

View File

@ -148,6 +148,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
page:on_enter(player, context)
end
sfinv.set_player_inventory_formspec(player, context)
minetest.sound_play("click2", {to_player=name, gain=0.5, loop=false})
end
end
return