Add tons of new achievements; closes #32. Recommend not using this version with older worlds
This commit is contained in:
parent
ef86ababf1
commit
d24cd2146e
@ -70,10 +70,10 @@ function achievements.trigger_achievement(player, aname, times)
|
||||
if achievements.achievements[name][aname] >= achievements.registered_achievements[aname].times then
|
||||
achievements.achievements[name][aname] = -1
|
||||
minetest.after(2.0, function()
|
||||
minetest.chat_send_all(
|
||||
"*** " .. name .." has earned the achievement [" ..
|
||||
achievements.registered_achievements[aname].title .. "]")
|
||||
end)
|
||||
minetest.chat_send_all(
|
||||
"*** " .. name .." has earned the achievement [" ..
|
||||
achievements.registered_achievements[aname].title .. "]")
|
||||
end)
|
||||
end
|
||||
|
||||
save_achievements()
|
||||
@ -198,7 +198,7 @@ function achievements.get_formspec(name, row)
|
||||
|
||||
local aname = achievements.registered_achievements_list[row]
|
||||
local def = achievements.registered_achievements[aname]
|
||||
|
||||
|
||||
local progress = ""
|
||||
if achievements.achievements[name][aname] then
|
||||
if achievements.achievements[name][aname] == -1 then
|
||||
@ -243,10 +243,10 @@ end
|
||||
minetest.register_on_player_receive_fields(receive_fields)
|
||||
|
||||
--
|
||||
-- Below is the default achievements
|
||||
-- Below are the default achievements
|
||||
--
|
||||
|
||||
-- Crafting a broadsword
|
||||
-- Tools
|
||||
|
||||
achievements.register_achievement(
|
||||
"off_to_battle",
|
||||
@ -255,7 +255,27 @@ achievements.register_achievement(
|
||||
description = "Craft a Broadsword",
|
||||
times = 1,
|
||||
craftitem = "default:broadsword",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"hardened_miner",
|
||||
{
|
||||
title = "Hardened Miner",
|
||||
description = "Craft 3 carbon steel pickaxes.",
|
||||
times = 3,
|
||||
craftitem = "default:pick_carbonsteel",
|
||||
})
|
||||
|
||||
-- Dirt/soil
|
||||
|
||||
achievements.register_achievement(
|
||||
"drain_the_swamp",
|
||||
{
|
||||
title = "Drain the Swamp",
|
||||
description = "Dig 30 swamp dirt.",
|
||||
times = 30,
|
||||
dignode = "default:swamp_dirt",
|
||||
})
|
||||
|
||||
-- Placing planks
|
||||
|
||||
@ -266,7 +286,7 @@ achievements.register_achievement(
|
||||
description = "Place 10 planks",
|
||||
times = 10,
|
||||
placenode = "group:planks",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"carpenter",
|
||||
@ -275,7 +295,7 @@ achievements.register_achievement(
|
||||
description = "Place 100 planks",
|
||||
times = 100,
|
||||
placenode = "group:planks",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"master_carpenter",
|
||||
@ -284,9 +304,9 @@ achievements.register_achievement(
|
||||
description = "Place 500 planks",
|
||||
times = 500,
|
||||
placenode = "group:planks",
|
||||
})
|
||||
})
|
||||
|
||||
-- Digging stone
|
||||
-- Stone
|
||||
|
||||
achievements.register_achievement(
|
||||
"mineority",
|
||||
@ -295,7 +315,7 @@ achievements.register_achievement(
|
||||
description = "Mine 20 stone",
|
||||
times = 20,
|
||||
dignode = "group:stone",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"rockin'",
|
||||
@ -304,7 +324,7 @@ achievements.register_achievement(
|
||||
description = "Mine 200 stone",
|
||||
times = 200,
|
||||
dignode = "group:stone",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"rocksolid",
|
||||
@ -313,7 +333,16 @@ achievements.register_achievement(
|
||||
description = "Mine 1000 stone",
|
||||
times = 1000,
|
||||
dignode = "group:stone",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"cave_builder",
|
||||
{
|
||||
title = "Cave Builder",
|
||||
description = "Place 60 stone.",
|
||||
times = 60,
|
||||
placenode = "default:stone",
|
||||
})
|
||||
|
||||
-- Digging wood
|
||||
|
||||
@ -324,7 +353,7 @@ achievements.register_achievement(
|
||||
description = "Dig 10 tree trunks.",
|
||||
times = 10,
|
||||
dignode = "group:tree",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"timberer",
|
||||
@ -333,7 +362,7 @@ achievements.register_achievement(
|
||||
description = "Dig 100 tree trunks.",
|
||||
times = 100,
|
||||
dignode = "group:tree",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"timbererest",
|
||||
@ -342,9 +371,21 @@ achievements.register_achievement(
|
||||
description = "Dig 500 tree trunks.",
|
||||
times = 500,
|
||||
dignode = "group:tree",
|
||||
})
|
||||
})
|
||||
|
||||
-- Planting flowers
|
||||
-- Crafting bricks
|
||||
|
||||
achievements.register_achievement(
|
||||
"builder",
|
||||
{
|
||||
title = "Builder",
|
||||
description = "Craft 180 bricks.",
|
||||
times = 180,
|
||||
craftitem = "default:brick",
|
||||
})
|
||||
|
||||
|
||||
-- Plants/farming
|
||||
|
||||
achievements.register_achievement(
|
||||
"gardener",
|
||||
@ -353,7 +394,7 @@ achievements.register_achievement(
|
||||
description = "Plant 10 flowers.",
|
||||
times = 10,
|
||||
placenode = "default:flower",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"master_gardener",
|
||||
@ -362,6 +403,77 @@ achievements.register_achievement(
|
||||
description = "Plant 100 flowers.",
|
||||
times = 100,
|
||||
placenode = "default:flower",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"welcome_to_the_mountains",
|
||||
{
|
||||
title = "Welcome to the Mountains",
|
||||
description = "Collect dry grass.",
|
||||
times = 1,
|
||||
dignode = "default:dry_grass",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"fertile",
|
||||
{
|
||||
title = "Fertile",
|
||||
description = "Craft 100 bags of fertilizer.",
|
||||
times = 100,
|
||||
craftitem = "default:fertilizer",
|
||||
})
|
||||
|
||||
-- Crafting reinforced blocks
|
||||
|
||||
achievements.register_achievement(
|
||||
"master_carpenter",
|
||||
{
|
||||
title = "Master Carpenter",
|
||||
description = "Craft 200 reinforced frames.",
|
||||
times = 200,
|
||||
craftitem = "default:reinforced_frame",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"master_stonemason",
|
||||
{
|
||||
title = "Master Stonemason",
|
||||
description = "Craft 200 reinforced cobble.",
|
||||
times = 200,
|
||||
craftitem = "default:reinforced_cobble",
|
||||
})
|
||||
|
||||
-- Crafting sand-related materials
|
||||
|
||||
achievements.register_achievement(
|
||||
"sandman",
|
||||
{
|
||||
title = "Sandman",
|
||||
description = "Craft 60 compressed sandstone.",
|
||||
times = 60,
|
||||
craftitem = "default:compressed_sandstone",
|
||||
})
|
||||
|
||||
-- Literature
|
||||
|
||||
achievements.register_achievement(
|
||||
"librarian",
|
||||
{
|
||||
title = "Librarian",
|
||||
description = "Craft 10 bookshelves.",
|
||||
times = 10,
|
||||
craftitem = "default:bookshelf",
|
||||
})
|
||||
|
||||
-- Misc.
|
||||
|
||||
achievements.register_achievement(
|
||||
"smelting_room",
|
||||
{
|
||||
title = "Smelting Room",
|
||||
description = "Craft 20 furnaces.",
|
||||
times = 200,
|
||||
craftitem = "default:furnace",
|
||||
})
|
||||
|
||||
default.log("mod:achievements", "loaded")
|
||||
|
@ -7,7 +7,7 @@ minetest.register_craftitem(
|
||||
{
|
||||
description = "Fiber",
|
||||
inventory_image = "default_fiber.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:stick",
|
||||
@ -15,14 +15,14 @@ minetest.register_craftitem(
|
||||
description = "Stick",
|
||||
inventory_image = "default_stick.png",
|
||||
groups = {stick = 1}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:paper",
|
||||
{
|
||||
description = "Paper",
|
||||
inventory_image = "default_paper.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:book",
|
||||
@ -31,42 +31,42 @@ minetest.register_craftitem(
|
||||
inventory_image = "default_book.png",
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
stack_max = 1,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:lump_coal",
|
||||
{
|
||||
description = "Coal Lump",
|
||||
inventory_image = "default_lump_coal.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:lump_iron",
|
||||
{
|
||||
description = "Iron Lump",
|
||||
inventory_image = "default_lump_iron.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:dust_carbonsteel",
|
||||
{
|
||||
description = "Carbon Steel Dust",
|
||||
inventory_image = "default_dust_carbonsteel.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:ingot_steel",
|
||||
{
|
||||
description = "Steel Ingot",
|
||||
inventory_image = "default_ingot_steel.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:ingot_carbonsteel",
|
||||
{
|
||||
description = "Carbon Steel Ingot",
|
||||
inventory_image = "default_ingot_carbonsteel.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:lump_sugar",
|
||||
@ -74,21 +74,21 @@ minetest.register_craftitem(
|
||||
description = "Sugar Lump",
|
||||
inventory_image = "default_lump_sugar.png",
|
||||
on_use = minetest.item_eat({hp = 1, sat = 10})
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:pearl",
|
||||
{
|
||||
description = "Pearl",
|
||||
inventory_image = "default_pearl.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:flint",
|
||||
{
|
||||
description = "Flint Shard",
|
||||
inventory_image = "default_flint.png",
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket_water",
|
||||
@ -99,32 +99,32 @@ minetest.register_craftitem(
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
liquids_pointable = true,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
|
||||
itemstack:take_item()
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
local inv=user:get_inventory()
|
||||
|
||||
local pos = pointed_thing.above
|
||||
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
minetest.add_node(pos, {name = "default:water_source"})
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
local pos = pointed_thing.above
|
||||
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
minetest.add_node(pos, {name = "default:water_source"})
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket_river_water",
|
||||
@ -135,32 +135,32 @@ minetest.register_craftitem(
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
liquids_pointable = true,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
|
||||
itemstack:take_item()
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
local inv=user:get_inventory()
|
||||
|
||||
local pos = pointed_thing.above
|
||||
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
minetest.add_node(pos, {name = "default:river_water_source"})
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
local pos = pointed_thing.above
|
||||
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
minetest.add_node(pos, {name = "default:river_water_source"})
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket_swamp_water",
|
||||
@ -171,32 +171,32 @@ minetest.register_craftitem(
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
liquids_pointable = true,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
|
||||
itemstack:take_item()
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
local inv=user:get_inventory()
|
||||
|
||||
local pos = pointed_thing.above
|
||||
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
minetest.add_node(pos, {name = "default:swamp_water_source"})
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
local pos = pointed_thing.above
|
||||
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
minetest.add_node(pos, {name = "default:swamp_water_source"})
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket",
|
||||
@ -207,58 +207,58 @@ minetest.register_craftitem(
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local nodename=minetest.get_node(pointed_thing.under).name
|
||||
|
||||
if nodename == "default:water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_water"}) then
|
||||
inv:add_item("main", "default:bucket_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
elseif nodename == "default:river_water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_river_water"}) then
|
||||
inv:add_item("main", "default:bucket_river_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_river_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
elseif nodename == "default:swamp_water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_swamp_water"}) then
|
||||
inv:add_item("main", "default:bucket_swamp_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_swamp_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
end
|
||||
local nodename=minetest.get_node(pointed_thing.under).name
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
})
|
||||
if nodename == "default:water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_water"}) then
|
||||
inv:add_item("main", "default:bucket_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
elseif nodename == "default:river_water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_river_water"}) then
|
||||
inv:add_item("main", "default:bucket_river_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_river_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
elseif nodename == "default:swamp_water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_swamp_water"}) then
|
||||
inv:add_item("main", "default:bucket_swamp_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_swamp_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem(
|
||||
@ -268,24 +268,24 @@ minetest.register_craftitem(
|
||||
inventory_image = "default_fertilizer_inventory.png",
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
local pos = pointed_thing.above
|
||||
|
||||
local underdef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
local underdef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
|
||||
if underdef.groups then
|
||||
if underdef.groups.plantable_soil then
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(pointed_thing.under, {name = "default:fertilized_dirt"})
|
||||
elseif underdef.groups.plantable_sandy then
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(pointed_thing.under, {name = "default:fertilized_sand"})
|
||||
end
|
||||
end
|
||||
if underdef.groups then
|
||||
if underdef.groups.plantable_soil then
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(pointed_thing.under, {name = "default:fertilized_dirt"})
|
||||
elseif underdef.groups.plantable_sandy then
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(pointed_thing.under, {name = "default:fertilized_sand"})
|
||||
end
|
||||
end
|
||||
|
||||
itemstack:take_item()
|
||||
itemstack:take_item()
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
default.log("craftitems", "loaded")
|
||||
|
@ -33,7 +33,7 @@ end
|
||||
|
||||
function default.ui.button(x, y, w, h, name, label, noclip)
|
||||
local nc = "false"
|
||||
|
||||
|
||||
if noclip then
|
||||
nc = "true"
|
||||
end
|
||||
@ -47,7 +47,7 @@ end
|
||||
|
||||
function default.ui.button_exit(x, y, w, h, name, label, noclip)
|
||||
local nc = "false"
|
||||
|
||||
|
||||
if noclip then
|
||||
nc = "true"
|
||||
end
|
||||
@ -92,7 +92,7 @@ function default.ui.fake_itemstack(x, y, itemstack, name)
|
||||
|
||||
local result = ""
|
||||
if itemname ~= "" then
|
||||
-- result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
|
||||
-- result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
|
||||
result = result .. "image_button["..x..","..y..";1,1;ui_null.png;"..name..";;false;false;ui_null.png]"
|
||||
result = result .. "item_image["..x..","..y..";1,1;"..minetest.formspec_escape(itemname).."]"
|
||||
result = result .. "label["..(x+0.6)..","..(y+0.5)..";"..itemamt.."]"
|
||||
@ -112,7 +112,7 @@ function default.ui.fake_simple_itemstack(x, y, itemname, name)
|
||||
|
||||
local result = ""
|
||||
if itemname ~= "" then
|
||||
-- result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
|
||||
-- result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
|
||||
result = result .. "image_button["..x..","..y..";1,1;ui_null.png;"..name..";;false;false;ui_null.png]"
|
||||
result = result .. "item_image["..x..","..y..";1,1;"..minetest.formspec_escape(itemname).."]"
|
||||
result = result .. "tooltip["..name..";"..itemdesc.."]"
|
||||
@ -139,7 +139,7 @@ function default.ui.item_group(x, y, group, name)
|
||||
|
||||
local result = ""
|
||||
if itemname ~= "" then
|
||||
-- result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
|
||||
-- result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
|
||||
result = result .. "image_button["..x..","..y..";1,1;ui_null.png;"..name..";G;false;false;ui_null.png]"
|
||||
result = result .. "item_image["..x..","..y..";1,1;"..minetest.formspec_escape(itemname).."]"
|
||||
result = result .. "tooltip["..name..";Group: "..group.."]"
|
||||
@ -153,7 +153,7 @@ default.ui.registered_pages = {
|
||||
|
||||
function default.ui.get_page(name)
|
||||
local page= default.ui.registered_pages[name]
|
||||
|
||||
|
||||
if page == nil then
|
||||
default.log("UI page '" .. name .. "' is not yet registered", "dev")
|
||||
page = ""
|
||||
@ -234,8 +234,8 @@ default.ui.register_page("core_bookshelf", form_bookshelf)
|
||||
function default.ui.receive_fields(player, form_name, fields)
|
||||
local name = player:get_player_name()
|
||||
|
||||
-- print("Received formspec fields from '"..name.."': "..dump(fields))
|
||||
|
||||
-- print("Received formspec fields from '"..name.."': "..dump(fields))
|
||||
|
||||
if fields.tab_crafting then
|
||||
minetest.show_formspec(name, "core_crafting", default.ui.get_page("core_crafting"))
|
||||
elseif minetest.get_modpath("craftingguide") ~= nil and fields.tab_craftingguide then
|
||||
@ -252,7 +252,7 @@ end
|
||||
minetest.register_on_player_receive_fields(
|
||||
function(player, form_name, fields)
|
||||
default.ui.receive_fields(player, form_name, fields)
|
||||
end)
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(
|
||||
function(player)
|
||||
@ -260,6 +260,6 @@ minetest.register_on_joinplayer(
|
||||
minetest.chat_send_player(player:get_player_name(), "Welcome to Pixture! Type /help for a list of commands.")
|
||||
end
|
||||
minetest.after(1.0, welcome)
|
||||
|
||||
|
||||
player:set_inventory_formspec(default.ui.get_page("core_crafting"))
|
||||
end)
|
||||
end)
|
||||
|
@ -410,4 +410,4 @@ minetest.register_tool(
|
||||
end,
|
||||
})
|
||||
|
||||
default.log("tools", "loaded")
|
||||
default.log("tools", "loaded")
|
||||
|
@ -1 +1,2 @@
|
||||
achievements
|
||||
default
|
||||
|
@ -161,11 +161,11 @@ function gold.trade(trade, trade_type, player)
|
||||
if item:get_name() ~= "gold:trading_book" then return end
|
||||
|
||||
local inv = player:get_inventory()
|
||||
|
||||
|
||||
if inv:get_size("gold_trade_wanted") ~= 2 then
|
||||
inv:set_size("gold_trade_wanted", 2)
|
||||
end
|
||||
|
||||
|
||||
if inv:get_size("gold_trade_out") ~= 1 then
|
||||
inv:set_size("gold_trade_out", 1)
|
||||
end
|
||||
@ -173,10 +173,10 @@ function gold.trade(trade, trade_type, player)
|
||||
if inv:get_size("gold_trade_in") ~= 2 then
|
||||
inv:set_size("gold_trade_in", 2)
|
||||
end
|
||||
|
||||
|
||||
inv:set_stack("gold_trade_wanted", 1, trade[1])
|
||||
inv:set_stack("gold_trade_wanted", 2, trade[2])
|
||||
|
||||
|
||||
local meta = minetest.deserialize(item:get_metadata())
|
||||
|
||||
if not meta then meta = {} end
|
||||
@ -218,14 +218,14 @@ minetest.register_on_player_receive_fields(
|
||||
|
||||
local trade_in1 = inv:get_stack("gold_trade_in", 1):to_string()
|
||||
local trade_in2 = inv:get_stack("gold_trade_in", 2):to_string()
|
||||
|
||||
|
||||
local matches = trade_wanted1 == trade_in1 and trade_wanted2 == trade_in2
|
||||
|
||||
local meta = minetest.deserialize(item:get_metadata())
|
||||
|
||||
|
||||
local trade = {"gold:gold", "gold:gold", "default:stick"}
|
||||
local trade_type = ""
|
||||
|
||||
|
||||
if meta then
|
||||
trade = meta.trade
|
||||
trade_type = meta.trade_type
|
||||
@ -235,11 +235,11 @@ minetest.register_on_player_receive_fields(
|
||||
if inv:room_for_item("gold_trade_out", trade[3]) then
|
||||
inv:add_item("gold_trade_out", trade[3])
|
||||
inv:set_stack("gold_trade_in", 1, "")
|
||||
inv:set_stack("gold_trade_in", 2, "")
|
||||
inv:set_stack("gold_trade_in", 2, "")
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
minetest.register_craftitem(
|
||||
"gold:trading_book",
|
||||
@ -247,7 +247,7 @@ minetest.register_craftitem(
|
||||
description = "Trading Book",
|
||||
inventory_image = "default_book.png^gold_bookribbon.png",
|
||||
stack_max = 1,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"gold:gold",
|
||||
@ -255,14 +255,14 @@ minetest.register_craftitem(
|
||||
description = "Gold",
|
||||
inventory_image = "gold_gold.png",
|
||||
stack_max = 120
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "gold:trading_book",
|
||||
type = "shapeless",
|
||||
recipe = {"default:book", "gold:gold"}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_alias("gold", "gold:gold")
|
||||
|
||||
@ -275,7 +275,7 @@ minetest.register_node(
|
||||
drop = "gold:gold",
|
||||
is_ground_content = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_ore(
|
||||
{
|
||||
@ -287,4 +287,26 @@ minetest.register_ore(
|
||||
clust_size = 10,
|
||||
y_min = -256,
|
||||
y_max = -32,
|
||||
})
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"trader",
|
||||
{
|
||||
title = "Trader",
|
||||
description = "Craft a trading book.",
|
||||
times = 1,
|
||||
craftitem = "gold:trading_book",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"gold_rush",
|
||||
{
|
||||
title = "Gold Rush",
|
||||
description = "Dig 60 gold ore.",
|
||||
times = 60,
|
||||
dignode = "gold:ore",
|
||||
})
|
||||
|
||||
default.log("mod:gold", "loaded")
|
||||
|
@ -1,3 +1,4 @@
|
||||
achievements
|
||||
default
|
||||
tnt
|
||||
util
|
||||
|
@ -120,7 +120,7 @@ minetest.register_abm(
|
||||
ok = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if ok then
|
||||
minetest.set_node(
|
||||
pos,
|
||||
@ -159,4 +159,15 @@ end
|
||||
|
||||
minetest.register_globalstep(step)
|
||||
|
||||
default.log("mod:lumien", "loaded")
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"enlightened",
|
||||
{
|
||||
title = "Enlightened",
|
||||
description = "Place 9 lumien crystals.",
|
||||
times = 9,
|
||||
plcenode = "lumien:lumien_crystal_off",
|
||||
})
|
||||
|
||||
default.log("mod:lumien", "loaded")
|
||||
|
@ -1 +1,2 @@
|
||||
achievements
|
||||
util
|
||||
|
@ -22,7 +22,7 @@ if minetest.setting_getbool("music_enable") then
|
||||
music.players[dp] = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function music.start(pos)
|
||||
local dp = minetest.hash_node_position(pos)
|
||||
|
||||
@ -37,7 +37,7 @@ if minetest.setting_getbool("music_enable") then
|
||||
{
|
||||
pos = pos,
|
||||
gain = 0.8,
|
||||
}),
|
||||
}),
|
||||
["timer"] = 0,
|
||||
["pos"] = pos,
|
||||
}
|
||||
@ -49,7 +49,7 @@ if minetest.setting_getbool("music_enable") then
|
||||
{
|
||||
pos = pos,
|
||||
gain = 0.8,
|
||||
})
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,7 +73,7 @@ if minetest.setting_getbool("music_enable") then
|
||||
|
||||
function music.toggle(pos)
|
||||
local dp = minetest.hash_node_position(pos)
|
||||
|
||||
|
||||
if music.players[dp] == nil then
|
||||
music.start(pos)
|
||||
else
|
||||
@ -100,24 +100,24 @@ if minetest.setting_getbool("music_enable") then
|
||||
},
|
||||
|
||||
on_construct = function(pos)
|
||||
music.start(pos)
|
||||
end,
|
||||
music.start(pos)
|
||||
end,
|
||||
|
||||
after_destruct = function(pos)
|
||||
music.stop(pos)
|
||||
end,
|
||||
music.stop(pos)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos)
|
||||
music.toggle(pos)
|
||||
end,
|
||||
music.toggle(pos)
|
||||
end,
|
||||
|
||||
groups = {oddly_breakable_by_hand = 3}
|
||||
})
|
||||
})
|
||||
|
||||
function step(dtime)
|
||||
for dp, _ in pairs(music.players) do
|
||||
music.players[dp]["timer"] = music.players[dp]["timer"] + dtime
|
||||
|
||||
|
||||
music.update(music.players[dp]["pos"])
|
||||
end
|
||||
end
|
||||
@ -130,14 +130,14 @@ if minetest.setting_getbool("music_enable") then
|
||||
chance = 1,
|
||||
interval = 1,
|
||||
action = function(pos, node)
|
||||
if music.players[minetest.hash_node_position(pos)] == nil then
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("music_player_enabled") == 1 then
|
||||
music.start(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
if music.players[minetest.hash_node_position(pos)] == nil then
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("music_player_enabled") == 1 then
|
||||
music.start(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
else
|
||||
minetest.register_node(
|
||||
"music:player",
|
||||
@ -158,13 +158,13 @@ else
|
||||
},
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
meta:set_string("infotext", "Music player(Disabled by server)")
|
||||
end,
|
||||
meta:set_string("infotext", "Music player(Disabled by server)")
|
||||
end,
|
||||
|
||||
groups = {oddly_breakable_by_hand = 3}
|
||||
})
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft(
|
||||
@ -174,4 +174,17 @@ minetest.register_craft(
|
||||
{"group:planks", "group:planks", "group:planks"},
|
||||
{"group:planks", "default:ingot_steel", "group:planks"},
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"musician",
|
||||
{
|
||||
title = "Musician",
|
||||
description = "Craft a music player.",
|
||||
times = 1,
|
||||
craftitem = "music:player",
|
||||
})
|
||||
|
||||
default.log("mod:music", "loaded")
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 398 B |
Binary file not shown.
@ -1 +1,2 @@
|
||||
achievements
|
||||
default
|
||||
|
@ -21,39 +21,39 @@ minetest.register_craftitem(
|
||||
wield_image = "parachute_inventory.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, player, pointed_thing)
|
||||
local pos = player:getpos()
|
||||
local pos = player:getpos()
|
||||
|
||||
local on = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
local on = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
|
||||
if default.player_attached[player:get_player_name()] then
|
||||
return
|
||||
end
|
||||
if default.player_attached[player:get_player_name()] then
|
||||
return
|
||||
end
|
||||
|
||||
if on.name == "air" then
|
||||
-- Spawn parachute
|
||||
pos.y = pos.y + 3
|
||||
if on.name == "air" then
|
||||
-- Spawn parachute
|
||||
pos.y = pos.y + 3
|
||||
|
||||
local ent = minetest.add_entity(pos, "parachute:entity")
|
||||
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 = player:get_player_velocity().y, z = 0})
|
||||
|
||||
player:set_attach(ent, "", {x = 0, y = -8, z = 0}, {x = 0, y = 0, 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 = ent:get_luaentity()
|
||||
ent.attached = player
|
||||
ent:setyaw(player:get_look_yaw() - (math.pi / 2))
|
||||
ent = ent:get_luaentity()
|
||||
ent.attached = player
|
||||
|
||||
default.player_attached[player:get_player_name()] = true
|
||||
default.player_attached[player:get_player_name()] = true
|
||||
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
else
|
||||
minetest.chat_send_player(
|
||||
player:get_player_name(),
|
||||
"Cannot open parachute on ground!")
|
||||
end
|
||||
end
|
||||
})
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
else
|
||||
minetest.chat_send_player(
|
||||
player:get_player_name(),
|
||||
"Cannot open parachute on ground!")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_entity(
|
||||
"parachute:entity",
|
||||
@ -65,59 +65,59 @@ minetest.register_entity(
|
||||
automatic_face_movement_dir = -90,
|
||||
attached = nil,
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
local pos = self.object:getpos()
|
||||
local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
|
||||
if self.attached ~= nil then
|
||||
local vel = self.object:getvelocity()
|
||||
if self.attached ~= nil then
|
||||
local vel = self.object:getvelocity()
|
||||
|
||||
local accel = {x = 0, y = 0, z = 0}
|
||||
local accel = {x = 0, y = 0, z = 0}
|
||||
|
||||
local lookyaw = self.attached:get_look_yaw()
|
||||
local lookyaw = self.attached:get_look_yaw()
|
||||
|
||||
local s = math.sin((math.pi * 0.5) - lookyaw)
|
||||
local c = math.cos((math.pi * 0.5) - lookyaw)
|
||||
local s = math.sin((math.pi * 0.5) - lookyaw)
|
||||
local c = math.cos((math.pi * 0.5) - lookyaw)
|
||||
|
||||
local sr = math.sin(((math.pi * 0.5) - lookyaw) + (math.pi / 2))
|
||||
local cr = math.cos(((math.pi * 0.5) - lookyaw) + (math.pi / 2))
|
||||
local sr = math.sin(((math.pi * 0.5) - lookyaw) + (math.pi / 2))
|
||||
local cr = math.cos(((math.pi * 0.5) - lookyaw) + (math.pi / 2))
|
||||
|
||||
local controls = self.attached:get_player_control()
|
||||
local controls = self.attached:get_player_control()
|
||||
|
||||
local speed = 3.0
|
||||
local speed = 3.0
|
||||
|
||||
if controls.up then
|
||||
accel.x = s * speed
|
||||
accel.z = c * speed
|
||||
elseif controls.down then
|
||||
accel.x = s * -speed
|
||||
accel.z = c * -speed
|
||||
end
|
||||
if controls.up then
|
||||
accel.x = s * speed
|
||||
accel.z = c * speed
|
||||
elseif controls.down then
|
||||
accel.x = s * -speed
|
||||
accel.z = c * -speed
|
||||
end
|
||||
|
||||
if controls.right then
|
||||
accel.x = sr * speed
|
||||
accel.z = cr * speed
|
||||
elseif controls.left then
|
||||
accel.x = sr * -speed
|
||||
accel.z = cr * -speed
|
||||
end
|
||||
if controls.right then
|
||||
accel.x = sr * speed
|
||||
accel.z = cr * speed
|
||||
elseif controls.left then
|
||||
accel.x = sr * -speed
|
||||
accel.z = cr * -speed
|
||||
end
|
||||
|
||||
accel.y = accel.y + a(vel.y) * 0.25
|
||||
accel.y = accel.y + a(vel.y) * 0.25
|
||||
|
||||
self.object:setacceleration(accel)
|
||||
self.object:setacceleration(accel)
|
||||
|
||||
if under.name ~= "air" then
|
||||
default.player_attached[self.attached:get_player_name()] = false
|
||||
end
|
||||
end
|
||||
if under.name ~= "air" then
|
||||
default.player_attached[self.attached:get_player_name()] = false
|
||||
end
|
||||
end
|
||||
|
||||
if under.name ~= "air" then
|
||||
default.player_attached[self.attached:get_player_name()] = false
|
||||
if under.name ~= "air" then
|
||||
default.player_attached[self.attached:get_player_name()] = false
|
||||
|
||||
self.object:set_detach()
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
})
|
||||
self.object:set_detach()
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
@ -127,6 +127,17 @@ minetest.register_craft(
|
||||
{"default:rope", "", "default:rope"},
|
||||
{"", "default:stick", ""}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
default.log("mod:parachute", "loaded")
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"sky_diver",
|
||||
{
|
||||
title = "Sky Diver",
|
||||
description = "Craft 5 parachutes.",
|
||||
times = 5,
|
||||
craftitem = "parachute:parachute",
|
||||
})
|
||||
|
||||
default.log("mod:parachute", "loaded")
|
||||
|
Loading…
Reference in New Issue
Block a user