mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-08 08:50:20 +01:00
add pint sized rune to shrink tamed animals
This commit is contained in:
parent
a6a3b44c96
commit
47e91b9b6b
@ -1,4 +1,7 @@
|
||||
|
||||
local S = minetest.get_translator("mobs")
|
||||
|
||||
|
||||
lucky_block:add_blocks({
|
||||
{"dro", {"mobs:meat_raw"}, 5},
|
||||
{"dro", {"mobs:meat"}, 5},
|
||||
@ -13,3 +16,90 @@ lucky_block:add_blocks({
|
||||
{"dro", {"mobs:fence_top"}, 12},
|
||||
{"lig"}
|
||||
})
|
||||
|
||||
|
||||
-- pint sized rune
|
||||
|
||||
minetest.register_craftitem(":mobs:pint_sized_rune", {
|
||||
description = S("Pint Sized Rune"),
|
||||
inventory_image = "mobs_pint_sized_rune.png",
|
||||
groups = {flammable = 2},
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
if pointed_thing.type ~= "object" then
|
||||
return
|
||||
end
|
||||
|
||||
local name = user and user:get_player_name() or ""
|
||||
local tool = user and user:get_wielded_item()
|
||||
local tool_name = tool:get_name()
|
||||
|
||||
if tool_name ~= "mobs:pint_sized_rune" then
|
||||
return
|
||||
end
|
||||
|
||||
local self = pointed_thing.ref:get_luaentity()
|
||||
|
||||
if not self._cmi_is_mob then
|
||||
minetest.chat_send_player(name, S("Not a Mobs Redo mob!"))
|
||||
return
|
||||
end
|
||||
|
||||
if not self.tamed then
|
||||
minetest.chat_send_player(name, S("Not tamed!"))
|
||||
return
|
||||
end
|
||||
|
||||
if self.pint_size_potion then
|
||||
minetest.chat_send_player(name, S("Potion already applied!"))
|
||||
return
|
||||
end
|
||||
|
||||
if not mobs.is_creative(user:get_player_name()) then
|
||||
tool:take_item() -- take 1 rune
|
||||
user:set_wielded_item(tool)
|
||||
end
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
local prop = self.object:get_properties()
|
||||
|
||||
vis_size = {x = self.base_size.x * .5, y = self.base_size.y * .5}
|
||||
|
||||
self.base_size = vis_size
|
||||
|
||||
colbox = {
|
||||
self.base_colbox[1] * .5, self.base_colbox[2] * .5,
|
||||
self.base_colbox[3] * .5, self.base_colbox[4] * .5,
|
||||
self.base_colbox[5] * .5, self.base_colbox[6] * .5}
|
||||
|
||||
self.base_colbox = colbox
|
||||
|
||||
selbox = {
|
||||
self.base_selbox[1] * .5, self.base_selbox[2] * .5,
|
||||
self.base_selbox[3] * .5, self.base_selbox[4] * .5,
|
||||
self.base_selbox[5] * .5, self.base_selbox[6] * .5}
|
||||
|
||||
self.base_selbox = selbox
|
||||
|
||||
self.object:set_properties({
|
||||
visual_size = vis_size,
|
||||
collisionbox = colbox,
|
||||
selectionbox = selbox
|
||||
})
|
||||
|
||||
self.pint_size_potion = true
|
||||
|
||||
pos.y = pos.y + prop.collisionbox[5]
|
||||
|
||||
mobs:effect(pos, 25, "mobs_protect_particle.png", 0.5, 4, 2, 15)
|
||||
|
||||
self:mob_sound("mobs_spell")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "lucky_block:pint_sized_rune",
|
||||
recipe = {{ "lucky_block:pint_sized_potion", "mobs:protector" }}
|
||||
})
|
||||
|
||||
|
BIN
textures/mobs_pint_sized_rune.png
Normal file
BIN
textures/mobs_pint_sized_rune.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 160 B |
Loading…
Reference in New Issue
Block a user