mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-29 13:53:43 +01:00
Fix some bugs
This commit is contained in:
parent
211c02abce
commit
b486b65231
27
init.lua
27
init.lua
@ -860,21 +860,28 @@ local function craft_stack(player, pname, data, _f)
|
|||||||
local scrbar_val = data[sprintf("scrbar_%s", _f.craft_rcp and "rcp" or "usg")]
|
local scrbar_val = data[sprintf("scrbar_%s", _f.craft_rcp and "rcp" or "usg")]
|
||||||
|
|
||||||
for name, count in pairs(data.export_counts[rcp_usg].rcp) do
|
for name, count in pairs(data.export_counts[rcp_usg].rcp) do
|
||||||
if is_group(name) then
|
local items = {[name] = count}
|
||||||
local groups = extract_groups(name)
|
|
||||||
local items = groups_to_items(groups, true)
|
|
||||||
|
|
||||||
for _, item in ipairs(items) do
|
if is_group(name) then
|
||||||
|
items = {}
|
||||||
|
local groups = extract_groups(name)
|
||||||
|
local item_groups = groups_to_items(groups, true)
|
||||||
|
local remaining = count
|
||||||
|
|
||||||
|
for _, item in ipairs(item_groups) do
|
||||||
for _name, _count in pairs(data.export_counts[rcp_usg].inv) do
|
for _name, _count in pairs(data.export_counts[rcp_usg].inv) do
|
||||||
if item == _name and _count >= count then
|
if item == _name and remaining > 0 then
|
||||||
name = _name
|
local c = min(remaining, _count)
|
||||||
break
|
items[item] = c
|
||||||
|
remaining = remaining - c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
inv:remove_item("main", sprintf("%s %s", name, count * scrbar_val))
|
for k, v in pairs(items) do
|
||||||
|
inv:remove_item("main", sprintf("%s %s", k, v * scrbar_val))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local count = stackcount * scrbar_val
|
local count = stackcount * scrbar_val
|
||||||
@ -883,7 +890,7 @@ local function craft_stack(player, pname, data, _f)
|
|||||||
|
|
||||||
if inv:room_for_item("main", stack) then
|
if inv:room_for_item("main", stack) then
|
||||||
inv:add_item("main", stack)
|
inv:add_item("main", stack)
|
||||||
msg(pname, sprintf(S"%s added to your inventory", message))
|
msg(pname, sprintf("%s added in your inventory", message))
|
||||||
else
|
else
|
||||||
local dir = player:get_look_dir()
|
local dir = player:get_look_dir()
|
||||||
local ppos = player:get_pos()
|
local ppos = player:get_pos()
|
||||||
@ -891,7 +898,7 @@ local function craft_stack(player, pname, data, _f)
|
|||||||
local look_at = vec_add(ppos, vec_mul(dir, 1))
|
local look_at = vec_add(ppos, vec_mul(dir, 1))
|
||||||
|
|
||||||
core.add_item(look_at, stack)
|
core.add_item(look_at, stack)
|
||||||
msg(pname, sprintf(S"%s crafted", message))
|
msg(pname, sprintf("%s crafted", message))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,5 +63,5 @@ Cannot mark this item. Limit of bookmarks reached.=Impossible de mettre cet item
|
|||||||
Only drop if using one of these tools: @1=Tombe seulement si détruit avec un de ces outils : @1
|
Only drop if using one of these tools: @1=Tombe seulement si détruit avec un de ces outils : @1
|
||||||
Only drop if using this tool: @1=Tombe seulement si détruit avec cet outil : @1
|
Only drop if using this tool: @1=Tombe seulement si détruit avec cet outil : @1
|
||||||
Craft this stack=Fabriquer cet objet
|
Craft this stack=Fabriquer cet objet
|
||||||
@1 added to your inventory=@1 ajouté(s) à votre inventaire
|
@1 added in your inventory=@1 mis dans votre inventaire
|
||||||
@1 crafted=@1 fabriqué(s)
|
@1 crafted=@1 fabriqué(s)
|
||||||
|
@ -63,5 +63,5 @@ Cannot mark this item. Limit of bookmarks reached.=
|
|||||||
Only drop if using one of these tools: @1=
|
Only drop if using one of these tools: @1=
|
||||||
Only drop if using this tool: @1=
|
Only drop if using this tool: @1=
|
||||||
Craft this stack=
|
Craft this stack=
|
||||||
@1 added to your inventory=
|
@1 added in your inventory=
|
||||||
@1 crafted=
|
@1 crafted=
|
||||||
|
Loading…
Reference in New Issue
Block a user