Save tropical fish properties in item meta on bucket pickup

This commit is contained in:
cora 2022-11-25 03:30:44 +01:00
parent 665e8a06a2
commit d3349396b4
1 changed files with 7 additions and 2 deletions

View File

@ -104,8 +104,13 @@ local tropical_fish = {
fear_height = 4, fear_height = 4,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then
self.object:remove() if clicker:set_wielded_item("mcl_buckets:bucket_tropical_fish") then
clicker:set_wielded_item("mcl_buckets:bucket_tropical_fish") local it = clicker:get_wielded_item()
local m = it:get_meta()
m:set_string("properties",minetest.serialize(self.object:get_properties()))
clicker:set_wielded_item(it)
self.object:remove()
end
awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing") awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing")
end end
end, end,