mirror of
https://github.com/ElCeejo/animalia.git
synced 2025-03-15 04:11:25 +00:00
Libri improvements
This commit is contained in:
parent
712d1c7daa
commit
2999966fc0
5 changed files with 181 additions and 271 deletions
235
api/api.lua
235
api/api.lua
|
@ -195,7 +195,9 @@ function animalia.head_tracking(self)
|
|||
end
|
||||
animalia.move_head(self, tyaw, dir.y)
|
||||
return
|
||||
elseif self:timer(random(6, 12)) then
|
||||
elseif self:timer(6)
|
||||
and random(4) < 2 then
|
||||
|
||||
local players = creatura.get_nearby_players(self, 6)
|
||||
self.head_tracking = #players > 0 and players[random(#players)]
|
||||
end
|
||||
|
@ -220,69 +222,16 @@ end
|
|||
------------------------
|
||||
-- Environment Access --
|
||||
------------------------
|
||||
|
||||
function animalia.set_nametag(self, clicker)
|
||||
local plyr_name = clicker and clicker:get_player_name()
|
||||
if not plyr_name then return end
|
||||
local item = clicker:get_wielded_item()
|
||||
if item
|
||||
and item:get_name() ~= "animalia:nametag" then
|
||||
return
|
||||
end
|
||||
local name = item:get_meta():get_string("name")
|
||||
if not name
|
||||
or name == "" then
|
||||
return
|
||||
end
|
||||
self.nametag = self:memorize("nametag", name)
|
||||
self.despawn_after = self:memorize("despawn_after", nil)
|
||||
activate_nametag(self)
|
||||
if not minetest.is_creative_enabled(plyr_name) then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function animalia.get_group_positions(name, pos, radius)
|
||||
local objects = minetest.get_objects_in_area(vec_sub(pos, radius), vec_add(pos, radius))
|
||||
local group = {}
|
||||
for i = 1, #objects do
|
||||
local object = objects[i]
|
||||
if object
|
||||
and object:get_luaentity()
|
||||
and object:get_luaentity().name == name then
|
||||
table.insert(group, object:get_pos())
|
||||
end
|
||||
end
|
||||
return group
|
||||
end
|
||||
|
||||
function animalia.get_group(self)
|
||||
function animalia.get_nearby_mate(self)
|
||||
local pos = self.object:get_pos()
|
||||
local radius = self.tracking_range
|
||||
local objects = minetest.get_objects_in_area(vec_sub(pos, radius), vec_add(pos, radius))
|
||||
local group = {}
|
||||
for i = 1, #objects do
|
||||
local object = objects[i]
|
||||
if object
|
||||
and object ~= self.object
|
||||
and object:get_luaentity()
|
||||
and object:get_luaentity().name == self.name then
|
||||
table.insert(group, object)
|
||||
end
|
||||
end
|
||||
return group
|
||||
end
|
||||
|
||||
function animalia.get_nearby_mate(self, name)
|
||||
local objects = minetest.get_objects_inside_radius(self:get_center_pos(), self.tracking_range)
|
||||
if not pos then return end
|
||||
local objects = creatura.get_nearby_objects(self, self.name)
|
||||
for _, object in ipairs(objects) do
|
||||
if creatura.is_alive(object)
|
||||
and not object:is_player()
|
||||
and object:get_luaentity().name == name
|
||||
and object:get_luaentity().gender ~= self.gender
|
||||
and object:get_luaentity().breeding then
|
||||
local obj_pos = object and object:get_pos()
|
||||
local ent = obj_pos and object:get_luaentity()
|
||||
if obj_pos
|
||||
and ent.gender ~= self.gender
|
||||
and ent.breeding then
|
||||
return object
|
||||
end
|
||||
end
|
||||
|
@ -313,11 +262,6 @@ function animalia.random_drop_item(self, item, chance)
|
|||
end
|
||||
end
|
||||
|
||||
function animalia.protect_from_despawn(self)
|
||||
self._despawn = self:memorize("_despawn", false)
|
||||
self.despawn_after = self:memorize("despawn_after", false)
|
||||
end
|
||||
|
||||
---------------
|
||||
-- Particles --
|
||||
---------------
|
||||
|
@ -367,9 +311,38 @@ function animalia.particle_spawner(pos, texture, type, min_pos, max_pos)
|
|||
end
|
||||
end
|
||||
|
||||
--------------
|
||||
-- Entities --
|
||||
--------------
|
||||
----------
|
||||
-- Mobs --
|
||||
----------
|
||||
|
||||
function animalia.protect_from_despawn(self)
|
||||
self._despawn = self:memorize("_despawn", false)
|
||||
self.despawn_after = self:memorize("despawn_after", false)
|
||||
end
|
||||
|
||||
function animalia.set_nametag(self, clicker)
|
||||
local plyr_name = clicker and clicker:get_player_name()
|
||||
if not plyr_name then return end
|
||||
local item = clicker:get_wielded_item()
|
||||
if item
|
||||
and item:get_name() ~= "animalia:nametag" then
|
||||
return
|
||||
end
|
||||
local name = item:get_meta():get_string("name")
|
||||
if not name
|
||||
or name == "" then
|
||||
return
|
||||
end
|
||||
self.nametag = self:memorize("nametag", name)
|
||||
self.despawn_after = self:memorize("despawn_after", nil)
|
||||
activate_nametag(self)
|
||||
if not minetest.is_creative_enabled(plyr_name) then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
function animalia.initialize_api(self)
|
||||
self.gender = self:recall("gender") or nil
|
||||
|
@ -467,55 +440,73 @@ function animalia.add_trust(self, player, amount)
|
|||
self:memorize("trust", self.trust)
|
||||
end
|
||||
|
||||
function animalia.feed(self, player, tame, breed)
|
||||
local plyr_name = clicker and clicker:get_player_name()
|
||||
if not plyr_name then return end
|
||||
local item, item_name = self:follow_wielded_item(player)
|
||||
function animalia.feed(self, clicker, breed, tame)
|
||||
local yaw = self.object:get_yaw()
|
||||
local pos = self.object:get_pos()
|
||||
if not pos then return end
|
||||
local name = clicker:is_player() and clicker:get_player_name()
|
||||
local item, item_name = self:follow_wielded_item(clicker)
|
||||
if item_name then
|
||||
if not minetest.is_creative_enabled(plyr_name) then
|
||||
-- Eat Animation
|
||||
local offset_h = self.head_data.pivot_h
|
||||
local offset_v = self.head_data.pivot_v
|
||||
local head_pos = {
|
||||
x = pos.x + sin(yaw) * -offset_h,
|
||||
y = pos.y + offset_v,
|
||||
z = pos.z + cos(yaw) * offset_h
|
||||
}
|
||||
local def = minetest.registered_items[item_name]
|
||||
if def.inventory_image then
|
||||
minetest.add_particlespawner({
|
||||
pos = head_pos,
|
||||
time = 0.1,
|
||||
amount = 3,
|
||||
collisiondetection = true,
|
||||
collision_removal = true,
|
||||
vel = {min = {x = -1, y = 3, z = -1}, max = {x = 1, y = 4, z = 1}},
|
||||
acc = {x = 0, y = -9.8, z = 0},
|
||||
size = {min = 2, max = 4},
|
||||
texture = def.inventory_image
|
||||
})
|
||||
end
|
||||
-- Increase Health
|
||||
local feed_no = (self.feed_no or 0) + 1
|
||||
local max_hp = self.max_health
|
||||
local hp = self.hp
|
||||
hp = hp + (max_hp / 5)
|
||||
if hp > max_hp then hp = max_hp end
|
||||
self.hp = hp
|
||||
-- Tame/Breed
|
||||
if feed_no >= 5 then
|
||||
feed_no = 0
|
||||
if tame then
|
||||
self.owner = self:memorize("owner", name)
|
||||
minetest.add_particlespawner({
|
||||
pos = {min = vec_sub(pos, self.width), max = vec_add(pos, self.width)},
|
||||
time = 0.1,
|
||||
amount = 12,
|
||||
vel = {min = {x = 0, y = 3, z = 0}, max = {x = 0, y = 4, z = 0}},
|
||||
size = {min = 4, max = 6},
|
||||
glow = 16,
|
||||
texture = "creatura_particle_green.png"
|
||||
})
|
||||
end
|
||||
if breed
|
||||
and self.owner
|
||||
and self.owner == name then
|
||||
-- TODO: Breeding
|
||||
end
|
||||
self._despawn = self:memorize("_despawn", false)
|
||||
self.despawn_after = self:memorize("despawn_after", false)
|
||||
end
|
||||
self.feed_no = feed_no
|
||||
-- Take item
|
||||
if not minetest.is_creative_enabled(name) then
|
||||
item:take_item()
|
||||
player:set_wielded_item(item)
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
if self.hp < self.max_health then
|
||||
self:heal(self.max_health / 5)
|
||||
end
|
||||
self.food = self.food + 1
|
||||
if self.food >= 5 then
|
||||
local pos = self:get_center_pos()
|
||||
local minp = vec_sub(pos, 1)
|
||||
local maxp = vec_add(pos, 1)
|
||||
self.food = 0
|
||||
local follow = self.follow
|
||||
if type(follow) == "table" then
|
||||
follow = follow[1]
|
||||
end
|
||||
if tame
|
||||
and not self.owner
|
||||
and (follow == item_name) then
|
||||
self.owner = self:memorize("owner", player:get_player_name())
|
||||
local name = correct_name(self.name)
|
||||
minetest.chat_send_player(player:get_player_name(), name .. " has been tamed!")
|
||||
if self.logic then
|
||||
self:clear_task()
|
||||
end
|
||||
animalia.particle_spawner(pos, "creatura_particle_green.png", "float", minp, maxp)
|
||||
if not animalia.pets[self.owner][self.object] then
|
||||
table.insert(animalia.pets[self.owner], self.object)
|
||||
end
|
||||
end
|
||||
if breed then
|
||||
if self.breeding then return false end
|
||||
if self.breeding_cooldown <= 0 then
|
||||
self.breeding = true
|
||||
self.breeding_cooldown = 60
|
||||
animalia.particle_spawner(pos, "heart.png", "float", minp, maxp)
|
||||
end
|
||||
end
|
||||
end
|
||||
animalia.protect_from_despawn(self)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function animalia.mount(self, player, params)
|
||||
|
@ -592,22 +583,6 @@ minetest.register_on_mods_loaded(function()
|
|||
end
|
||||
end)
|
||||
|
||||
local spawn_biomes = {
|
||||
["animalia:bat"] = "cave",
|
||||
["animalia:bird"] = "temperate",
|
||||
["animalia:cat"] = "urban",
|
||||
["animalia:chicken"] = "tropical",
|
||||
["animalia:cow"] = "grassland",
|
||||
["animalia:tropical_fish"] = "ocean",
|
||||
["animalia:frog"] = "swamp",
|
||||
["animalia:horse"] = "grassland",
|
||||
["animalia:pig"] = "temperate",
|
||||
["animalia:reindeer"] = "boreal",
|
||||
["animalia:sheep"] = "grassland",
|
||||
["animalia:turkey"] = "boreal",
|
||||
["animalia:wolf"] = "boreal",
|
||||
}
|
||||
|
||||
animalia.register_biome_group("temperate", {
|
||||
name_kw = "",
|
||||
turf_kw = "grass",
|
||||
|
|
|
@ -972,10 +972,17 @@ creatura.register_utility("animalia:attack_target", function(self, target)
|
|||
local tgt_alive, _, tgt_pos = _self:get_target(target)
|
||||
if not tgt_alive then return true end
|
||||
local dist = vec_dist(pos, tgt_pos)
|
||||
if dist < width + 1
|
||||
local punch_cooldown = self.punch_cooldown or 0
|
||||
if punch_cooldown > 0 then
|
||||
punch_cooldown = punch_cooldown - self.dtime
|
||||
end
|
||||
self.punch_cooldown = punch_cooldown
|
||||
if punch_cooldown <= 0
|
||||
and dist < width + 1
|
||||
and not punch_init then
|
||||
punch_init = true
|
||||
animalia.action_punch(_self, target)
|
||||
self.punch_cooldown = 3
|
||||
end
|
||||
if not _self:get_action() then
|
||||
if punch_init then return true end
|
||||
|
|
|
@ -101,7 +101,7 @@ local function generate_page(mob)
|
|||
element_type = "label",
|
||||
center_text = true,
|
||||
font_size = 20,
|
||||
offset = {x = 9, y = 1.5},
|
||||
offset = {x = 8, y = 1.5},
|
||||
file = "animalia_libri_" .. name .. ".txt"
|
||||
},
|
||||
{ -- Image
|
||||
|
@ -200,7 +200,7 @@ minetest.register_on_mods_loaded(function()
|
|||
element_type = "label",
|
||||
center_text = true,
|
||||
font_size = 24,
|
||||
offset = {x = 1, y = 1.5},
|
||||
offset = {x = 0, y = 1.5},
|
||||
file = "animalia_libri_home.txt"
|
||||
},
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ minetest.register_on_mods_loaded(function()
|
|||
element_type = "label",
|
||||
center_text = true,
|
||||
font_size = 20,
|
||||
offset = {x = 9, y = 1.5},
|
||||
offset = {x = 8, y = 1.5},
|
||||
file = "animalia_libri_tropical_fish.txt"
|
||||
},
|
||||
{ -- Image
|
||||
|
@ -366,31 +366,21 @@ function libri.render_element(def, meta, playername)
|
|||
if def.element_type == "label" then
|
||||
local font_size_x = (animalia.libri_font_size[playername] or 1)
|
||||
local font_size = (def.font_size or 16) * font_size_x
|
||||
form = form .. "style_type[label;font_size=" .. font_size .. "]"
|
||||
if def.file then
|
||||
local filename = path .. "/libri/" .. def.file
|
||||
local file = io.open(filename)
|
||||
if file then
|
||||
local i = 0
|
||||
local full_text = ""
|
||||
for line in file:lines() do
|
||||
i = i + 1
|
||||
local center_offset = 0
|
||||
local max_length = 42
|
||||
local line_length = line:len()
|
||||
if line_length > max_length then line_length = max_length end
|
||||
local total_line_area = font_size * line_length
|
||||
local total_max_area = font_size * max_length
|
||||
if def.center_text then
|
||||
center_offset = ((total_max_area - total_line_area) / 100) * 0.3
|
||||
end
|
||||
local line_unit = (max_length * 0.075)
|
||||
local align_x = (offset_x + line_unit - (line_unit * font_size_x)) + center_offset
|
||||
local align_y = offset_y + (page_spacing * font_size_x) * i
|
||||
form = form .. "label[" .. align_x .. "," .. align_y .. ";" .. color("#000000", line .. "\n") .. "]"
|
||||
full_text = full_text .. line .. "\n"
|
||||
end
|
||||
local total_offset = (offset_x + (0.35 - 0.35 * font_size_x)) .. "," .. offset_y
|
||||
form = form .. "hypertext[" .. total_offset .. ";8,9;text;<global color=#000000 size=".. font_size .. " halign=center>" .. full_text .. "]"
|
||||
file:close()
|
||||
end
|
||||
else
|
||||
form = form .. "style_type[label;font_size=" .. font_size .. "]"
|
||||
local line = def.text
|
||||
form = form .. "label[" .. offset_x .. "," .. offset_y .. ";" .. color("#000000", line .. "\n") .. "]"
|
||||
end
|
||||
|
|
182
craftitems.lua
182
craftitems.lua
|
@ -390,6 +390,7 @@ minetest.register_node("animalia:nest_song_bird", {
|
|||
mesh = "animalia_nest.obj",
|
||||
tiles = {"animalia_nest.png"},
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
stack_max = 1,
|
||||
groups = {snappy = 3, flammable = 3},
|
||||
selection_box = {
|
||||
|
@ -579,119 +580,20 @@ minetest.register_node("animalia:guano", {
|
|||
end
|
||||
end
|
||||
})
|
||||
|
||||
-----------
|
||||
-- Libri --
|
||||
-----------
|
||||
|
||||
animalia.libri_pages = {}
|
||||
|
||||
function animalia.show_libri_main_form(player, pages, group)
|
||||
group = group or 1
|
||||
local basic_form = table.concat({
|
||||
"formspec_version[3]",
|
||||
"size[16,10]",
|
||||
"background[-0.7,-0.5;17.5,11.5;animalia_libri_bg.png]"
|
||||
}, "")
|
||||
if group == 1 then
|
||||
if pages[1] then
|
||||
basic_form = basic_form .. "button[1.75,1.5;4,1;".. pages[1].form .."]"
|
||||
end
|
||||
if pages[2] then
|
||||
basic_form = basic_form .. "button[1.75,3.5;4,1;".. pages[2].form .."]"
|
||||
end
|
||||
if pages[3] then
|
||||
basic_form = basic_form .. "button[1.75,5.5;4,1;".. pages[3].form .."]"
|
||||
end
|
||||
if pages[4] then
|
||||
basic_form = basic_form .. "button[1.75,7.5;4,1;".. pages[4].form .."]"
|
||||
end
|
||||
if pages[5] then
|
||||
basic_form = basic_form .. "button[10.25,1.5;4,1;".. pages[5].form .."]"
|
||||
end
|
||||
if pages[6] then
|
||||
basic_form = basic_form .. "button[10.25,3.5;4,1;".. pages[6].form .."]"
|
||||
end
|
||||
if pages[7] then
|
||||
basic_form = basic_form .. "button[10.25,5.5;4,1;".. pages[7].form .."]"
|
||||
end
|
||||
if pages[8] then
|
||||
basic_form = basic_form .. "button[10.25,7.5;4,1;".. pages[8].form .."]"
|
||||
end
|
||||
if pages[9] then
|
||||
basic_form = basic_form .. "button[12.25,9;1.5,1;btn_next;Next Page]"
|
||||
end
|
||||
elseif group == 2 then
|
||||
if pages[9] then
|
||||
basic_form = basic_form .. "button[1.75,1.5;4,1;".. pages[9].form .."]"
|
||||
end
|
||||
if pages[10] then
|
||||
basic_form = basic_form .. "button[1.75,3.5;4,1;".. pages[10].form .."]"
|
||||
end
|
||||
if pages[11] then
|
||||
basic_form = basic_form .. "button[1.75,5.5;4,1;".. pages[11].form .."]"
|
||||
end
|
||||
if pages[12] then
|
||||
basic_form = basic_form .. "button[1.75,7.5;4,1;".. pages[12].form .."]"
|
||||
end
|
||||
if pages[13] then
|
||||
basic_form = basic_form .. "button[10.25,1.5;4,1;".. pages[13].form .."]"
|
||||
end
|
||||
if pages[14] then
|
||||
basic_form = basic_form .. "button[10.25,3.5;4,1;".. pages[14].form .."]"
|
||||
end
|
||||
if pages[15] then
|
||||
basic_form = basic_form .. "button[10.25,5.5;4,1;".. pages[15].form .."]"
|
||||
end
|
||||
if pages[16] then
|
||||
basic_form = basic_form .. "button[10.25,7.5;4,1;".. pages[16].form .."]"
|
||||
end
|
||||
end
|
||||
animalia.libri_pages[player:get_player_name()] = pages
|
||||
minetest.show_formspec(player:get_player_name(), "animalia:libri_main", basic_form)
|
||||
end
|
||||
|
||||
--[[minetest.register_craftitem("animalia:libri_animalia", {
|
||||
description = "Libri Animalia",
|
||||
inventory_image = "animalia_libri_animalia.png",
|
||||
stack_max = 1,
|
||||
on_place = function(itemstack, player, pointed_thing)
|
||||
if pointed_thing and pointed_thing.type == "object" then return end
|
||||
local meta = itemstack:get_meta()
|
||||
local pages = minetest.deserialize(meta:get_string("pages"))
|
||||
if not pages
|
||||
or #pages < 1 then return end
|
||||
animalia.show_libri_main_form(player, pages)
|
||||
end,
|
||||
on_secondary_use = function(itemstack, player, pointed_thing)
|
||||
if pointed_thing and pointed_thing.type == "object" then return end
|
||||
local meta = itemstack:get_meta()
|
||||
local pages = minetest.deserialize(meta:get_string("pages"))
|
||||
if not pages
|
||||
or #pages < 1 then return end
|
||||
animalia.show_libri_main_form(player, pages)
|
||||
end
|
||||
})]]
|
||||
|
||||
--------------
|
||||
-- Crafting --
|
||||
--------------
|
||||
|
||||
local steel_ingot = "default:steel_ingot"
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
if minetest.registered_items[steel_ingot] then return end
|
||||
for name, def in pairs(minetest.registered_items) do
|
||||
if string.find(name, "ingot")
|
||||
and string.find(name, "steel") then
|
||||
if not def.groups then
|
||||
def.groups = {}
|
||||
end
|
||||
def.groups["steel_ingot"] = 1
|
||||
minetest.register_item(":" .. name, def)
|
||||
elseif string.find(name, "string") then
|
||||
if not def.groups then
|
||||
def.groups = {}
|
||||
end
|
||||
def.groups["string"] = 1
|
||||
minetest.register_item(":" .. name, def)
|
||||
if name:find("ingot")
|
||||
and (name:find("steel")
|
||||
or name:find("iron")) then
|
||||
steel_ingot = name
|
||||
break
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -699,8 +601,17 @@ end)
|
|||
minetest.register_craft({
|
||||
output = "animalia:cat_toy",
|
||||
recipe = {
|
||||
{"", "", "group:string"},
|
||||
{"", "group:stick", "group:string"},
|
||||
{"", "", "group:thread"},
|
||||
{"", "group:stick", "group:thread"},
|
||||
{"group:stick", "", "group:feather"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "animalia:cat_toy",
|
||||
recipe = {
|
||||
{"", "", "farming:string"},
|
||||
{"", "group:stick", "farming:string"},
|
||||
{"group:stick", "", "group:feather"}
|
||||
}
|
||||
})
|
||||
|
@ -708,36 +619,63 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
output = "animalia:lasso",
|
||||
recipe = {
|
||||
{"", "group:string", "group:string"},
|
||||
{"", "group:leather", "group:string"},
|
||||
{"group:string", "", ""}
|
||||
{"", "group:thread", "group:thread"},
|
||||
{"", "group:leather", "group:thread"},
|
||||
{"group:thread", "", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "animalia:lasso",
|
||||
recipe = {
|
||||
{"", "farming:string", "farming:string"},
|
||||
{"", "group:leather", "farming:string"},
|
||||
{"farming:string", "", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "animalia:net",
|
||||
recipe = {
|
||||
{"group:string", "", "group:string"},
|
||||
{"group:string", "", "group:string"},
|
||||
{"group:stick", "group:string", ""}
|
||||
{"group:thread", "", "group:thread"},
|
||||
{"group:thread", "", "group:thread"},
|
||||
{"group:stick", "group:thread", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "animalia:net",
|
||||
recipe = {
|
||||
{"farming:string", "", "farming:string"},
|
||||
{"farming:string", "", "farming:string"},
|
||||
{"group:stick", "farming:string", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "animalia:saddle",
|
||||
recipe = {
|
||||
{"group:leather", "group:leather", "group:leather"},
|
||||
{"group:leather", "group:steel_ingot", "group:leather"},
|
||||
{"group:string", "", "group:string"}
|
||||
{"group:leather", steel_ingot, "group:leather"},
|
||||
{"group:thread", "", "group:thread"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "animalia:saddle",
|
||||
recipe = {
|
||||
{"group:leather", "group:leather", "group:leather"},
|
||||
{"group:leather", steel_ingot, "group:leather"},
|
||||
{"farming:string", "", "farming:string"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "animalia:shears",
|
||||
recipe = {
|
||||
{"", "group:steel_ingot", ""},
|
||||
{"", "group:leather", "group:steel_ingot"}
|
||||
{"", steel_ingot, ""},
|
||||
{"", "group:leather", steel_ingot}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -772,9 +710,9 @@ minetest.register_on_craft(function(itemstack, _, old_craft_grid)
|
|||
if itemstack:get_name() == "animalia:libri_animalia"
|
||||
and itemstack:get_count() > 1 then
|
||||
for _, old_libri in pairs(old_craft_grid) do
|
||||
if old_libri:get_meta():get_string("pages") then
|
||||
local pages = old_libri:get_meta():get_string("pages")
|
||||
itemstack:get_meta():set_string("pages", pages)
|
||||
if old_libri:get_meta():get_string("chapters") then
|
||||
local chapters = old_libri:get_meta():get_string("chapters")
|
||||
itemstack:get_meta():set_string("chapters", chapters)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
Loading…
Add table
Reference in a new issue