commit 6a8d9509bed3bd0dd5a508469fa28940b578ffa8 Author: Thomas Rudin Date: Mon May 28 14:12:05 2018 +0200 import: https://forum.minetest.net/viewtopic.php?t=12918 diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..b6cac21 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +3d_armor diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..305ead2 --- /dev/null +++ b/init.lua @@ -0,0 +1,83 @@ +if minetest.get_modpath("default") then + local stats = { + space = { name="Space", armor=1, heal=0, use=75 }, + } + local mats = { + --PLACEHOLDER + space="default:dirt", + } + for k, v in pairs(stats) do + minetest.register_tool("moontest_spacesuit:helmet_"..k, { + description = v.name.." Helmet", + inventory_image = "moontest_spacesuit_inv_helmet_"..k..".png", + groups = {armor_head=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use}, + wear = 0, + }) + minetest.register_tool("moontest_spacesuit:chestplate_"..k, { + description = v.name.." Chestplate", + inventory_image = "moontest_spacesuit_inv_chestplate_"..k..".png", + groups = {armor_torso=math.floor(8*v.armor), armor_heal=v.heal, armor_use=v.use}, + wear = 0, + }) + minetest.register_tool("moontest_spacesuit:pants_"..k, { + description = v.name.." Pants", + inventory_image = "moontest_spacesuit_inv_pants_"..k..".png", + groups = {armor_legs=math.floor(7*v.armor), armor_heal=v.heal, armor_use=v.use}, + wear = 0, + }) + minetest.register_tool("moontest_spacesuit:boots_"..k, { + description = v.name.." Boots", + inventory_image = "moontest_spacesuit_inv_boots_"..k..".png", + groups = {armor_feet=math.floor(4*v.armor), armor_heal=v.heal, armor_use=v.use}, + wear = 0, + }) + end + for k, v in pairs(mats) do + minetest.register_craft({ + output = "moontest_spacesuit:helmet_"..k, + recipe = { + {v, v, v}, + {v, "", v}, + {"", "", ""}, + }, + }) + minetest.register_craft({ + output = "moontest_spacesuit:chestplate_"..k, + recipe = { + {v, "", v}, + {v, v, v}, + {v, v, v}, + }, + }) + minetest.register_craft({ + output = "moontest_spacesuit:pants_"..k, + recipe = { + {v, v, v}, + {v, "", v}, + {v, "", v}, + }, + }) + minetest.register_craft({ + output = "moontest_spacesuit:boots_"..k, + recipe = { + {v, "", v}, + {v, "", v}, + }, + }) + end +end + + +--currently broken + +minetest.register_globalstep(function(dtime) + for _, player in ipairs(minetest.get_connected_players()) do + if math.random() < 0.1 then -- spacesuit restores breath + local name = player:get_player_name() + local inv = player:get_inventory() + if inv:contains_item("armor", "moontest_spacesuit:helmet_space") and inv:contains_item("armor", "moontest_spacesuit:chestplate_space") and inv:contains_item("armor", "moontest_spacesuit:pants_space") and inv:contains_item("armor", "moontest_spacesuit:boots_space") then + player:set_breath(10) + end + end + end +end) \ No newline at end of file diff --git a/textures/moontest_spacesuit_boots_space.png b/textures/moontest_spacesuit_boots_space.png new file mode 100644 index 0000000..f4a7d49 Binary files /dev/null and b/textures/moontest_spacesuit_boots_space.png differ diff --git a/textures/moontest_spacesuit_boots_space_preview.png b/textures/moontest_spacesuit_boots_space_preview.png new file mode 100644 index 0000000..2cf7165 Binary files /dev/null and b/textures/moontest_spacesuit_boots_space_preview.png differ diff --git a/textures/moontest_spacesuit_chestplate_space.png b/textures/moontest_spacesuit_chestplate_space.png new file mode 100644 index 0000000..11c413a Binary files /dev/null and b/textures/moontest_spacesuit_chestplate_space.png differ diff --git a/textures/moontest_spacesuit_chestplate_space_preview.png b/textures/moontest_spacesuit_chestplate_space_preview.png new file mode 100644 index 0000000..72afe30 Binary files /dev/null and b/textures/moontest_spacesuit_chestplate_space_preview.png differ diff --git a/textures/moontest_spacesuit_helmet_space.png b/textures/moontest_spacesuit_helmet_space.png new file mode 100644 index 0000000..b60d5a7 Binary files /dev/null and b/textures/moontest_spacesuit_helmet_space.png differ diff --git a/textures/moontest_spacesuit_helmet_space_preview.png b/textures/moontest_spacesuit_helmet_space_preview.png new file mode 100644 index 0000000..a2f1ebe Binary files /dev/null and b/textures/moontest_spacesuit_helmet_space_preview.png differ diff --git a/textures/moontest_spacesuit_inv_boots_space.png b/textures/moontest_spacesuit_inv_boots_space.png new file mode 100644 index 0000000..9b90b2e Binary files /dev/null and b/textures/moontest_spacesuit_inv_boots_space.png differ diff --git a/textures/moontest_spacesuit_inv_chestplate_space.png b/textures/moontest_spacesuit_inv_chestplate_space.png new file mode 100644 index 0000000..74ff1fb Binary files /dev/null and b/textures/moontest_spacesuit_inv_chestplate_space.png differ diff --git a/textures/moontest_spacesuit_inv_helmet_space.png b/textures/moontest_spacesuit_inv_helmet_space.png new file mode 100644 index 0000000..53da3ee Binary files /dev/null and b/textures/moontest_spacesuit_inv_helmet_space.png differ diff --git a/textures/moontest_spacesuit_inv_pants_space.png b/textures/moontest_spacesuit_inv_pants_space.png new file mode 100644 index 0000000..54e9b29 Binary files /dev/null and b/textures/moontest_spacesuit_inv_pants_space.png differ diff --git a/textures/moontest_spacesuit_pants_space.png b/textures/moontest_spacesuit_pants_space.png new file mode 100644 index 0000000..d20b7fc Binary files /dev/null and b/textures/moontest_spacesuit_pants_space.png differ diff --git a/textures/moontest_spacesuit_pants_space_preview.png b/textures/moontest_spacesuit_pants_space_preview.png new file mode 100644 index 0000000..4f104ee Binary files /dev/null and b/textures/moontest_spacesuit_pants_space_preview.png differ