mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
trade on item pickup instead of on_rightclick
This commit is contained in:
parent
5b3480860a
commit
f8777220a3
1 changed files with 12 additions and 2 deletions
|
@ -38,6 +38,8 @@ local piglin = {
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "extra_mobs_piglin.b3d",
|
mesh = "extra_mobs_piglin.b3d",
|
||||||
|
spawn_in_group = 5,
|
||||||
|
spawn_in_group_min = 3,
|
||||||
textures = { {
|
textures = { {
|
||||||
"extra_mobs_piglin.png",
|
"extra_mobs_piglin.png",
|
||||||
"mcl_bows_bow_2.png",
|
"mcl_bows_bow_2.png",
|
||||||
|
@ -71,11 +73,12 @@ local piglin = {
|
||||||
},
|
},
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
|
pick_up = {"mcl_core:gold_ingot"},
|
||||||
on_spawn = function(self)
|
on_spawn = function(self)
|
||||||
self.weapon = self.base_texture[2]
|
self.weapon = self.base_texture[2]
|
||||||
self.gold_items = 0
|
self.gold_items = 0
|
||||||
end,
|
end,
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if self.object:get_pos().y > -100 then
|
if self.object:get_pos().y > -100 then
|
||||||
--local zog = minetest.add_entity(self.object:get_pos(), "mobs_mc:zombified_piglin")
|
--local zog = minetest.add_entity(self.object:get_pos(), "mobs_mc:zombified_piglin")
|
||||||
--zog:set_rotation(self.object:get_rotation())
|
--zog:set_rotation(self.object:get_rotation())
|
||||||
|
@ -110,7 +113,14 @@ local piglin = {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(self, clicker)
|
on_pick_up = function(self, itementity)
|
||||||
|
local clicker
|
||||||
|
for _,p in pairs(minetest.get_connected_players()) do
|
||||||
|
if vector.distance(p:get_pos(),self.object:get_pos()) < 10 then
|
||||||
|
clicker = p
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--return true --do not pick up
|
||||||
if clicker:is_player() and clicker:get_wielded_item():get_name() == "mcl_core:gold_ingot" and self.state ~= "attack" and self.gold_items < 3 then
|
if clicker:is_player() and clicker:get_wielded_item():get_name() == "mcl_core:gold_ingot" and self.state ~= "attack" and self.gold_items < 3 then
|
||||||
local item_gold = clicker:get_wielded_item()
|
local item_gold = clicker:get_wielded_item()
|
||||||
item_gold:take_item(1)
|
item_gold:take_item(1)
|
||||||
|
|
Loading…
Reference in a new issue