diff --git a/credits.md b/credits.md index 1f1758b..d771f01 100644 --- a/credits.md +++ b/credits.md @@ -38,3 +38,15 @@ Tools used: * for creative mode building * [Audacity](https://www.audacityteam.org/) * for recording and editing sound effect + +External Mods: + +* [Spears](https://content.minetest.net/packages/Echoes91/spears) + * For spear functionality +* [MPD](https://content.minetest.net/packages/orwell/mpd/) + * Background music + +Music: + +* [Kevin Hartnell - Cells](http://kevinhartnell.com/) + * Music diff --git a/minetest.conf b/minetest.conf index 5897953..e26b721 100644 --- a/minetest.conf +++ b/minetest.conf @@ -1,3 +1,3 @@ give_initial_stuff = true -initial_stuff = mtr_weapons:sharp_stick +initial_stuff = spears:spear_sharp time_speed = 0 diff --git a/mods/mtr_shop/anvil.spec b/mods/mtr_shop/anvil.spec index ff72338..18abd49 100644 --- a/mods/mtr_shop/anvil.spec +++ b/mods/mtr_shop/anvil.spec @@ -5,7 +5,7 @@ label[7,0.75;What do you want to do?] button[8.0,1.5;3,0.5;form;MAKE ROCK] label[7.0,2.5;Use 5 pebbles to make a rock!] button[8.0,3.0;3,0.5;sharpen;SHARPEN] -label[7.90,4.0;Sharpen your stick!] +label[7.90,4.0;Sharpen your spear with a stick!] image[0.5,0.25;4.5,4.5;anvil_pic.png] background[0,0;14,5;brick_background.png] button[13,0.2;0.5,0.5;back;<] diff --git a/mods/mtr_shop/buy_sell_shop.spec b/mods/mtr_shop/buy_sell_shop.spec index 0745181..90bbfce 100644 --- a/mods/mtr_shop/buy_sell_shop.spec +++ b/mods/mtr_shop/buy_sell_shop.spec @@ -1,17 +1,39 @@ formspec_version[4] + size[13.5,5] position[0.5,0.5] -label[7,0.9;What do you want to buy/sell?] -button[5.5,1.5;3,0.5;bdirt;BUY (3g)] -button[10.5,1.5;3,0.5;sdirt;SELL (1g)] -button[5.5,2.5;3,0.5;bpebble;BUY (10g)] -button[10.5,2.5;3,0.5;spebble;SELL (5g)] -button[5.5,3.5;3,0.5;bstick;BUY (5g)] -button[10.5,3.5;3,0.5;sstick;SELL (3g)] -image[0.5,0.25;4.5,4.5;gold_pic.png] + background[0,0;14,5;brick_background.png] +button[13,0.2;0.5,0.5;back;<] + +label[7,0.9;What do you want to buy/sell?] + +button[5.5,1.25;1.5,0.5;bdirt;BUY (3g)] +button[7.0,1.25;1.5,0.5;bdirt16;BUY x16 (48g)] +button[5.5,1.75;1.5,0.5;bdirt64;BUY x64 (192g)] + +button[10.5,1.25;1.5,0.5;sdirt;SELL (1g)] +button[12.0,1.25;1.5,0.5;sdirt16;SELL (16g)] +button[10.5,1.75;1.5,0.5;sdirt64;SELL (64g)] + +button[5.5,2.25;1.5,0.5;bpebble;BUY (10g)] +button[7.0,2.25;1.5,0.5;bpebble16;BUY x16 (160g)] +button[5.5,2.75;1.5,0.5;bpebble64;BUY x64 (640g)] + +button[10.5,2.25;1.5,0.5;spebble;SELL (5g)] +button[12.0,2.25;1.5,0.5;spebble16;SELL x16 (80g)] +button[10.5,2.75;1.5,0.5;spebble64;SELL x64 (320g)] + +button[5.5,3.25;1.5,0.5;bstick;BUY (5g)] +button[7.0,3.25;1.5,0.5;bstick16;BUY x16 (80g)] +button[5.5,3.75;1.5,0.5;bstick64;BUY x64 (320g)] + +button[10.5,3.25;1.5,0.5;sstick;SELL (3g)] +button[12.0,3.25;1.5,0.5;sstick x16;SELL x16 (48g)] +button[10.5,3.75;1.5,0.5;sstick x64;SELL x64 (192g)] + +image[0.5,0.25;4.5,4.5;gold_pic.png] image[8.9,1.15;1.1,3.1;white_tranlu.png] image[8.95,1.2;1.0,1.0;dirt_pic.png] image[8.7,2;1.5,1.5;pebble_pic.png] image[8.95,3.2;1.0,1.0;stick_pic.png] -button[13,0.2;0.5,0.5;back;<] diff --git a/mods/mtr_shop/buy_sell_shop.spec.new b/mods/mtr_shop/buy_sell_shop.spec.new new file mode 100644 index 0000000..46f3077 --- /dev/null +++ b/mods/mtr_shop/buy_sell_shop.spec.new @@ -0,0 +1,39 @@ +formspec_version[4] + +size[13.5,5] +position[0.5,0.5] + +background[0,0 ;14,5 ;brick_background.png] +button[13,0.2 ;0.5,0.5 ;back;<] + +label[7,0.9;What do you want to buy/sell?] + +button[5.5,1.25 ;1.5,0.5 ;bdirt ;BUY (3g)] +button[7.0,1.25 ;1.5,0.5 ;bdirt16 ;BUY x16 (48g)] +button[5.5,1.75 ;1.5,0.5 ;bdirt64 ;BUY x64 (192g)] + +button[10.5,1.25 ;1.5,0.5 ;sdirt ;SELL (1g)] +button[12.0,1.25 ;1.5,0.5 ;sdirt16 ;SELL (16g)] +button[10.5,1.75 ;1.5,0.5 ;sdirt64 ;SELL (64g)] + +button[5.5,2.25 ;1.5,0.5 ;bpebble ;BUY (10g)] +button[7.0,2.25 ;1.5,0.5 ;bpebble16 ;BUY x16 (160g)] +button[5.5,2.75 ;1.5,0.5 ;bpebble64 ;BUY x64 (640g)] + +button[10.5,2.25 ;1.5,0.5 ;spebble ;SELL (5g)] +button[12.0,2.25 ;1.5,0.5 ;spebble16 ;SELL x16 (80g)] +button[10.5,2.75 ;1.5,0.5 ;spebble64 ;SELL x64 (320g)] + +button[5.5,3.25 ;1.5,0.5 ;bstick ;BUY (5g)] +button[7.0,3.25 ;1.5,0.5 ;bstick16 ;BUY x16 (80g)] +button[5.5,3.75 ;1.5,0.5 ;bstick64 ;BUY x64 (320g)] + +button[10.5,3.25 ;1.5,0.5 ;sstick ;SELL (3g)] +button[12.0,3.25 ;1.5,0.5 ;sstick x16 ;SELL x16 (48g)] +button[10.5,3.75 ;1.5,0.5 ;sstick x64 ;SELL x64 (192g)] + +image[0.5,0.25 ;4.5,4.5 ;gold_pic.png] +image[8.9,1.15 ;1.1,3.1 ;white_tranlu.png] +image[8.95,1.2 ;1.0,1.0 ;dirt_pic.png] +image[8.7,2 ;1.5,1.5 ;pebble_pic.png] +image[8.95,3.2 ;1.0,1.0 ;stick_pic.png] diff --git a/mods/mtr_shop/buy_sell_shop.spec.old b/mods/mtr_shop/buy_sell_shop.spec.old new file mode 100644 index 0000000..0745181 --- /dev/null +++ b/mods/mtr_shop/buy_sell_shop.spec.old @@ -0,0 +1,17 @@ +formspec_version[4] +size[13.5,5] +position[0.5,0.5] +label[7,0.9;What do you want to buy/sell?] +button[5.5,1.5;3,0.5;bdirt;BUY (3g)] +button[10.5,1.5;3,0.5;sdirt;SELL (1g)] +button[5.5,2.5;3,0.5;bpebble;BUY (10g)] +button[10.5,2.5;3,0.5;spebble;SELL (5g)] +button[5.5,3.5;3,0.5;bstick;BUY (5g)] +button[10.5,3.5;3,0.5;sstick;SELL (3g)] +image[0.5,0.25;4.5,4.5;gold_pic.png] +background[0,0;14,5;brick_background.png] +image[8.9,1.15;1.1,3.1;white_tranlu.png] +image[8.95,1.2;1.0,1.0;dirt_pic.png] +image[8.7,2;1.5,1.5;pebble_pic.png] +image[8.95,3.2;1.0,1.0;stick_pic.png] +button[13,0.2;0.5,0.5;back;<] diff --git a/mods/mtr_shop/init.lua b/mods/mtr_shop/init.lua index 630c146..29e31aa 100644 --- a/mods/mtr_shop/init.lua +++ b/mods/mtr_shop/init.lua @@ -13,115 +13,199 @@ minetest.register_node("mtr_shop:shopkeeper", { tiles = { {name = "colors_a6a549.png"}, {name = "colors_e0d968.png"}, {name = "colors_796a44.png"}, {name = "colors_5f4617.png"}, {name = "colors_48280d.png"}, {name = "colors_483712.png"} }, visual_scale = (1.0/16.0), selection_box = { - type = "fixed", - fixed = { - {-6 / 16, -6 / 16, -6 / 16, 6 / 16, 22 / 16, 6 / 16}, - }, - }, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - minetest.show_formspec(clicker:get_player_name(), "mtr_shop:opening_shop", get_formspec("opening_shop.spec")) - end, - groups = {plastic = 5}, + type = "fixed", + fixed = { + {-6 / 16, -6 / 16, -6 / 16, 6 / 16, 22 / 16, 6 / 16}, + }, + }, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + minetest.show_formspec(clicker:get_player_name(), "mtr_shop:opening_shop", get_formspec("opening_shop.spec")) + end, + groups = {plastic = 5}, }) -- main shop formspec minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname ~= "mtr_shop:opening_shop" then - return - end + if formname ~= "mtr_shop:opening_shop" then + return + end - if fields.exit then - minetest.show_formspec(player:get_player_name(), "mtr_shop:exit", "") -- TODO: figure out how to close formspecs programatically - end - - if fields.shop then - minetest.show_formspec(player:get_player_name(), "mtr_shop:buy_sell_shop", get_formspec("buy_sell_shop.spec")) - end - - -- TODO: warn or stop players who try to use the anvil without any items that can be transformed at the anvil - if fields.anvil and mtr_currency.subtract_credits(10, player:get_player_name()) then - minetest.show_formspec(player:get_player_name(), "mtr_shop:anvil", get_formspec("anvil.spec")) - end + if fields.exit then + minetest.show_formspec(player:get_player_name(), "mtr_shop:exit", "") -- TODO: figure out how to close formspecs programatically + end + + if fields.shop then + minetest.show_formspec(player:get_player_name(), "mtr_shop:buy_sell_shop", get_formspec("buy_sell_shop.spec")) + end + + -- TODO: warn or stop players who try to use the anvil without any items that can be transformed at the anvil + if fields.anvil and mtr_currency.subtract_credits(10, player:get_player_name()) then + minetest.show_formspec(player:get_player_name(), "mtr_shop:anvil", get_formspec("anvil.spec")) + end end) minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname ~= "mtr_shop:buy_sell_shop" then - return - end + if formname ~= "mtr_shop:buy_sell_shop" then + return + end - if fields.back then - minetest.show_formspec(player:get_player_name(), "mtr_shop:opening_shop", get_formspec("opening_shop.spec")) - end - - local playerInvRef = minetest.get_inventory({type="player", name=player:get_player_name()}) - - -- buy dirt + if fields.back then + minetest.show_formspec(player:get_player_name(), "mtr_shop:opening_shop", get_formspec("opening_shop.spec")) + end + + local playerInvRef = minetest.get_inventory({type="player", name=player:get_player_name()}) + + -- buy dirt if fields.bdirt then if (playerInvRef:room_for_item("main", ItemStack("mtr_resources:dirt_pieces")) and mtr_currency.subtract_credits(3, player:get_player_name())) then playerInvRef:add_item("main", ItemStack("mtr_resources:dirt_pieces")) end end - + -- buy dirt x16 + if fields.bdirt16 then + if (playerInvRef:room_for_item("main", ItemStack("mtr_resources:dirt_pieces 16")) and mtr_currency.subtract_credits(3*16, player:get_player_name())) then + playerInvRef:add_item("main", ItemStack("mtr_resources:dirt_pieces 16")) + end + end + -- buy dirt x64 + if fields.bdirt64 then + if (playerInvRef:room_for_item("main", ItemStack("mtr_resources:dirt_pieces 64")) and mtr_currency.subtract_credits(3*64, player:get_player_name())) then + playerInvRef:add_item("main", ItemStack("mtr_resources:dirt_pieces 64")) + end + end + -- sell dirt if fields.sdirt then if (playerInvRef:contains_item("main", ItemStack("mtr_resources:dirt_pieces")) and playerInvRef:remove_item("main", ItemStack("mtr_resources:dirt_pieces"))) then mtr_currency.add_credits(1, player:get_player_name()) end end - + + -- sell dirt x16 + if fields.sdirt16 then + if (playerInvRef:contains_item("main", ItemStack("mtr_resources:dirt_pieces 16")) and playerInvRef:remove_item("main", ItemStack("mtr_resources:dirt_pieces 16"))) then + mtr_currency.add_credits(1*16, player:get_player_name()) + end + end + + -- sell dirt x64 + if fields.sdirt64 then + if (playerInvRef:contains_item("main", ItemStack("mtr_resources:dirt_pieces 64")) and playerInvRef:remove_item("main", ItemStack("mtr_resources:dirt_pieces 64"))) then + mtr_currency.add_credits(1*64, player:get_player_name()) + end + end + -- buy pebble if fields.bpebble then if (playerInvRef:room_for_item("main", ItemStack("mtr_weapons:pebble")) and mtr_currency.subtract_credits(10, player:get_player_name())) then playerInvRef:add_item("main", ItemStack("mtr_weapons:pebble")) end end - + + -- buy pebble x16 + if fields.bpebble16 then + if (playerInvRef:room_for_item("main", ItemStack("mtr_weapons:pebble 16")) and mtr_currency.subtract_credits(10*16, player:get_player_name())) then + playerInvRef:add_item("main", ItemStack("mtr_weapons:pebble 16")) + end + end + + -- buy pebble x64 + if fields.bpebble64 then + if (playerInvRef:room_for_item("main", ItemStack("mtr_weapons:pebble 16")) and mtr_currency.subtract_credits(10*16, player:get_player_name())) then + playerInvRef:add_item("main", ItemStack("mtr_weapons:pebble 16")) + end + end + -- sell pebble if fields.spebble then if (playerInvRef:contains_item("main", ItemStack("mtr_weapons:pebble")) and playerInvRef:remove_item("main", ItemStack("mtr_weapons:pebble"))) then mtr_currency.add_credits(5, player:get_player_name()) end end - + + -- sell pebble x16 + if fields.spebble16 then + if (playerInvRef:contains_item("main", ItemStack("mtr_weapons:pebble 16")) and playerInvRef:remove_item("main", ItemStack("mtr_weapons:pebble 16"))) then + mtr_currency.add_credits(5*16, player:get_player_name()) + end + end + + -- sell pebble x64 + if fields.spebble64 then + if (playerInvRef:contains_item("main", ItemStack("mtr_weapons:pebble 64")) and playerInvRef:remove_item("main", ItemStack("mtr_weapons:pebble 64"))) then + mtr_currency.add_credits(5*64, player:get_player_name()) + end + end + -- buy stick if fields.bstick then if (playerInvRef:room_for_item("main", ItemStack("mtr_resources:stick")) and mtr_currency.subtract_credits(5, player:get_player_name())) then playerInvRef:add_item("main", ItemStack("mtr_resources:stick")) end end - + + -- buy stick x16 + if fields.bstick16 then + if (playerInvRef:room_for_item("main", ItemStack("mtr_resources:stick 16")) and mtr_currency.subtract_credits(5*16, player:get_player_name())) then + playerInvRef:add_item("main", ItemStack("mtr_resources:stick 16")) + end + end + + -- buy stick x64 + if fields.bstick64 then + if (playerInvRef:room_for_item("main", ItemStack("mtr_resources:stick 64")) and mtr_currency.subtract_credits(5*64, player:get_player_name())) then + playerInvRef:add_item("main", ItemStack("mtr_resources:stick 64")) + end + end + -- sell stick if fields.sstick then if (playerInvRef:contains_item("main", ItemStack("mtr_resources:stick")) and playerInvRef:remove_item("main", ItemStack("mtr_resources:stick"))) then mtr_currency.add_credits(3, player:get_player_name()) end end - + + -- sell stick x16 + if fields.sstick16 then + if (playerInvRef:contains_item("main", ItemStack("mtr_resources:stick 16")) and playerInvRef:remove_item("main", ItemStack("mtr_resources:stick 16"))) then + mtr_currency.add_credits(3*16, player:get_player_name()) + end + end + + -- sell stick x64 + if fields.sstick64 then + if (playerInvRef:contains_item("main", ItemStack("mtr_resources:stick 64")) and playerInvRef:remove_item("main", ItemStack("mtr_resources:stick 64"))) then + mtr_currency.add_credits(3*64, player:get_player_name()) + end + end + end) minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname ~= "mtr_shop:anvil" then - return - end + if formname ~= "mtr_shop:anvil" then + return + end - if fields.back then - minetest.show_formspec(player:get_player_name(), "mtr_shop:opening_shop", get_formspec("opening_shop.spec")) - end - - local playerInvRef = minetest.get_inventory({type="player", name=player:get_player_name()}) - - -- make rock + if fields.back then + minetest.show_formspec(player:get_player_name(), "mtr_shop:opening_shop", get_formspec("opening_shop.spec")) + end + + local playerInvRef = minetest.get_inventory({type="player", name=player:get_player_name()}) + + -- make rock if fields.form then if (playerInvRef:contains_item("main", ItemStack("mtr_weapons:pebble 5")) and playerInvRef:room_for_item("main", ItemStack("mtr_weapons:rock")) and playerInvRef:remove_item("main", ItemStack("mtr_weapons:pebble 5"))) then playerInvRef:add_item("main", ItemStack("mtr_weapons:rock")) end end - + -- sharpen stick if fields.sharpen then - if (playerInvRef:contains_item("main", ItemStack("mtr_resources:stick")) and playerInvRef:room_for_item("main", ItemStack("mtr_weapons:sharp_stick")) and playerInvRef:remove_item("main", ItemStack("mtr_resources:stick"))) then - playerInvRef:add_item("main", ItemStack("mtr_weapons:sharp_stick")) + if (playerInvRef:contains_item("main", ItemStack("spears:spear_sharp")) and playerInvRef:room_for_item("main", ItemStack("spears:spear_sharp")) and playerInvRef:remove_item("main", ItemStack("mtr_resources:stick"))) then + playerInvRef:remove_item("main", ItemStack("spears:spear_sharp")) + playerInvRef:remove_item("main", ItemStack("mtr_resources:stick")) + playerInvRef:add_item("main", ItemStack("spears:spear_sharp")) end end - + end) diff --git a/mods/spears b/mods/spears new file mode 160000 index 0000000..32d0ee5 --- /dev/null +++ b/mods/spears @@ -0,0 +1 @@ +Subproject commit 32d0ee567aed58fca8729a334b3f1d2f33fed9f7