Mods update
parent
4d568e86da
commit
5f8b4428c8
|
@ -41,7 +41,7 @@ origin git@github.com:Sokomine/bell.git (fetch)
|
|||
Mod: buildings/bell
|
||||
|
||||
origin https://github.com/Sokomine/cottages (fetch)
|
||||
* master 3dec7bf [origin/master] fixed bug with hud removal
|
||||
* master 2b10e6f [origin/master] fixed tree well
|
||||
Mod: buildings/cottages
|
||||
|
||||
origin https://bitbucket.org/sorcerykid/doors.git (fetch)
|
||||
|
@ -73,11 +73,12 @@ origin https://github.com/minetest-mods/dynamic_liquid (fetch)
|
|||
Mod: environment/dynamic_liquid
|
||||
|
||||
origin https://notabug.org/tenplus1/farming (fetch)
|
||||
* master 70803f8 [origin/master] add pumpkin bottom texture, redo melon node, fix typo in scythe, make pumpkin/melon rotatable
|
||||
* master e699423 [origin/master] add popcorn
|
||||
Mod: flora/farming
|
||||
|
||||
origin https://github.com/minetest-mods/i3.git (fetch)
|
||||
* main dde5148 [origin/main] Show a tooltip for waypoints
|
||||
origin https://github.com/daretmavi/i3.git (fetch)
|
||||
upstream https://github.com/minetest-mods/i3.git (fetch)
|
||||
* main 57784ba [origin/main] Better solution for turning off progresive mode in creative
|
||||
Mod: gui/i3
|
||||
|
||||
origin https://repo.or.cz/minetest_hbarmor.git (fetch)
|
||||
|
@ -113,11 +114,11 @@ origin https://github.com/TheTermos/mobkit (fetch)
|
|||
Mod: lib_api/mobkit
|
||||
|
||||
origin https://notabug.org/tenplus1/mobs_redo (fetch)
|
||||
* master 33589eb [origin/master] improve pathfinding level 2 digging/building, add infotext, stop mob attack spin, tweak & tidy code
|
||||
* master e50d04a [origin/master] fix facing fence jump bug
|
||||
Mod: lib_api/mobs_redo
|
||||
|
||||
origin https://github.com/appgurueu/modlib (fetch)
|
||||
* master d8f3bf2 [origin/master] Fix debug.stack
|
||||
* master 56ad946 [origin/master] Bump version
|
||||
Mod: lib_api/modlib
|
||||
|
||||
origin git@github.com:runsy/rcbows.git (fetch)
|
||||
|
@ -149,7 +150,7 @@ origin https://codeberg.org/Hamlet/mobs_ghost_redo (fetch)
|
|||
Mod: mobs/mobs_mobs/mobs_ghost_redo
|
||||
|
||||
origin https://notabug.org/TenPlus1/mobs_monster.git (fetch)
|
||||
* master 9b3c1e1 [origin/master] fire spirit additions
|
||||
* master 5009e74 [origin/master] lava flan heals while in lava
|
||||
Mod: mobs/mobs_mobs/mobs_monster
|
||||
|
||||
origin https://github.com/berengma/aerotest (fetch)
|
||||
|
@ -157,7 +158,7 @@ origin https://github.com/berengma/aerotest (fetch)
|
|||
Mod: mobs/mobs_mobkit/aerotest
|
||||
|
||||
origin https://github.com/runsy/petz (fetch)
|
||||
* master b593d81 [origin/master] fix: pumpkin grenade respects protected nodes
|
||||
* master 48a3df7 [origin/master] Merge pull request #71 from snowyu/fix/cant_wool_regrow
|
||||
Mod: mobs/mobs_mobkit/petz
|
||||
|
||||
origin https://github.com/berengma/water_life (fetch)
|
||||
|
@ -165,7 +166,7 @@ origin https://github.com/berengma/water_life (fetch)
|
|||
Mod: mobs/mobs_mobkit/water_life
|
||||
|
||||
origin https://github.com/minetest-mods/3d_armor (fetch)
|
||||
* master a0cf12b [origin/master] Add setting to disable armor visuals on player model (#48)
|
||||
* master 38fc2cf [origin/master] Fix typo in wieldview (#56)
|
||||
Mod: player/3d_armor
|
||||
|
||||
origin https://github.com/appgurueu/character_anim (fetch)
|
||||
|
@ -201,7 +202,7 @@ origin https://github.com/minetest-mods/wielded_light.git (fetch)
|
|||
Mod: player/wielded_light
|
||||
|
||||
origin https://notabug.org/TenPlus1/bonemeal.git (fetch)
|
||||
* master b5819d0 [origin/master] reduce shapeless crafts
|
||||
* master 75ec006 [origin/master] dry grass grows on dry dirt
|
||||
Mod: tools/bonemeal
|
||||
|
||||
origin git@gitlab.com:daretmavi/bucket-lite.git (fetch)
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
|
||||
local S = cottages.S
|
||||
|
||||
-- disable repair with anvil by setting a message for the item in question
|
||||
cottages.forbid_repair = {}
|
||||
-- example for hammer no longer beeing able to repair the hammer
|
||||
--cottages.forbid_repair["cottages:hammer"] = 'The hammer is too complex for repairing.'
|
||||
|
||||
|
||||
-- the hammer for the anvil
|
||||
minetest.register_tool("cottages:hammer", {
|
||||
description = S("Steel hammer for repairing tools on the anvil"),
|
||||
|
@ -138,6 +144,12 @@ minetest.register_node("cottages:anvil", {
|
|||
S('The workpiece slot is for damaged tools only.'));
|
||||
return 0;
|
||||
end
|
||||
if( listname=='input'
|
||||
and cottages.forbid_repair[ stack:get_name() ]) then
|
||||
minetest.chat_send_player( player:get_player_name(),
|
||||
S(cottages.forbid_repair[ stack:get_name() ]));
|
||||
return 0;
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
|
@ -181,6 +193,14 @@ minetest.register_node("cottages:anvil", {
|
|||
-- 65535 is max damage
|
||||
local damage_state = 40-math.floor(input:get_wear()/1638);
|
||||
|
||||
-- just to make sure that it really can't get repaired if it should not
|
||||
-- (if the check of placing the item in the input slot failed somehow)
|
||||
if( puncher and name and cottages.forbid_repair[ input:get_name() ]) then
|
||||
minetest.chat_send_player( name,
|
||||
S(cottages.forbid_repair[ input:get_name() ]));
|
||||
return;
|
||||
end
|
||||
|
||||
local tool_name = input:get_name();
|
||||
local hud_image = "";
|
||||
if( tool_name
|
||||
|
|
|
@ -117,7 +117,7 @@ minetest.register_node("cottages:water_gen", {
|
|||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
|
||||
groups = {tree = 1, choppy = 2, cracky = 1, flammable = 2},
|
||||
sounds = cottages.sounds.wood,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -178,8 +178,14 @@ minetest.register_node("cottages:water_gen", {
|
|||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main") and
|
||||
default.can_interact_with_node(player, pos)
|
||||
local bucket = meta:get_string("bucket")
|
||||
local start = meta:get_string("fillstarttime")
|
||||
return inv:is_empty("main")
|
||||
and default.can_interact_with_node(player, pos)
|
||||
and (not(bucket) or bucket == "")
|
||||
and ((not(start) or start == "" or
|
||||
(minetest.get_us_time()/1000000) - tonumber(start)
|
||||
>= cottages.water_fill_time -2))
|
||||
end,
|
||||
-- no inventory move allowed
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index,
|
||||
|
@ -213,7 +219,7 @@ minetest.register_node("cottages:water_gen", {
|
|||
cottages.switch_public(pos, formname, fields, sender, 'tree trunk well')
|
||||
end,
|
||||
-- punch to place and retrieve bucket
|
||||
on_punch = function(pos, node, puncher)
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
if( not( pos ) or not( node ) or not( puncher )) then
|
||||
return
|
||||
end
|
||||
|
@ -223,7 +229,8 @@ minetest.register_node("cottages:water_gen", {
|
|||
local owner = meta:get_string("owner")
|
||||
local public = meta:get_string("public")
|
||||
if( name ~= owner and public~="public") then
|
||||
minetest.chat_send_player( name, S("This tree trunk well is owned by %s. You can't use it."):format(name))
|
||||
minetest.chat_send_player( name,
|
||||
S("This tree trunk well is owned by %s. You can't use it."):format(owner))
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -233,13 +240,18 @@ minetest.register_node("cottages:water_gen", {
|
|||
-- is the well working on something? (either empty or full bucket)
|
||||
local bucket = meta:get_string("bucket")
|
||||
-- there is a bucket loaded - either empty or full
|
||||
if( bucket and bucket~="") then
|
||||
if( bucket and bucket~="" and bucket ~= "bucket:bucket_empty") then
|
||||
if( not(pinv:room_for_item("main", bucket))) then
|
||||
minetest.chat_send_player( puncher:get_player_name(),
|
||||
S("Sorry. You have no room for the bucket. Please free some "..
|
||||
"space in your inventory first!"))
|
||||
return
|
||||
end
|
||||
elseif( bucket and bucket == "bucket:bucket_empty") then
|
||||
minetest.chat_send_player( puncher:get_player_name(),
|
||||
S("Please wait until your bucket has been filled."))
|
||||
-- do not give the empty bucket back immediately
|
||||
return
|
||||
end
|
||||
|
||||
-- remove the old entity (either a bucket will be placed now or a bucket taken)
|
||||
|
@ -267,8 +279,6 @@ minetest.register_node("cottages:water_gen", {
|
|||
if( wielded
|
||||
and wielded:get_name()
|
||||
and wielded:get_name() == "bucket:bucket_empty") then
|
||||
-- remove the bucket from the players inventory
|
||||
pinv:remove_item( "main", "bucket:bucket_empty")
|
||||
-- remember that we got a bucket loaded
|
||||
meta:set_string("bucket", "bucket:bucket_empty")
|
||||
-- create the entity
|
||||
|
@ -280,6 +290,8 @@ minetest.register_node("cottages:water_gen", {
|
|||
minetest.after(cottages.water_fill_time, cottages.water_gen_fill_bucket, pos)
|
||||
-- the bucket will only be filled if the water ran long enough
|
||||
meta:set_string("fillstarttime", tostring(minetest.get_us_time()/1000000))
|
||||
-- remove the bucket from the players inventory
|
||||
pinv:remove_item( "main", "bucket:bucket_empty")
|
||||
return;
|
||||
end
|
||||
-- buckets can also be emptied here
|
||||
|
|
|
@ -0,0 +1,659 @@
|
|||
ts_doors = {}
|
||||
|
||||
ts_doors.registered_doors = {}
|
||||
|
||||
ts_doors.sounds = {}
|
||||
|
||||
-- Used for localization
|
||||
local S = minetest.get_translator("ts_doors")
|
||||
|
||||
-- Get texture by node name
|
||||
local T = function (node_name)
|
||||
local def = minetest.registered_nodes[node_name]
|
||||
if not (def and def.tiles) then
|
||||
return ""
|
||||
end
|
||||
local tile = def.tiles[5] or def.tiles[4] or def.tiles[3] or def.tiles[2] or def.tiles[1]
|
||||
if type(tile) == "string" then
|
||||
return tile
|
||||
elseif type(tile) == "table" and tile.name then
|
||||
return tile.name
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
-- Use this to generate the translation template file.
|
||||
--[[
|
||||
local oldS = S
|
||||
local function S(x)
|
||||
print(x .. "=")
|
||||
return oldS(x)
|
||||
end
|
||||
]]
|
||||
|
||||
if default.node_sound_metal_defaults then
|
||||
ts_doors.sounds.metal = {
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
sound_open = "doors_steel_door_open",
|
||||
sound_close = "doors_steel_door_close",
|
||||
}
|
||||
else
|
||||
ts_doors.sounds.metal = {
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
sound_open = "doors_steel_door_open",
|
||||
sound_close = "doors_steel_door_close",
|
||||
}
|
||||
end
|
||||
|
||||
ts_doors.sounds.wood = {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
sound_open = "doors_door_open",
|
||||
sound_close = "doors_door_close"
|
||||
}
|
||||
|
||||
ts_doors.sounds.glass = {
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sound_open = "doors_glass_door_open",
|
||||
sound_close = "doors_glass_door_close",
|
||||
}
|
||||
|
||||
local function get_door_name(meta, item)
|
||||
local door_type_string = meta:get_int("trapdoor") == 1 and "trapdoor_" or "door_"
|
||||
local locked_string = meta:get_int("locked") == 1 and "locked_" or ""
|
||||
local solid_string = meta:get_int("solid") == 1 and "full_" or ""
|
||||
return "ts_doors:" .. door_type_string .. solid_string .. locked_string .. item:gsub(":", "_")
|
||||
end
|
||||
|
||||
local function register_door_alias(name, convert_to)
|
||||
minetest.register_alias(name, convert_to)
|
||||
minetest.register_alias(name .. "_a", convert_to .. "_a")
|
||||
minetest.register_alias(name .. "_b", convert_to .. "_b")
|
||||
minetest.register_alias(name .. "_c", convert_to .. "_c")
|
||||
minetest.register_alias(name .. "_d", convert_to .. "_d")
|
||||
end
|
||||
local function register_trapdoor_alias(name, convert_to)
|
||||
minetest.register_alias(name, convert_to)
|
||||
minetest.register_alias(name .. "_open", convert_to .. "_open")
|
||||
end
|
||||
|
||||
function ts_doors.register_alias(name, convert_to)
|
||||
name = name:gsub(":", "_")
|
||||
convert_to = convert_to:gsub(":", "_")
|
||||
for _,style in pairs({"", "full_", "locked_", "full_locked_"}) do
|
||||
register_door_alias("ts_doors:door_" .. style .. name, "ts_doors:door_" .. style .. convert_to)
|
||||
register_trapdoor_alias("ts_doors:trapdoor_" .. style .. name, "ts_doors:trapdoor_" .. style .. convert_to)
|
||||
end
|
||||
end
|
||||
|
||||
function ts_doors.register_door(item, description, texture, sounds, recipe)
|
||||
if not minetest.registered_nodes[item] then
|
||||
minetest.log("[ts_doors] bug found: "..item.." is not a registered node. Cannot create doors")
|
||||
return
|
||||
end
|
||||
if not sounds then
|
||||
sounds = {}
|
||||
end
|
||||
if not texture then
|
||||
texture = T(item)
|
||||
end
|
||||
recipe = recipe or item
|
||||
ts_doors.registered_doors[item:gsub(":", "_")] = recipe
|
||||
register_door_alias("doors:ts_door_" .. item:gsub(":", "_"), "ts_doors:door_" .. item:gsub(":", "_"))
|
||||
register_door_alias("doors:ts_door_full_" .. item:gsub(":", "_"), "ts_doors:door_full_" .. item:gsub(":", "_"))
|
||||
register_door_alias("doors:ts_door_locked_" .. item:gsub(":", "_"), "ts_doors:door_locked_" .. item:gsub(":", "_"))
|
||||
register_door_alias("doors:ts_door_full_locked_" .. item:gsub(":", "_"), "ts_doors:door_full_locked_" .. item:gsub(":", "_"))
|
||||
|
||||
|
||||
local groups = minetest.registered_nodes[item].groups
|
||||
local door_groups = {door=1}
|
||||
for k, v in pairs(groups) do
|
||||
if k ~= "wood" then
|
||||
door_groups[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
doors.register("ts_doors:door_" .. item:gsub(":", "_"), {
|
||||
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base.png^[noalpha^[makealpha:0,255,0", backface_culling = true } },
|
||||
description = S(description .. " Windowed Door"),
|
||||
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_inv.png^[noalpha^[makealpha:0,255,0",
|
||||
groups = table.copy(door_groups),
|
||||
sounds = sounds.sounds or nil,
|
||||
sound_open = sounds.sound_open or nil,
|
||||
sound_close = sounds.sound_close or nil,
|
||||
})
|
||||
|
||||
doors.register("ts_doors:door_full_" .. item:gsub(":", "_"), {
|
||||
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full.png^[noalpha", backface_culling = true } },
|
||||
description = S("Solid " .. description .. " Door"),
|
||||
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_inv.png^[noalpha^[makealpha:0,255,0",
|
||||
groups = table.copy(door_groups),
|
||||
sounds = sounds.sounds or nil,
|
||||
sound_open = sounds.sound_open or nil,
|
||||
sound_close = sounds.sound_close or nil,
|
||||
})
|
||||
|
||||
doors.register_trapdoor("ts_doors:trapdoor_" .. item:gsub(":", "_"), {
|
||||
description = S("Windowed " .. description .. " Trapdoor"),
|
||||
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
||||
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
||||
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
||||
tile_side = texture .. "^[colorize:#fff:30",
|
||||
groups = table.copy(door_groups),
|
||||
sounds = sounds.sounds or nil,
|
||||
sound_open = sounds.sound_open or nil,
|
||||
sound_close = sounds.sound_close or nil,
|
||||
})
|
||||
|
||||
doors.register_trapdoor("ts_doors:trapdoor_full_" .. item:gsub(":", "_"), {
|
||||
description = S("Solid " .. description .. " Trapdoor"),
|
||||
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
||||
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
||||
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
||||
tile_side = texture .. "^[colorize:#fff:30",
|
||||
groups = table.copy(door_groups),
|
||||
sounds = sounds.sounds or nil,
|
||||
sound_open = sounds.sound_open or nil,
|
||||
sound_close = sounds.sound_close or nil,
|
||||
})
|
||||
|
||||
door_groups.level = 2
|
||||
|
||||
doors.register("ts_doors:door_locked_" .. item:gsub(":", "_"), {
|
||||
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_locked.png^[noalpha^[makealpha:0,255,0", backface_culling = true } },
|
||||
description = S("Windowed Locked " .. description .. " Door"),
|
||||
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_locked_inv.png^[noalpha^[makealpha:0,255,0",
|
||||
protected = true,
|
||||
groups = table.copy(door_groups),
|
||||
sound_open = "doors_steel_door_open",
|
||||
sound_close = "doors_steel_door_close",
|
||||
sounds = sounds.sounds or nil,
|
||||
sound_open = sounds.sound_open or nil,
|
||||
sound_close = sounds.sound_close or nil,
|
||||
})
|
||||
|
||||
doors.register("ts_doors:door_full_locked_" .. item:gsub(":", "_"), {
|
||||
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_locked.png^[noalpha", backface_culling = true } },
|
||||
description = S("Solid Locked " .. description .. " Door"),
|
||||
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_locked_inv.png^[noalpha^[makealpha:0,255,0",
|
||||
protected = true,
|
||||
groups = table.copy(door_groups),
|
||||
sound_open = "doors_steel_door_open",
|
||||
sound_close = "doors_steel_door_close",
|
||||
sounds = sounds.sounds or nil,
|
||||
sound_open = sounds.sound_open or nil,
|
||||
sound_close = sounds.sound_close or nil,
|
||||
})
|
||||
|
||||
doors.register_trapdoor("ts_doors:trapdoor_locked_" .. item:gsub(":", "_"), {
|
||||
description = S("Windowed Locked " .. description .. " Trapdoor"),
|
||||
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
||||
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
||||
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
||||
tile_side = texture .. "^[colorize:#fff:30",
|
||||
protected = true,
|
||||
groups = table.copy(door_groups),
|
||||
sounds = sounds.sounds or nil,
|
||||
sound_open = sounds.sound_open or nil,
|
||||
sound_close = sounds.sound_close or nil,
|
||||
})
|
||||
|
||||
doors.register_trapdoor("ts_doors:trapdoor_full_locked_" .. item:gsub(":", "_"), {
|
||||
description = S("Solid Locked " .. description .. " Trapdoor"),
|
||||
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
||||
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
||||
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
||||
tile_side = texture .. "^[colorize:#fff:30",
|
||||
protected = true,
|
||||
groups = table.copy(door_groups),
|
||||
sounds = sounds.sounds or nil,
|
||||
sound_open = sounds.sound_open or nil,
|
||||
sound_close = sounds.sound_close or nil,
|
||||
})
|
||||
end
|
||||
|
||||
ts_doors.register_door("default:aspen_wood", "Aspen", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("default:pine_wood", "Pine", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("default:acacia_wood", "Acacia", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("default:wood", "Wooden", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("default:junglewood", "Jungle Wood", nil, ts_doors.sounds.wood)
|
||||
|
||||
if minetest.get_modpath("moretrees") then
|
||||
ts_doors.register_door("moretrees:apple_tree_planks", "Apple Tree", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:beech_planks", "Beech", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:birch_planks", "Birch", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:fir_planks", "Fir", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:oak_planks", "Oak", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:palm_planks", "Palm", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:rubber_tree_planks", "Rubber Tree", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:sequoia_planks", "Sequoia", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:spruce_planks", "Spruce", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("moretrees:willow_planks", "Willow", nil, ts_doors.sounds.wood)
|
||||
end
|
||||
|
||||
if minetest.get_modpath("ethereal") then
|
||||
ts_doors.register_door("ethereal:banana_wood", "Banana", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:birch_wood", "Birch", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:frost_wood", "Frost", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:mushroom_trunk", "Mushroom", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:palm_wood", "Palm", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:redwood_wood", "Redwood", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:sakura_wood", "Sakura", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:scorched_tree", "Scorched", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:willow_wood", "Willow", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:yellow_wood", "Healing Tree", nil, ts_doors.sounds.wood)
|
||||
ts_doors.register_door("ethereal:crystal_block", "Crystal", nil, ts_doors.sounds.metal, "ethereal:crystal_ingot")
|
||||
end
|
||||
|
||||
|
||||
ts_doors.register_door("default:bronzeblock", "Bronze", nil, ts_doors.sounds.metal, "default:bronze_ingot")
|
||||
ts_doors.register_door("default:copperblock", "Copper", nil, ts_doors.sounds.metal, "default:copper_ingot")
|
||||
ts_doors.register_door("default:diamondblock", "Diamond", nil, ts_doors.sounds.metal, "default:diamond")
|
||||
ts_doors.register_door("default:goldblock", "Gold", nil, ts_doors.sounds.metal, "default:gold_ingot")
|
||||
ts_doors.register_door("default:steelblock", "Steel", nil, ts_doors.sounds.metal, "default:steel_ingot")
|
||||
|
||||
if minetest.get_modpath("moreores") then
|
||||
ts_doors.register_door("moreores:mithril_block", "Mithril", nil, ts_doors.sounds.metal, "moreores:mithril_ingot")
|
||||
ts_doors.register_door("moreores:silver_block", "Silver", nil, ts_doors.sounds.metal, "moreores:silver_ingot")
|
||||
ts_doors.register_door("moreores:tin_block", "Tin", nil, ts_doors.sounds.metal, "moreores:tin_ingot")
|
||||
end
|
||||
|
||||
if minetest.get_modpath("technic") then
|
||||
ts_doors.register_door("technic:carbon_steel_block", "Carbon Steel", nil, ts_doors.sounds.metal, "technic:carbon_steel_ingot")
|
||||
ts_doors.register_door("technic:cast_iron_block", "Cast Iron", nil, ts_doors.sounds.metal, "technic:cast_iron_ingot")
|
||||
ts_doors.register_door("technic:chromium_block", "Chromium", nil, ts_doors.sounds.metal, "technic:chromium_ingot")
|
||||
ts_doors.register_door("technic:lead_block", "Lead", nil, ts_doors.sounds.metal, "technic:lead_ingot")
|
||||
ts_doors.register_door("technic:stainless_steel_block", "Stainless Steel", nil, ts_doors.sounds.metal, "technic:stainless_steel_ingot")
|
||||
ts_doors.register_door("technic:zinc_block", "Zinc", nil, ts_doors.sounds.metal, "technic:zinc_ingot")
|
||||
ts_doors.register_door("technic:blast_resistant_concrete", "Blast Resistant Concrete", nil, ts_doors.sounds.metal)
|
||||
end
|
||||
|
||||
if minetest.get_modpath("basic_materials") then
|
||||
ts_doors.register_door("basic_materials:brass_block", "Brass", nil, ts_doors.sounds.metal, "basic_materials:brass_ingot")
|
||||
ts_doors.register_door("basic_materials:concrete_block", "Concrete", nil, ts_doors.sounds.metal)
|
||||
ts_doors.register_alias("technic:brass_block", "basic_materials:brass_block")
|
||||
ts_doors.register_alias("technic:concrete", "basic_materials:concrete_block")
|
||||
end
|
||||
|
||||
minetest.override_item("doors:door_steel", {
|
||||
description = S("Windowed Locked Plain Steel Door"),
|
||||
})
|
||||
|
||||
minetest.override_item("doors:door_wood", {
|
||||
description = S("Windowed Mixed Wood Door"),
|
||||
})
|
||||
|
||||
minetest.override_item("doors:trapdoor", {
|
||||
description = S("Windowed Mixed Wood Trapdoor"),
|
||||
})
|
||||
|
||||
minetest.override_item("doors:trapdoor_steel", {
|
||||
description = S("Windowed Locked Plain Steel Trapdoor"),
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
ts_doors.workshop = {}
|
||||
|
||||
function ts_doors.workshop.update_formspec(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local page = meta:get_int("page")
|
||||
local maxpage = meta:get_int("maxpage")
|
||||
local selection = meta:get_string("selection")
|
||||
|
||||
local trapdoor = meta:get_int("trapdoor") == 1
|
||||
local locked = meta:get_int("locked") == 1
|
||||
local solid = meta:get_int("solid") == 1
|
||||
|
||||
if page < 1 then
|
||||
page = maxpage
|
||||
elseif page > maxpage then
|
||||
page = 1
|
||||
end
|
||||
meta:set_int("page", page)
|
||||
|
||||
local fs = "size[9,9;]"
|
||||
fs = fs .. default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
if minetest.colorize then
|
||||
if not locked then
|
||||
fs = fs .. "button[0,0;2,1;unlocked;" .. minetest.colorize("#ffff00", "Unlocked") .. "]"
|
||||
fs = fs .. "button[0,0.75;2,1;locked;Locked]"
|
||||
else
|
||||
fs = fs .. "button[0,0;2,1;unlocked;Unlocked]"
|
||||
fs = fs .. "button[0,0.75;2,1;locked;" .. minetest.colorize("#ffff00", "Locked") .. "]"
|
||||
end
|
||||
|
||||
if not solid then
|
||||
fs = fs .. "button[2,0;2,1;windowed;" .. minetest.colorize("#ffff00", "Windowed") .. "]"
|
||||
fs = fs .. "button[2,0.75;2,1;solid;Solid]"
|
||||
else
|
||||
fs = fs .. "button[2,0;2,1;windowed;Windowed]"
|
||||
fs = fs .. "button[2,0.75;2,1;solid;" .. minetest.colorize("#ffff00", "Solid") .. "]"
|
||||
end
|
||||
|
||||
if not trapdoor then
|
||||
fs = fs .. "button[4,0;2,1;doors;" .. minetest.colorize("#ffff00", "Doors") .. "]"
|
||||
fs = fs .. "button[4,0.75;2,1;trapdoors;Trapdoors]"
|
||||
else
|
||||
fs = fs .. "button[4,0;2,1;doors;Doors]"
|
||||
fs = fs .. "button[4,0.75;2,1;trapdoors;" .. minetest.colorize("#ffff00", "Trapdoors") .. "]"
|
||||
end
|
||||
else
|
||||
fs = fs .. "button[0,0;2,1;unlocked;Unlocked]"
|
||||
fs = fs .. "button[0,0.75;2,1;locked;Locked]"
|
||||
fs = fs .. "button[2,0;2,1;windowed;Windowed]"
|
||||
fs = fs .. "button[2,0.75;2,1;solid;Solid]"
|
||||
fs = fs .. "button[4,0;2,1;doors;Doors]"
|
||||
fs = fs .. "button[4,0.75;2,1;trapdoors;Trapdoors]"
|
||||
end
|
||||
|
||||
fs = fs .. "label[0,1.6;Material]"
|
||||
fs = fs .. "label[0,1.9;needed]"
|
||||
fs = fs .. "list[context;material_needed;0,2.3;1,1]"
|
||||
fs = fs .. "label[0,3.25;Input]"
|
||||
fs = fs .. "list[context;material;0,3.75;1,1]"
|
||||
fs = fs .. "label[1,1.6;Steel]"
|
||||
fs = fs .. "label[1,1.9;needed]"
|
||||
fs = fs .. "list[context;steel_needed;1,2.3;1,1]"
|
||||
fs = fs .. "label[1,3.25;Input]"
|
||||
fs = fs .. "list[context;steel;1,3.75;1,1]"
|
||||
local x = 2
|
||||
local y = 1.75
|
||||
local count = 0
|
||||
for item, recipe in pairs(ts_doors.registered_doors) do
|
||||
count = count + 1
|
||||
if (count >= (page - 1) * 12 + 1 and count <= page * 12) then
|
||||
local door = get_door_name(meta, item)
|
||||
fs = fs .. "item_image_button[" .. x .. "," .. y .. ";1,1;" .. door .. ";" .. door .. ";]"
|
||||
x = x + 1
|
||||
if x > 5 then
|
||||
x = 2
|
||||
y = y + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
fs = fs .. "button[6, 1;1,1;noselection;X]"
|
||||
fs = fs .. "tooltip[noselection;Remove Current Selection]"
|
||||
if maxpage > 1 then
|
||||
fs = fs .. "button[6,2.25;1,1;prevpage;<-]"
|
||||
fs = fs .. "button[6,3.25;1,1;nextpage;->]"
|
||||
fs = fs .. "label[6,4;" .. string.format("Page %s of %s", page, maxpage) .. "]"
|
||||
end
|
||||
fs = fs .. "label[7.5,0.2;Current]"
|
||||
fs = fs .. "label[7.5,0.5;Door]"
|
||||
fs = fs .. "item_image[7.5,1;1,1;" .. selection .. "]"
|
||||
fs = fs .. "image[7.5,2;1,1;gui_furnace_arrow_bg.png^[lowpart:" .. meta:get_int("progress") * 10 .. ":gui_furnace_arrow_fg.png^[transformR180]"
|
||||
fs = fs .. "list[context;output;7.5,3;1,1]"
|
||||
fs = fs .. "list[current_player;main;0.5,5;8,4]"
|
||||
fs = fs .. "listring[current_player;main]"
|
||||
fs = fs .. "listring[context;material]"
|
||||
fs = fs .. "listring[current_player;main]"
|
||||
fs = fs .. "listring[context;steel]"
|
||||
fs = fs .. "listring[current_player;main]"
|
||||
fs = fs .. "listring[context;output]"
|
||||
meta:set_string("formspec", fs)
|
||||
end
|
||||
|
||||
local function update_inventory(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
local itemcount = 0
|
||||
for k, v in pairs(ts_doors.registered_doors) do
|
||||
itemcount = itemcount + 1
|
||||
end
|
||||
|
||||
meta:set_int("maxpage", math.ceil(itemcount / 16))
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("material_needed", 0)
|
||||
inv:set_size("material_needed", 1)
|
||||
inv:set_size("steel_needed", 0)
|
||||
inv:set_size("steel_needed", 1)
|
||||
inv:set_size("material", 1)
|
||||
inv:set_size("steel", 1)
|
||||
inv:set_size("output", 1)
|
||||
|
||||
local trapdoor = meta:get_int("trapdoor") == 1
|
||||
local locked = meta:get_int("locked") == 1
|
||||
local solid = meta:get_int("solid") == 1
|
||||
|
||||
local selection = meta:get_string("selection")
|
||||
if selection and selection ~= "" then
|
||||
local door = selection:sub(10)
|
||||
if door:sub(0, 4) == "trap" then
|
||||
trapdoor = true
|
||||
door = door:sub(10)
|
||||
else
|
||||
trapdoor = false
|
||||
door = door:sub(6)
|
||||
end
|
||||
if door:sub(0, 4) == "full" then
|
||||
solid = true
|
||||
door = door:sub(6)
|
||||
else
|
||||
solid = false
|
||||
end
|
||||
if door:sub(0, 7) == "locked_" then
|
||||
locked = true
|
||||
door = door:sub(8)
|
||||
else
|
||||
locked = false
|
||||
end
|
||||
local material_needed = 1
|
||||
if trapdoor then
|
||||
material_needed = 4
|
||||
else
|
||||
material_needed = 6
|
||||
end
|
||||
if solid then
|
||||
material_needed = material_needed + 1
|
||||
end
|
||||
local steel_needed = 0
|
||||
if locked then
|
||||
steel_needed = 1
|
||||
end
|
||||
inv:add_item("material_needed", { name = ts_doors.registered_doors[door], count = material_needed })
|
||||
inv:add_item("steel_needed", { name = "default:steel_ingot", count = steel_needed })
|
||||
end
|
||||
end
|
||||
|
||||
local function on_receive_fields(pos, formname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if fields.unlocked then
|
||||
meta:set_int("locked", 0)
|
||||
elseif fields.locked then
|
||||
meta:set_int("locked", 1)
|
||||
elseif fields.windowed then
|
||||
meta:set_int("solid", 0)
|
||||
elseif fields.solid then
|
||||
meta:set_int("solid", 1)
|
||||
elseif fields.doors then
|
||||
meta:set_int("trapdoor", 0)
|
||||
elseif fields.trapdoors then
|
||||
meta:set_int("trapdoor", 1)
|
||||
elseif fields.prevpage then
|
||||
meta:set_int("page", meta:get_int("page") - 1)
|
||||
elseif fields.nextpage then
|
||||
meta:set_int("page", meta:get_int("page") + 1)
|
||||
elseif fields.noselection then
|
||||
meta:set_string("selection", "")
|
||||
else
|
||||
for item, recipe in pairs(ts_doors.registered_doors) do
|
||||
if fields[get_door_name(meta, item)] then
|
||||
meta:set_string("selection", get_door_name(meta, item))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_construct(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("trapdoor", 0)
|
||||
meta:set_int("locked", 0)
|
||||
meta:set_int("solid", 0)
|
||||
meta:set_int("progress", 0)
|
||||
meta:set_string("working_on", "")
|
||||
meta:set_int("page", 1)
|
||||
meta:set_int("maxpage", 1)
|
||||
meta:set_string("selection", "")
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
return 0
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if listname == "material" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local selection = meta:get_string("selection")
|
||||
if selection and selection ~= "" then
|
||||
local door = selection:sub(10)
|
||||
if door:sub(0, 4) == "trap" then
|
||||
door = door:sub(10)
|
||||
else
|
||||
door = door:sub(6)
|
||||
end
|
||||
if door:sub(0, 4) == "full" then
|
||||
door = door:sub(6)
|
||||
end
|
||||
if door:sub(0, 7) == "locked_" then
|
||||
door = door:sub(8)
|
||||
end
|
||||
if stack:get_name() == ts_doors.registered_doors[door] then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == "steel" and (stack:get_name() == "default:steel_ingot") then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if listname == "material" or listname == "steel" or listname == "output" then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
local function on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
end
|
||||
|
||||
local function on_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
end
|
||||
|
||||
local function on_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
end
|
||||
|
||||
local function can_dig(pos, player)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
if inv:is_empty("material") and inv:is_empty("steel") and inv:is_empty("output") then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
ts_workshop.register_workshop("ts_doors", "workshop", {
|
||||
description = S("Door Workshop"),
|
||||
tiles = {
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png^doors_item_wood.png",
|
||||
"default_wood.png^doors_item_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { choppy = 2, oddly_breakable_by_hand = 2 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.5, 0.5, -0.3125, 0.5 }, -- NodeBox1
|
||||
{ -0.5, -0.5, -0.5, -0.375, 0.5, 0.5 }, -- NodeBox2
|
||||
{ 0.375, -0.5, -0.5, 0.5, 0.5, 0.5 }, -- NodeBox3
|
||||
{ -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 }, -- NodeBox4
|
||||
{ -0.5, 0.3125, -0.4375, 0.5, 0.4375, -0.3125 }, -- NodeBox5
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "regular"
|
||||
},
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_construct = on_construct,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
on_metadata_inventory_move = on_metadata_inventory_move,
|
||||
on_metadata_inventory_put = on_metadata_inventory_put,
|
||||
on_metadata_inventory_take = on_metadata_inventory_take,
|
||||
can_dig = can_dig,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
enough_supply = function(pos, selection)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_string("working_on") ~= "" then
|
||||
return
|
||||
end
|
||||
local inv = meta:get_inventory()
|
||||
local selection = meta:get_string("selection")
|
||||
local material = inv:get_stack("material", 1):get_name()
|
||||
local material_needed_name = inv:get_stack("material_needed", 1):get_name()
|
||||
local material_needed = inv:get_stack("material_needed", 1):get_count()
|
||||
local material_ok = inv:get_stack("material", 1):get_count() >= material_needed
|
||||
local steel = inv:get_stack("steel", 1):get_name()
|
||||
local steel_needed = inv:get_stack("steel_needed", 1):get_count()
|
||||
local steel_ok = inv:get_stack("steel", 1):get_count() >= steel_needed
|
||||
|
||||
if not (material_ok and steel_ok
|
||||
and (steel and steel == "default:steel_ingot" or steel_needed == 0)
|
||||
and selection and selection ~= ""
|
||||
and material == material_needed_name)
|
||||
then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end,
|
||||
remove_supply = function(pos, selection)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local material = inv:get_stack("material", 1):get_name()
|
||||
local material_needed = inv:get_stack("material_needed", 1):get_count()
|
||||
local steel_needed = inv:get_stack("steel_needed", 1):get_count()
|
||||
|
||||
inv:remove_item("material", { name = material, count = material_needed })
|
||||
inv:remove_item("steel", { name = "default:steel_ingot", count = steel_needed })
|
||||
end,
|
||||
update_inventory = update_inventory,
|
||||
update_formspec = ts_doors.workshop.update_formspec,
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
name = "ts_doors:update_door_workshop",
|
||||
nodenames = { "ts_doors:door_workshop" },
|
||||
action = function(pos, node)
|
||||
update_inventory(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "ts_doors:workshop",
|
||||
recipe = {
|
||||
{ "default:wood", "default:wood", "default:wood" },
|
||||
{ "default:wood", "doors:door_wood", "default:wood" },
|
||||
{ "default:wood", "default:wood", "default:wood" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "ts_doors:workshop",
|
||||
burntime = 30,
|
||||
})
|
|
@ -32,6 +32,25 @@ minetest.register_craft({
|
|||
recipe = "group:food_corn"
|
||||
})
|
||||
|
||||
-- popcorn
|
||||
minetest.register_craftitem("farming:popcorn", {
|
||||
description = S("Popcorn"),
|
||||
inventory_image = "farming_popcorn.png",
|
||||
groups = {food_popcorn = 1, flammable = 2},
|
||||
on_use = minetest.item_eat(4)
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:popcorn",
|
||||
recipe = {
|
||||
{"group:food_pot", "group:food_oil", "group:food_corn"}
|
||||
},
|
||||
replacements = {
|
||||
{"group:food_pot", "farming:pot"},
|
||||
{"group:food_oil", "vessels:glass_bottle"}
|
||||
}
|
||||
})
|
||||
|
||||
-- cornstarch
|
||||
minetest.register_craftitem("farming:cornstarch", {
|
||||
description = S("Cornstarch"),
|
||||
|
|
|
@ -173,3 +173,6 @@ Created by gorlock (CC0)
|
|||
Created by sirrobzeroone (CC0)
|
||||
farming_gyoza.png
|
||||
farming_pineapple_ring.png
|
||||
|
||||
Created by TechM8 (https://www.deviantart.com/techm8)
|
||||
farming_popcorn.png
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 292 B |
|
@ -38,7 +38,7 @@ i3.new_tab {
|
|||
|
||||
Updates the current formspec. `extra_formspec` adds an additional formspec string.
|
||||
|
||||
#### `i3.delete_tab(tabname)`
|
||||
#### `i3.remove_tab(tabname)`
|
||||
|
||||
Deletes a tab by name.
|
||||
|
||||
|
@ -141,7 +141,7 @@ Recipes can be registered from a given URL containing a JSON file (HTTP support
|
|||
|
||||
```Lua
|
||||
i3.register_craft({
|
||||
url = "https://raw.githubusercontent.com/minetest-mods/i3/main/test_online_recipe.json"
|
||||
url = "https://raw.githubusercontent.com/minetest-mods/i3/main/tests/test_online_recipe.json"
|
||||
})
|
||||
```
|
||||
|
||||
|
@ -178,7 +178,7 @@ end)
|
|||
|
||||
Removes all recipe filters and adds a new one.
|
||||
|
||||
#### `i3.delete_recipe_filter(name)`
|
||||
#### `i3.remove_recipe_filter(name)`
|
||||
|
||||
Removes the recipe filter with the given `name`.
|
||||
|
||||
|
@ -197,12 +197,12 @@ They can be used like so: `<optional_name> +<filter name>=<value1>,<value2>,<...
|
|||
Example usages:
|
||||
|
||||
- `+groups=cracky,crumbly`: search for groups `cracky` and `crumbly` in all items.
|
||||
- `wood +groups=flammable +types=node`: search for group `flammable` amongst items which contain
|
||||
`wood` in their names AND have a `node` drawtype.
|
||||
- `wood +groups=flammable`: search for group `flammable` amongst items which contain
|
||||
`wood` in their names.
|
||||
|
||||
Notes:
|
||||
- If `optional_name` is omitted, the search filter will apply to all items, without pre-filtering.
|
||||
- The `+groups` and `+types` filters are currently implemented by default.
|
||||
- The `+groups` filter is currently implemented by default.
|
||||
|
||||
#### `i3.add_search_filter(name, function(item, values))`
|
||||
|
||||
|
@ -237,15 +237,6 @@ Returns a map of search filters, indexed by name.
|
|||
|
||||
### Miscellaneous
|
||||
|
||||
#### `i3.group_stereotypes`
|
||||
|
||||
This is the table indexing the item groups by stereotypes.
|
||||
You can add a stereotype like so:
|
||||
|
||||
```Lua
|
||||
i3.group_stereotypes.radioactive = "mod:item"
|
||||
```
|
||||
|
||||
#### `i3.export_url`
|
||||
|
||||
If set, the mod will export all the cached recipes and usages in a JSON format
|
||||
|
|
|
@ -18,6 +18,7 @@ This mod requires **Minetest 5.4+**
|
|||
- Inventory Sorting (alphabetical + item stack compression)
|
||||
- Item Bookmarks
|
||||
- Waypoints
|
||||
- Item List Compression (**`moreblocks`** supported)
|
||||
|
||||
**¹** *This mode is a Terraria-like system that shows recipes you can craft from items you ever had in your inventory.
|
||||
To enable it: `i3_progressive_mode = true` in `minetest.conf`.*
|
||||
|
@ -48,4 +49,4 @@ Love this mod? Donations are appreciated: https://www.paypal.me/jpg84240
|
|||
|
||||
Demo video (outdated): https://www.youtube.com/watch?v=25nCAaqeacU
|
||||
|
||||
![Preview](https://user-images.githubusercontent.com/7883281/116791813-0edf7b00-aabd-11eb-90b3-11c604af34dc.png)
|
||||
![Preview](https://user-images.githubusercontent.com/7883281/123561657-10ba7780-d7aa-11eb-8bbe-dcec348bb28c.png)
|
||||
|
|
|
@ -0,0 +1,319 @@
|
|||
local fmt, insert = string.format, table.insert
|
||||
|
||||
local wood_types = {
|
||||
"acacia_wood", "aspen_wood", "junglewood", "pine_wood",
|
||||
}
|
||||
|
||||
local material_tools = {
|
||||
"bronze", "diamond", "mese", "stone", "wood",
|
||||
}
|
||||
|
||||
local material_stairs = {
|
||||
"acacia_wood", "aspen_wood", "brick", "bronzeblock", "cobble", "copperblock",
|
||||
"desert_cobble", "desert_sandstone", "desert_sandstone_block", "desert_sandstone_brick",
|
||||
"desert_stone", "desert_stone_block", "desert_stonebrick",
|
||||
"glass", "goldblock", "ice", "junglewood", "mossycobble", "obsidian",
|
||||
"obsidian_block", "obsidian_glass", "obsidianbrick", "pine_wood",
|
||||
"sandstone", "sandstone_block", "sandstonebrick",
|
||||
"silver_sandstone", "silver_sandstone_block", "silver_sandstone_brick",
|
||||
"snowblock", "steelblock", "stone", "stone_block", "stonebrick",
|
||||
"straw", "tinblock",
|
||||
}
|
||||
|
||||
local colors = {
|
||||
"black", "blue", "brown", "cyan", "dark_green", "dark_grey", "green",
|
||||
"grey", "magenta", "orange", "pink", "red", "violet", "yellow",
|
||||
}
|
||||
|
||||
local to_compress = {
|
||||
["default:wood"] = {
|
||||
replace = "wood",
|
||||
by = wood_types,
|
||||
},
|
||||
|
||||
["default:fence_wood"] = {
|
||||
replace = "wood",
|
||||
by = wood_types,
|
||||
},
|
||||
|
||||
["default:fence_rail_wood"] = {
|
||||
replace = "wood",
|
||||
by = wood_types,
|
||||
},
|
||||
|
||||
["default:mese_post_light"] = {
|
||||
replace = "mese_post_light",
|
||||
by = {
|
||||
"mese_post_light_acacia",
|
||||
"mese_post_light_aspen_wood",
|
||||
"mese_post_light_junglewood",
|
||||
"mese_post_light_pine_wood",
|
||||
}
|
||||
},
|
||||
|
||||
["doors:gate_wood_closed"] = {
|
||||
replace = "wood",
|
||||
by = wood_types,
|
||||
},
|
||||
|
||||
["wool:white"] = {
|
||||
replace = "white",
|
||||
by = colors
|
||||
},
|
||||
|
||||
["dye:white"] = {
|
||||
replace = "white",
|
||||
by = colors
|
||||
},
|
||||
|
||||
["default:axe_steel"] = {
|
||||
replace = "steel",
|
||||
by = material_tools
|
||||
},
|
||||
|
||||
["default:pick_steel"] = {
|
||||
replace = "steel",
|
||||
by = material_tools
|
||||
},
|
||||
|
||||
["default:shovel_steel"] = {
|
||||
replace = "steel",
|
||||
by = material_tools
|
||||
},
|
||||
|
||||
["default:sword_steel"] = {
|
||||
replace = "steel",
|
||||
by = material_tools
|
||||
},
|
||||
|
||||
["farming:hoe_steel"] = {
|
||||
replace = "steel",
|
||||
by = {"wood", "stone"}
|
||||
},
|
||||
|
||||
["stairs:slab_wood"] = {
|
||||
replace = "wood",
|
||||
by = material_stairs
|
||||
},
|
||||
|
||||
["stairs:stair_wood"] = {
|
||||
replace = "wood",
|
||||
by = material_stairs
|
||||
},
|
||||
|
||||
["stairs:stair_inner_wood"] = {
|
||||
replace = "wood",
|
||||
by = material_stairs
|
||||
},
|
||||
|
||||
["stairs:stair_outer_wood"] = {
|
||||
replace = "wood",
|
||||
by = material_stairs
|
||||
},
|
||||
|
||||
["walls:cobble"] = {
|
||||
replace = "cobble",
|
||||
by = {"desertcobble", "mossycobble"}
|
||||
},
|
||||
}
|
||||
|
||||
local circular_saw_names = {
|
||||
{"micro", "_1"},
|
||||
{"panel", "_1"},
|
||||
{"micro", "_2"},
|
||||
{"panel", "_2"},
|
||||
{"micro", "_4"},
|
||||
{"panel", "_4"},
|
||||
{"micro", ""},
|
||||
{"panel", ""},
|
||||
|
||||
{"micro", "_12"},
|
||||
{"panel", "_12"},
|
||||
{"micro", "_14"},
|
||||
{"panel", "_14"},
|
||||
{"micro", "_15"},
|
||||
{"panel", "_15"},
|
||||
{"stair", "_outer"},
|
||||
{"stair", ""},
|
||||
|
||||
{"stair", "_inner"},
|
||||
{"slab", "_1"},
|
||||
{"slab", "_2"},
|
||||
{"slab", "_quarter"},
|
||||
{"slab", ""},
|
||||
{"slab", "_three_quarter"},
|
||||
{"slab", "_14"},
|
||||
{"slab", "_15"},
|
||||
|
||||
{"slab", "_two_sides"},
|
||||
{"slab", "_three_sides"},
|
||||
{"slab", "_three_sides_u"},
|
||||
{"stair", "_half"},
|
||||
{"stair", "_alt_1"},
|
||||
{"stair", "_alt_2"},
|
||||
{"stair", "_alt_4"},
|
||||
{"stair", "_alt"},
|
||||
{"stair", "_right_half"},
|
||||
|
||||
{"slope", ""},
|
||||
{"slope", "_half"},
|
||||
{"slope", "_half_raised"},
|
||||
{"slope", "_inner"},
|
||||
{"slope", "_inner_half"},
|
||||
{"slope", "_inner_half_raised"},
|
||||
{"slope", "_inner_cut"},
|
||||
{"slope", "_inner_cut_half"},
|
||||
|
||||
{"slope", "_inner_cut_half_raised"},
|
||||
{"slope", "_outer"},
|
||||
{"slope", "_outer_half"},
|
||||
{"slope", "_outer_half_raised"},
|
||||
{"slope", "_outer_cut"},
|
||||
{"slope", "_outer_cut_half"},
|
||||
{"slope", "_outer_cut_half_raised"},
|
||||
{"slope", "_cut"},
|
||||
}
|
||||
|
||||
local moreblocks_nodes = {
|
||||
"coal_stone",
|
||||
"wood_tile",
|
||||
"iron_checker",
|
||||
"circle_stone_bricks",
|
||||
"cobble_compressed",
|
||||
"plankstone",
|
||||
"clean_glass",
|
||||
"split_stone_tile",
|
||||
"all_faces_tree",
|
||||
"dirt_compressed",
|
||||
"coal_checker",
|
||||
"clean_glow_glass",
|
||||
"tar",
|
||||
"clean_super_glow_glass",
|
||||
"stone_tile",
|
||||
"cactus_brick",
|
||||
"super_glow_glass",
|
||||
"desert_cobble_compressed",
|
||||
"copperpatina",
|
||||
"coal_stone_bricks",
|
||||
"glow_glass",
|
||||
"cactus_checker",
|
||||
"all_faces_pine_tree",
|
||||
"all_faces_aspen_tree",
|
||||
"all_faces_acacia_tree",
|
||||
"all_faces_jungle_tree",
|
||||
"iron_stone",
|
||||
"grey_bricks",
|
||||
"wood_tile_left",
|
||||
"wood_tile_down",
|
||||
"wood_tile_center",
|
||||
"wood_tile_right",
|
||||
"wood_tile_full",
|
||||
"checker_stone_tile",
|
||||
"iron_glass",
|
||||
"iron_stone_bricks",
|
||||
"wood_tile_flipped",
|
||||
"wood_tile_offset",
|
||||
"coal_glass",
|
||||
|
||||
"straw",
|
||||
|
||||
"stone",
|
||||
"stone_block",
|
||||
"cobble",
|
||||
"mossycobble",
|
||||
"brick",
|
||||
"sandstone",
|
||||
"steelblock",
|
||||
"goldblock",
|
||||
"copperblock",
|
||||
"bronzeblock",
|
||||
"diamondblock",
|
||||
"tinblock",
|
||||
"desert_stone",
|
||||
"desert_stone_block",
|
||||
"desert_cobble",
|
||||
"meselamp",
|
||||
"glass",
|
||||
"tree",
|
||||
"wood",
|
||||
"jungletree",
|
||||
"junglewood",
|
||||
"pine_tree",
|
||||
"pine_wood",
|
||||
"acacia_tree",
|
||||
"acacia_wood",
|
||||
"aspen_tree",
|
||||
"aspen_wood",
|
||||
"obsidian",
|
||||
"obsidian_block",
|
||||
"obsidianbrick",
|
||||
"obsidian_glass",
|
||||
"stonebrick",
|
||||
"desert_stonebrick",
|
||||
"sandstonebrick",
|
||||
"silver_sandstone",
|
||||
"silver_sandstone_brick",
|
||||
"silver_sandstone_block",
|
||||
"desert_sandstone",
|
||||
"desert_sandstone_brick",
|
||||
"desert_sandstone_block",
|
||||
"sandstone_block",
|
||||
"coral_skeleton",
|
||||
"ice",
|
||||
}
|
||||
|
||||
local colors_moreblocks = table.copy(colors)
|
||||
insert(colors_moreblocks, "white")
|
||||
|
||||
local moreblocks_mods = {
|
||||
wool = colors_moreblocks,
|
||||
moreblocks = moreblocks_nodes,
|
||||
}
|
||||
|
||||
local t = {}
|
||||
|
||||
for mod, v in pairs(moreblocks_mods) do
|
||||
for _, nodename in ipairs(v) do
|
||||
t[nodename] = {}
|
||||
|
||||
for _, shape in ipairs(circular_saw_names) do
|
||||
local to_add = true
|
||||
|
||||
if shape[1] == "slope" and shape[2] == "" then
|
||||
to_add = nil
|
||||
end
|
||||
|
||||
if to_add then
|
||||
insert(t[nodename], fmt("%s_%s%s", shape[1], nodename, shape[2]))
|
||||
end
|
||||
end
|
||||
|
||||
local slope_name = fmt("slope_%s", nodename)
|
||||
|
||||
to_compress[fmt("%s:%s", mod, slope_name)] = {
|
||||
replace = slope_name,
|
||||
by = t[nodename]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local compressed = {}
|
||||
|
||||
for k, v in pairs(to_compress) do
|
||||
compressed[k] = compressed[k] or {}
|
||||
|
||||
for _, str in ipairs(v.by) do
|
||||
local it = k:gsub(v.replace, str)
|
||||
insert(compressed[k], it)
|
||||
end
|
||||
end
|
||||
|
||||
local _compressed = {}
|
||||
|
||||
for _, v in pairs(compressed) do
|
||||
for _, v2 in ipairs(v) do
|
||||
_compressed[v2] = true
|
||||
end
|
||||
end
|
||||
|
||||
return compressed, _compressed
|
|
@ -0,0 +1,62 @@
|
|||
local S = core.get_translator "i3"
|
||||
|
||||
local group_stereotypes = {
|
||||
dye = "dye:white",
|
||||
wool = "wool:white",
|
||||
wood = "default:wood",
|
||||
tree = "default:tree",
|
||||
sand = "default:sand",
|
||||
glass = "default:glass",
|
||||
stick = "default:stick",
|
||||
stone = "default:stone",
|
||||
leaves = "default:leaves",
|
||||
coal = "default:coal_lump",
|
||||
vessel = "vessels:glass_bottle",
|
||||
flower = "flowers:dandelion_yellow",
|
||||
water_bucket = "bucket:bucket_water",
|
||||
mesecon_conductor_craftable = "mesecons:wire_00000000_off",
|
||||
}
|
||||
|
||||
local group_names = {
|
||||
dye = S"Any dye",
|
||||
coal = S"Any coal",
|
||||
sand = S"Any sand",
|
||||
tree = S"Any tree",
|
||||
wool = S"Any wool",
|
||||
glass = S"Any glass",
|
||||
stick = S"Any stick",
|
||||
stone = S"Any stone",
|
||||
carpet = S"Any carpet",
|
||||
flower = S"Any flower",
|
||||
leaves = S"Any leaves",
|
||||
vessel = S"Any vessel",
|
||||
wood = S"Any wood planks",
|
||||
mushroom = S"Any mushroom",
|
||||
|
||||
["color_red,flower"] = S"Any red flower",
|
||||
["color_blue,flower"] = S"Any blue flower",
|
||||
["color_black,flower"] = S"Any black flower",
|
||||
["color_white,flower"] = S"Any white flower",
|
||||
["color_green,flower"] = S"Any green flower",
|
||||
["color_orange,flower"] = S"Any orange flower",
|
||||
["color_yellow,flower"] = S"Any yellow flower",
|
||||
["color_violet,flower"] = S"Any violet flower",
|
||||
|
||||
["color_red,dye"] = S"Any red dye",
|
||||
["color_blue,dye"] = S"Any blue dye",
|
||||
["color_grey,dye"] = S"Any grey dye",
|
||||
["color_pink,dye"] = S"Any pink dye",
|
||||
["color_cyan,dye"] = S"Any cyan dye",
|
||||
["color_black,dye"] = S"Any black dye",
|
||||
["color_white,dye"] = S"Any white dye",
|
||||
["color_brown,dye"] = S"Any brown dye",
|
||||
["color_green,dye"] = S"Any green dye",
|
||||
["color_orange,dye"] = S"Any orange dye",
|
||||
["color_yellow,dye"] = S"Any yellow dye",
|
||||
["color_violet,dye"] = S"Any violet dye",
|
||||
["color_magenta,dye"] = S"Any magenta dye",
|
||||
["color_dark_grey,dye"] = S"Any dark grey dye",
|
||||
["color_dark_green,dye"] = S"Any dark green dye",
|
||||
}
|
||||
|
||||
return group_stereotypes, group_names
|
|
@ -0,0 +1,13 @@
|
|||
local model_alias = {
|
||||
["boats:boat"] = {name = "boats:boat", drawtype = "entity"},
|
||||
["carts:cart"] = {name = "carts:cart", drawtype = "entity", frames = "0,0"},
|
||||
["default:chest"] = {name = "default:chest_open"},
|
||||
["default:chest_locked"] = {name = "default:chest_locked_open"},
|
||||
["doors:door_wood"] = {name = "doors:door_wood_a"},
|
||||
["doors:door_glass"] = {name = "doors:door_glass_a"},
|
||||
["doors:door_obsidian_glass"] = {name = "doors:door_obsidian_glass_a"},
|
||||
["doors:door_steel"] = {name = "doors:door_steel_a"},
|
||||
["xpanes:door_steel_bar"] = {name = "xpanes:door_steel_bar_a"},
|
||||
}
|
||||
|
||||
return model_alias
|
|
@ -0,0 +1,116 @@
|
|||
local fmt = string.format
|
||||
|
||||
local PNG = {
|
||||
bg = "i3_bg.png",
|
||||
bg_full = "i3_bg_full.png",
|
||||
bar = "i3_bar.png",
|
||||
hotbar = "i3_hotbar.png",
|
||||
search = "i3_search.png",
|
||||
heart = "i3_heart.png",
|
||||
heart_half = "i3_heart_half.png",
|
||||
heart_grey = "i3_heart_grey.png",
|
||||
prev = "i3_next.png^\\[transformFX",
|
||||
next = "i3_next.png",
|
||||
arrow = "i3_arrow.png",
|
||||
trash = "i3_trash.png",
|
||||
sort_az = "i3_sort_az.png",
|
||||
sort_za = "i3_sort_za.png",
|
||||
compress = "i3_compress.png",
|
||||
fire = "i3_fire.png",
|
||||
fire_anim = "i3_fire_anim.png",
|
||||
book = "i3_book.png",
|
||||
sign = "i3_sign.png",
|
||||
cancel = "i3_cancel.png",
|
||||
export = "i3_export.png",
|
||||
slot = "i3_slot.png",
|
||||
tab = "i3_tab.png",
|
||||
tab_small = "i3_tab_small.png",
|
||||
tab_top = "i3_tab.png^\\[transformFY",
|
||||
furnace_anim = "i3_furnace_anim.png",
|
||||
bag = "i3_bag.png",
|
||||
armor = "i3_armor.png",
|
||||
awards = "i3_award.png",
|
||||
skins = "i3_skin.png",
|
||||
waypoints = "i3_waypoint.png",
|
||||
teleport = "i3_teleport.png",
|
||||
add = "i3_add.png",
|
||||
refresh = "i3_refresh.png",
|
||||
visible = "i3_visible.png^\\[brighten",
|
||||
nonvisible = "i3_non_visible.png",
|
||||
exit = "i3_exit.png",
|
||||
|
||||
cancel_hover = "i3_cancel.png^\\[brighten",
|
||||
search_hover = "i3_search.png^\\[brighten",
|
||||
export_hover = "i3_export.png^\\[brighten",
|
||||
trash_hover = "i3_trash.png^\\[brighten^\\[colorize:#f00:100",
|
||||
compress_hover = "i3_compress.png^\\[brighten",
|
||||
sort_az_hover = "i3_sort_az.png^\\[brighten",
|
||||
sort_za_hover = "i3_sort_za.png^\\[brighten",
|
||||
prev_hover = "i3_next_hover.png^\\[transformFX",
|
||||
next_hover = "i3_next_hover.png",
|
||||
tab_hover = "i3_tab_hover.png",
|
||||
tab_small_hover = "i3_tab_small_hover.png",
|
||||
tab_hover_top = "i3_tab_hover.png^\\[transformFY",
|
||||
bag_hover = "i3_bag_hover.png",
|
||||
armor_hover = "i3_armor_hover.png",
|
||||
awards_hover = "i3_award_hover.png",
|
||||
skins_hover = "i3_skin_hover.png",
|
||||
waypoints_hover = "i3_waypoint_hover.png",
|
||||
teleport_hover = "i3_teleport.png^\\[brighten",
|
||||
add_hover = "i3_add.png^\\[brighten",
|
||||
refresh_hover = "i3_refresh.png^\\[brighten",
|
||||
exit_hover = "i3_exit.png^\\[brighten",
|
||||
}
|
||||
|
||||
local styles = fmt([[
|
||||
style_type[field;border=false;bgcolor=transparent]
|
||||
style_type[label,field;font_size=16]
|
||||
style_type[button;border=false;content_offset=0]
|
||||
style_type[image_button,item_image_button;border=false;sound=i3_click]
|
||||
style_type[item_image_button;bgimg_hovered=%s]
|
||||
|
||||
style[pagenum,no_item,no_rcp;font=bold;font_size=18]
|
||||
style[exit;fgimg=%s;fgimg_hovered=%s;content_offset=0]
|
||||
style[cancel;fgimg=%s;fgimg_hovered=%s;content_offset=0]
|
||||
style[search;fgimg=%s;fgimg_hovered=%s;content_offset=0]
|
||||
style[prev_page;fgimg=%s;fgimg_hovered=%s]
|
||||
style[next_page;fgimg=%s;fgimg_hovered=%s]
|
||||
style[prev_recipe;fgimg=%s;fgimg_hovered=%s]
|
||||
style[next_recipe;fgimg=%s;fgimg_hovered=%s]
|
||||
style[prev_usage;fgimg=%s;fgimg_hovered=%s]
|
||||
style[next_usage;fgimg=%s;fgimg_hovered=%s]
|
||||
style[waypoint_add;fgimg=%s;fgimg_hovered=%s;content_offset=0]
|
||||
style[btn_bag,btn_armor,btn_skins;font=bold;font_size=18;content_offset=0;sound=i3_click]
|
||||
style[craft_rcp,craft_usg;noclip=true;font_size=16;sound=i3_craft;
|
||||
bgimg=i3_btn9.png;bgimg_hovered=i3_btn9_hovered.png;
|
||||
bgimg_pressed=i3_btn9_pressed.png;bgimg_middle=4,6]
|
||||
]],
|
||||
PNG.slot,
|
||||
PNG.exit, PNG.exit_hover,
|
||||
PNG.cancel, PNG.cancel_hover,
|
||||
PNG.search, PNG.search_hover,
|
||||
PNG.prev, PNG.prev_hover,
|
||||
PNG.next, PNG.next_hover,
|
||||
PNG.prev, PNG.prev_hover,
|
||||
PNG.next, PNG.next_hover,
|
||||
PNG.prev, PNG.prev_hover,
|
||||
PNG.next, PNG.next_hover,
|
||||
PNG.add, PNG.add_hover)
|
||||
|
||||
local fs_elements = {
|
||||
label = "label[%f,%f;%s]",
|
||||
box = "box[%f,%f;%f,%f;%s]",
|
||||
image = "image[%f,%f;%f,%f;%s]",
|
||||
tooltip = "tooltip[%f,%f;%f,%f;%s]",
|
||||
button = "button[%f,%f;%f,%f;%s;%s]",
|
||||
item_image = "item_image[%f,%f;%f,%f;%s]",
|
||||
hypertext = "hypertext[%f,%f;%f,%f;%s;%s]",
|
||||
bg9 = "background9[%f,%f;%f,%f;%s;false;%u]",
|
||||
scrollbar = "scrollbar[%f,%f;%f,%f;%s;%s;%u]",
|
||||
model = "model[%f,%f;%f,%f;%s;%s;%s;%s;%s;%s;%s]",
|
||||
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
|
||||
animated_image = "animated_image[%f,%f;%f,%f;;%s;%u;%u]",
|
||||
item_image_button = "item_image_button[%f,%f;%f,%f;%s;%s;%s]",
|
||||
}
|
||||
|
||||
return PNG, styles, fs_elements
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +1,5 @@
|
|||
# The progressive mode shows recipes you can craft from items you ever had in your inventory.
|
||||
i3_progressive_mode (Learn crafting recipes progressively) bool false
|
||||
|
||||
# Regroup the items of the same type in the item list.
|
||||
i3_item_compression (Regroup items of the same type) bool true
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||
|
||||
mobs = {
|
||||
mod = "redo",
|
||||
version = "20210613",
|
||||
version = "20210614",
|
||||
intllib = S,
|
||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||
}
|
||||
|
@ -1235,18 +1235,21 @@ function mob_class:do_jump()
|
|||
|
||||
local blocked = minetest.registered_nodes[nodt.name].walkable
|
||||
|
||||
--print("standing on:", self.standing_on, pos.y - 0.25)
|
||||
--print("in front:", nod.name, pos.y + 0.5)
|
||||
--print("in front above:", nodt.name, pos.y + 1.5)
|
||||
|
||||
-- are we facing a fence or wall
|
||||
if nod.name:find("fence") or nod.name:find("gate") or nod.name:find("wall") then
|
||||
self.facing_fence = true
|
||||
end
|
||||
|
||||
-- jump if standing on solid node (not snow) and not blocked above
|
||||
--[[
|
||||
print("on: " .. self.standing_on
|
||||
.. ", front: " .. nod.name
|
||||
.. ", front above: " .. nodt.name
|
||||
.. ", blocked: " .. (blocked and "yes" or "no")
|
||||
.. ", fence: " .. (self.facing_fence and "yes" or "no")
|
||||
)
|
||||
]]
|
||||
-- jump if standing on solid node (not snow) and not blocked
|
||||
if (self.walk_chance == 0 or minetest.registered_items[nod.name].walkable)
|
||||
and not blocked and nod.name ~= node_snow then
|
||||
and not blocked and not self.facing_fence and nod.name ~= node_snow then
|
||||
|
||||
local v = self.object:get_velocity()
|
||||
|
||||
|
|
|
@ -242,6 +242,12 @@ A schematic format with support for metadata and baked light data. **Experimenta
|
|||
|
||||
## Release Notes
|
||||
|
||||
### `rolling-70`
|
||||
|
||||
* Fixes module environments once and for all
|
||||
* Fixes vector aliases
|
||||
* Presumably boosts performance
|
||||
|
||||
### `rolling-69`
|
||||
|
||||
* Fixes various things, **most importantly modules indexing the global table**
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
local class = getfenv(1)
|
||||
local metatable = {__index = function(_self, key)
|
||||
return rawget(class, key)
|
||||
end}
|
||||
-- Localize globals
|
||||
local assert, error, math, modlib, next, pairs, setmetatable, table = assert, error, math, modlib, next, pairs, setmetatable, table
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
local metatable = {__index = _ENV}
|
||||
|
||||
--! experimental
|
||||
--+ Reads a single BB3D chunk from a stream
|
||||
|
@ -360,4 +364,7 @@ function get_animated_bone_properties(self, keyframe, interpolate)
|
|||
end
|
||||
get_props(self.node)
|
||||
return bone_properties
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local assert, math = assert, math
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
-- All little endian
|
||||
|
||||
--+ Reads doubles (f64) or floats (f32)
|
||||
|
@ -112,4 +119,7 @@ end
|
|||
|
||||
function write_double(write_byte, number)
|
||||
return write_float(write_byte, number, nil, true)
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,12 +1,16 @@
|
|||
-- Localize globals
|
||||
local assert, error, ipairs, math, modlib, next, pairs, setmetatable, string, table, type, unpack = assert, error, ipairs, math, modlib, next, pairs, setmetatable, string, table, type, unpack
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
--! experimental
|
||||
local bluon = getfenv(1)
|
||||
|
||||
local no_op = modlib.func.no_op
|
||||
local write_float = modlib.binary.write_float
|
||||
|
||||
local metatable = {__index = function(_self, key)
|
||||
return rawget(bluon, key)
|
||||
end}
|
||||
local metatable = {__index = _ENV}
|
||||
|
||||
function new(self)
|
||||
return setmetatable(self or {}, metatable)
|
||||
|
@ -323,4 +327,7 @@ function read(self, stream)
|
|||
return
|
||||
end
|
||||
return _read(type)
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local assert, dump, error, ipairs, minetest, modlib, pairs, pcall, table, tonumber, type = assert, dump, error, ipairs, minetest, modlib, pairs, pcall, table, tonumber, type
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
-- not deprecated
|
||||
function build_tree(dict)
|
||||
local tree = {}
|
||||
|
@ -293,4 +300,7 @@ function check_constraints(value, constraints)
|
|||
error(possible_errors)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local _G, debug, getfenv, table, tostring = _G, debug, getfenv, table, tostring
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
function variables(stacklevel)
|
||||
stacklevel = (stacklevel or 1) + 1
|
||||
local locals = {}
|
||||
|
@ -40,4 +47,7 @@ function stack(stacklevel)
|
|||
stacklevel = stacklevel + 1
|
||||
end
|
||||
return stack
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local io, minetest, modlib, string = io, minetest, modlib, string
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
function read(filename)
|
||||
local file = io.open(filename, "r")
|
||||
if file == nil then return nil end
|
||||
|
@ -104,4 +111,7 @@ end
|
|||
function process_bridge_start(name, command, os_execute)
|
||||
local bridge = process_bridges[name]
|
||||
os_execute(string.format(command, bridge.output, bridge.input, bridge.logs))
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local error, modlib, unpack = error, modlib, unpack
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
no_op = function() end
|
||||
|
||||
function curry(func, ...)
|
||||
|
@ -110,4 +117,7 @@ end
|
|||
|
||||
function or_(a, b)
|
||||
return a or b
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,4 +1,11 @@
|
|||
local metatable = {__index = getfenv(1)}
|
||||
-- Localize globals
|
||||
local math, setmetatable, table = math, setmetatable, table
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
local metatable = {__index = _ENV}
|
||||
|
||||
function less_than(a, b) return a < b end
|
||||
|
||||
|
@ -47,4 +54,7 @@ function pop(self)
|
|||
end
|
||||
heapify(1)
|
||||
return value
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,5 +1,3 @@
|
|||
local rawget, rawset = rawget, rawset
|
||||
|
||||
-- Lua version check
|
||||
if _VERSION then
|
||||
if _VERSION < "Lua 5" then
|
||||
|
@ -59,16 +57,8 @@ for _, file in pairs{
|
|||
modules[file] = file
|
||||
end
|
||||
if minetest then
|
||||
modules.minetest = {
|
||||
"misc",
|
||||
"collisionboxes",
|
||||
"liquid",
|
||||
"raycast",
|
||||
"wielditem_change",
|
||||
"colorspec",
|
||||
"schematic"
|
||||
}
|
||||
for _, file in pairs{
|
||||
"minetest",
|
||||
"log",
|
||||
"player",
|
||||
-- deprecated
|
||||
|
@ -77,12 +67,31 @@ if minetest then
|
|||
modules[file] = file
|
||||
end
|
||||
end
|
||||
-- aliases
|
||||
modules.string = "text"
|
||||
modules.number = "math"
|
||||
|
||||
local load_module, get_resource, loadfile_exports
|
||||
local parent_dir
|
||||
if not minetest then
|
||||
local init_path = arg and arg[0]
|
||||
parent_dir = init_path and init_path:match"^.[/\\]" or ""
|
||||
end
|
||||
|
||||
-- only used if Minetest is available
|
||||
local function get_resource(modname, resource, ...)
|
||||
if not resource then
|
||||
resource = modname
|
||||
modname = minetest.get_current_modname()
|
||||
end
|
||||
return table.concat({minetest.get_modpath(modname), resource, ...}, modlib.dir_delim)
|
||||
end
|
||||
|
||||
local rawget, rawset = rawget, rawset
|
||||
modlib = setmetatable({
|
||||
-- TODO bump on release
|
||||
version = 69,
|
||||
version = 70,
|
||||
modname = minetest and minetest.get_current_modname(),
|
||||
-- TODO
|
||||
dir_delim = rawget(_G, "DIR_DELIM") or "/",
|
||||
_RG = setmetatable({}, {
|
||||
__index = function(_, index)
|
||||
|
@ -98,66 +107,31 @@ modlib = setmetatable({
|
|||
end
|
||||
end
|
||||
}, {
|
||||
__index = function(self, module_name)
|
||||
local files = modules[module_name]
|
||||
local environment
|
||||
if type(files) == "string" then
|
||||
environment = load_module(files)
|
||||
elseif files then
|
||||
environment = loadfile_exports(get_resource(self.modname, module_name, files[1] .. ".lua"))
|
||||
for index = 2, #files do
|
||||
self.mod.include_env(get_resource(self.modname, module_name, files[index] .. ".lua"), environment)
|
||||
end
|
||||
else
|
||||
__index = function(self, module_name_or_alias)
|
||||
local module_name = modules[module_name_or_alias]
|
||||
if not module_name then
|
||||
-- module not available, return nil
|
||||
return
|
||||
end
|
||||
local module = {}
|
||||
for key, value in pairs(environment) do
|
||||
-- Shallow copy. Doesn't use `modlib.table.shallowcopy` as that is part of a module, too.
|
||||
module[key] = value
|
||||
local environment
|
||||
if module_name ~= module_name_or_alias then
|
||||
-- alias handling
|
||||
environment = self[module_name]
|
||||
else
|
||||
environment = dofile(minetest
|
||||
and get_resource(self.modname, module_name .. ".lua")
|
||||
or (parent_dir .. module_name .. ".lua"))
|
||||
end
|
||||
self[module_name] = module
|
||||
return module
|
||||
self[module_name_or_alias] = environment
|
||||
return environment
|
||||
end
|
||||
})
|
||||
|
||||
function get_resource(modname, resource, ...)
|
||||
if not resource then
|
||||
resource = modname
|
||||
modname = minetest.get_current_modname()
|
||||
end
|
||||
return table.concat({minetest.get_modpath(modname), resource, ...}, modlib.dir_delim)
|
||||
end
|
||||
|
||||
function loadfile_exports(filename)
|
||||
local env = setmetatable({}, {__index = _G})
|
||||
local file = assert(loadfile(filename))
|
||||
setfenv(file, env)
|
||||
file()
|
||||
return env
|
||||
end
|
||||
|
||||
local parent_dir
|
||||
if not minetest then
|
||||
local init_path = arg and arg[0]
|
||||
parent_dir = init_path and init_path:match"^.[/\\]" or ""
|
||||
end
|
||||
function load_module(module_name)
|
||||
local file = module_name .. ".lua"
|
||||
return loadfile_exports(minetest and get_resource(modlib.modname, file) or (parent_dir .. file))
|
||||
end
|
||||
|
||||
modlib.mod = minetest and loadfile_exports(get_resource(modlib.modname, "mod.lua"))
|
||||
|
||||
-- Aliases
|
||||
modlib.string = modlib.text
|
||||
modlib.number = modlib.math
|
||||
modlib.mod = minetest and dofile(get_resource(modlib.modname, "mod.lua"))
|
||||
|
||||
if minetest then
|
||||
modlib.conf.build_setting_tree()
|
||||
|
||||
modlib.mod.get_resource = get_resource
|
||||
modlib.mod.loadfile_exports = loadfile_exports
|
||||
end
|
||||
|
||||
_ml = modlib
|
||||
|
@ -166,4 +140,5 @@ _ml = modlib
|
|||
--modlib.mod.include"test.lua"
|
||||
]]
|
||||
|
||||
-- TODO verify localizations suffice
|
||||
return modlib
|
|
@ -1,7 +1,11 @@
|
|||
local class = getfenv(1)
|
||||
local metatable = {__index = function(_self, key)
|
||||
return rawget(class, key)
|
||||
end}
|
||||
-- Localize globals
|
||||
local assert, math, modlib, setmetatable, table, unpack = assert, math, modlib, setmetatable, table, unpack
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
local metatable = {__index = _ENV}
|
||||
|
||||
distance = modlib.vector.distance
|
||||
|
||||
|
@ -54,4 +58,7 @@ function get_nearest_neighbor(self, vector)
|
|||
return nearest_neighbor, min_distance
|
||||
end
|
||||
|
||||
-- TODO insertion & deletion + rebalancing
|
||||
-- TODO insertion & deletion + rebalancing
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local ipairs, minetest, modlib, os, pairs, table = ipairs, minetest, modlib, os, pairs, table
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
-- Log helpers - write to log, force writing to file
|
||||
minetest.mkdir(minetest.get_worldpath() .. "/logs")
|
||||
channels = {}
|
||||
|
@ -74,3 +81,7 @@ minetest.register_on_shutdown(
|
|||
write_all_to_file()
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local math, minetest, modlib, os, string, table = math, minetest, modlib, os, string, table
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
-- Make random random
|
||||
math.randomseed(minetest and minetest.get_us_time() or os.time() + os.clock())
|
||||
for _ = 1, 100 do math.random() end
|
||||
|
@ -68,4 +75,7 @@ function fround(number)
|
|||
return sign * math.huge
|
||||
end
|
||||
return sign * powexp * (leading - mantissa / 0x800000)
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -0,0 +1,12 @@
|
|||
local _ENV = setmetatable({}, {__index = _G})
|
||||
local function load(filename)
|
||||
assert(loadfile(modlib.mod.get_resource(modlib.modname, "minetest", filename .. ".lua")))(_ENV)
|
||||
end
|
||||
load"misc"
|
||||
load"collisionboxes"
|
||||
load"liquid"
|
||||
load"raycast"
|
||||
load"wielditem_change"
|
||||
load"colorspec"
|
||||
load"schematic"
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local assert, ipairs, math, minetest, pairs, table, type, vector = assert, ipairs, math, minetest, pairs, table, type, vector
|
||||
|
||||
-- Set environment
|
||||
local _ENV = ...
|
||||
setfenv(1, _ENV)
|
||||
|
||||
-- Minetest allows shorthand collisionbox = {...} instead of {{...}}
|
||||
local function get_collisionboxes(box_or_boxes)
|
||||
return type(box_or_boxes[1]) == "number" and {box_or_boxes} or box_or_boxes
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local assert, error, math, minetest, setmetatable, tonumber, type = assert, error, math, minetest, setmetatable, tonumber, type
|
||||
|
||||
-- Set environment
|
||||
local _ENV = ...
|
||||
setfenv(1, _ENV)
|
||||
|
||||
-- As in src/util/string.cpp
|
||||
named_colors = {
|
||||
aliceblue = 0xf0f8ff,
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local minetest, modlib, pairs = minetest, modlib, pairs
|
||||
|
||||
-- Set environment
|
||||
local _ENV = ...
|
||||
setfenv(1, _ENV)
|
||||
|
||||
liquid_level_max = 8
|
||||
--+ Calculates the corner levels of a flowingliquid node
|
||||
--> 4 corner levels from -0.5 to 0.5 as list of `modlib.vector`
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local assert, minetest, modlib, next, pairs, string, table, type = assert, minetest, modlib, next, pairs, string, table, type
|
||||
|
||||
-- Set environment
|
||||
local _ENV = ...
|
||||
setfenv(1, _ENV)
|
||||
|
||||
max_wear = 2 ^ 16 - 1
|
||||
function override(function_name, function_builder)
|
||||
local func = minetest[function_name]
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local assert, math, minetest, modlib, pairs, setmetatable, vector = assert, math, minetest, modlib, pairs, setmetatable, vector
|
||||
|
||||
-- Set environment
|
||||
local _ENV = ...
|
||||
setfenv(1, _ENV)
|
||||
|
||||
--+ Raycast wrapper with proper flowingliquid intersections
|
||||
function raycast(_pos1, _pos2, objects, liquids)
|
||||
local raycast = minetest.raycast(_pos1, _pos2, objects, liquids)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local VoxelArea, assert, error, io, ipairs, math, minetest, modlib, next, pairs, setmetatable, table, vector = VoxelArea, assert, error, io, ipairs, math, minetest, modlib, next, pairs, setmetatable, table, vector
|
||||
|
||||
-- Set environment
|
||||
local _ENV = ...
|
||||
setfenv(1, _ENV)
|
||||
|
||||
schematic = {}
|
||||
local metatable = {__index = schematic}
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local minetest, modlib, pairs, table = minetest, modlib, pairs, table
|
||||
|
||||
-- Set environment
|
||||
local _ENV = ...
|
||||
setfenv(1, _ENV)
|
||||
|
||||
players = {}
|
||||
|
||||
registered_on_wielditem_changes = {function(...)
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
-- Localize globals
|
||||
local Settings, _G, assert, dofile, error, getmetatable, ipairs, loadfile, loadstring, minetest, modlib, pairs, rawget, rawset, setfenv, setmetatable, tonumber, type = Settings, _G, assert, dofile, error, getmetatable, ipairs, loadfile, loadstring, minetest, modlib, pairs, rawget, rawset, setfenv, setmetatable, tonumber, type
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
function loadfile_exports(filename)
|
||||
local env = setmetatable({}, {__index = _G})
|
||||
local file = assert(loadfile(filename))
|
||||
setfenv(file, env)
|
||||
file()
|
||||
return env
|
||||
end
|
||||
|
||||
-- get resource + dofile
|
||||
function include(modname, file)
|
||||
if not file then
|
||||
|
@ -128,4 +143,7 @@ function configuration(modname)
|
|||
return schema:load({}, {error_message = true})
|
||||
end
|
||||
return conf
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local assert, error, io, ipairs, loadfile, math, minetest, modlib, pairs, setfenv, setmetatable, table, type = assert, error, io, ipairs, loadfile, math, minetest, modlib, pairs, setfenv, setmetatable, table, type
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
lua_log_file = {}
|
||||
local files = {}
|
||||
local metatable = {__index = lua_log_file}
|
||||
|
@ -158,4 +165,7 @@ function lua_log_file:rewrite()
|
|||
end
|
||||
self:_rewrite()
|
||||
self:open()
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local ipairs, minetest, modlib, table = ipairs, minetest, modlib, table
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
forbidden_names = {}
|
||||
|
||||
function register_forbidden_name(name) forbidden_names[name] = true end
|
||||
|
@ -75,4 +82,7 @@ function datatable(table, default)
|
|||
end)
|
||||
minetest.register_on_leaveplayer(function(player) table[player:get_player_name()] = nil end)
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local math, modlib, pairs, unpack, vector = math, modlib, pairs, unpack, vector
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
-- TODO OOP, extend vector
|
||||
|
||||
function from_euler_rotation(rotation)
|
||||
|
@ -126,4 +133,7 @@ function to_euler_rotation_irrlicht(self)
|
|||
end
|
||||
|
||||
return vector.apply(_calc(), math.deg)
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,7 +1,11 @@
|
|||
local class = getfenv(1)
|
||||
local metatable = {__index = function(_self, key)
|
||||
return rawget(class, key)
|
||||
end}
|
||||
-- Localize globals
|
||||
local assert, modlib, pairs, setmetatable, table = assert, modlib, pairs, setmetatable, table
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
local metatable = {__index = _ENV}
|
||||
|
||||
comparator = modlib.table.default_comparator
|
||||
|
||||
|
@ -311,4 +315,7 @@ function get_by_rank(self, rank)
|
|||
tree = right
|
||||
end
|
||||
until not tree
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,7 +1,11 @@
|
|||
local class = getfenv(1)
|
||||
local metatable = {__index = function(_self, key)
|
||||
return rawget(class, key)
|
||||
end}
|
||||
-- Localize globals
|
||||
local assert, error, ipairs, math, minetest, modlib, pairs, setmetatable, table, tonumber, tostring, type = assert, error, ipairs, math, minetest, modlib, pairs, setmetatable, table, tonumber, tostring, type
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
local metatable = {__index = _ENV}
|
||||
|
||||
function new(def)
|
||||
-- TODO type inference, sanity checking etc.
|
||||
|
@ -295,4 +299,7 @@ function load(self, override, params)
|
|||
end
|
||||
if self.func then self.func(override) end
|
||||
return override
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local assert, error, ipairs, math, next, pairs, rawget, rawset, setmetatable, string, table, type = assert, error, ipairs, math, next, pairs, rawget, rawset, setmetatable, string, table, type
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
-- Table helpers
|
||||
|
||||
function map_index(table, func)
|
||||
|
@ -586,4 +593,7 @@ function repetition(value, count)
|
|||
table[index] = value
|
||||
end
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,3 +1,10 @@
|
|||
-- Localize globals
|
||||
local math, modlib, pairs, setmetatable, string, table = math, modlib, pairs, setmetatable, string, table
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
function upper_first(text) return text:sub(1, 1):upper() .. text:sub(2) end
|
||||
|
||||
function lower_first(text) return text:sub(1, 1):lower() .. text:sub(2) end
|
||||
|
@ -163,4 +170,7 @@ function handle_ifdefs(code, vars)
|
|||
end
|
||||
table.insert(finalcode, string.sub(code, after_endif + 2))
|
||||
return table.concat(finalcode, "")
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,7 +1,11 @@
|
|||
local class = getfenv(1)
|
||||
local metatable = {__index = function(_self, key)
|
||||
return rawget(class, key)
|
||||
end}
|
||||
-- Localize globals
|
||||
local math, next, pairs, setmetatable, string, table, unpack = math, next, pairs, setmetatable, string, table, unpack
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
local metatable = {__index = _ENV}
|
||||
|
||||
function new(table) return setmetatable(table or {}, metatable) end
|
||||
|
||||
|
@ -121,4 +125,7 @@ function find_longest(self, query, query_offset)
|
|||
end
|
||||
end
|
||||
return last_leaf, leaf_pos
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -1,5 +1,11 @@
|
|||
-- Localize globals
|
||||
local assert, math, modlib, pairs, rawset, setmetatable, unpack, vector = assert, math, modlib, pairs, rawset, setmetatable, unpack, vector
|
||||
|
||||
-- Set environment
|
||||
local _ENV = {}
|
||||
setfenv(1, _ENV)
|
||||
|
||||
local mt_vector = vector
|
||||
local class = getfenv(1)
|
||||
|
||||
index_aliases = {
|
||||
x = 1,
|
||||
|
@ -16,10 +22,11 @@ metatable = {
|
|||
if index ~= nil then
|
||||
return table[index]
|
||||
end
|
||||
return rawget(class, key)
|
||||
return _ENV[key]
|
||||
end,
|
||||
__newindex = function(table, key, value)
|
||||
local index = letters[key]
|
||||
-- TODO
|
||||
local index = index_aliases[key]
|
||||
if index ~= nil then
|
||||
return rawset(table, index, value)
|
||||
end
|
||||
|
@ -222,4 +229,7 @@ function triangle_normal(triangle)
|
|||
local point_1, point_2, point_3 = unpack(triangle)
|
||||
local edge_1, edge_2 = subtract(point_2, point_1), subtract(point_3, point_1)
|
||||
return normalize(cross3(edge_1, edge_2))
|
||||
end
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
|
@ -21,7 +21,7 @@ petz.lamb_wool_regrow = function(self)
|
|||
return
|
||||
end
|
||||
local food_count_wool = self.food_count_wool + 1
|
||||
mobkit.remember(self, "food_count_wool", food_count_wool)
|
||||
self.food_count_wool = mobkit.remember(self, "food_count_wool", food_count_wool)
|
||||
if self.food_count_wool >= 5 then -- if lamb replaces 5x grass then it regrows wool
|
||||
self.food_count_wool = mobkit.remember(self, "food_count_wool", 0)
|
||||
self.shaved = mobkit.remember(self, "shaved", false)
|
||||
|
|
|
@ -36,7 +36,7 @@ mobs:register_mob("mobs_monster:lava_flan", {
|
|||
{name = "mobs:lava_orb", chance = 15, min = 1, max = 1},
|
||||
},
|
||||
water_damage = 8,
|
||||
lava_damage = 0,
|
||||
lava_damage = -1,
|
||||
fire_damage = 0,
|
||||
light_damage = 0,
|
||||
immune_to = {
|
||||
|
@ -53,7 +53,7 @@ mobs:register_mob("mobs_monster:lava_flan", {
|
|||
run_start = 20,
|
||||
run_end = 28,
|
||||
punch_start = 20,
|
||||
punch_end = 28,
|
||||
punch_end = 28
|
||||
},
|
||||
on_die = function(self, pos)
|
||||
|
||||
|
@ -174,9 +174,13 @@ minetest.register_tool(":mobs:pick_lava", {
|
|||
inventory_image = "mobs_pick_lava.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.4,
|
||||
max_drop_level=3,
|
||||
groupcaps={
|
||||
cracky = {times={[1]=1.80, [2]=0.80, [3]=0.40}, uses=40, maxlevel=3},
|
||||
max_drop_level = 3,
|
||||
groupcaps = {
|
||||
cracky = {
|
||||
times = {[1] = 1.80, [2] = 0.80, [3] = 0.40},
|
||||
uses = 40,
|
||||
maxlevel = 3
|
||||
}
|
||||
},
|
||||
damage_groups = {fleshy = 6, fire = 1},
|
||||
},
|
||||
|
@ -189,7 +193,7 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
{"mobs:lava_orb", "mobs:lava_orb", "mobs:lava_orb"},
|
||||
{"", "default:obsidian_shard", ""},
|
||||
{"", "default:obsidian_shard", ""},
|
||||
{"", "default:obsidian_shard", ""}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -253,7 +257,7 @@ mobs:register_mob("mobs_monster:obsidian_flan", {
|
|||
run_start = 20,
|
||||
run_end = 28,
|
||||
punch_start = 20,
|
||||
punch_end = 28,
|
||||
punch_end = 28
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -296,9 +300,11 @@ mobs:register_arrow("mobs_monster:obsidian_arrow", {
|
|||
|
||||
local radius = 1
|
||||
local def = minetest.registered_nodes[node]
|
||||
|
||||
if def then
|
||||
node = { name = node }
|
||||
node = {name = node}
|
||||
end
|
||||
|
||||
if def and def.tiles and def.tiles[1] then
|
||||
texture = def.tiles[1]
|
||||
end
|
||||
|
@ -325,7 +331,7 @@ mobs:register_arrow("mobs_monster:obsidian_arrow", {
|
|||
texture = texture,
|
||||
-- ^ only as fallback for clients without support for `node` parameter
|
||||
node = node,
|
||||
collisiondetection = true,
|
||||
collisiondetection = true
|
||||
})
|
||||
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
|
|
|
@ -55,12 +55,14 @@ armor = {
|
|||
crystal = "ethereal:crystal_ingot",
|
||||
},
|
||||
fire_nodes = {
|
||||
{"nether:lava_source", 5, 8},
|
||||
{"default:lava_source", 5, 8},
|
||||
{"default:lava_flowing", 5, 8},
|
||||
{"fire:basic_flame", 3, 4},
|
||||
{"fire:permanent_flame", 3, 4},
|
||||
{"ethereal:crystal_spike", 2, 1},
|
||||
{"ethereal:fire_flower", 2, 1},
|
||||
{"nether:lava_crust", 2, 1},
|
||||
{"default:torch", 1, 1},
|
||||
{"default:torch_ceiling", 1, 1},
|
||||
{"default:torch_wall", 1, 1},
|
||||
|
@ -671,3 +673,10 @@ armor.drop_armor = function(pos, stack)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Allows skin mod to be set manually.
|
||||
--
|
||||
-- Useful for skin mod forks that do not use the same name.
|
||||
armor.set_skin_mod = function(mod)
|
||||
armor.skin_mod = mod
|
||||
end
|
||||
|
|
|
@ -69,12 +69,12 @@ end
|
|||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
wieldview.wielded_item[name] = ""
|
||||
minetest.after(0, function()
|
||||
local pplayer = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
minetest.after(0, function(pname)
|
||||
local pplayer = minetest.get_player_by_name(pname)
|
||||
if pplayer then
|
||||
wieldview:update_wielded_item(pplayer)
|
||||
end
|
||||
end)
|
||||
end, name)
|
||||
end)
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
|
|
@ -95,6 +95,8 @@ end)
|
|||
|
||||
-- default biomes deco
|
||||
local deco = {
|
||||
{"default:dry_dirt", dry_grass, {}},
|
||||
{"default:dry_dirt_with_dry_grass", dry_grass, {}},
|
||||
{"default:dirt_with_dry_grass", dry_grass, flowers},
|
||||
{"default:sand", {}, {"default:dry_shrub", "", "", ""} },
|
||||
{"default:desert_sand", {}, {"default:dry_shrub", "", "", ""} },
|
||||
|
|
Loading…
Reference in New Issue