Add shears
This commit is contained in:
parent
4acb4cff64
commit
dfc48840a3
@ -55,6 +55,9 @@ following sounds are created by confusion_music (freesound.org)
|
||||
following sound is created by Yuval (freesound.org)
|
||||
- creatures_sheep.3.ogg, CC-BY 3.0
|
||||
|
||||
following sound is created by SmartWentCody (freesound.org)
|
||||
- creatures_shears.ogg, CC-BY 3.0
|
||||
|
||||
All other sounds (c) Copyright BlockMen (2014), CC-BY 3.0
|
||||
|
||||
Changelog:
|
||||
|
@ -1,3 +1,8 @@
|
||||
minetest.register_tool("creatures:shears", {
|
||||
description = "Shears",
|
||||
inventory_image = "creatures_shears.png",
|
||||
})
|
||||
|
||||
-- drop items
|
||||
minetest.register_craftitem("creatures:flesh", {
|
||||
description = "Flesh",
|
||||
|
24
sheep.lua
24
sheep.lua
@ -11,6 +11,7 @@ local s_player_radius = 14
|
||||
local s_sound_normal = "creatures_sheep"
|
||||
local s_sound_hit = "creatures_sheep"
|
||||
local s_sound_dead = "creatures_sheep"
|
||||
local s_sound_shears = "creatures_shears"
|
||||
|
||||
creatures.s_spawn_nodes = {"default:dirt_with_grass"}
|
||||
|
||||
@ -147,7 +148,7 @@ SHEEP_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabili
|
||||
end
|
||||
|
||||
local my_pos = self.object:getpos()
|
||||
my_pos.y = my_pos.y + 0.5
|
||||
my_pos.y = my_pos.y + 0.4
|
||||
|
||||
-- drop 1-2 whool when punched
|
||||
if self.has_wool then
|
||||
@ -158,6 +159,27 @@ SHEEP_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabili
|
||||
|
||||
end
|
||||
|
||||
SHEEP_DEF.on_rightclick = function(self, clicker)
|
||||
if not clicker or not self.has_wool then
|
||||
return
|
||||
end
|
||||
|
||||
local item = clicker:get_wielded_item()
|
||||
local name = item:get_name()
|
||||
if item and name and name == "creatures:shears" then
|
||||
local my_pos = self.object:getpos()
|
||||
minetest.sound_play(s_sound_shears, {pos = my_pos, max_hear_distance = 10, gain = 1})
|
||||
my_pos.y = my_pos.y + 0.4
|
||||
self.has_wool = false
|
||||
s_update_visuals_def(self)
|
||||
creatures.drop(my_pos, {{name=s_drop, count=2}})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
item:add_wear(65535/100)
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
SHEEP_DEF.on_step = function(self, dtime)
|
||||
if self.dead then return end
|
||||
if self.lifetime == nil then self.lifetime = 0 end
|
||||
|
BIN
sounds/creatures_shears.ogg
Normal file
BIN
sounds/creatures_shears.ogg
Normal file
Binary file not shown.
BIN
textures/creatures_shears.png
Normal file
BIN
textures/creatures_shears.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 282 B |
Loading…
x
Reference in New Issue
Block a user