first commit

master
runs 2022-01-19 22:44:08 +01:00
commit 555fa22237
433 changed files with 6131 additions and 0 deletions

4
LICENSE.txt Normal file
View File

@ -0,0 +1,4 @@
License information for Development Test
----------------------------------------
The same license as for Minetest applies.

1
README.md Normal file
View File

@ -0,0 +1 @@
# Samz Game

2
game.conf Normal file
View File

@ -0,0 +1,2 @@
name = The Samz
description = A game for kids.

BIN
menu/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

BIN
menu/header.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

BIN
menu/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

364
mods/basetools/init.lua Normal file
View File

@ -0,0 +1,364 @@
--
-- Tool definitions
--
--[[ TOOLS SUMMARY:
Tool types:
* Hand: basic tool/weapon (special capabilities in creative mode)
* Pickaxe: dig cracky
* Axe: dig choppy
* Shovel: dig crumbly
* Shears: dig snappy
* Sword: deal damage
* Dagger: deal damage, but faster
Tool materials:
* Wood: dig nodes of rating 3
* Stone: dig nodes of rating 3 or 2
* Steel: dig nodes of rating 3, 2 or 1
* Mese: dig "everything" instantly
* n-Uses: can be used n times before breaking
]]
-- The hand
if minetest.settings:get_bool("creative_mode") then
local digtime = 42
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x = 1, y = 1, z = 2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = caps,
cracky = caps,
snappy = caps,
choppy = caps,
oddly_breakable_by_hand = caps,
-- dig_immediate group doesn't use value 1. Value 3 is instant dig
dig_immediate =
{times = {[2] = digtime, [3] = 0}, uses = 0, maxlevel = 256},
},
damage_groups = {fleshy = 10},
}
})
else
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x = 1, y = 1, z = 2.5},
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 0,
groupcaps = {
crumbly = {times = {[2] = 3.00, [3] = 0.70}, uses = 0, maxlevel = 1},
snappy = {times = {[3] = 0.40}, uses = 0, maxlevel = 1},
oddly_breakable_by_hand =
{times = {[1] = 3.50, [2] = 2.00, [3] = 0.70}, uses = 0}
},
damage_groups = {fleshy = 1},
}
})
end
-- Mese Pickaxe: special tool that digs "everything" instantly
minetest.register_tool("basetools:pick_mese", {
description = "Mese Pickaxe".."\n"..
"Digs diggable nodes instantly",
inventory_image = "basetools_mesepick.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=3,
groupcaps={
cracky={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
crumbly={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
snappy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
choppy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
dig_immediate={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
},
damage_groups = {fleshy=100},
},
})
--
-- Pickaxes: Dig cracky
--
minetest.register_tool("basetools:pick_wood", {
description = "Wooden Pickaxe".."\n"..
"Digs cracky=3",
inventory_image = "basetools_woodpick.png",
tool_capabilities = {
max_drop_level=0,
groupcaps={
cracky={times={[3]=2.00}, uses=30, maxlevel=0}
},
},
})
minetest.register_tool("basetools:pick_stone", {
description = "Stone Pickaxe".."\n"..
"Digs cracky=2..3",
inventory_image = "basetools_stonepick.png",
tool_capabilities = {
max_drop_level=0,
groupcaps={
cracky={times={[2]=1.20, [3]=0.80}, uses=60, maxlevel=0}
},
},
})
minetest.register_tool("basetools:pick_steel", {
description = "Steel Pickaxe".."\n"..
"Digs cracky=1..3",
inventory_image = "basetools_steelpick.png",
tool_capabilities = {
max_drop_level=1,
groupcaps={
cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=0}
},
},
})
minetest.register_tool("basetools:pick_steel_l1", {
description = "Steel Pickaxe Level 1".."\n"..
"Digs cracky=1..3".."\n"..
"maxlevel=1",
inventory_image = "basetools_steelpick_l1.png",
tool_capabilities = {
max_drop_level=1,
groupcaps={
cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=1}
},
},
})
minetest.register_tool("basetools:pick_steel_l2", {
description = "Steel Pickaxe Level 2".."\n"..
"Digs cracky=1..3".."\n"..
"maxlevel=2",
inventory_image = "basetools_steelpick_l2.png",
tool_capabilities = {
max_drop_level=1,
groupcaps={
cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=2}
},
},
})
--
-- Shovels (dig crumbly)
--
minetest.register_tool("basetools:shovel_wood", {
description = "Wooden Shovel".."\n"..
"Digs crumbly=3",
inventory_image = "basetools_woodshovel.png",
tool_capabilities = {
max_drop_level=0,
groupcaps={
crumbly={times={[3]=0.50}, uses=30, maxlevel=0}
},
},
})
minetest.register_tool("basetools:shovel_stone", {
description = "Stone Shovel".."\n"..
"Digs crumbly=2..3",
inventory_image = "basetools_stoneshovel.png",
tool_capabilities = {
max_drop_level=0,
groupcaps={
crumbly={times={[2]=0.50, [3]=0.30}, uses=60, maxlevel=0}
},
},
})
minetest.register_tool("basetools:shovel_steel", {
description = "Steel Shovel".."\n"..
"Digs crumbly=1..3",
inventory_image = "basetools_steelshovel.png",
tool_capabilities = {
max_drop_level=1,
groupcaps={
crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=90, maxlevel=0}
},
},
})
--
-- Axes (dig choppy)
--
minetest.register_tool("basetools:axe_wood", {
description = "Wooden Axe".."\n"..
"Digs choppy=3",
inventory_image = "basetools_woodaxe.png",
tool_capabilities = {
max_drop_level=0,
groupcaps={
choppy={times={[3]=0.80}, uses=30, maxlevel=0},
},
},
})
minetest.register_tool("basetools:axe_stone", {
description = "Stone Axe".."\n"..
"Digs choppy=2..3",
inventory_image = "basetools_stoneaxe.png",
tool_capabilities = {
max_drop_level=0,
groupcaps={
choppy={times={[2]=1.00, [3]=0.60}, uses=60, maxlevel=0},
},
},
})
minetest.register_tool("basetools:axe_steel", {
description = "Steel Axe".."\n"..
"Digs choppy=1..3",
inventory_image = "basetools_steelaxe.png",
tool_capabilities = {
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=90, maxlevel=0},
},
},
})
--
-- Shears (dig snappy)
--
minetest.register_tool("basetools:shears_wood", {
description = "Wooden Shears".."\n"..
"Digs snappy=3",
inventory_image = "basetools_woodshears.png",
tool_capabilities = {
max_drop_level=0,
groupcaps={
snappy={times={[3]=1.00}, uses=30, maxlevel=0},
},
},
})
minetest.register_tool("basetools:shears_stone", {
description = "Stone Shears".."\n"..
"Digs snappy=2..3",
inventory_image = "basetools_stoneshears.png",
tool_capabilities = {
max_drop_level=0,
groupcaps={
snappy={times={[2]=1.00, [3]=0.50}, uses=60, maxlevel=0},
},
},
})
minetest.register_tool("basetools:shears_steel", {
description = "Steel Shears".."\n"..
"Digs snappy=1..3",
inventory_image = "basetools_steelshears.png",
tool_capabilities = {
max_drop_level=1,
groupcaps={
snappy={times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=90, maxlevel=0},
},
},
})
--
-- Swords (deal damage)
--
minetest.register_tool("basetools:sword_wood", {
description = "Wooden Sword".."\n"..
"Damage: fleshy=2",
inventory_image = "basetools_woodsword.png",
tool_capabilities = {
full_punch_interval = 1.0,
damage_groups = {fleshy=2},
}
})
minetest.register_tool("basetools:sword_stone", {
description = "Stone Sword".."\n"..
"Damage: fleshy=4",
inventory_image = "basetools_stonesword.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=0,
damage_groups = {fleshy=4},
}
})
minetest.register_tool("basetools:sword_steel", {
description = "Steel Sword".."\n"..
"Damage: fleshy=6",
inventory_image = "basetools_steelsword.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
damage_groups = {fleshy=6},
}
})
-- Fire/Ice sword: Deal damage to non-fleshy damage groups
minetest.register_tool("basetools:sword_fire", {
description = "Fire Sword".."\n"..
"Damage: icy=6",
inventory_image = "basetools_firesword.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=0,
damage_groups = {icy=6},
}
})
minetest.register_tool("basetools:sword_ice", {
description = "Ice Sword".."\n"..
"Damage: fiery=6",
inventory_image = "basetools_icesword.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=0,
damage_groups = {fiery=6},
}
})
--
-- Dagger: Low damage, fast punch interval
--
minetest.register_tool("basetools:dagger_steel", {
description = "Steel Dagger".."\n"..
"Damage: fleshy=2".."\n"..
"Full Punch Interval: 0.5s",
inventory_image = "basetools_steeldagger.png",
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level=0,
damage_groups = {fleshy=2},
}
})
-- Test tool uses and punch_attack_uses
local uses = { 1, 2, 3, 5, 10, 50, 100, 1000, 10000, 65535 }
for i=1, #uses do
local u = uses[i]
local color = string.format("#FF00%02X", math.floor(((i-1)/#uses) * 255))
minetest.register_tool("basetools:pick_uses_"..string.format("%05d", u), {
description = u.."-Uses Pickaxe".."\n"..
"Digs cracky=3",
inventory_image = "basetools_steelpick.png^[colorize:"..color..":127",
tool_capabilities = {
max_drop_level=0,
groupcaps={
cracky={times={[3]=0.1, [2]=0.2, [1]=0.3}, uses=u, maxlevel=0}
},
},
})
minetest.register_tool("basetools:sword_uses_"..string.format("%05d", u), {
description = u.."-Uses Sword".."\n"..
"Damage: fleshy=1",
inventory_image = "basetools_woodsword.png^[colorize:"..color..":127",
tool_capabilities = {
damage_groups = {fleshy=1},
punch_attack_uses = u,
},
})
end

2
mods/basetools/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = basetools
description = Contains basic digging tools

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

27
mods/bucket/init.lua Normal file
View File

@ -0,0 +1,27 @@
-- Bucket: Punch liquid source or flowing liquid to collect it
minetest.register_tool("bucket:bucket", {
description = "Bucket".."\n"..
"Picks up liquid nodes",
inventory_image = "bucket.png",
stack_max = 1,
liquids_pointable = true,
groups = { disable_repair = 1 },
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid
local n = minetest.get_node(pointed_thing.under)
local def = minetest.registered_nodes[n.name]
if def ~= nil and (def.liquidtype == "source" or def.liquidtype == "flowing") then
minetest.add_node(pointed_thing.under, {name="air"})
local inv = user:get_inventory()
if inv then
inv:add_item("main", ItemStack(n.name))
end
end
end,
})

2
mods/bucket/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = bucket
description = Minimal bucket to pick up liquids

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

40
mods/chest/init.lua Normal file
View File

@ -0,0 +1,40 @@
minetest.register_node("chest:chest", {
description = "Chest" .. "\n" ..
"32 inventory slots",
tiles ={"chest_chest.png^[sheet:2x2:0,0", "chest_chest.png^[sheet:2x2:0,0",
"chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:1,0",
"chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:0,1"},
paramtype2 = "facedir",
groups = {dig_immediate=2,choppy=3},
is_ground_content = false,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]" ..
"listring[]")
meta:set_string("infotext", "Chest")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.chat_send_player(player:get_player_name(), "Allow put: " .. stack:to_string())
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.chat_send_player(player:get_player_name(), "Allow take: " .. stack:to_string())
return stack:get_count()
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.chat_send_player(player:get_player_name(), "On put: " .. stack:to_string())
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.chat_send_player(player:get_player_name(), "On take: " .. stack:to_string())
end,
})

2
mods/chest/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = chest
description = A simple chest to store items

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

View File

@ -0,0 +1,136 @@
local F = minetest.formspec_escape
-- Create a detached inventory
local inv_everything = minetest.create_detached_inventory("everything", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
return 0
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
return -1
end,
})
local inv_trash = minetest.create_detached_inventory("trash", {
allow_take = function(inv, listname, index, stack, player)
return 0
end,
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
return 0
end,
on_put = function(inv, listname, index, stack, player)
inv:set_list("main", {})
end,
})
inv_trash:set_size("main", 1)
local max_page = 1
local function get_chest_formspec(page)
local start = 0 + (page-1)*32
return "size[8,9]"..
"list[detached:everything;main;0,0;8,4;"..start.."]"..
"list[current_player;main;0,5;8,4;]" ..
"label[6,4;Trash:]" ..
"list[detached:trash;main;7,4;1,1]" ..
"button[0,4;1,1;chest_of_everything_prev;"..F("<").."]"..
"button[1,4;1,1;chest_of_everything_next;"..F(">").."]"..
"label[2,4;"..F("Page: "..page).."]"..
"listring[detached:everything;main]"..
"listring[current_player;main]"..
"listring[detached:trash;main]"
end
minetest.register_node("chest_of_everything:chest", {
description = "Chest of Everything" .. "\n" ..
"Grants access to all items",
tiles ={"chest_of_everything_chest.png^[sheet:2x2:0,0", "chest_of_everything_chest.png^[sheet:2x2:0,0",
"chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:1,0",
"chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:0,1"},
paramtype2 = "facedir",
groups = {dig_immediate=2,choppy=3},
is_ground_content = false,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Chest of Everything")
meta:set_int("page", 1)
meta:set_string("formspec", get_chest_formspec(1))
end,
on_receive_fields = function(pos, formname, fields, sender)
if formname == "" then
local meta = minetest.get_meta(pos)
local page = meta:get_int("page")
if fields.chest_of_everything_prev then
page = page - 1
elseif fields.chest_of_everything_next then
page = page + 1
end
if page < 1 then
page = 1
end
if page > max_page then
page = max_page
end
meta:set_int("page", page)
meta:set_string("formspec", get_chest_formspec(page))
end
end,
})
minetest.register_on_mods_loaded(function()
local items = {}
for itemstring,_ in pairs(minetest.registered_items) do
if itemstring ~= "" and itemstring ~= "unknown" and itemstring ~= "ignore" then
table.insert(items, itemstring)
end
end
--[[ Sort items in this order:
* Chest of Everything
* Test tools
* Other tools
* Craftitems
* Other items
* Dummy items ]]
local function compare(item1, item2)
local def1 = minetest.registered_items[item1]
local def2 = minetest.registered_items[item2]
local tool1 = def1.type == "tool"
local tool2 = def2.type == "tool"
local testtool1 = minetest.get_item_group(item1, "testtool") == 1
local testtool2 = minetest.get_item_group(item2, "testtool") == 1
local dummy1 = minetest.get_item_group(item1, "dummy") == 1
local dummy2 = minetest.get_item_group(item2, "dummy") == 1
local craftitem1 = def1.type == "craft"
local craftitem2 = def2.type == "craft"
if item1 == "chest_of_everything:chest" then
return true
elseif item2 == "chest_of_everything:chest" then
return false
elseif dummy1 and not dummy2 then
return false
elseif not dummy1 and dummy2 then
return true
elseif testtool1 and not testtool2 then
return true
elseif not testtool1 and testtool2 then
return false
elseif tool1 and not tool2 then
return true
elseif not tool1 and tool2 then
return false
elseif craftitem1 and not craftitem2 then
return true
elseif not craftitem1 and craftitem2 then
return false
else
return item1 < item2
end
end
table.sort(items, compare)
inv_everything:set_size("main", #items)
max_page = math.ceil(#items / 32)
for i=1, #items do
inv_everything:add_item("main", items[i])
end
end)

View File

@ -0,0 +1,2 @@
name = chest_of_everything
description = Adds the chest of everything from which you can take all items

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

37
mods/dignodes/init.lua Normal file
View File

@ -0,0 +1,37 @@
local groups = {
"cracky", "dig_immediate"
}
-- Register dig nodes with 1 digging group, a rating between 1-3 and a level between 0-2
for g=1, #groups do
local gr = groups[g]
for r=1, 3 do
for l=0, 2 do
if not (gr=="dig_immediate" and (l>0 or r==1)) then
local d
if l > 0 then
d = string.format("Dig Test Node: %s=%d, level=%d", gr, r, l)
else
d = string.format("Dig Test Node: %s=%d", gr, r)
end
local tile = "dignodes_"..gr..".png^dignodes_rating"..r..".png"
if l==1 then
tile = tile .. "^[colorize:#FFFF00:127"
elseif l==2 then
tile = tile .. "^[colorize:#FF0000:127"
end
minetest.register_node("dignodes:"..gr.."_"..r.."_"..l, {
description = d,
tiles = { tile },
groups = { [gr] = r, level = l },
})
end
end
end
end
-- Node without any digging groups
minetest.register_node("dignodes:none", {
description = "Dig Test Node: groupless",
tiles = {"dignodes_none.png"},
})

2
mods/dignodes/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = dignodes
description = Nodes with different digging groups

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

View File

@ -0,0 +1,36 @@
local give_if_not_gotten_already = function(inv, list, item)
if not inv:contains_item(list, item) then
inv:add_item(list, item)
end
end
local give_initial_stuff = function(player)
local inv = player:get_inventory()
give_if_not_gotten_already(inv, "main", "basetools:pick_mese")
give_if_not_gotten_already(inv, "main", "basetools:axe_steel")
give_if_not_gotten_already(inv, "main", "basetools:shovel_steel")
give_if_not_gotten_already(inv, "main", "bucket:bucket")
give_if_not_gotten_already(inv, "main", "chest_of_everything:chest")
minetest.log("action", "[give_initial_stuff] Giving initial stuff to "..player:get_player_name())
end
minetest.register_on_newplayer(function(player)
if minetest.settings:get_bool("give_initial_stuff", true) then
give_initial_stuff(player)
end
end)
minetest.register_chatcommand("stuff", {
params = "",
privs = { give = true },
description = "Give yourself initial items",
func = function(name, param)
local player = minetest.get_player_by_name(name)
if not player or not player:is_player() then
return false, "No player."
end
give_initial_stuff(player)
return true
end,
})

View File

@ -0,0 +1,3 @@
name = give_initial_stuff
description = Gives items to players on join
depends = basetools, bucket, chest_of_everything, testnodes

View File

@ -0,0 +1,9 @@
minetest.register_on_joinplayer(function(player)
local cb = function(player)
if not player or not player:is_player() then
return
end
minetest.chat_send_player(player:get_player_name(), "This is the \"Development Test\" [samz], meant only for testing and development.")
end
minetest.after(2.0, cb, player)
end)

View File

@ -0,0 +1,2 @@
name = initial_message
description = Show message to joining players explaining what this testing game is about

135
mods/invz/init.lua Normal file
View File

@ -0,0 +1,135 @@
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local frmspc_server = [[
image_button[0,0;1,1;invz_day.png;btn_day;]]..S("Day")..[[;;]
image_button[1,0;1,1;invz_night.png;btn_night;]]..S("Night")..[[;;]
]]
local function get_session_time(player)
return os.difftime(os.time(), player:get_meta():get_int("invz:join_time"))
end
local function get_play_time(player)
local play_time = player:get_meta():get_int("invz:play_time")
local session_time = get_session_time(player)
local total_time = play_time + session_time
return total_time
end
local function disp_time(time)
local days = math.floor(time/86400)
local remaining = time % 86400
local hours = math.floor(remaining/3600)
remaining = remaining % 3600
local minutes = math.floor(remaining/60)
remaining = remaining % 60
local seconds = remaining
if (hours < 10) then
hours = "0" .. tostring(hours)
end
if (minutes < 10) then
minutes = "0" .. tostring(minutes)
end
if (seconds < 10) then
seconds = "0" .. tostring(seconds)
end
local answer = tostring(days)..':'..hours..':'..minutes..':'..seconds
return answer
end
local function get_frmspc_stats(player)
local meta = player:get_meta()
local level = meta:get_int("level")
local died = meta:get_int("invz:died")
local died_player = meta:get_int("invz:died_player")
local died_creature = meta:get_int("invz:died_creature")
local died_fall = meta:get_int("invz:died_fall")
local died_drown = meta:get_int("invz:died_drown")
local died_fire = meta:get_int("invz:died_fire")
local died_lava = meta:get_int("invz:died_lava")
local kills = meta:get_int("invz:kills")
local last_login = os.date('%Y-%m-%d %H:%M:%S', meta:get_int("invz:last_login"))
local session_time = get_session_time(player)
local play_time = get_play_time(player)
return [[
label[0.25,0.25;]]..S("Level")..": "..tostring(level)..[[]
label[0.25,1.0;]]..tostring(died).." "..S("times died")..[[]
label[0.5,1.25;]]..tostring(died_player).." "..S("times died by player")..[[]
label[0.5,1.5;]]..tostring(died_creature).." "..S("times died by creature")..[[]
label[0.5,1.75;]]..tostring(died_fall).." "..S("times died by fall")..[[]
label[0.5,2;]]..tostring(died_drown).." "..S("times drown")..[[]
label[0.5,2.25;]]..tostring(died_fire).." "..S("times died by fire")..[[]
label[0.5,2.5;]]..tostring(died_lava).." "..S("times died by lava")..[[]
label[0.25,3;]]..tostring(kills).." "..S("kills")..[[]
label[0.25,3.5;]]..S("Last Login")..": "..last_login..[[]
label[0.25,3.75;]]..S("This Session Time")..": "..disp_time(session_time)..[[]
label[0.25,4;]]..S("Total Play Time")..": "..disp_time(play_time)..[[]
]]
end
--Save the stats when an event produced
minetest.register_on_dieplayer(function(player, reason)
local meta = player:get_meta()
meta:set_int("invz:died", (meta:get_int("invz:died") + 1))
if reason.type == "punch" and reason.object then
if minetest.is_player(reason.object) then
meta:set_int("invz:died_player", (meta:get_int("invz:died_player") + 1))
local meta_killer = reason.object:get_meta()
meta_killer:set_int("invz:kills", (meta_killer:get_int("invz:kills") + 1))
else
meta:set_int("invz:died_creature", (meta:get_int("invz:died_creature") + 1))
end
elseif reason.type == "fall" then
meta:set_int("invz:died_fall", (meta:get_int("invz:died_fall") + 1))
elseif reason.type == "drown" then
meta:set_int("invz:died_drown", (meta:get_int("invz:died_drown") + 1))
elseif reason.type == "node_damage" and reason.node then
if reason.node == "default:lava_source" then
meta:set_int("invz:died_lava", (meta:get_int("invz:died_lava") + 1))
elseif reason.node == "fire:basic_flame" or reason.node == "fire:permanent_flame" then
meta:set_int("invz:died_fire", (meta:get_int("invz:died_fire") + 1))
end
end
end)
minetest.register_on_joinplayer(function(player, last_login)
if last_login then
player:get_meta():set_int("invz:last_login", last_login)
end
player:get_meta():set_int("invz:join_time", os.time())
end)
minetest.register_on_leaveplayer(function(player, timed_out)
player:get_meta():set_int("invz:play_time", get_play_time(player))
end)
sfinv.register_page("server", {
title = S("Server"),
get = function(self, player, context)
return sfinv.make_formspec(player, context, frmspc_server, false)
end,
is_in_nav = function(self, player, context)
local player_name = player:get_player_name()
if minetest.check_player_privs(player_name, {server=true}) then
return true
else
return false
end
end,
on_player_receive_fields = function(self, player, context, fields)
if fields.btn_day then
minetest.set_timeofday(0.5)
end
if fields.btn_night then
minetest.set_timeofday(0)
end
end,
})
sfinv.register_page("stats", {
title = S("Stats"),
get = function(self, player, context)
return sfinv.make_formspec(player, context, get_frmspc_stats(player), false)
end,
})

View File

@ -0,0 +1,18 @@
# textdomain: invz
Server=Servidor
Day=Día
Night=Noche
Level=Nivel
Stats=Estado
times died=veces muerto
times died by player=veces muerto por jugador
times died by creature=veces muerto por criatura
times died by fall=veces muerto por caída
times drown=veces ahogado
times died by fire=veces abrasado por fuego
times died by lava=veces abrasado por lava
kills=muertes
Last Login=Último ingreso
This Session Time=Tiempo de sesión
Total Play Time=Tiempo total jugado

2
mods/invz/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = invz
depends = sfinv

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

102
mods/mapgen/init.lua Normal file
View File

@ -0,0 +1,102 @@
--
-- Aliases for map generator outputs
--
-- ESSENTIAL node aliases
-- Basic nodes
minetest.register_alias("mapgen_stone", "nodez:stone")
minetest.register_alias("mapgen_water_source", "nodez:water_source")
minetest.register_alias("mapgen_river_water_source", "nodez:river_water_source")
-- Additional essential aliases for v6
minetest.register_alias("mapgen_lava_source", "nodez:lava_source")
minetest.register_alias("mapgen_dirt", "nodez:dirt")
minetest.register_alias("mapgen_dirt_with_grass", "nodez:dirt_with_grass")
minetest.register_alias("mapgen_sand", "nodez:sand")
minetest.register_alias("mapgen_tree", "nodez:tree")
minetest.register_alias("mapgen_leaves", "nodez:leaves")
minetest.register_alias("mapgen_apple", "nodez:apple")
-- Essential alias for dungeons
minetest.register_alias("mapgen_cobble", "nodez:cobble")
-- Optional aliases for v6 (they all have fallback values in the engine)
if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then
minetest.register_alias("mapgen_gravel", "nodez:gravel")
minetest.register_alias("mapgen_desert_stone", "nodez:desert_stone")
minetest.register_alias("mapgen_desert_sand", "nodez:desert_sand")
minetest.register_alias("mapgen_dirt_with_snow", "nodez:dirt_with_snow")
minetest.register_alias("mapgen_snowblock", "nodez:snowblock")
minetest.register_alias("mapgen_snow", "nodez:snow")
minetest.register_alias("mapgen_ice", "nodez:ice")
minetest.register_alias("mapgen_junglegrass", "nodez:junglegrass")
minetest.register_alias("mapgen_jungletree", "nodez:jungletree")
minetest.register_alias("mapgen_jungleleaves", "nodez:jungleleaves")
minetest.register_alias("mapgen_pine_tree", "nodez:pine_tree")
minetest.register_alias("mapgen_pine_needles", "nodez:pine_needles")
end
-- Optional alias for mossycobble (should fall back to cobble)
if minetest.settings:get_bool("devtest_dungeon_mossycobble", false) then
minetest.register_alias("mapgen_mossycobble", "nodez:mossycobble")
end
-- Optional aliases for dungeon stairs (should fall back to full nodes)
if minetest.settings:get_bool("devtest_dungeon_stairs", false) then
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then
minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone")
end
end
--
-- Register biomes for biome API
--
minetest.clear_registered_biomes()
minetest.clear_registered_decorations()
minetest.register_biome({
name = "forest",
node_top = "nodez:dirt_with_grass",
depth_top = 1,
node_filler = "nodez:dirt",
depth_filler = 1,
node_riverbed = "nodez:sand",
depth_riverbed = 2,
node_dungeon = "nodez:cobble",
node_dungeon_alt = "nodez:mossycobble",
node_dungeon_stair = "stairs:stair_cobble",
y_max = 31000,
y_min = 4,
heat_point = 50,
humidity_point = 50,
})
minetest.register_biome({
name = "forest_ocean",
node_top = "nodez:sand",
depth_top = 1,
node_filler = "nodez:sand",
depth_filler = 3,
node_riverbed = "nodez:sand",
depth_riverbed = 2,
node_cave_liquid = "nodez:water_source",
node_dungeon = "nodez:cobble",
node_dungeon_alt = "nodez:mossycobble",
node_dungeon_stair = "stairs:stair_cobble",
y_max = 3,
y_min = -255,
heat_point = 50,
humidity_point = 50,
})
minetest.register_biome({
name = "grassland_under",
node_cave_liquid = {"nodez:water_source", "nodez:lava_source"},
node_dungeon = "nodez:cobble",
node_dungeon_alt = "nodez:mossycobble",
node_dungeon_stair = "stairs:stair_cobble",
y_max = -256,
y_min = -31000,
heat_point = 50,
humidity_point = 50,
})

3
mods/mapgen/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = mapgen
description = Minimal map generator
depends = nodez

17
mods/nodez/dirt.lua Normal file
View File

@ -0,0 +1,17 @@
local S = ...
minetest.register_node("nodez:dirt", {
description = S("Dirt"),
tiles ={"default_dirt.png"},
groups = {crumbly=3, soil=1},
})
minetest.register_node("nodez:dirt_with_grass", {
description = S("Dirt with Grass"),
tiles ={"default_grass.png",
-- a little dot on the bottom to distinguish it from dirt
"default_dirt.png^basenodes_dirt_with_grass_bottom.png",
{name = "default_dirt.png^default_grass_side.png",
tileable_vertical = false}},
groups = {crumbly=3, soil=1},
})

1
mods/nodez/grass.lua Normal file
View File

@ -0,0 +1 @@
local S = ...

17
mods/nodez/init.lua Normal file
View File

@ -0,0 +1,17 @@
--
-- Nodez
--
nodez = {}
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(modname)
assert(loadfile(modpath .. "/dirt.lua"))(S)
assert(loadfile(modpath .. "/grass.lua"))(S)
assert(loadfile(modpath .. "/lava.lua"))(S)
assert(loadfile(modpath .. "/sand.lua"))(S)
assert(loadfile(modpath .. "/stone.lua"))(S)
assert(loadfile(modpath .. "/water.lua"))(S)

57
mods/nodez/lava.lua Normal file
View File

@ -0,0 +1,57 @@
local S = ...
local LAVA_VISC = 7
minetest.register_node("nodez:lava_flowing", {
description = S("Flowing Lava").."\n"..
"4 damage per second".."\n"..
"Drowning damage: 1",
drawtype = "flowingliquid",
tiles = {"default_lava_flowing.png"},
special_tiles = {
{name="default_lava_flowing.png", backface_culling = false},
{name="default_lava_flowing.png", backface_culling = false},
},
paramtype = "light",
light_source = minetest.LIGHT_MAX,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drowning = 1,
damage_per_second = 4,
liquidtype = "flowing",
liquid_alternative_flowing = "nodez:lava_flowing",
liquid_alternative_source = "nodez:lava_source",
liquid_viscosity = LAVA_VISC,
post_effect_color = {a=192, r=255, g=64, b=0},
groups = {lava=3, liquid=1},
})
minetest.register_node("nodez:lava_source", {
description = S("Lava Source").."\n"..
"4 damage per second".."\n"..
"Drowning damage: 1",
drawtype = "liquid",
tiles = { "default_lava.png" },
special_tiles = {
{name = "default_lava.png", backface_culling = false},
{name = "default_lava.png", backface_culling = true},
},
paramtype = "light",
light_source = minetest.LIGHT_MAX,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drowning = 1,
damage_per_second = 4,
liquidtype = "source",
liquid_alternative_flowing = "nodez:lava_flowing",
liquid_alternative_source = "nodez:lava_source",
liquid_viscosity = LAVA_VISC,
post_effect_color = {a=192, r=255, g=64, b=0},
groups = {lava=3, liquid=1},
})

View File

@ -0,0 +1,16 @@
# textdomain: nodez
Cobblestone=Empedrado
Dirt=Tierra
Dirt with Grass=Tierra con pasto
Flowing Water=Corriente de agua
Flowing River Water=Corriente de agua de río
Flowing Lava=Corriente de lava
Gravel=Gravilla
Lava Source=Fuente de lava
Mossy Cobblestone=Empredrado musgoso
River Water Source=Fuente de agua de río
Sand=Arena
Stone=Piedra
Water Source=Fuente de agua

2
mods/nodez/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = nodez
description = Contains basic nodes for mapgen

13
mods/nodez/sand.lua Normal file
View File

@ -0,0 +1,13 @@
local S = ...
minetest.register_node("nodez:sand", {
description = S("Sand"),
tiles ={"default_sand.png"},
groups = {crumbly=3},
})
minetest.register_node("nodez:desert_sand", {
description = S("Desert Sand"),
tiles ={"default_desert_sand.png"},
groups = {crumbly=3},
})

28
mods/nodez/stone.lua Normal file
View File

@ -0,0 +1,28 @@
local S = ...
minetest.register_node("nodez:stone", {
description = S("Stone"),
tiles = {"default_stone.png"},
groups = {cracky=3},
})
minetest.register_node("nodez:cobble", {
description = S("Cobblestone"),
tiles ={"default_cobble.png"},
is_ground_content = false,
groups = {cracky=3},
})
minetest.register_node("nodez:mossycobble", {
description = S("Mossy Cobblestone"),
tiles ={"default_mossycobble.png"},
is_ground_content = false,
groups = {cracky=3},
})
minetest.register_node("nodez:gravel", {
description = S("Gravel"),
tiles ={"default_gravel.png"},
groups = {crumbly=2},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Some files were not shown because too many files have changed in this diff Show More