More crafing recipes and fix parachutes and compasses
This commit is contained in:
parent
063ff13475
commit
0feaa580d5
@ -332,7 +332,7 @@ crafting.register_craft(
|
||||
{
|
||||
output = "default:heated_dirt_path",
|
||||
items = {
|
||||
"group:soil_path",
|
||||
"default:dirt_path",
|
||||
"default:ingot_steel",
|
||||
}
|
||||
})
|
||||
|
@ -1,2 +1,3 @@
|
||||
achievements
|
||||
default
|
||||
crafting
|
||||
achievements
|
||||
|
@ -257,15 +257,15 @@ minetest.register_craftitem(
|
||||
stack_max = 120
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "gold:trading_book",
|
||||
type = "shapeless",
|
||||
recipe = {"default:book", "gold:gold"}
|
||||
items = {
|
||||
"default:book",
|
||||
"gold:gold",
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_alias("gold", "gold:gold")
|
||||
|
||||
minetest.register_node(
|
||||
"gold:ore",
|
||||
{
|
||||
|
@ -1,2 +1,3 @@
|
||||
default
|
||||
crafting
|
||||
achievements
|
||||
|
@ -1,13 +1,38 @@
|
||||
|
||||
--
|
||||
-- Jewels mod
|
||||
-- By Kaadmy
|
||||
--
|
||||
|
||||
jewels = {}
|
||||
|
||||
-- Array of registered jeweled tools
|
||||
|
||||
jewels.registered_jewels = {}
|
||||
|
||||
local function p(i)
|
||||
if i >= 0 then i = "+" .. i end
|
||||
-- Formspec
|
||||
|
||||
local form_bench = default.ui.get_page("default:2part")
|
||||
|
||||
form_bench = form_bench .. "list[current_name;main;2.25,1.75;1,1;]"
|
||||
form_bench = form_bench .. "listring[current_name;main]"
|
||||
form_bench = form_bench .. default.ui.get_itemslot_bg(2.25, 1.75, 1, 1)
|
||||
|
||||
form_bench = form_bench .. "label[3.25,1.75;1. Place unjeweled tool here]"
|
||||
form_bench = form_bench .. "label[3.25,2.25;2. Hold a jewel and punch the bench]"
|
||||
|
||||
form_bench = form_bench .. "list[current_player;main;0.25,4.75;8,4;]"
|
||||
form_bench = form_bench .. "listring[current_player;main]"
|
||||
form_bench = form_bench .. default.ui.get_hotbar_itemslot_bg(0.25, 4.75, 8, 1)
|
||||
form_bench = form_bench .. default.ui.get_itemslot_bg(0.25, 5.75, 8, 3)
|
||||
|
||||
default.ui.register_page("jewels_bench", form_bench)
|
||||
|
||||
local function plus_power(i)
|
||||
if i >= 0 then
|
||||
i = "+" .. i
|
||||
end
|
||||
|
||||
return i
|
||||
end
|
||||
|
||||
@ -31,6 +56,7 @@ function jewels.register_jewel(toolname, new_toolname, def)
|
||||
if not jewels.registered_jewels[toolname] then
|
||||
jewels.registered_jewels[toolname] = {}
|
||||
end
|
||||
|
||||
table.insert(jewels.registered_jewels[toolname], data)
|
||||
|
||||
local tooldef = minetest.deserialize(minetest.serialize(minetest.registered_tools[toolname]))
|
||||
@ -59,13 +85,13 @@ function jewels.register_jewel(toolname, new_toolname, def)
|
||||
|
||||
if data.stats.range and new_tooldef.range then
|
||||
new_tooldef.range = new_tooldef.range + data.stats.range
|
||||
desc = desc .. "\nRange: " .. p(data.stats.range)
|
||||
desc = desc .. "\nRange: " .. plus_power(data.stats.range)
|
||||
end
|
||||
|
||||
if new_tooldef.tool_capabilities then
|
||||
if data.stats.maxdrop and new_tooldef.tool_capabilities.max_drop_level then
|
||||
new_tooldef.tool_capabilities.max_drop_level = new_tooldef.tool_capabilities.max_drop_level + data.stats.maxdrop
|
||||
desc = desc .. "\nDrop level: " .. p(data.stats.maxdrop)
|
||||
desc = desc .. "\nDrop level: " .. plus_power(data.stats.maxdrop)
|
||||
end
|
||||
|
||||
if data.stats.digspeed then
|
||||
@ -83,19 +109,19 @@ function jewels.register_jewel(toolname, new_toolname, def)
|
||||
end
|
||||
end
|
||||
|
||||
desc = desc .. "\nDig time: " .. p(data.stats.digspeed) .. " seconds"
|
||||
desc = desc .. "\nDig time: " .. plus_power(data.stats.digspeed) .. " seconds"
|
||||
end
|
||||
|
||||
if data.stats.uses then
|
||||
desc = desc .. "\nUses: " .. p(data.stats.uses)
|
||||
desc = desc .. "\nUses: " .. plus_power(data.stats.uses)
|
||||
end
|
||||
if data.stats.maxlevel then
|
||||
desc = desc .. "\nDig level: " .. p(data.stats.maxlevel)
|
||||
desc = desc .. "\nDig level: " .. plus_power(data.stats.maxlevel)
|
||||
end
|
||||
|
||||
if data.stats.fleshy and new_tooldef.tool_capabilities.damage_groups and new_tooldef.tool_capabilities.damage_groups.fleshy then
|
||||
new_tooldef.tool_capabilities.damage_groups.fleshy = new_tooldef.tool_capabilities.damage_groups.fleshy + data.stats.fleshy
|
||||
desc = desc .. "\nDamage: " .. p(data.stats.fleshy)
|
||||
desc = desc .. "\nDamage: " .. plus_power(data.stats.fleshy)
|
||||
end
|
||||
end
|
||||
|
||||
@ -177,30 +203,16 @@ minetest.register_node(
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "jewels:bench",
|
||||
recipe = {
|
||||
{"group:planks", "jewels:jewel", "group:planks"},
|
||||
{"default:ingot_carbonsteel", "group:planks", "default:ingot_carbonsteel"},
|
||||
{"group:planks", "group:planks", "group:planks"}
|
||||
items = {
|
||||
"group:planks 5",
|
||||
"default:ingot_carbonsteel 2",
|
||||
"jewels:jewel",
|
||||
}
|
||||
})
|
||||
|
||||
local form_bench = default.ui.get_page("default:2part")
|
||||
form_bench = form_bench .. "list[current_name;main;2.25,1.75;1,1;]"
|
||||
form_bench = form_bench .. "listring[current_name;main]"
|
||||
form_bench = form_bench .. default.ui.get_itemslot_bg(2.25, 1.75, 1, 1)
|
||||
|
||||
form_bench = form_bench .. "label[3.25,1.75;1. Place unjeweled tool here]"
|
||||
form_bench = form_bench .. "label[3.25,2.25;2. Hold a jewel and punch the bench]"
|
||||
|
||||
form_bench = form_bench .. "list[current_player;main;0.25,4.75;8,4;]"
|
||||
form_bench = form_bench .. "listring[current_player;main]"
|
||||
form_bench = form_bench .. default.ui.get_hotbar_itemslot_bg(0.25, 4.75, 8, 1)
|
||||
form_bench = form_bench .. default.ui.get_itemslot_bg(0.25, 5.75, 8, 3)
|
||||
default.ui.register_page("jewels_bench", form_bench)
|
||||
|
||||
minetest.register_node(
|
||||
"jewels:jewel_ore",
|
||||
{
|
||||
@ -224,8 +236,6 @@ minetest.register_ore(
|
||||
y_max = 31000,
|
||||
})
|
||||
|
||||
dofile(minetest.get_modpath("jewels").."/jewels.lua")
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
@ -244,4 +254,8 @@ achievements.register_achievement(
|
||||
times = 10,
|
||||
})
|
||||
|
||||
-- The tool jewel definitions
|
||||
|
||||
dofile(minetest.get_modpath("jewels").."/jewels.lua")
|
||||
|
||||
default.log("mod:jewels", "loaded")
|
||||
|
@ -3,6 +3,7 @@
|
||||
--
|
||||
|
||||
-- Pickaxes
|
||||
|
||||
jewels.register_jewel(
|
||||
"default:pick_stone",
|
||||
"jewels:pick_stone_digspeed",
|
||||
@ -85,6 +86,7 @@ jewels.register_jewel(
|
||||
})
|
||||
|
||||
-- Shovels
|
||||
|
||||
jewels.register_jewel(
|
||||
"default:shovel_stone",
|
||||
"jewels:shovel_stone_digspeed",
|
||||
@ -167,6 +169,7 @@ jewels.register_jewel(
|
||||
})
|
||||
|
||||
-- Axes
|
||||
|
||||
jewels.register_jewel(
|
||||
"default:axe_stone",
|
||||
"jewels:axe_stone_digspeed",
|
||||
@ -249,6 +252,7 @@ jewels.register_jewel(
|
||||
})
|
||||
|
||||
-- Spears
|
||||
|
||||
jewels.register_jewel(
|
||||
"default:spear_stone",
|
||||
"jewels:spear_stone_digspeed",
|
||||
|
@ -1,2 +1,3 @@
|
||||
default
|
||||
crafting
|
||||
achievements
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
--
|
||||
-- Locks mod
|
||||
-- By Kaadmy, for Pixture
|
||||
@ -5,9 +6,13 @@
|
||||
|
||||
locks = {}
|
||||
|
||||
-- Settings
|
||||
|
||||
local picked_time = tonumber(minetest.setting_get("locks_picked_time")) or 15 -- unlocked for 15 seconds
|
||||
local all_unlocked = minetest.setting_getbool("locks_all_unlocked")
|
||||
|
||||
-- API functions
|
||||
|
||||
function locks.is_owner(meta, player)
|
||||
local name = player:get_player_name()
|
||||
local owner = meta:get_string("lock_owner")
|
||||
@ -41,6 +46,8 @@ function locks.is_locked(meta, player)
|
||||
return true
|
||||
end
|
||||
|
||||
-- Items and nodes
|
||||
|
||||
minetest.register_tool(
|
||||
"locks:pick",
|
||||
{
|
||||
@ -62,7 +69,8 @@ minetest.register_tool(
|
||||
if own then
|
||||
minetest.chat_send_player(
|
||||
own,
|
||||
minetest.colorize("#f00", player:get_player_name() .. " has broken into your locked chest!"))
|
||||
minetest.colorize("#f00", player:get_player_name()
|
||||
.. " has broken into your locked chest!"))
|
||||
end
|
||||
end
|
||||
|
||||
@ -80,26 +88,6 @@ minetest.register_craftitem(
|
||||
wield_image = "locks_lock.png",
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "locks:pick",
|
||||
recipe = {
|
||||
{"", "", "default:ingot_steel"},
|
||||
{"", "default:stick", ""},
|
||||
{"default:stick", "", ""},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "locks:lock",
|
||||
recipe = {
|
||||
{"", "default:ingot_steel", ""},
|
||||
{"default:ingot_steel", "", "default:ingot_steel"},
|
||||
{"group:planks", "group:planks", "group:planks"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"locks:chest",
|
||||
{
|
||||
@ -189,11 +177,33 @@ minetest.register_node(
|
||||
on_blast = function() end,
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
-- Crafting
|
||||
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "locks:pick",
|
||||
items = {
|
||||
"default:ingot_carbonsteel 2",
|
||||
"default:stick 3",
|
||||
},
|
||||
})
|
||||
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "locks:lock",
|
||||
items = {
|
||||
"default:ingot_steel 3",
|
||||
"group:planks 2",
|
||||
},
|
||||
})
|
||||
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "locks:chest",
|
||||
type = "shapeless",
|
||||
recipe = {"default:chest", "locks:lock"},
|
||||
items = {
|
||||
"default:chest",
|
||||
"locks:lock",
|
||||
},
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
@ -1,4 +1,5 @@
|
||||
achievements
|
||||
default
|
||||
tnt
|
||||
util
|
||||
crafting
|
||||
achievements
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
--
|
||||
-- Lumien mod
|
||||
-- By Kaadmy, for Pixture
|
||||
@ -6,6 +7,47 @@
|
||||
local lumien_on_radius = 2
|
||||
local lumien_off_radius = 4
|
||||
|
||||
local timer_interval = 1
|
||||
local timer = 0
|
||||
|
||||
-- Update function
|
||||
|
||||
local function on_globalstep(dtime)
|
||||
timer = timer + dtime
|
||||
|
||||
if timer < timer_interval then
|
||||
return
|
||||
end
|
||||
|
||||
timer = 0
|
||||
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local pos = player:getpos()
|
||||
|
||||
util.nodefunc(
|
||||
{x = pos.x-lumien_on_radius, y = pos.y-lumien_on_radius, z = pos.z-lumien_on_radius},
|
||||
{x = pos.x+lumien_on_radius, y = pos.y+lumien_on_radius, z = pos.z+lumien_on_radius},
|
||||
"lumien:crystal_off",
|
||||
function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
minetest.set_node(
|
||||
pos,
|
||||
{
|
||||
name = "lumien:crystal_on",
|
||||
param = node.param,
|
||||
param2 = node.param2
|
||||
})
|
||||
end,
|
||||
true
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_globalstep(on_globalstep)
|
||||
|
||||
-- Nodes
|
||||
|
||||
minetest.register_node(
|
||||
"lumien:crystal_on",
|
||||
{
|
||||
@ -23,7 +65,7 @@ minetest.register_node(
|
||||
},
|
||||
|
||||
groups = {crumbly = 3},
|
||||
light_source = 13,
|
||||
light_source = 12,
|
||||
drop = "lumien:crystal_off",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
@ -54,11 +96,13 @@ minetest.register_node(
|
||||
{
|
||||
description = "Lumien Block",
|
||||
tiles = {"lumien_block.png"},
|
||||
groups = {cracky = 1, stone = 1},
|
||||
groups = {cracky = 1},
|
||||
light_source = 14,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
-- Ores
|
||||
|
||||
minetest.register_node(
|
||||
"lumien:ore",
|
||||
{
|
||||
@ -69,23 +113,6 @@ minetest.register_node(
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "lumien:crystal_off 9",
|
||||
recipe = {"lumien:block"},
|
||||
type = "shapeless",
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "lumien:block",
|
||||
recipe = {
|
||||
{"lumien:crystal_off", "lumien:crystal_off", "lumien:crystal_off"},
|
||||
{"lumien:crystal_off", "lumien:crystal_off", "lumien:crystal_off"},
|
||||
{"lumien:crystal_off", "lumien:crystal_off", "lumien:crystal_off"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_ore(
|
||||
{
|
||||
ore_type = "scatter",
|
||||
@ -98,10 +125,12 @@ minetest.register_ore(
|
||||
y_max = -64,
|
||||
})
|
||||
|
||||
-- Update functions
|
||||
|
||||
minetest.register_abm(
|
||||
{
|
||||
nodenames = {"lumien:crystal_on"},
|
||||
interval = 1,
|
||||
interval = timer_interval,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
util.nodefunc(
|
||||
@ -115,6 +144,7 @@ minetest.register_abm(
|
||||
)
|
||||
|
||||
local ok = true
|
||||
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, lumien_off_radius)) do
|
||||
if object:is_player() then
|
||||
ok = false
|
||||
@ -133,31 +163,23 @@ minetest.register_abm(
|
||||
end,
|
||||
})
|
||||
|
||||
local function step(dtime)
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local pos = player:getpos()
|
||||
-- Crafting
|
||||
|
||||
util.nodefunc(
|
||||
{x = pos.x-lumien_on_radius, y = pos.y-lumien_on_radius, z = pos.z-lumien_on_radius},
|
||||
{x = pos.x+lumien_on_radius, y = pos.y+lumien_on_radius, z = pos.z+lumien_on_radius},
|
||||
"lumien:crystal_off",
|
||||
function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
minetest.set_node(
|
||||
pos,
|
||||
crafting.register_craft(
|
||||
{
|
||||
name = "lumien:crystal_on",
|
||||
param = node.param,
|
||||
param2 = node.param2
|
||||
output = "lumien:crystal_off 9",
|
||||
items = {
|
||||
"lumien:block"
|
||||
},
|
||||
})
|
||||
end,
|
||||
true
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_globalstep(step)
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "lumien:block",
|
||||
items = {
|
||||
"lumien:crystal_off 9",
|
||||
},
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
|
@ -1,2 +1,4 @@
|
||||
achievements
|
||||
default
|
||||
util
|
||||
crafting
|
||||
achievements
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
--
|
||||
-- Music player mod
|
||||
-- By Kaadmy, for Pixture
|
||||
@ -9,7 +10,9 @@ music.default_track = minetest.setting_get("music_track") or "music_catsong"
|
||||
music.track_length = tonumber(minetest.setting_get("music_track_length")) or 30.0
|
||||
music.volume = tonumber(minetest.setting_get("music_volume")) or 1.0
|
||||
|
||||
music.players = {} -- music players
|
||||
-- Array of music players
|
||||
|
||||
music.players = {}
|
||||
|
||||
if minetest.setting_getbool("music_enable") then
|
||||
function music.stop(pos)
|
||||
@ -169,12 +172,12 @@ else
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft(
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "music:player",
|
||||
recipe = {
|
||||
{"group:planks", "group:planks", "group:planks"},
|
||||
{"group:planks", "default:ingot_steel", "group:planks"},
|
||||
items = {
|
||||
"group:planks 5",
|
||||
"default:ingot_steel",
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -1,121 +1,16 @@
|
||||
|
||||
--
|
||||
-- Compass handling
|
||||
--
|
||||
|
||||
local wield_image_0 = "nav_compass_inventory_0.png"
|
||||
local wield_image_1 = "nav_compass_inventory_1.png"
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_0",
|
||||
{
|
||||
description = "Compass(E)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_0.png^[transformR90",
|
||||
wield_image = wield_image_0 .. "^[transformR90",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_1",
|
||||
{
|
||||
description = "Compass(NE)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_1.png^[transformR90",
|
||||
wield_image = wield_image_1 .. "^[transformR90",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_2",
|
||||
{
|
||||
description = "Compass(N)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_0.png",
|
||||
wield_image = wield_image_0,
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_3",
|
||||
{
|
||||
description = "Compass(NW)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_1.png",
|
||||
wield_image = wield_image_1,
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_4",
|
||||
{
|
||||
description = "Compass(W)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_0.png^[transformR270",
|
||||
wield_image = wield_image_0 .. "^[transformR270",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_5",
|
||||
{
|
||||
description = "Compass(SW)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_1.png^[transformR270",
|
||||
wield_image = wield_image_1 .. "^[transformR270",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_6",
|
||||
{
|
||||
description = "Compass(S)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_0.png^[transformR180",
|
||||
wield_image = wield_image_0 .. "^[transformR180",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_7",
|
||||
{
|
||||
description = "Compass(SE)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_1.png^[transformR180",
|
||||
wield_image = wield_image_1 .. "^[transformR180",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_alias("nav:compass", "nav:compass_2")
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "nav:compass_2",
|
||||
recipe = {
|
||||
{"", "default:ingot_carbonsteel", ""},
|
||||
{"default:ingot_steel", "default:stick", "default:ingot_steel"},
|
||||
{"", "default:ingot_steel", ""},
|
||||
}
|
||||
})
|
||||
|
||||
function step(dtime)
|
||||
function on_globalstep(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
|
||||
local yaw = player:get_look_yaw()
|
||||
local yaw = player:get_look_horizontal()
|
||||
local dir = math.floor(((yaw / math.pi) * 4) + 0.5)
|
||||
|
||||
if dir < 0 then
|
||||
@ -139,7 +34,119 @@ function step(dtime)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_globalstep(step)
|
||||
minetest.register_globalstep(on_globalstep)
|
||||
|
||||
-- Items
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_0",
|
||||
{
|
||||
description = "Compass(N)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_0.png",
|
||||
wield_image = wield_image_0,
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_1",
|
||||
{
|
||||
description = "Compass(NE)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_1.png",
|
||||
wield_image = wield_image_1,
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_2",
|
||||
{
|
||||
description = "Compass(E)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_0.png^[transformR270",
|
||||
wield_image = wield_image_0 .. "^[transformR270",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_3",
|
||||
{
|
||||
description = "Compass(SE)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_1.png^[transformR270",
|
||||
wield_image = wield_image_1 .. "^[transformR270",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_4",
|
||||
{
|
||||
description = "Compass(S)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_0.png^[transformR180",
|
||||
wield_image = wield_image_0 .. "^[transformR180",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_5",
|
||||
{
|
||||
description = "Compass(SW)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_1.png^[transformR180",
|
||||
wield_image = wield_image_1 .. "^[transformR180",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_6",
|
||||
{
|
||||
description = "Compass(W)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_0.png^[transformR90",
|
||||
wield_image = wield_image_0 .. "^[transformR90",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:compass_7",
|
||||
{
|
||||
description = "Compass(NW)",
|
||||
|
||||
inventory_image = "nav_compass_inventory_1.png^[transformR90",
|
||||
wield_image = wield_image_1 .. "^[transformR90",
|
||||
|
||||
groups = {nav_compass = 1},
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_alias("nav:compass", "nav:compass_2")
|
||||
|
||||
-- Crafting
|
||||
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "nav:compass_2",
|
||||
items = {
|
||||
"default:ingot_steel 4",
|
||||
"default:stick",
|
||||
}
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
@ -151,3 +158,5 @@ achievements.register_achievement(
|
||||
times = 1,
|
||||
craftitem = "nav:compass_2",
|
||||
})
|
||||
|
||||
default.log("compass", "loaded")
|
||||
|
@ -7,3 +7,5 @@ nav = {}
|
||||
|
||||
dofile(minetest.get_modpath("nav").."/map.lua")
|
||||
dofile(minetest.get_modpath("nav").."/compass.lua")
|
||||
|
||||
default.log("mod:nav", "loaded")
|
||||
|
@ -1,19 +1,26 @@
|
||||
|
||||
--
|
||||
-- Map handling
|
||||
--
|
||||
|
||||
nav.map_radius = 256
|
||||
|
||||
nav.waypoints = {}
|
||||
|
||||
local form_nav = default.ui.get_page("default:default")
|
||||
default.ui.register_page("nav:nav", form_nav)
|
||||
|
||||
local open_formspecs = {}
|
||||
|
||||
-- Timer
|
||||
|
||||
local timer_interval = 0.1
|
||||
local timer = 10
|
||||
local update_time = 0.2
|
||||
|
||||
function nav.add_waypoint(pos, name, label, isinfo, type)
|
||||
nav.waypoints[name] = {pos = pos, label = label, isinfo = isinfo or false, type = type}
|
||||
nav.waypoints[name] = {
|
||||
pos = pos,
|
||||
label = label,
|
||||
isinfo = isinfo or false,
|
||||
type = type
|
||||
}
|
||||
end
|
||||
|
||||
function nav.remove_waypoint(name)
|
||||
@ -30,7 +37,8 @@ function nav.get_waypoints_in_square(pos, radius)
|
||||
for name, data in pairs(nav.waypoints) do
|
||||
local wp = data.pos
|
||||
|
||||
if wp.x > pos.x-radius and wp.x < pos.x+radius and wp.z > pos.z-radius and wp.z < pos.z+radius then
|
||||
if wp.x > pos.x-radius and wp.x < pos.x+radius
|
||||
and wp.z > pos.z-radius and wp.z < pos.z+radius then
|
||||
table.insert(wpts, name)
|
||||
end
|
||||
end
|
||||
@ -46,7 +54,8 @@ local function get_formspec_waypoint(x, y, name, label, isinfo)
|
||||
|
||||
local form = ""
|
||||
|
||||
form = form .. "image_button["..(x-0.72)..","..(y-0.53)..";0.5,0.5;"..img..";"..name..";;false;false;"..img.."]"
|
||||
form = form .. "image_button[" .. (x-0.72) .. "," .. (y-0.53) .. ";0.5,0.5;"
|
||||
.. img .. ";" .. name .. ";;false;false;" .. img .. "]"
|
||||
form = form .. "tooltip[" .. name .. ";" .. minetest.formspec_escape(label) .. "]"
|
||||
|
||||
return form
|
||||
@ -61,11 +70,14 @@ function nav.show_map(player)
|
||||
|
||||
local pos = player:getpos()
|
||||
|
||||
local form = default.ui.get_page("nav:nav")
|
||||
local form = default.ui.get_page("default:default")
|
||||
|
||||
form = form .. "field[-1,-1;0,0;nav_map_tracker;;]"
|
||||
|
||||
form = form .. "label[0.25,0.25;"..minetest.formspec_escape(name).." (x: "..math.floor(pos.x+0.5)..", y: "..math.floor(pos.y)..", z: "..math.floor(pos.z+0.5)..")]"
|
||||
form = form .. "label[0.25,0.25;" .. minetest.formspec_escape(name)
|
||||
.. " (x: " .. math.floor(pos.x+0.5)
|
||||
.. ", y: " .. math.floor(pos.y)
|
||||
.. ", z: " .. math.floor(pos.z+0.5) .. ")]"
|
||||
|
||||
form = form .. "image[0.5,3;6,6;nav_background.png]"
|
||||
|
||||
@ -84,12 +96,15 @@ function nav.show_map(player)
|
||||
form = form .. "image[5.5,3;1,1;nav_map_compass.png]"
|
||||
|
||||
form = form .. "label[6.25,6.6;" .. nav.map_radius .. "m]"
|
||||
form = form .. "image[5.5,5.5;3,3;"..minetest.formspec_escape("nav_legend.png^[transformFX").."]"
|
||||
form = form .. "image[5.5,5.5;3,3;"
|
||||
.. minetest.formspec_escape("nav_legend.png^[transformFX") .. "]"
|
||||
|
||||
minetest.show_formspec(name, "nav:map", form)
|
||||
end
|
||||
|
||||
local function recieve_fields(player, form_name, fields)
|
||||
-- Formspec interaction
|
||||
|
||||
local function on_player_recieve_fields(player, form_name, fields)
|
||||
if form_name == "nav:map" then
|
||||
if fields.quit or fields.nav_map_tracker then
|
||||
open_formspecs[player:get_player_name()] = false
|
||||
@ -97,7 +112,8 @@ local function recieve_fields(player, form_name, fields)
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.setting_get_pos("static_spawnpoint") and (not minetest.is_singleplayer()) then
|
||||
if minetest.setting_get_pos("static_spawnpoint")
|
||||
and (not minetest.is_singleplayer()) then
|
||||
minetest.after(
|
||||
1.0,
|
||||
function()
|
||||
@ -106,26 +122,43 @@ if minetest.setting_get_pos("static_spawnpoint") and (not minetest.is_singleplay
|
||||
end)
|
||||
end
|
||||
|
||||
-- Joining player
|
||||
|
||||
local function on_joinplayer(player)
|
||||
local name = player:get_player_name()
|
||||
|
||||
minetest.after(
|
||||
1.0,
|
||||
function()
|
||||
nav.add_waypoint(player:getpos(), "player_"..name, name, true, "player")
|
||||
nav.add_waypoint(
|
||||
player:getpos(),
|
||||
"player_" .. name,
|
||||
name,
|
||||
true,
|
||||
"player"
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
-- Disconnecting player
|
||||
|
||||
local function on_leaveplayer(player)
|
||||
local name = player:get_player_name()
|
||||
|
||||
nav.remove_waypoint("player_" .. name)
|
||||
end
|
||||
|
||||
local function step(dtime)
|
||||
-- Global update function
|
||||
|
||||
local function on_globalstep(dtime)
|
||||
timer = timer + dtime
|
||||
|
||||
if timer > update_time then
|
||||
if timer < timer_interval then
|
||||
return
|
||||
end
|
||||
|
||||
timer = 0
|
||||
|
||||
local players = {}
|
||||
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
@ -145,10 +178,16 @@ local function step(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
timer = 0
|
||||
end
|
||||
end
|
||||
minetest.register_on_joinplayer(on_joinplayer)
|
||||
minetest.register_on_leaveplayer(on_leaveplayer)
|
||||
|
||||
minetest.register_on_player_receive_fields(on_player_recieve_fields)
|
||||
|
||||
minetest.register_globalstep(on_globalstep)
|
||||
|
||||
-- Items
|
||||
|
||||
minetest.register_craftitem(
|
||||
"nav:map",
|
||||
@ -163,22 +202,18 @@ minetest.register_craftitem(
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
-- Crafting
|
||||
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "nav:map",
|
||||
recipe = {
|
||||
{"default:stick", "default:stick", "default:stick"},
|
||||
{"default:paper", "default:paper", "default:paper"},
|
||||
{"default:stick", "default:stick", "default:stick"},
|
||||
items = {
|
||||
"default:stick 6",
|
||||
"default:paper 3",
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_on_joinplayer(on_joinplayer)
|
||||
minetest.register_on_leaveplayer(on_leaveplayer)
|
||||
minetest.register_globalstep(step)
|
||||
minetest.register_on_player_receive_fields(recieve_fields)
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
@ -189,3 +224,5 @@ achievements.register_achievement(
|
||||
times = 1,
|
||||
craftitem = "nav:map",
|
||||
})
|
||||
|
||||
default.log("map", "loaded")
|
||||
|
@ -1,2 +1,3 @@
|
||||
achievements
|
||||
default
|
||||
crafting
|
||||
achievements
|
||||
|
@ -1,13 +1,14 @@
|
||||
|
||||
--
|
||||
-- Parachute mod
|
||||
-- By webdesigner97(No license?)
|
||||
-- Tweaked by Kaadmy, for Pixture
|
||||
--
|
||||
|
||||
function a(v)
|
||||
function air_physics(v)
|
||||
local m = 80 -- Weight of player, kg
|
||||
local g = -9.81 -- Earth Acceleration, m/s^2
|
||||
local cw = 1.33 -- Drag coefficient
|
||||
local cw = 1.25 -- Drag coefficient
|
||||
local rho = 1.2 -- Density of air (on ground, not accurate), kg/m^3
|
||||
local A = 25 -- Surface of the parachute, m^2
|
||||
|
||||
@ -21,11 +22,13 @@ minetest.register_craftitem(
|
||||
wield_image = "parachute_inventory.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, player, pointed_thing)
|
||||
local name = player:get_player_name()
|
||||
|
||||
local pos = player:getpos()
|
||||
|
||||
local on = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
|
||||
if default.player_attached[player:get_player_name()] then
|
||||
if default.player_attached[name] then
|
||||
return
|
||||
end
|
||||
|
||||
@ -35,17 +38,24 @@ minetest.register_craftitem(
|
||||
|
||||
local ent = minetest.add_entity(pos, "parachute:entity")
|
||||
|
||||
ent:setvelocity({x = 0, y = player:get_player_velocity().y, z = 0})
|
||||
ent:setvelocity(
|
||||
{
|
||||
x = 0,
|
||||
y = math.min(0, player:get_player_velocity().y),
|
||||
z = 0
|
||||
})
|
||||
|
||||
player:set_attach(ent, "", {x = 0, y = -8, z = 0}, {x = 0, y = 0, z = 0})
|
||||
|
||||
ent:setyaw(player:get_look_yaw() - (math.pi / 2))
|
||||
ent:setyaw(player:get_look_horizontal())
|
||||
|
||||
ent = ent:get_luaentity()
|
||||
ent.attached = player
|
||||
ent.attached = name
|
||||
|
||||
default.player_attached[player:get_player_name()] = true
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
return itemstack
|
||||
else
|
||||
minetest.chat_send_player(
|
||||
@ -69,26 +79,37 @@ minetest.register_entity(
|
||||
local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
|
||||
if self.attached ~= nil then
|
||||
local player = minetest.get_player_by_name(self.attached)
|
||||
|
||||
local vel = self.object:getvelocity()
|
||||
|
||||
local accel = {x = 0, y = 0, z = 0}
|
||||
|
||||
local lookyaw = self.attached:get_look_yaw()
|
||||
local lookyaw = math.pi - player:get_look_horizontal()
|
||||
|
||||
local s = math.sin((math.pi * 0.5) - lookyaw)
|
||||
local c = math.cos((math.pi * 0.5) - lookyaw)
|
||||
if lookyaw < 0 then
|
||||
lookyaw = lookyaw + (math.pi * 2)
|
||||
end
|
||||
|
||||
local sr = math.sin(((math.pi * 0.5) - lookyaw) + (math.pi / 2))
|
||||
local cr = math.cos(((math.pi * 0.5) - lookyaw) + (math.pi / 2))
|
||||
if lookyaw >= (math.pi * 2) then
|
||||
lookyaw = lookyaw - (math.pi * 2)
|
||||
end
|
||||
-- self.object:setyaw(lookyaw)
|
||||
|
||||
local controls = self.attached:get_player_control()
|
||||
local s = math.sin(lookyaw)
|
||||
local c = math.cos(lookyaw)
|
||||
|
||||
local speed = 3.0
|
||||
local sr = math.sin(lookyaw - (math.pi / 2))
|
||||
local cr = math.cos(lookyaw - (math.pi / 2))
|
||||
|
||||
if controls.up then
|
||||
local controls = player:get_player_control()
|
||||
|
||||
local speed = 4.0
|
||||
|
||||
if controls.down then
|
||||
accel.x = s * speed
|
||||
accel.z = c * speed
|
||||
elseif controls.down then
|
||||
elseif controls.up then
|
||||
accel.x = s * -speed
|
||||
accel.z = c * -speed
|
||||
end
|
||||
@ -101,31 +122,36 @@ minetest.register_entity(
|
||||
accel.z = cr * -speed
|
||||
end
|
||||
|
||||
accel.y = accel.y + a(vel.y) * 0.25
|
||||
accel.y = accel.y + air_physics(vel.y) * 0.25
|
||||
|
||||
self.object:setacceleration(accel)
|
||||
|
||||
if under.name ~= "air" then
|
||||
default.player_attached[self.attached:get_player_name()] = false
|
||||
default.player_attached[self.attached] = false
|
||||
end
|
||||
end
|
||||
|
||||
if under.name ~= "air" then
|
||||
default.player_attached[self.attached:get_player_name()] = false
|
||||
if self.attached ~= nil then
|
||||
default.player_attached[self.attached] = false
|
||||
|
||||
self.object:set_detach()
|
||||
end
|
||||
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
-- Crafting
|
||||
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "parachute:parachute",
|
||||
recipe = {
|
||||
{"group:fuzzy", "group:fuzzy", "group:fuzzy"},
|
||||
{"default:rope", "", "default:rope"},
|
||||
{"", "default:stick", ""}
|
||||
items = {
|
||||
"group:fuzzy 3",
|
||||
"default:rope 4",
|
||||
"default:stick 6",
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user