summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-20 00:30:28 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-20 00:30:28 -0700
commitf3cda1f5db7adadeb993a88e05006c6952d53c87 (patch)
treed3c2cfbbd8f92c3c47a04bdf3d8a9360611f5b28
parent68a83a7a8d689c72facbd24e7df87684f7701ba3 (diff)
add achievements for storing Digtrons in crates
-rw-r--r--awards.lua36
-rw-r--r--node_crate.lua2
2 files changed, 38 insertions, 0 deletions
diff --git a/awards.lua b/awards.lua
index beef27b..dc2b73e 100644
--- a/awards.lua
+++ b/awards.lua
@@ -2,6 +2,7 @@ if not minetest.get_modpath("awards") then
digtron.award_item_dug = function (items, player, count) end
digtron.award_layout = function (layout, player) end
digtron.award_item_built = function(item_name, player) end
+ digtron.award_crate = function (layout, player) end
return
end
---------------------------------------------------------------------------
@@ -152,6 +153,20 @@ digtron.award_layout = function (layout, player)
end
end
+digtron.award_crate = function (layout, player)
+ if layout == nil or player == nil or player == "" then
+ return
+ end
+
+ -- Note that we're testing >10 rather than >9 because this layout includes the crate node
+ if table.getn(layout.all) > 10 then
+ awards.unlock(player, "digtron_crate10")
+ if table.getn(layout.all) > 100 then
+ awards.unlock(player, "digtron_crate100")
+ end
+ end
+end
+
awards.register_achievement("digtron_water",{
title = "Deep Blue Digtron",
description = "Encountered water while operating a Digtron.",
@@ -374,4 +389,25 @@ awards.register_achievement("digtron_10000_built",{
description = "Build 10,000 blocks with a Digtron",
background = "awards_bg_mining.png",
icon = "digtron_plate.png^digtron_axel_side.png^[transformR90^digtron_builder.png",
+})
+
+awards.register_achievement("digtron_water",{
+ title = "Deep Blue Digtron",
+ description = "Encountered water while operating a Digtron.",
+ background = "awards_bg_mining.png",
+ icon = "default_water.png^digtron_digger_yb_frame.png",
+})
+
+awards.register_achievement("digtron_crate10",{
+ title = "Digtron Packrat",
+ description = "Stored 10 or more Digtron blocks in one crate.",
+ background = "awards_bg_mining.png",
+ icon = "digtron_plate.png^digtron_crate.png", -- TODO: Visually distinguish this from Bigtron
+})
+
+awards.register_achievement("digtron_crate100",{
+ title = "Digtron Hoarder",
+ description = "Stored 100 or more Digtron blocks in one crate.",
+ background = "awards_bg_mining.png",
+ icon = "digtron_plate.png^digtron_crate.png", -- TODO: Visually distinguish this from Bigtron
}) \ No newline at end of file
diff --git a/node_crate.lua b/node_crate.lua
index a9e91ac..9168911 100644
--- a/node_crate.lua
+++ b/node_crate.lua
@@ -29,6 +29,8 @@ minetest.register_node("digtron:empty_crate", {
return
end
+ digtron.award_crate(layout, clicker:get_player_name())
+
local layout_string = layout:serialize()
-- destroy everything. Note that this includes the empty crate, which will be bundled up with the layout.