Remove backup files
Remove all of the backup files within the repository. Also add a gitignore file with a rule to ignore all future backup files. Closes #14
This commit is contained in:
parent
f10ba9c11d
commit
44f16ade4e
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Backup files
|
||||||
|
*~
|
@ -1 +0,0 @@
|
|||||||
name = rpgtest
|
|
@ -1,22 +0,0 @@
|
|||||||
building = {}
|
|
||||||
function building.register_schematic(name, f)
|
|
||||||
minetest.register_craftitem("building:".. name, {
|
|
||||||
description = "Schematic : " .. name,
|
|
||||||
inventory_image = "building_stick.png",
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if f and pointed_thing.above then
|
|
||||||
minetest.place_schematic(pointed_thing.above, minetest.get_modpath("building").."/schematics/"..name..".mts", "0", {}, true)
|
|
||||||
elseif pointed_thing.under then
|
|
||||||
minetest.place_schematic(pointed_thing.under, minetest.get_modpath("building").."/schematics/"..name..".mts", "0", {}, true)
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
building.register_schematic("house", true)
|
|
||||||
building.register_schematic("house_with_garden", true)
|
|
||||||
building.register_schematic("farm", true)
|
|
||||||
building.register_schematic("latern", true)
|
|
||||||
building.register_schematic("tower", false)
|
|
||||||
building.register_schematic("road", false)
|
|
@ -1,123 +0,0 @@
|
|||||||
cmsg = {}
|
|
||||||
cmsg.hudids = {}
|
|
||||||
cmsg.messages = {}
|
|
||||||
cmsg.settings = {}
|
|
||||||
cmsg.next_msgids = {}
|
|
||||||
|
|
||||||
cmsg.settings.max_messages = 7
|
|
||||||
local setting = minetest.setting_get("central_message_max")
|
|
||||||
if type(tonumber(setting)) == "number" then
|
|
||||||
cmsg.settings.max_messages = tonumber(setting)
|
|
||||||
elseif setting == "inf" then
|
|
||||||
cmsg.settings.max_messages = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
cmsg.settings.color = 0xFFFFFF
|
|
||||||
setting = minetest.setting_get("central_message_color")
|
|
||||||
if type(tonumber(setting)) == "number" then
|
|
||||||
cmsg.settings.color = tonumber(setting)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function update_display(player, pname)
|
|
||||||
local messages = {}
|
|
||||||
local start, stop
|
|
||||||
stop = #cmsg.messages[pname]
|
|
||||||
if cmsg.settings.max_messages ~= nil then
|
|
||||||
local max = math.min(cmsg.settings.max_messages, #cmsg.messages[pname])
|
|
||||||
if #cmsg.messages[pname] > cmsg.settings.max_messages then
|
|
||||||
start = stop - max
|
|
||||||
else
|
|
||||||
start = 1
|
|
||||||
end
|
|
||||||
else
|
|
||||||
start = 1
|
|
||||||
end
|
|
||||||
for i=start, stop do
|
|
||||||
table.insert(messages, cmsg.messages[pname][i].text)
|
|
||||||
end
|
|
||||||
local concat = table.concat(messages, "\n")
|
|
||||||
player:hud_change(cmsg.hudids[pname], "text", concat)
|
|
||||||
end
|
|
||||||
|
|
||||||
cmsg.push_message_player = function(player, text)
|
|
||||||
local function push(tbl)
|
|
||||||
-- Horrible Workaround code starts here
|
|
||||||
if not (cmsg.last_push < cmsg.steps) then
|
|
||||||
minetest.after(0, push, tbl)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local player = tbl.player
|
|
||||||
local text = tbl.text
|
|
||||||
-- Horrible Workaround code ends here
|
|
||||||
|
|
||||||
local pname = player:get_player_name()
|
|
||||||
if cmsg.hudids[pname] == nil then
|
|
||||||
cmsg.hudids[pname] = player:hud_add({
|
|
||||||
hud_elem_type = "text",
|
|
||||||
text = text,
|
|
||||||
number = cmsg.settings.color,
|
|
||||||
position = {x=0.5, y=0.5},
|
|
||||||
offset = {x=-0,y=-256},
|
|
||||||
direction = 3,
|
|
||||||
alignment = {x=0,y=1},
|
|
||||||
scale = {x=800,y=20*cmsg.settings.max_messages},
|
|
||||||
})
|
|
||||||
cmsg.messages[pname] = {}
|
|
||||||
cmsg.next_msgids[pname] = 0
|
|
||||||
table.insert(cmsg.messages[pname], {text=text, msgid=cmsg.next_msgids[pname]})
|
|
||||||
else
|
|
||||||
cmsg.next_msgids[pname] = cmsg.next_msgids[pname] + 1
|
|
||||||
table.insert(cmsg.messages[pname], {text=text, msgid=cmsg.next_msgids[pname]})
|
|
||||||
update_display(player, pname)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.after(5, function(param)
|
|
||||||
if not param.player then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local pname = param.player:get_player_name()
|
|
||||||
if not pname then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not cmsg.messages[pname] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
for i=1, #cmsg.messages[pname] do
|
|
||||||
if param.msgid == cmsg.messages[pname][i].msgid then
|
|
||||||
table.remove(cmsg.messages[pname], i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
update_display(player, pname)
|
|
||||||
end, {player=player, msgid=cmsg.next_msgids[pname]})
|
|
||||||
|
|
||||||
-- Update timer for Horrible Workaround
|
|
||||||
cmsg.last_push = cmsg.steps
|
|
||||||
end
|
|
||||||
|
|
||||||
if cmsg.last_push < cmsg.steps then
|
|
||||||
push({player=player, text=text})
|
|
||||||
else
|
|
||||||
minetest.after(0, push, {player=player, text=text})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
cmsg.push_message_all = function(text)
|
|
||||||
local players = minetest.get_connected_players()
|
|
||||||
for i=1,#players do
|
|
||||||
cmsg.push_message_player(players[i], text)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
|
||||||
cmsg.hudids[player:get_player_name()] = nil
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Horrible Workaround code starts here
|
|
||||||
cmsg.steps = 0
|
|
||||||
cmsg.last_push = -1
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
cmsg.steps = cmsg.steps + 1
|
|
||||||
end)
|
|
||||||
-- Horrible Workaround code ends here
|
|
@ -1,106 +0,0 @@
|
|||||||
clans = {}
|
|
||||||
clans.all_clans = {}
|
|
||||||
clans.clans_file = minetest.get_worldpath() .. "/clans"
|
|
||||||
|
|
||||||
function clans.create_clan(plname, clan_name)
|
|
||||||
clans.all_clans[clan_name] = {plname}
|
|
||||||
clans.save_clans()
|
|
||||||
end
|
|
||||||
|
|
||||||
function clans.add_member(clan_name, plname)
|
|
||||||
table.insert(clans.all_clans[clan_name], plname)
|
|
||||||
clans.save_clans()
|
|
||||||
end
|
|
||||||
|
|
||||||
function clans.load_clans()
|
|
||||||
local input = io.open(clans.clans_file, "r")
|
|
||||||
if input then
|
|
||||||
local str = input:read()
|
|
||||||
if str then
|
|
||||||
if minetest.deserialize(str) then
|
|
||||||
clans.all_clans = minetest.deserialize(str)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
io.close(input)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function clans.save_clans()
|
|
||||||
if clans.all_clans then
|
|
||||||
local output = io.open(clans.clans_file, "w")
|
|
||||||
local str = minetest.serialize(clans.all_clans)
|
|
||||||
output:write(str)
|
|
||||||
io.close(output)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
clans.load_clans()
|
|
||||||
|
|
||||||
minetest.register_chatcommand("create_clan", {
|
|
||||||
params = "<name>",
|
|
||||||
description = "Creates a clan",
|
|
||||||
privs = {},
|
|
||||||
func = function(name, text)
|
|
||||||
if clans.all_clans[text] then
|
|
||||||
return true, "There already is a clan named " .. text
|
|
||||||
end
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
if player then
|
|
||||||
clans.create_clan(name, text)
|
|
||||||
return true, "Added a clan named " .. text
|
|
||||||
end
|
|
||||||
return true, "Error couldnt find player " .. name
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_chatcommand("join_clan", {
|
|
||||||
params = "<name>",
|
|
||||||
description = "Join a clan",
|
|
||||||
privs = {},
|
|
||||||
func = function(name, text)
|
|
||||||
if not clans.all_clans[text] then
|
|
||||||
return true, "There is no clan named " .. text
|
|
||||||
end
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
if player then
|
|
||||||
clans.add_member(text, name)
|
|
||||||
return true, "Joined clan " .. text
|
|
||||||
end
|
|
||||||
return true, "Error couldnt find player " .. name
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_chatcommand("list_clans", {
|
|
||||||
params = "<name>",
|
|
||||||
description = "Shows all clans",
|
|
||||||
privs = {},
|
|
||||||
func = function(name, text)
|
|
||||||
if not clans.all_clans then
|
|
||||||
return true, "Error"
|
|
||||||
end
|
|
||||||
local keys = {}
|
|
||||||
local i = 0
|
|
||||||
for k,_ in pairs(clans.all_clans) do
|
|
||||||
keys[i] = k
|
|
||||||
i= i+1
|
|
||||||
end
|
|
||||||
if not keys then
|
|
||||||
return true, "Error"
|
|
||||||
end
|
|
||||||
minetest.chat_send_player(name, table.concat(keys, ","))
|
|
||||||
return true, "type /join_clan <clan> to join a clan"
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_chatcommand("show_clan", {
|
|
||||||
params = "<name>",
|
|
||||||
description = "Shows the clan",
|
|
||||||
privs = {},
|
|
||||||
func = function(name, text)
|
|
||||||
if not clans.all_clans[text] then
|
|
||||||
return true, "There is no clan named " .. text
|
|
||||||
end
|
|
||||||
minetest.chat_send_player(name, table.concat(clans.all_clans[text], ","))
|
|
||||||
return true, "type /join_clan " .. text .." to join this clan"
|
|
||||||
end,
|
|
||||||
})
|
|
@ -1,5 +0,0 @@
|
|||||||
default
|
|
||||||
legendary_items
|
|
||||||
mobs
|
|
||||||
xp
|
|
||||||
central_message
|
|
@ -1,233 +0,0 @@
|
|||||||
classes = {}
|
|
||||||
classes.all_classes = {}
|
|
||||||
classes.selected = {}
|
|
||||||
classes.classes_file = minetest.get_worldpath() .. "/classes"
|
|
||||||
classes.register_weapon = function(name,fromLevel,levels, def)
|
|
||||||
for i = fromLevel, levels, 1 do
|
|
||||||
minetest.register_tool("classes:"..name .. "_lvl_" .. tostring(i), {
|
|
||||||
description = def.description.."\n For Level: ".. tostring(i).. "\n Damage: " .. tostring(def.damage+ i-fromLevel) .." \n Class: " .. def.class,
|
|
||||||
inventory_image = def.inventory_image,
|
|
||||||
wield_scale = def.wield_scale,
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
damage_groups = {fleshy=def.damage+ i-fromLevel},
|
|
||||||
},
|
|
||||||
class = def.class,
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
if user == nil then return end
|
|
||||||
if minetest.registered_tools[itemstack:get_name()].class then print(minetest.registered_tools[itemstack:get_name()].class) end
|
|
||||||
if classes.selected[user:get_player_name()] == minetest.registered_tools[itemstack:get_name()].class then
|
|
||||||
if pointed_thing.type == "object" then
|
|
||||||
if xp.player_levels[user:get_player_name()] and xp.player_levels[user:get_player_name()] > i-1 then
|
|
||||||
pointed_thing.ref:punch(user, 10,minetest.registered_tools[itemstack:get_name()].tool_capabilities)
|
|
||||||
print("[info]" .. user:get_player_name() .. " is fighting!")
|
|
||||||
else
|
|
||||||
cmsg.push_message_player(user, "[info] You have to be level "..tostring(i).. " to use this weapon!")
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
else
|
|
||||||
cmsg.push_message_player(user, "[info] You cant use this weapon.")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
if i < levels then
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "classes:"..name .. "_lvl_" .. tostring(i+1),
|
|
||||||
recipe = {
|
|
||||||
{"classes:"..name .. "_lvl_" .. tostring(i), "potions:upgrading"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if def.recipe then
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "classes:"..name .. "_lvl_" .. tostring(fromLevel),
|
|
||||||
recipe = def.recipe,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function classes.register_tool(name, def)
|
|
||||||
minetest.register_craftitem(name, {
|
|
||||||
description = def.description,
|
|
||||||
inventory_image = def.inventory_image,
|
|
||||||
class = def.class,
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
if user == nil then return end
|
|
||||||
if classes.selected[user:get_player_name()] == def.class then
|
|
||||||
if pointed_thing.type == "object" then
|
|
||||||
if xp.player_levels[user:get_player_name()] and xp.player_levels[user:get_player_name()] > def.lvl then
|
|
||||||
def.on_use(itemstack, user, pointed_thing)
|
|
||||||
else
|
|
||||||
cmsg.push_message_player(user, "[info] You have to be level "..tostring(def.lvl).. " to use this tool!")
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
else
|
|
||||||
cmsg.push_message_player(user, "[info] You cant use this tool.")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- load save
|
|
||||||
|
|
||||||
function classes.load_selected_classes()
|
|
||||||
local input = io.open(classes.classes_file, "r")
|
|
||||||
if input then
|
|
||||||
local str = input:read()
|
|
||||||
if str then
|
|
||||||
for k, v in str.gmatch(str,"(%w+)=(%w+)") do
|
|
||||||
classes.selected[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
io.close(input)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function classes.save_selected_classes()
|
|
||||||
if classes.selected then
|
|
||||||
local output = io.open(classes.classes_file, "w")
|
|
||||||
local str = ""
|
|
||||||
for k, v in pairs(classes.selected) do
|
|
||||||
str = str .. k .. "=" .. v .. ","
|
|
||||||
end
|
|
||||||
str = str:sub(1, #str - 1)
|
|
||||||
output:write(str)
|
|
||||||
io.close(output)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- cmd
|
|
||||||
|
|
||||||
minetest.register_chatcommand("class", {
|
|
||||||
params = "<class>",
|
|
||||||
description = "Set your class to <class>",
|
|
||||||
privs = {},
|
|
||||||
func = function(name, text)
|
|
||||||
if classes.selected[name] then
|
|
||||||
return true, "Your class is : ".. classes.selected[name] .. "\nYou cant switch your class. If you want to player an other class, you should ask an admin :)"
|
|
||||||
end
|
|
||||||
if classes.all_classes[text] then
|
|
||||||
classes.selected[name] = text
|
|
||||||
minetest.chat_send_all(name .. " is now a " .. text)
|
|
||||||
classes.save_selected_classes()
|
|
||||||
return true, "Your class is now "..text
|
|
||||||
else
|
|
||||||
return true, "You cant be a "..text
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_chatcommand("myclass", {
|
|
||||||
params = "",
|
|
||||||
description = "This command will show you your class",
|
|
||||||
privs = {},
|
|
||||||
func = function(name, text)
|
|
||||||
if classes.selected[name] == nil then return true, "You havent coosen your class, yet!" end
|
|
||||||
return true, "Your class is "..classes.selected[name]
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
classes.register_class = function(name)
|
|
||||||
classes.all_classes[name] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
classes.register_class("farmer")
|
|
||||||
classes.register_class("warrior")
|
|
||||||
classes.register_class("thief")
|
|
||||||
classes.register_class("healer")
|
|
||||||
|
|
||||||
classes.load_selected_classes()
|
|
||||||
|
|
||||||
classes.register_weapon("spear",2, 12, {
|
|
||||||
description = "Spear",
|
|
||||||
inventory_image = "classes_spear.png",
|
|
||||||
wield_scale = {x = 2, y=2, z = 1},
|
|
||||||
damage = 17,
|
|
||||||
class = "warrior",
|
|
||||||
recipe = {
|
|
||||||
{"", "default:flint", ""},
|
|
||||||
{"", "default:string_strong", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
classes.register_weapon("chemical_spear",2, 17, {
|
|
||||||
description = "Chemical Spear",
|
|
||||||
inventory_image = "classes_chemical_spear.png",
|
|
||||||
wield_scale = {x = 2, y=2, z = 1},
|
|
||||||
damage = 19,
|
|
||||||
class = "warrior",
|
|
||||||
})
|
|
||||||
|
|
||||||
classes.register_weapon("sword",20, 30, {
|
|
||||||
description = "Sword",
|
|
||||||
inventory_image = "classes_sword.png",
|
|
||||||
wield_scale = {x = 1.5, y=1.5, z = 1},
|
|
||||||
damage = 21,
|
|
||||||
class = "warrior",
|
|
||||||
recipe = {
|
|
||||||
{"", "default:blade", ""},
|
|
||||||
{"", "default:string_strong", ""},
|
|
||||||
{"", "furnace:iron_rod", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
classes.register_weapon("hoe",2, 20, {
|
|
||||||
description = "Hoe",
|
|
||||||
inventory_image = "classes_hoe.png",
|
|
||||||
wield_scale = {x = 1, y=1, z = 1},
|
|
||||||
damage = 12,
|
|
||||||
class = "farmer",
|
|
||||||
recipe = {
|
|
||||||
{"", "furnace:iron_rod", "default:blade"},
|
|
||||||
{"", "default:string_strong", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
classes.register_weapon("pitchfork",15, 30, {
|
|
||||||
description = "Pitchfork",
|
|
||||||
inventory_image = "classes_pitchfork.png",
|
|
||||||
wield_scale = {x = 1, y=1, z = 1},
|
|
||||||
damage = 18,
|
|
||||||
class = "farmer",
|
|
||||||
recipe = {
|
|
||||||
{"furnace:iron_rod", "furnace:iron_rod", "furnace:iron_rod"},
|
|
||||||
{"", "default:string_strong", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
classes.register_weapon("stick",2, 30, {
|
|
||||||
description = "Stick",
|
|
||||||
inventory_image = "classes_stick.png",
|
|
||||||
wield_scale = {x = 1, y=1, z = 1},
|
|
||||||
damage = 9,
|
|
||||||
class = "thief",
|
|
||||||
recipe = {
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
classes.register_weapon("long_stick",20, 60, {
|
|
||||||
description = "Long Stick",
|
|
||||||
inventory_image = "classes_stick.png",
|
|
||||||
wield_scale = {x = 2, y=2, z = 1},
|
|
||||||
damage = 20,
|
|
||||||
class = "thief",
|
|
||||||
recipe = {
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
@ -1,182 +0,0 @@
|
|||||||
-- minetest/creative/init.lua
|
|
||||||
|
|
||||||
creative_inventory = {}
|
|
||||||
creative_inventory.creative_inventory_size = 0
|
|
||||||
|
|
||||||
-- Create detached creative inventory after loading all mods
|
|
||||||
minetest.after(0, function()
|
|
||||||
local inv = minetest.create_detached_inventory("creative", {
|
|
||||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
|
||||||
if minetest.setting_getbool("creative_mode") then
|
|
||||||
return count
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
allow_put = function(inv, listname, index, stack, player)
|
|
||||||
return 0
|
|
||||||
end,
|
|
||||||
allow_take = function(inv, listname, index, stack, player)
|
|
||||||
if minetest.setting_getbool("creative_mode") then
|
|
||||||
return -1
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
|
||||||
end,
|
|
||||||
on_put = function(inv, listname, index, stack, player)
|
|
||||||
end,
|
|
||||||
on_take = function(inv, listname, index, stack, player)
|
|
||||||
--print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
|
|
||||||
if stack then
|
|
||||||
minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory")
|
|
||||||
--print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
local creative_list = {}
|
|
||||||
for name,def in pairs(minetest.registered_items) do
|
|
||||||
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
|
|
||||||
and def.description and def.description ~= "" then
|
|
||||||
table.insert(creative_list, name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
table.sort(creative_list)
|
|
||||||
inv:set_size("main", #creative_list)
|
|
||||||
for _,itemstring in ipairs(creative_list) do
|
|
||||||
inv:add_item("main", ItemStack(itemstring))
|
|
||||||
end
|
|
||||||
creative_inventory.creative_inventory_size = #creative_list
|
|
||||||
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Create the trash field
|
|
||||||
local trash = minetest.create_detached_inventory("creative_trash", {
|
|
||||||
-- Allow the stack to be placed and remove it in on_put()
|
|
||||||
-- This allows the creative inventory to restore the stack
|
|
||||||
allow_put = function(inv, listname, index, stack, player)
|
|
||||||
if minetest.setting_getbool("creative_mode") then
|
|
||||||
return stack:get_count()
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_put = function(inv, listname, index, stack, player)
|
|
||||||
inv:set_stack(listname, index, "")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
trash:set_size("main", 1)
|
|
||||||
|
|
||||||
|
|
||||||
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
|
|
||||||
pagenum = math.floor(pagenum)
|
|
||||||
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
|
|
||||||
player:set_inventory_formspec(
|
|
||||||
"size[13,7.5]"..
|
|
||||||
--"image[6,0.6;1,2;player.png]"..
|
|
||||||
"listcolors[#00000000;#10101030;#00000000;#68B259;#FFF]"..
|
|
||||||
"bgcolor[#a88e69FF;false]"..
|
|
||||||
"list[current_player;main;5,3.5;8,1;]"..
|
|
||||||
default.itemslot_bg(5,3.5,8,1)..
|
|
||||||
"list[current_player;main;5,4.75;8,3;8]"..
|
|
||||||
default.itemslot_bg(5,4.75,8,3)..
|
|
||||||
"list[current_player;craft;8,0;3,3;]"..
|
|
||||||
default.itemslot_bg(8,0,3,3)..
|
|
||||||
"list[current_player;craftpreview;12,1;1,1;]"..
|
|
||||||
default.itemslot_bg(12,1,1,1)..
|
|
||||||
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
|
|
||||||
default.itemslot_bg(0.3,0.5,4,6)..
|
|
||||||
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
|
|
||||||
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
|
|
||||||
"button[2.7,6.5;1.6,1;creative_next;>>]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[current_player;craft]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[detached:creative;main]"..
|
|
||||||
"label[5,1.5;Trash:]"..
|
|
||||||
"list[detached:creative_trash;main;5,2;1,1;]"..
|
|
||||||
default.itemslot_bg(5,2,1,1)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
-- If in creative mode, modify player's inventory forms
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
creative_inventory.set_creative_formspec(player, 0, 1)
|
|
||||||
end)
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- Figure out current page from formspec
|
|
||||||
local current_page = 0
|
|
||||||
local formspec = player:get_inventory_formspec()
|
|
||||||
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
|
|
||||||
start_i = tonumber(start_i) or 0
|
|
||||||
|
|
||||||
if fields.creative_prev then
|
|
||||||
start_i = start_i - 4*6
|
|
||||||
end
|
|
||||||
if fields.creative_next then
|
|
||||||
start_i = start_i + 4*6
|
|
||||||
end
|
|
||||||
|
|
||||||
if start_i < 0 then
|
|
||||||
start_i = start_i + 4*6
|
|
||||||
end
|
|
||||||
if start_i >= creative_inventory.creative_inventory_size then
|
|
||||||
start_i = start_i - 4*6
|
|
||||||
end
|
|
||||||
|
|
||||||
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
|
|
||||||
start_i = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
|
|
||||||
end)
|
|
||||||
|
|
||||||
if minetest.setting_getbool("creative_mode") then
|
|
||||||
local digtime = 0.5
|
|
||||||
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 = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
|
||||||
cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
|
||||||
snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
|
||||||
choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
|
||||||
quests = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
|
||||||
ray = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
|
||||||
oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
|
||||||
},
|
|
||||||
damage_groups = {fleshy = 10},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
|
||||||
return true
|
|
||||||
end)
|
|
||||||
|
|
||||||
function minetest.handle_node_drops(pos, drops, digger)
|
|
||||||
if not digger or not digger:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local inv = digger:get_inventory()
|
|
||||||
if inv then
|
|
||||||
for _,item in ipairs(drops) do
|
|
||||||
item = ItemStack(item):get_name()
|
|
||||||
if not inv:contains_item("main", item) then
|
|
||||||
inv:add_item("main", item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,3 +0,0 @@
|
|||||||
default
|
|
||||||
legendary_items
|
|
||||||
mobs
|
|
@ -1,26 +0,0 @@
|
|||||||
minetest.register_node("decoration:stalagmite", {
|
|
||||||
description = "Stalagmite",
|
|
||||||
tiles = {"decoration_stalagmite.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "decoration_stalagmite.png",
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
drop = "default:stone_item",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("decoration:pick", {
|
|
||||||
description = "Decorative Pick",
|
|
||||||
tiles = {"decoration_pick.png"},
|
|
||||||
drawtype = "signlike",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
},
|
|
||||||
inventory_image = "decoration_pick.png",
|
|
||||||
wield_image = "decoration_pick.png",
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
@ -1,160 +0,0 @@
|
|||||||
-- workbench
|
|
||||||
|
|
||||||
minetest.register_node("default:workbench", {
|
|
||||||
description = "Workbench v1",
|
|
||||||
tiles = {"default_workbench_top.png", "default_wooden_planks.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec", default.craft_form)
|
|
||||||
meta:set_string("infotext", "Workbench")
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 8*4)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
default.craft_form_v2 = "size[8,7.5;]"
|
|
||||||
default.craft_form_v2 = default.craft_form_v2..default.gui_colors
|
|
||||||
default.craft_form_v2 = default.craft_form_v2..default.gui_bg
|
|
||||||
default.craft_form_v2 = default.craft_form_v2.."list[current_player;main;0,3.5;8,4;]"
|
|
||||||
default.craft_form_v2 = default.craft_form_v2..default.itemslot_bg(0,3.5,8,4)
|
|
||||||
default.craft_form_v2 = default.craft_form_v2.."list[current_name;main;0,0;2,3;]"
|
|
||||||
default.craft_form_v2 = default.craft_form_v2..default.itemslot_bg(0,0,2,3)
|
|
||||||
default.craft_form_v2 = default.craft_form_v2.."list[current_player;craft;2.5,0;3,3;]"
|
|
||||||
default.craft_form_v2 = default.craft_form_v2..default.itemslot_bg(2.5,0,3,3)
|
|
||||||
default.craft_form_v2 = default.craft_form_v2.."list[current_player;craftpreview;6,1;1,1;]"
|
|
||||||
default.craft_form_v2 = default.craft_form_v2..default.itemslot_bg(6,1,1,1)
|
|
||||||
|
|
||||||
minetest.register_node("default:workbench_v2", {
|
|
||||||
description = "Workbench V2",
|
|
||||||
tiles = {"default_workbench_v2_top.png", "default_small_stone_tile.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec", default.craft_form_v2)
|
|
||||||
meta:set_string("infotext", "Workbench V2")
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 3*2)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- crafts
|
|
||||||
|
|
||||||
-- wood
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:wood 3",
|
|
||||||
recipe = {
|
|
||||||
{"default:log_1"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:wood 2",
|
|
||||||
recipe = {
|
|
||||||
{"default:log_2"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:wood",
|
|
||||||
recipe = {
|
|
||||||
{"default:log_3"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:wooden_planks 4",
|
|
||||||
recipe = {
|
|
||||||
{"default:wood", "default:wood"},
|
|
||||||
{"default:wood", "default:wood"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- stone
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:stone_tile",
|
|
||||||
recipe = {
|
|
||||||
{"default:stone_item", "default:stone_item"},
|
|
||||||
{"default:stone_item", "default:stone_item"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:small_stone_tiles 4",
|
|
||||||
recipe = {
|
|
||||||
{"default:stone_tile", "default:stone_tile"},
|
|
||||||
{"default:stone_tile", "default:stone_tile"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:stonebrick 4",
|
|
||||||
recipe = {
|
|
||||||
{"default:small_stone_tiles", "default:small_stone_tiles"},
|
|
||||||
{"default:small_stone_tiles", "default:small_stone_tiles"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
--workbench
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:workbench",
|
|
||||||
recipe = {
|
|
||||||
{"default:wood", "default:wood", "default:wood"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:workbench_v2",
|
|
||||||
recipe = {
|
|
||||||
{"default:stone_tile", "default:stone_tile", "default:stone_tile"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- string
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:string_strong",
|
|
||||||
recipe = {
|
|
||||||
{"default:string", "default:string", "default:string"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:string",
|
|
||||||
recipe = {
|
|
||||||
{"group:plant", "group:plant", "group:plant"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- grass
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:plant_grass 3",
|
|
||||||
recipe = {
|
|
||||||
{"default:grass"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- tools
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:basic_hammer",
|
|
||||||
recipe = {
|
|
||||||
{"", "default:log_1", ""},
|
|
||||||
{"", "default:string_strong", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:axe_stone",
|
|
||||||
recipe = {
|
|
||||||
{"", "default:stone_item", ""},
|
|
||||||
{"", "default:string_strong", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
@ -1,61 +0,0 @@
|
|||||||
minetest.register_craftitem("default:string", {
|
|
||||||
description = "String",
|
|
||||||
inventory_image = "default_string.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:stone_item", {
|
|
||||||
description = "Stone",
|
|
||||||
inventory_image = "default_stone_item.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:flint", {
|
|
||||||
description = "Flint",
|
|
||||||
inventory_image = "default_flint.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:coal_lump", {
|
|
||||||
description = "Coal Lump",
|
|
||||||
inventory_image = "default_coal_lump.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:iron_lump", {
|
|
||||||
description = "Iron Lump",
|
|
||||||
inventory_image = "default_iron_lump.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:gold_lump", {
|
|
||||||
description = "Gold Lump",
|
|
||||||
inventory_image = "default_gold_lump.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:diamond", {
|
|
||||||
description = "Diamond",
|
|
||||||
inventory_image = "default_diamond.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:ruby", {
|
|
||||||
description = "Ruby",
|
|
||||||
inventory_image = "default_ruby.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:string_strong", {
|
|
||||||
description = "String (STRONG)",
|
|
||||||
inventory_image = "default_string_strong.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:coin", {
|
|
||||||
description = "Coin",
|
|
||||||
inventory_image = "default_coin.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:silver_coin", {
|
|
||||||
description = "Silver Coin",
|
|
||||||
inventory_image = "default_silver_coin.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:xp", {
|
|
||||||
description = "XP",
|
|
||||||
inventory_image = "default_xp.png",
|
|
||||||
stack_max = 99*99,
|
|
||||||
})
|
|
@ -1,10 +0,0 @@
|
|||||||
default = {}
|
|
||||||
|
|
||||||
local modpath = minetest.get_modpath("default")
|
|
||||||
|
|
||||||
dofile(modpath.."/player.lua")
|
|
||||||
dofile(modpath.."/craftitems.lua")
|
|
||||||
dofile(modpath.."/nodes.lua")
|
|
||||||
dofile(modpath.."/tools.lua")
|
|
||||||
dofile(modpath.."/craft.lua")
|
|
||||||
dofile(modpath.."/mapgen.lua")
|
|
@ -1,374 +0,0 @@
|
|||||||
minetest.register_alias("mapgen_dirt", "default:dirt")
|
|
||||||
minetest.register_alias("mapgen_dirt_with_grass", "default:grass")
|
|
||||||
minetest.register_alias("mapgen_water_source", "default:water_source")
|
|
||||||
minetest.register_alias("mapgen_river_water_source", "default:water_source")
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
|
|
||||||
minetest.register_alias("mapgen_sand", "default:sand")
|
|
||||||
minetest.register_alias("mapgen_desert_sand", "default:sand")
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_tree", "default:log_1")
|
|
||||||
minetest.register_alias("mapgen_leaves", "default:leaves_1")
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_dirt_with_snow", "default:dirt_with_snow")
|
|
||||||
minetest.register_alias("mapgen_snowblock", "default:snow")
|
|
||||||
minetest.register_alias("mapgen_snow", "default:snow")
|
|
||||||
minetest.register_alias("mapgen_ice", "default:ice")
|
|
||||||
minetest.register_alias("mapgen_sandstone", "default:desert_stone")
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_gravel", "default:gravel")
|
|
||||||
minetest.register_alias("mapgen_stone", "default:stone")
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_cobble", "default:stonebrick")
|
|
||||||
minetest.register_alias("mapgen_stair_cobble", "default:stonebrick")
|
|
||||||
minetest.register_alias("mapgen_mossycobble", "default:stonebrick")
|
|
||||||
minetest.register_alias("mapgen_sandstonebrick", "default:stonebrick")
|
|
||||||
minetest.register_alias("mapgen_stair_sandstonebrick", "default:stonebrick")
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "tundra",
|
|
||||||
node_top = "default:dirt_with_snow",
|
|
||||||
node_filler = "default:dirt",
|
|
||||||
depth_filler = 2,
|
|
||||||
depth_top = 1,
|
|
||||||
y_min = 1,
|
|
||||||
y_max = 55,
|
|
||||||
heat_point = 15,
|
|
||||||
humidity_point = 35,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "grassland",
|
|
||||||
node_top = "default:grass",
|
|
||||||
depth_top = 1,
|
|
||||||
node_filler = "default:dirt",
|
|
||||||
depth_filler = 0,
|
|
||||||
y_min = 6,
|
|
||||||
y_max = 31000,
|
|
||||||
heat_point = 45,
|
|
||||||
humidity_point = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "forest",
|
|
||||||
node_top = "default:grass",
|
|
||||||
depth_top = 1,
|
|
||||||
node_filler = "default:dirt",
|
|
||||||
depth_filler = 0,
|
|
||||||
y_min = 6,
|
|
||||||
y_max = 31000,
|
|
||||||
heat_point = 25,
|
|
||||||
humidity_point = 35,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "beach",
|
|
||||||
node_top = "default:sand",
|
|
||||||
depth_top = 1,
|
|
||||||
node_filler = "default:sand",
|
|
||||||
depth_filler = 2,
|
|
||||||
y_min = -112,
|
|
||||||
y_max = 5,
|
|
||||||
heat_point = 45,
|
|
||||||
humidity_point = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "swamp",
|
|
||||||
node_top = "default:dirt",
|
|
||||||
depth_top = 1,
|
|
||||||
node_filler = "default:dirt",
|
|
||||||
depth_filler = 2,
|
|
||||||
node_stone = "default:wet_stone",
|
|
||||||
y_min = -3,
|
|
||||||
y_max = 4,
|
|
||||||
heat_point = 95,
|
|
||||||
humidity_point = 90,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "savanna",
|
|
||||||
node_top = "default:dry_grass",
|
|
||||||
node_filler = "default:dirt",
|
|
||||||
depth_filler = 2,
|
|
||||||
depth_top = 1,
|
|
||||||
y_min = 1,
|
|
||||||
y_max = 55,
|
|
||||||
heat_point = 60,
|
|
||||||
humidity_point = 25,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "desert",
|
|
||||||
node_top = "default:sand",
|
|
||||||
node_filler = "default:desert_stone",
|
|
||||||
depth_filler = 2,
|
|
||||||
depth_top = 1,
|
|
||||||
y_min = 1,
|
|
||||||
y_max = 256,
|
|
||||||
heat_point = 80,
|
|
||||||
humidity_point = 20,
|
|
||||||
})
|
|
||||||
-- deco
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = {"default:grass"},
|
|
||||||
sidelen = 16,
|
|
||||||
fill_ratio = 0.07,
|
|
||||||
biomes = {
|
|
||||||
"grassland", "forest"
|
|
||||||
},
|
|
||||||
y_min = 0,
|
|
||||||
y_max = 31000,
|
|
||||||
decoration = "default:plant_grass",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = {"default:grass"},
|
|
||||||
sidelen = 16,
|
|
||||||
fill_ratio = 0.07,
|
|
||||||
biomes = {
|
|
||||||
"grassland", "forest"
|
|
||||||
},
|
|
||||||
y_min = 0,
|
|
||||||
y_max = 31000,
|
|
||||||
decoration = "default:plant_grass_2",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = {"default:grass"},
|
|
||||||
sidelen = 16,
|
|
||||||
fill_ratio = 0.06,
|
|
||||||
biomes = {
|
|
||||||
"grassland", "forest"
|
|
||||||
},
|
|
||||||
y_min = 0,
|
|
||||||
y_max = 31000,
|
|
||||||
decoration = "default:plant_grass_3",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = {"default:grass"},
|
|
||||||
sidelen = 16,
|
|
||||||
fill_ratio = 0.04,
|
|
||||||
biomes = {
|
|
||||||
"grassland"
|
|
||||||
},
|
|
||||||
y_min = 0,
|
|
||||||
y_max = 31000,
|
|
||||||
decoration = "default:plant_grass_4",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = {"default:grass"},
|
|
||||||
sidelen = 16,
|
|
||||||
fill_ratio = 0.04,
|
|
||||||
biomes = {
|
|
||||||
"grassland"
|
|
||||||
},
|
|
||||||
y_min = 0,
|
|
||||||
y_max = 31000,
|
|
||||||
decoration = "default:plant_grass_5",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = {"default:sand"},
|
|
||||||
sidelen = 16,
|
|
||||||
noise_params = {
|
|
||||||
offset = -0.015,
|
|
||||||
scale = 0.05,
|
|
||||||
spread = {x=200, y=200, z=200},
|
|
||||||
seed = 329,
|
|
||||||
octaves = 3,
|
|
||||||
persist = 0.6
|
|
||||||
},
|
|
||||||
biomes = {
|
|
||||||
"beach"
|
|
||||||
},
|
|
||||||
y_min = 0,
|
|
||||||
y_max = 31000,
|
|
||||||
decoration = "default:plant_grass",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = {"default:dry_grass", "default:grass", "default:sand"},
|
|
||||||
sidelen = 16,
|
|
||||||
noise_params = {
|
|
||||||
offset = -0.015,
|
|
||||||
scale = 0.03,
|
|
||||||
spread = {x=200, y=200, z=200},
|
|
||||||
seed = 333,
|
|
||||||
octaves = 3,
|
|
||||||
persist = 0.6
|
|
||||||
},
|
|
||||||
biomes = {
|
|
||||||
"beach", "grassland", "forest", "savanna"
|
|
||||||
},
|
|
||||||
y_min = 0,
|
|
||||||
y_max = 31000,
|
|
||||||
decoration = "default:stones_on_floor",
|
|
||||||
})
|
|
||||||
|
|
||||||
--trees
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "schematic",
|
|
||||||
place_on = {"default:grass"},
|
|
||||||
sidelen = 16,
|
|
||||||
noise_params = {
|
|
||||||
offset = 0.04,
|
|
||||||
scale = 0.02,
|
|
||||||
spread = {x = 250, y = 250, z = 250},
|
|
||||||
seed = 22,
|
|
||||||
octaves = 3,
|
|
||||||
persist = 0.66
|
|
||||||
},
|
|
||||||
biomes = {"forest"},
|
|
||||||
y_min = 1,
|
|
||||||
y_max = 31000,
|
|
||||||
schematic = minetest.get_modpath("default").."/schematics/tree1.mts",
|
|
||||||
flags = "place_center_x, place_center_z",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "schematic",
|
|
||||||
place_on = {"default:grass"},
|
|
||||||
sidelen = 16,
|
|
||||||
noise_params = {
|
|
||||||
offset = 0.04,
|
|
||||||
scale = 0.01,
|
|
||||||
spread = {x = 250, y = 250, z = 250},
|
|
||||||
seed = 21,
|
|
||||||
octaves = 3,
|
|
||||||
persist = 0.66
|
|
||||||
},
|
|
||||||
biomes = {"forest"},
|
|
||||||
y_min = 1,
|
|
||||||
y_max = 31000,
|
|
||||||
schematic = minetest.get_modpath("default").."/schematics/tree2.mts",
|
|
||||||
flags = "place_center_x, place_center_z",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "schematic",
|
|
||||||
place_on = {"default:dirt_with_snow"},
|
|
||||||
sidelen = 16,
|
|
||||||
noise_params = {
|
|
||||||
offset = 0.04,
|
|
||||||
scale = 0.01,
|
|
||||||
spread = {x = 250, y = 250, z = 250},
|
|
||||||
seed = 21,
|
|
||||||
octaves = 3,
|
|
||||||
persist = 0.66
|
|
||||||
},
|
|
||||||
biomes = {"tundra"},
|
|
||||||
y_min = 1,
|
|
||||||
y_max = 31000,
|
|
||||||
schematic = minetest.get_modpath("default").."/schematics/pinetree1.mts",
|
|
||||||
flags = "place_center_x, place_center_z",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "schematic",
|
|
||||||
place_on = {"default:dry_grass"},
|
|
||||||
sidelen = 16,
|
|
||||||
noise_params = {
|
|
||||||
offset = 0.04,
|
|
||||||
scale = 0.01,
|
|
||||||
spread = {x = 250, y = 250, z = 250},
|
|
||||||
seed = 21,
|
|
||||||
octaves = 3,
|
|
||||||
persist = 0.66
|
|
||||||
},
|
|
||||||
biomes = {"savanna"},
|
|
||||||
y_min = 1,
|
|
||||||
y_max = 31000,
|
|
||||||
schematic = minetest.get_modpath("default").."/schematics/drytree2.mts",
|
|
||||||
flags = "place_center_x, place_center_z",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- ores
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "blob",
|
|
||||||
ore = "default:gravel",
|
|
||||||
wherein = {"default:stone"},
|
|
||||||
clust_scarcity = 16 * 16 * 16,
|
|
||||||
clust_size = 5,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = 31000,
|
|
||||||
noise_threshold = 0.0,
|
|
||||||
noise_params = {
|
|
||||||
offset = 0.5,
|
|
||||||
scale = 0.2,
|
|
||||||
spread = {x = 5, y = 5, z = 5},
|
|
||||||
seed = 766,
|
|
||||||
octaves = 1,
|
|
||||||
persist = 0.0
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_coal",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 24 * 24 * 24,
|
|
||||||
clust_num_ores = 27,
|
|
||||||
clust_size = 6,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_iron",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 9*9*9,
|
|
||||||
clust_num_ores = 5,
|
|
||||||
clust_size = 3,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_gold",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 9*9*9,
|
|
||||||
clust_num_ores = 5,
|
|
||||||
clust_size = 3,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = -256,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_diamond",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 36 * 36 * 36,
|
|
||||||
clust_num_ores = 3,
|
|
||||||
clust_size = 2,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = -256,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_ruby",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 17*17*17,
|
|
||||||
clust_num_ores = 4,
|
|
||||||
clust_size = 5,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = -256,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
@ -1,686 +0,0 @@
|
|||||||
minetest.register_node("default:dirt", {
|
|
||||||
description = "Dirt",
|
|
||||||
tiles = {"default_dirt.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("default:dirt_with_snow", {
|
|
||||||
description = "Dirt with Snow",
|
|
||||||
tiles = {"default_snow.png", "default_dirt.png","default_dirt_with_snow.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:sand", {
|
|
||||||
description = "Sand",
|
|
||||||
tiles = {"default_sand.png"},
|
|
||||||
groups = {crumbly = 3, falling_node=1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:grass", {
|
|
||||||
description = "Grass",
|
|
||||||
tiles = {"default_grass.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:dry_grass", {
|
|
||||||
description = "dry Grass",
|
|
||||||
tiles = {"default_dry_grass.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:snow", {
|
|
||||||
description = "Snow",
|
|
||||||
tiles = {"default_snow.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:ice", {
|
|
||||||
description = "Ice",
|
|
||||||
tiles = {"default_ice.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:leaves_1", {
|
|
||||||
description = "Leaves",
|
|
||||||
paramtype = "light",
|
|
||||||
drawtype = "allfaces",
|
|
||||||
tiles = {"default_leaves_1.png"},
|
|
||||||
groups = {crumbly = 3, leaves = 1},
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:leaves_2", {
|
|
||||||
description = "Leaves",
|
|
||||||
paramtype = "light",
|
|
||||||
drawtype = "allfaces",
|
|
||||||
tiles = {"default_leaves_2.png"},
|
|
||||||
groups = {crumbly = 3, leaves = 1},
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:leaves_3", {
|
|
||||||
description = "Leaves",
|
|
||||||
paramtype = "light",
|
|
||||||
drawtype = "allfaces",
|
|
||||||
tiles = {"default_leaves_3.png"},
|
|
||||||
groups = {crumbly = 3, leaves = 1},
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:leaves_4", {
|
|
||||||
description = "Leaves",
|
|
||||||
paramtype = "light",
|
|
||||||
drawtype = "allfaces",
|
|
||||||
tiles = {"default_leaves_4.png"},
|
|
||||||
groups = {crumbly = 3, leaves = 1},
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stones_on_floor", {
|
|
||||||
description = "Stones on Floor",
|
|
||||||
tiles = {"default_stones_on_floor.png"},
|
|
||||||
groups = {snappy = 3},
|
|
||||||
paramtype = "light",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
drop = "default:stone_item 2",
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- box
|
|
||||||
|
|
||||||
local box_form = "size[8,9]"
|
|
||||||
local box_form = box_form..default.gui_colors
|
|
||||||
local box_form = box_form..default.gui_bg
|
|
||||||
local box_form = box_form.."list[current_name;main;0,0.3;8,4;]"
|
|
||||||
local box_form = box_form..default.itemslot_bg(0,0.3,8,4)
|
|
||||||
local box_form = box_form.."list[current_player;main;0,4.85;8,1;]"
|
|
||||||
local box_form = box_form..default.itemslot_bg(0,4.85,8,1)
|
|
||||||
local box_form = box_form.."list[current_player;main;0,6.08;8,3;8]"
|
|
||||||
local box_form = box_form..default.itemslot_bg(0,6,8,3)
|
|
||||||
|
|
||||||
minetest.register_node("default:box", {
|
|
||||||
description = "Box",
|
|
||||||
tiles = {"default_wooden_planks.png", "default_wooden_planks.png", "default_box_side.png", "default_box_side.png", "default_box_side.png", "default_box_front.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.4, -0.5, -0.4, 0.4, 0.2, 0.4},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec", box_form)
|
|
||||||
meta:set_string("infotext", "Box")
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 8*4)
|
|
||||||
end,
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:treasure_chest", {
|
|
||||||
description = "Treasure Chest",
|
|
||||||
tiles = {"default_treasure_chest.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
drop = "default:box",
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 8*4)
|
|
||||||
local items = {"default:dirt", "default:sand", "default:iron_lump", "default:stone_item", "default:coin", "default:gold_lump", "default:coal_lump"}
|
|
||||||
local item = items[math.random(5)]
|
|
||||||
inv:add_item("main", {name = item, count = math.random(2,10)})
|
|
||||||
local item = items[math.random(5)]
|
|
||||||
inv:add_item("main", {name = item, count = math.random(2,10)})
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:from_table(oldmetadata)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
for i = 1, inv:get_size("main") do
|
|
||||||
local stack = inv:get_stack("main", i)
|
|
||||||
if not stack:is_empty() then
|
|
||||||
local p = { x = pos.x + math.random(0, 5)/5 - 0.5,
|
|
||||||
y = pos.y,
|
|
||||||
z = pos.z + math.random(0, 5)/5 - 0.5
|
|
||||||
}
|
|
||||||
minetest.add_item(p, stack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:lamp", {
|
|
||||||
description = "Lamp",
|
|
||||||
tiles = {"default_lamp.png"},
|
|
||||||
light_source = 14,
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:present", {
|
|
||||||
description = "Present",
|
|
||||||
tiles = {"default_present_top.png", "default_present_top.png", "default_present_side.png", "default_present_side.png", "default_present_side.png", "default_present_side.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.4, -0.5, -0.4, 0.4, 0, 0.4},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:present_big", {
|
|
||||||
description = "Present (big)",
|
|
||||||
tiles = {"default_present_top.png", "default_present_top.png", "default_present_side.png", "default_present_side.png", "default_present_side.png", "default_present_side.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.4, -0.5, -0.4, 0.4, 0.4, 0.4},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("default:ladder", {
|
|
||||||
description = "Ladder",
|
|
||||||
drawtype = "signlike",
|
|
||||||
tiles = {"default_ladder.png"},
|
|
||||||
inventory_image = "default_ladder.png",
|
|
||||||
wield_image = "default_ladder.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
legacy_wallmounted = true,
|
|
||||||
})
|
|
||||||
-- flowing and sources
|
|
||||||
|
|
||||||
minetest.register_node("default:water_source", {
|
|
||||||
description = "Water Source",
|
|
||||||
drawtype = "liquid",
|
|
||||||
tiles = {"default_water.png"},
|
|
||||||
walkable = false,
|
|
||||||
pointable = false,
|
|
||||||
diggable = false,
|
|
||||||
buildable = false,
|
|
||||||
buildable_to = true,
|
|
||||||
paramtype = "light",
|
|
||||||
alpha = 160,
|
|
||||||
drowning = 1,
|
|
||||||
liquidtype = "source",
|
|
||||||
liquid_alternative_flowing = "default:water_flowing",
|
|
||||||
liquid_alternative_source = "default:water_source",
|
|
||||||
liquid_viscosity = 3,
|
|
||||||
groups = {liquid=3, water = 1},
|
|
||||||
post_effect_color = {a=50, r=0, g=64, b=200},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:water_flowing", {
|
|
||||||
description = "Water Flowing",
|
|
||||||
tiles = {"default_water.png"},
|
|
||||||
special_tiles = {
|
|
||||||
{
|
|
||||||
name = "default_water.png",
|
|
||||||
backface_culling = false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "default_water.png",
|
|
||||||
backface_culling = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
walkable = false,
|
|
||||||
drawtype = "flowingliquid",
|
|
||||||
pointable = false,
|
|
||||||
diggable = false,
|
|
||||||
buildable = false,
|
|
||||||
buildable_to = true,
|
|
||||||
alpha = 160,
|
|
||||||
drowning = 1,
|
|
||||||
paramtype = "light",
|
|
||||||
liquidtype = "flowing",
|
|
||||||
liquid_alternative_flowing = "default:water_flowing",
|
|
||||||
liquid_alternative_source = "default:water_source",
|
|
||||||
liquid_viscosity = 3,
|
|
||||||
groups = {liquid=3, not_in_creative_inventory=1, water = 1},
|
|
||||||
post_effect_color = {a=100, r=0, g=64, b=200},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- wood
|
|
||||||
|
|
||||||
minetest.register_node("default:wood", {
|
|
||||||
description = "Wood",
|
|
||||||
tiles = {"default_wood.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:wooden_planks", {
|
|
||||||
description = "Wooden Planks",
|
|
||||||
tiles = {"default_wooden_planks.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- log
|
|
||||||
|
|
||||||
minetest.register_node("default:log_1", {
|
|
||||||
description = "Log (thick)",
|
|
||||||
tiles = {"default_log_top.png","default_log_top.png","default_log.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.4, -0.5, -0.4, 0.4, 0.5, 0.4},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:log_2", {
|
|
||||||
description = "Log",
|
|
||||||
tiles = {"default_log_top.png","default_log_top.png","default_log.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:log_3", {
|
|
||||||
description = "Log (thin)",
|
|
||||||
tiles = {"default_log_top.png","default_log_top.png","default_log.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, 0.5, 0.2},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- plants
|
|
||||||
|
|
||||||
minetest.register_node("default:plant_grass", {
|
|
||||||
description = "Grass (Plant)",
|
|
||||||
tiles = {"default_plant_grass.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "default_plant_grass.png",
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3, plant = 1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:plant_grass_2", {
|
|
||||||
description = "Grass (Plant)",
|
|
||||||
tiles = {"default_plant_grass_2.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "default_plant_grass_2.png",
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3, plant = 1},
|
|
||||||
drop = "default:plant_grass",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:plant_grass_3", {
|
|
||||||
description = "Grass (Plant)",
|
|
||||||
tiles = {"default_plant_grass_3.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "default_plant_grass_3.png",
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3, plant = 1},
|
|
||||||
drop = "default:plant_grass",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:plant_grass_4", {
|
|
||||||
description = "Grass (Plant)",
|
|
||||||
tiles = {"default_plant_grass_4.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "default_plant_grass_4.png",
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3, plant = 1},
|
|
||||||
drop = "default:plant_grass",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:plant_grass_5", {
|
|
||||||
description = "Grass (Plant)",
|
|
||||||
tiles = {"default_plant_grass_5.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "default_plant_grass_5.png",
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3, plant = 1},
|
|
||||||
drop = "default:plant_grass",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:flower_1", {
|
|
||||||
description = "Flower",
|
|
||||||
tiles = {"default_flower_1.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "default_flower_1.png",
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3, plant = 1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:flower_2", {
|
|
||||||
description = "Flower (glowing)",
|
|
||||||
tiles = {"default_flower_2.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "default_flower_2.png",
|
|
||||||
light_source = 10,
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3, plant = 1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:mushroom", {
|
|
||||||
description = "Mushroom",
|
|
||||||
tiles = {"default_mushroom.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "default_mushroom_inv.png",
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {crumbly = 3, plant = 1},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- straw
|
|
||||||
|
|
||||||
minetest.register_node("default:straw", {
|
|
||||||
description = "Straw",
|
|
||||||
tiles = {"default_straw_top.png", "default_straw_top.png", "default_straw_side.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- frames
|
|
||||||
|
|
||||||
minetest.register_node("default:frame", {
|
|
||||||
description = "Frame",
|
|
||||||
tiles = {"default_frame.png"},
|
|
||||||
drawtype = "allfaces",
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {choppy = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:frame_with_wood", {
|
|
||||||
description = "Frame with Wood",
|
|
||||||
tiles = {"default_wood.png^default_frame.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:frame_with_stonebrick", {
|
|
||||||
description = "Frame with Stonebrick",
|
|
||||||
tiles = {"default_stonebrick.png^default_frame.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:frame_with_log", {
|
|
||||||
description = "Frame with Log",
|
|
||||||
tiles = {"default_log.png^default_frame.png"},
|
|
||||||
groups = {choppy = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- glass
|
|
||||||
|
|
||||||
minetest.register_node("default:glass", {
|
|
||||||
description = "Glass",
|
|
||||||
tiles = {"default_glass.png"},
|
|
||||||
drawtype = "glasslike",
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:glass_with_wood", {
|
|
||||||
description = "Glass with Wood",
|
|
||||||
tiles = {"default_wood.png^default_glass.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:glass_with_log", {
|
|
||||||
description = "Glass with Log",
|
|
||||||
tiles = {"default_log.png^default_glass.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:glass_with_stonebrick", {
|
|
||||||
description = "Glass with Stonebrick",
|
|
||||||
tiles = {"default_stonebrick.png^default_glass.png"},
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- floor
|
|
||||||
|
|
||||||
default.register_floor = function(color)
|
|
||||||
minetest.register_node("default:floor_"..color, {
|
|
||||||
description = color.." Floor",
|
|
||||||
tiles = {"default_floor.png^[colorize:"..color..":120"},
|
|
||||||
groups = {crumbly=3},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
default.register_floor("red")
|
|
||||||
default.register_floor("green")
|
|
||||||
default.register_floor("yellow")
|
|
||||||
default.register_floor("brown")
|
|
||||||
default.register_floor("white")
|
|
||||||
default.register_floor("black")
|
|
||||||
|
|
||||||
-- wool
|
|
||||||
|
|
||||||
default.register_wool = function(color)
|
|
||||||
minetest.register_node("default:wool_"..color, {
|
|
||||||
description = color.." Wool",
|
|
||||||
tiles = {"default_wool.png^[colorize:"..color..":120"},
|
|
||||||
groups = {crumbly=3},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
default.register_wool("red")
|
|
||||||
default.register_wool("green")
|
|
||||||
default.register_wool("yellow")
|
|
||||||
default.register_wool("brown")
|
|
||||||
default.register_wool("white")
|
|
||||||
default.register_wool("black")
|
|
||||||
|
|
||||||
-- stone
|
|
||||||
|
|
||||||
minetest.register_node("default:stone", {
|
|
||||||
description = "Stone",
|
|
||||||
tiles = {"default_stone.png"},
|
|
||||||
groups = {cracky = 3, stone= 1},
|
|
||||||
drop = {
|
|
||||||
max_items = 1,
|
|
||||||
items = {
|
|
||||||
{items = {'default:flint'},rarity = 5},
|
|
||||||
{items = {'default:stone_with_zinc'},rarity = 40},
|
|
||||||
{items = {'default:stone_with_iron'},rarity = 20},
|
|
||||||
{items = {'default:stone_with_copper'},rarity = 30},
|
|
||||||
{items = {'default:stone_with_silver'},rarity = 60},
|
|
||||||
{items = {"default:stone_item 5"}},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:desert_stone", {
|
|
||||||
description = "Desert Stone",
|
|
||||||
tiles = {"default_stone.png^[colorize:orange:50"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
drop = "default:stone_item 5",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:cobble", {
|
|
||||||
description = "Cobble",
|
|
||||||
tiles = {"default_cobble.png"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_tile", {
|
|
||||||
description = "Stone Tile",
|
|
||||||
tiles = {"default_stone_tile.png"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:small_stone_tiles", {
|
|
||||||
description = "Small Stone Tiles",
|
|
||||||
tiles = {"default_small_stone_tile.png"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stonebrick", {
|
|
||||||
description = "Stonebrick",
|
|
||||||
tiles = {"default_stonebrick.png"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:wet_stone", {
|
|
||||||
description = "Wet Stone",
|
|
||||||
tiles = {"default_wet_stone.png"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
drop = {"default:stone_item 5"},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:gravel", {
|
|
||||||
description = "Gravel",
|
|
||||||
tiles = {"default_gravel.png"},
|
|
||||||
groups = {crumbly = 2, falling_node=1},
|
|
||||||
drop = {
|
|
||||||
max_items = 1,
|
|
||||||
items = {
|
|
||||||
{items = {'default:flint'},rarity = 5},
|
|
||||||
{items = {'default:gravel'}},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
--brick
|
|
||||||
|
|
||||||
minetest.register_node("default:brick", {
|
|
||||||
description = "Brick",
|
|
||||||
tiles = {"default_brick.png"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- ores
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_coal", {
|
|
||||||
description = "Stone with Coal",
|
|
||||||
tiles = {"default_stone_with_coal.png"},
|
|
||||||
groups = {cracky = 2},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_iron", {
|
|
||||||
description = "Stone with Iron",
|
|
||||||
tiles = {"default_stone_with_iron.png"},
|
|
||||||
groups = {cracky = 2},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_copper", {
|
|
||||||
description = "Stone with Copper",
|
|
||||||
tiles = {"default_stone_with_copper.png"},
|
|
||||||
groups = {cracky = 2},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_zinc", {
|
|
||||||
description = "Stone with Zinc",
|
|
||||||
tiles = {"default_stone_with_zinc.png"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_silver", {
|
|
||||||
description = "Stone with Silver",
|
|
||||||
tiles = {"default_stone_with_silver.png"},
|
|
||||||
groups = {cracky = 3},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_gold", {
|
|
||||||
description = "Stone with Gold",
|
|
||||||
tiles = {"default_stone_with_gold.png"},
|
|
||||||
groups = {cracky = 1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_diamond", {
|
|
||||||
description = "Stone with Diamond",
|
|
||||||
tiles = {"default_stone_with_diamond.png"},
|
|
||||||
groups = {cracky = 1},
|
|
||||||
drop = "default:diamond",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_ruby", {
|
|
||||||
description = "Stone with Ruby",
|
|
||||||
tiles = {"default_stone_with_ruby.png"},
|
|
||||||
groups = {cracky = 1},
|
|
||||||
drop = "default:ruby",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- rail
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("default:rail", {
|
|
||||||
description = "Rail",
|
|
||||||
drawtype = "raillike",
|
|
||||||
tiles = {"default_rail.png", "default_rail_curve.png",
|
|
||||||
"default_rail_t.png", "default_rail_cross.png"},
|
|
||||||
inventory_image = "default_rail.png",
|
|
||||||
wield_image = "default_rail.png",
|
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
|
||||||
groups = {choppy = 1, attached_node = 1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:wire", {
|
|
||||||
description = "Wire",
|
|
||||||
drawtype = "raillike",
|
|
||||||
tiles = {"default_wire.png", "default_wire_curve.png",
|
|
||||||
"default_wire_t.png", "default_wire_cross.png"},
|
|
||||||
inventory_image = "default_wire.png",
|
|
||||||
wield_image = "default_wire.png",
|
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
|
||||||
groups = {choppy = 1, attached_node = 1},
|
|
||||||
})
|
|
@ -1,60 +0,0 @@
|
|||||||
function default.itemslot_bg(x,y,w,h)
|
|
||||||
local imgs = ""
|
|
||||||
for i = 0, w-1,1 do
|
|
||||||
for j=0, h-1,1 do
|
|
||||||
imgs = imgs .."image["..x+i..","..y+j..";1,1;gui_itemslot_bg.png]"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return imgs
|
|
||||||
end
|
|
||||||
|
|
||||||
default.gui_bg = "bgcolor[#a88e69FF;false]"
|
|
||||||
default.gui_colors = "listcolors[#00000000;#10101030;#00000000;#68B259;#FFF]"
|
|
||||||
|
|
||||||
default.inv_form = "size[8,7.5;]"
|
|
||||||
default.inv_form = default.inv_form..default.gui_colors
|
|
||||||
default.inv_form = default.inv_form..default.gui_bg
|
|
||||||
default.inv_form = default.inv_form.."list[current_player;main;0,3.5;8,4;]"
|
|
||||||
default.inv_form = default.inv_form..default.itemslot_bg(0,3.5,8,4)
|
|
||||||
default.inv_form = default.inv_form.."list[current_player;craft;1,1;3,1;]"
|
|
||||||
default.inv_form = default.inv_form..default.itemslot_bg(1,1,3,1)
|
|
||||||
default.inv_form = default.inv_form.."list[current_player;craftpreview;5,1;1,1;]"
|
|
||||||
default.inv_form = default.inv_form..default.itemslot_bg(5,1,1,1)
|
|
||||||
|
|
||||||
default.craft_form = "size[8,7.5;]"
|
|
||||||
default.craft_form = default.craft_form..default.gui_colors
|
|
||||||
default.craft_form = default.craft_form..default.gui_bg
|
|
||||||
default.craft_form = default.craft_form.."list[current_player;main;0,3.5;8,4;]"
|
|
||||||
default.craft_form = default.craft_form..default.itemslot_bg(0,3.5,8,4)
|
|
||||||
default.craft_form = default.craft_form.."list[current_player;craft;1.5,0;3,3;]"
|
|
||||||
default.craft_form = default.craft_form..default.itemslot_bg(1.5,0,3,3)
|
|
||||||
default.craft_form = default.craft_form.."list[current_player;craftpreview;5,1;1,1;]"
|
|
||||||
default.craft_form = default.craft_form..default.itemslot_bg(5,1,1,1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
|
||||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
|
||||||
player:set_inventory_formspec(default.inv_form)
|
|
||||||
|
|
||||||
player:set_properties({
|
|
||||||
mesh = "character.x",
|
|
||||||
textures = {"character.png"},
|
|
||||||
visual = "mesh",
|
|
||||||
visual_size = {x=1, y=1},
|
|
||||||
})
|
|
||||||
-- player:set_animation({ x= 25, y= 60,}, 30, 0)
|
|
||||||
-- player:set_local_animation({x=0, y=20},{x= 25, y=60}, {x= 25, y=60}, {x= 25, y=60}, 30)
|
|
||||||
-- default.player_anim[player:get_player_name()] = "stand"
|
|
||||||
|
|
||||||
-- Testing of HUD elements
|
|
||||||
player:hud_add({
|
|
||||||
hud_elem_type = "waypoint",
|
|
||||||
name = "spawn",
|
|
||||||
text = "",
|
|
||||||
number = 255,
|
|
||||||
world_pos = {x=0,y=0,z=0}
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
|||||||
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=2},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_tool("default:basic_hammer", {
|
|
||||||
description = "Basic Hammer\n Level: - \n Damage: 8",
|
|
||||||
inventory_image = "default_basic_hammer.png",
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
groupcaps= {
|
|
||||||
cracky={times={[3]=2.00, [3]=1.00}, uses=10, maxlevel=1},
|
|
||||||
choppy={times={[2]=1.50, [3]=1.00}, uses=20, maxlevel=1}
|
|
||||||
},
|
|
||||||
damage_groups = {fleshy=8},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_tool("default:axe_stone", {
|
|
||||||
description = "Stone Axe\n Level: - \n Damage: 5",
|
|
||||||
inventory_image = "default_axe_stone.png",
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
groupcaps= {
|
|
||||||
cracky={times={[3]=1.50}, uses=5, maxlevel=1},
|
|
||||||
choppy={times={[2]=3.50, [3]=1.10}, uses=10, maxlevel=1}
|
|
||||||
},
|
|
||||||
damage_groups = {fleshy=5},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_tool("default:pick", {
|
|
||||||
description = "Pick\n For Level: - \n Damage: 20",
|
|
||||||
inventory_image = "default_pick.png",
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
groupcaps= {
|
|
||||||
cracky={times={[1]=1.90, [2]=0.50, [3]=0.30}, uses=50, maxlevel=1},
|
|
||||||
choppy={times={[2]=3.50, [3]=1.10}, uses=50, maxlevel=1}
|
|
||||||
},
|
|
||||||
damage_groups = {fleshy=20},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_tool("default:shovel", {
|
|
||||||
description = "Shovel\n For Level: - \n Damage: 7",
|
|
||||||
inventory_image = "default_shovel.png",
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
groupcaps= {
|
|
||||||
crumbly={times={[1]=0.90, [2]=0.40, [3]=0.20}, uses=100, maxlevel=1}
|
|
||||||
},
|
|
||||||
damage_groups = {fleshy=7},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_tool("default:blade", {
|
|
||||||
description = "Blade\n Level: - \n Damage: 10",
|
|
||||||
inventory_image = "default_blade.png",
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
groupcaps= {
|
|
||||||
leaves={times={[1]=0.50}, uses=1000, maxlevel=1}
|
|
||||||
},
|
|
||||||
damage_groups = {fleshy=10},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_tool("default:knife", {
|
|
||||||
description = "Knife\n Level: - \n Damage: 12",
|
|
||||||
inventory_image = "default_knife.png",
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
groupcaps= {
|
|
||||||
leaves={times={[1]=0.10}, uses=1000, maxlevel=1},
|
|
||||||
choppy={times={[3]=2.00}, uses=50, maxlevel=1}
|
|
||||||
},
|
|
||||||
damage_groups = {fleshy=12},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_tool("default:knife_big", {
|
|
||||||
description = "Knife (big)\n Level: - \n Damage: 15",
|
|
||||||
inventory_image = "default_knife.png",
|
|
||||||
wield_scale = {x = 1.5, y=1.5, z = 1},
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
groupcaps= {
|
|
||||||
leaves={times={[1]=0.05}, uses=1000, maxlevel=1},
|
|
||||||
choppy={times={[3]=2.00}, uses=50, maxlevel=1}
|
|
||||||
},
|
|
||||||
damage_groups = {fleshy=15},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_tool("default:leaves_cutter", {
|
|
||||||
description = "Leaves Cutter",
|
|
||||||
inventory_image = "default_leaves_cutter.png",
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
groupcaps= {
|
|
||||||
leaves={times={[1]=0.10}, uses=1000, maxlevel=1},
|
|
||||||
choppy={times={[3]=2.00}, uses=50, maxlevel=1}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
@ -1 +0,0 @@
|
|||||||
default
|
|
@ -1,231 +0,0 @@
|
|||||||
farming = {}
|
|
||||||
|
|
||||||
function farming.register_plant(name, steps, def)
|
|
||||||
for i = 1, steps, 1 do
|
|
||||||
minetest.register_node(":farming:"..name.."_"..tostring(i), {
|
|
||||||
description = def.description .. " " .. tostring(i),
|
|
||||||
tiles = {def.texture.."_"..tostring(i)..".png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = def.texture.."_"..tostring(i)..".png",
|
|
||||||
drop = def.drop .. " " .. tostring(i),
|
|
||||||
groups = {crumbly=3},
|
|
||||||
walkable = false,
|
|
||||||
})
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"farming:"..name.."_"..tostring(i)},
|
|
||||||
neighbors = {"default:dirt", "default:grass"},
|
|
||||||
interval = 1.0,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
if i < steps then
|
|
||||||
minetest.set_node(pos, {name = "farming:"..name.."_"..tostring(i+1)})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
minetest.register_craftitem(def.drop, {
|
|
||||||
description = def.drop_description,
|
|
||||||
inventory_image = def.drop_texture,
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if pointed_thing.above then
|
|
||||||
minetest.set_node(pointed_thing.above, {name="farming:"..name.."_1"})
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
farming.register_plant("wheat", 5, {
|
|
||||||
description = "Wheat",
|
|
||||||
texture = "farming_wheat",
|
|
||||||
drop = "farming:wheat_seeds",
|
|
||||||
drop_description = "Wheat Seeds",
|
|
||||||
drop_texture = "farming_wheat_seeds.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.override_item("default:plant_grass", {drop = {
|
|
||||||
max_items = 1,
|
|
||||||
items = {
|
|
||||||
{items = {'farming:sugarcane'},rarity = 20},
|
|
||||||
{items = {'farming:wheat_seeds'},rarity = 5},
|
|
||||||
{items = {'default:plant_grass'}},
|
|
||||||
}
|
|
||||||
}})
|
|
||||||
|
|
||||||
minetest.override_item("default:plant_grass_2", {drop = {
|
|
||||||
max_items = 1,
|
|
||||||
items = {
|
|
||||||
{items = {'farming:wheat_seeds'},rarity = 5},
|
|
||||||
{items = {'farming:sugarcane'},rarity = 20},
|
|
||||||
{items = {'default:plant_grass'}},
|
|
||||||
}
|
|
||||||
}})
|
|
||||||
|
|
||||||
minetest.override_item("default:plant_grass_3", {drop = {
|
|
||||||
max_items = 1,
|
|
||||||
items = {
|
|
||||||
{items = {'farming:wheat_seeds'},rarity = 5},
|
|
||||||
{items = {'farming:sugarcane'},rarity = 20},
|
|
||||||
{items = {'default:plant_grass'}},
|
|
||||||
}
|
|
||||||
}})
|
|
||||||
|
|
||||||
minetest.override_item("default:plant_grass_4", {drop = {
|
|
||||||
max_items = 1,
|
|
||||||
items = {
|
|
||||||
{items = {'farming:wheat_seeds'},rarity = 5},
|
|
||||||
{items = {'farming:sugarcane'},rarity = 20},
|
|
||||||
{items = {'default:plant_grass'}},
|
|
||||||
}
|
|
||||||
}})
|
|
||||||
|
|
||||||
minetest.override_item("default:plant_grass_5", {drop = {
|
|
||||||
max_items = 1,
|
|
||||||
items = {
|
|
||||||
{items = {'farming:wheat_seeds'},rarity = 5},
|
|
||||||
{items = {'farming:sugarcane'},rarity = 20},
|
|
||||||
{items = {'default:plant_grass'}},
|
|
||||||
}
|
|
||||||
}})
|
|
||||||
|
|
||||||
-- other plants
|
|
||||||
|
|
||||||
minetest.register_node("farming:sugarcane", {
|
|
||||||
description = "Sugarcane",
|
|
||||||
tiles = {"farming_sugarcane.png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
paramtype = "light",
|
|
||||||
inventory_image = "farming_sugarcane.png",
|
|
||||||
groups = {crumbly=3, falling_node=1},
|
|
||||||
walkable = false,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"farming:sugarcane"},
|
|
||||||
neighbors = {"default:dirt", "default:grass"},
|
|
||||||
interval = 10.0,
|
|
||||||
chance = 5,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.set_node(pos, {name = "farming:sugarcane"})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("farming:cactus", {
|
|
||||||
description = "Cactus",
|
|
||||||
tiles = {"farming_cactus_top.png", "farming_cactus_top.png", "farming_cactus.png"},
|
|
||||||
groups = {crumbly=3, falling_node=1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"farming:cactus"},
|
|
||||||
neighbors = {"default:sand"},
|
|
||||||
interval = 60.0,
|
|
||||||
chance = 2,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.set_node(pos, {name = "farming:cactus"})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = {"default:sand"},
|
|
||||||
sidelen = 16,
|
|
||||||
fill_ratio = 0.004,
|
|
||||||
biomes = {
|
|
||||||
"desert"
|
|
||||||
},
|
|
||||||
y_min = 0,
|
|
||||||
y_max = 31000,
|
|
||||||
decoration = "farming:cactus",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- items
|
|
||||||
|
|
||||||
minetest.register_craftitem("farming:flour", {
|
|
||||||
description = "Flour",
|
|
||||||
inventory_image = "farming_flour.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("farming:sugar", {
|
|
||||||
description = "Sugar",
|
|
||||||
inventory_image = "farming_sugar.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("farming:bowl", {
|
|
||||||
description = "Bowl",
|
|
||||||
inventory_image = "farming_bowl.png",
|
|
||||||
stack_max = 1,
|
|
||||||
liquids_pointable = true,
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
if pointed_thing.above then
|
|
||||||
if minetest.get_node(pointed_thing.under).name == "default:water_source" then
|
|
||||||
itemstack:replace("farming:bowl_with_water")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("farming:bowl_with_water", {
|
|
||||||
description = "Bowl with Water",
|
|
||||||
inventory_image = "farming_bowl_with_water.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("farming:slice_of_bread", {
|
|
||||||
description = "Slice of Bread",
|
|
||||||
inventory_image = "farming_slice_of_bread.png",
|
|
||||||
on_use = minetest.item_eat(4),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("farming:cookie", {
|
|
||||||
description = "Cookie",
|
|
||||||
inventory_image = "farming_cookie.png",
|
|
||||||
on_use = minetest.item_eat(5),
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "farming:flour",
|
|
||||||
recipe = {"farming:wheat_seeds", "farming:wheat_seeds", "farming:wheat_seeds"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "farming:cookie 5",
|
|
||||||
recipe = {"farming:sugar", "farming:flour", "farming:bowl_with_water"},
|
|
||||||
replacements = {
|
|
||||||
{"farming:bowl_with_water", "farming:bowl"}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "farming:sugar 3",
|
|
||||||
recipe = {"farming:sugarcane"}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "farming:bowl",
|
|
||||||
recipe = {
|
|
||||||
{"default:wood", "", "default:wood"},
|
|
||||||
{"", "default:wood", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "farming:slice_of_bread 10",
|
|
||||||
recipe = {"farming:flour", "farming:flour", "farming:bowl_with_water"},
|
|
||||||
replacements = {
|
|
||||||
{"farming:bowl_with_water", "farming:bowl"}
|
|
||||||
}
|
|
||||||
})
|
|
@ -1,32 +0,0 @@
|
|||||||
minetest.register_craftitem("fishing:fishing_rod", {
|
|
||||||
description = "Fishing rod",
|
|
||||||
inventory_image = "fishing_fishing_rod.png",
|
|
||||||
wield_image = "fishing_fishing_rod_wield.png",
|
|
||||||
liquids_pointable = true,
|
|
||||||
range = 10.0,
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
if pointed_thing.above then
|
|
||||||
if minetest.get_node(pointed_thing.under).name == "default:water_source" then
|
|
||||||
if math.random(10) == 2 then
|
|
||||||
user:get_inventory():add_item("main", "fishing:fish")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "fishing:fishing_rod",
|
|
||||||
recipe = {
|
|
||||||
{"default:log_3", "default:string", ""},
|
|
||||||
{"default:log_3", "default:string", ""},
|
|
||||||
{"default:log_3", "default:string", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("fishing:fish", {
|
|
||||||
description = "Fish",
|
|
||||||
inventory_image = "fishing_fish.png",
|
|
||||||
on_use = minetest.item_eat(3),
|
|
||||||
})
|
|
@ -1 +0,0 @@
|
|||||||
default
|
|
@ -1,148 +0,0 @@
|
|||||||
local furnace_form = "size[8,9]"
|
|
||||||
local furnace_form = furnace_form..default.gui_colors
|
|
||||||
local furnace_form = furnace_form..default.gui_bg
|
|
||||||
local furnace_form = furnace_form.."list[current_name;main;2,0.3;4,4;]"
|
|
||||||
local furnace_form = furnace_form..default.itemslot_bg(2,0.3,4,4)
|
|
||||||
local furnace_form = furnace_form.."list[current_player;main;0,4.85;8,1;]"
|
|
||||||
local furnace_form = furnace_form..default.itemslot_bg(0,4.85,8,1)
|
|
||||||
local furnace_form = furnace_form.."list[current_player;main;0,6.08;8,3;8]"
|
|
||||||
local furnace_form = furnace_form..default.itemslot_bg(0,6,8,3)
|
|
||||||
|
|
||||||
minetest.register_node("furnace:furnace", {
|
|
||||||
description = "Furnace",
|
|
||||||
tiles = {"furnace_stone_tile.png", "furnace_stone_tile.png", "furnace_stone_tile.png", "furnace_stone_tile.png","furnace_stone_tile.png","furnace_stone_front.png"},
|
|
||||||
groups = {cracky = 2},
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec",furnace_form)
|
|
||||||
meta:set_string("infotext", "Furnace");
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 4*4)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"furnace:furnace"},
|
|
||||||
neighbors = {"group:pattern"},
|
|
||||||
interval = 10.0,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local mymeta = minetest.get_meta(pos)
|
|
||||||
pos.y = pos.y - 1
|
|
||||||
if minetest.get_node(pos).name == "lava:lava_source" then
|
|
||||||
local dir = vector.multiply(minetest.facedir_to_dir(minetest.get_node({x = pos.x, y= pos.y+1, z=pos.z}).param2), -1)
|
|
||||||
local patternpos = vector.add(pos, dir)
|
|
||||||
|
|
||||||
local pattern = minetest.get_node(patternpos).name
|
|
||||||
if pattern == "furnace:pattern_rod" then
|
|
||||||
local myinv = mymeta:get_inventory()
|
|
||||||
if myinv:contains_item("main", {name = "default:stone_with_iron"}) then
|
|
||||||
minetest.get_meta(patternpos):get_inventory():add_item("main", {name = "furnace:iron_rod"})
|
|
||||||
myinv:remove_item("main", {name = "default:stone_with_iron"})
|
|
||||||
elseif myinv:contains_item("main", {name = "default:stone_with_gold"}) then
|
|
||||||
minetest.get_meta(patternpos):get_inventory():add_item("main", {name = "furnace:gold_rod"})
|
|
||||||
myinv:remove_item("main", {name = "default:stone_with_gold"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if pattern == "furnace:pattern_blade" then
|
|
||||||
local myinv = mymeta:get_inventory()
|
|
||||||
if myinv:contains_item("main", {name = "default:stone_with_iron"}) then
|
|
||||||
minetest.get_meta(patternpos):get_inventory():add_item("main", {name = "default:blade"})
|
|
||||||
myinv:remove_item("main", {name = "default:stone_with_iron"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
local pattern_form = "size[8,9]"
|
|
||||||
local pattern_form = pattern_form..default.gui_colors
|
|
||||||
local pattern_form = pattern_form..default.gui_bg
|
|
||||||
local pattern_form = pattern_form.."list[current_name;main;0,0.3;8,4;]"
|
|
||||||
local pattern_form = pattern_form..default.itemslot_bg(0,0.3,8,4)
|
|
||||||
local pattern_form = pattern_form.."list[current_player;main;0,4.85;8,1;]"
|
|
||||||
local pattern_form = pattern_form..default.itemslot_bg(0,4.85,8,1)
|
|
||||||
local pattern_form = pattern_form.."list[current_player;main;0,6.08;8,3;8]"
|
|
||||||
local pattern_form = pattern_form..default.itemslot_bg(0,6,8,3)
|
|
||||||
|
|
||||||
minetest.register_node("furnace:pattern_rod", {
|
|
||||||
description = "Pattern for a Rod",
|
|
||||||
tiles = {"furnace_pattern_rod.png", "default_wooden_planks.png"},
|
|
||||||
groups = {snappy = 3, pattern = 1},
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec",pattern_form)
|
|
||||||
meta:set_string("infotext", "Pattern");
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 8*4)
|
|
||||||
end,
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("furnace:pattern_blade", {
|
|
||||||
description = "Pattern for a blade",
|
|
||||||
tiles = {"furnace_pattern_blade.png", "default_wooden_planks.png"},
|
|
||||||
groups = {snappy = 3, pattern = 1},
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec",pattern_form)
|
|
||||||
meta:set_string("infotext", "Pattern");
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 8*4)
|
|
||||||
end,
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("furnace:iron_rod", {
|
|
||||||
description = "Iron Rod",
|
|
||||||
inventory_image = "furnace_iron_rod.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("furnace:gold_rod", {
|
|
||||||
description = "Gold Rod",
|
|
||||||
inventory_image = "furnace_gold_rod.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("furnace:diamond_rod", {
|
|
||||||
description = "Diamond Rod",
|
|
||||||
inventory_image = "furnace_diamond_rod.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- crafting
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "furnace:furnace",
|
|
||||||
recipe = {
|
|
||||||
{"default:stonebrick", "default:stonebrick", "default:stonebrick"},
|
|
||||||
{"default:stonebrick", "", "default:stonebrick"},
|
|
||||||
{"default:stonebrick", "default:stonebrick", "default:stonebrick"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "furnace:pattern_rod",
|
|
||||||
recipe = {
|
|
||||||
{"default:stonebrick", "", "default:stonebrick"},
|
|
||||||
{"default:stonebrick", "default:stonebrick", "default:stonebrick"},
|
|
||||||
{"default:wood", "default:wood", "default:wood"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "furnace:pattern_blade",
|
|
||||||
recipe = {
|
|
||||||
{"default:stonebrick", "default:stonebrick", "default:stonebrick"},
|
|
||||||
{"default:stonebrick", "default:stonebrick", "default:stonebrick"},
|
|
||||||
{"default:wood", "default:wood", "default:wood"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:pick",
|
|
||||||
recipe = {
|
|
||||||
{"", "furnace:iron_rod", ""},
|
|
||||||
{"", "default:string_strong", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
@ -1,2 +0,0 @@
|
|||||||
default
|
|
||||||
farming
|
|
@ -1,77 +0,0 @@
|
|||||||
juice = {}
|
|
||||||
function juice.drink(player, itemstack, hp)
|
|
||||||
player:set_hp(player:get_hp()+hp)
|
|
||||||
itemstack = {name = "juice:glass", count = 1}
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_craftitem("juice:glass", {
|
|
||||||
description = "Glass",
|
|
||||||
inventory_image = "juice_glass.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("juice:water", {
|
|
||||||
description = "Water",
|
|
||||||
inventory_image = "juice_water.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return juice.drink(user, itemstack, 3)
|
|
||||||
end,
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("juice:water_sugar", {
|
|
||||||
description = "Water with Sugar",
|
|
||||||
inventory_image = "juice_water_sugar.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return juice.drink(user, itemstack, -2)
|
|
||||||
end,
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("juice:cactus", {
|
|
||||||
description = "Cactus Juice",
|
|
||||||
inventory_image = "juice_cactus.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return juice.drink(user, itemstack, 6)
|
|
||||||
end,
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("juice:strawberry", {
|
|
||||||
description = "Strawberry Juice",
|
|
||||||
inventory_image = "juice_strawberry.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return juice.drink(user, itemstack, 6)
|
|
||||||
end,
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("juice:apple", {
|
|
||||||
description = "Apple Juice",
|
|
||||||
inventory_image = "juice_apple.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return juice.drink(user, itemstack, 7)
|
|
||||||
end,
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "juice:cactus",
|
|
||||||
recipe = {"juice:glass", "farming:cactus"},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "juice:water",
|
|
||||||
recipe = {"juice:glass", "farming:bowl_with_water"},
|
|
||||||
replacements = {
|
|
||||||
{"farming:bowl_with_water", "farming:bowl"}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "juice:water_sugar",
|
|
||||||
recipe = {"juice:water", "farming:sugar"},
|
|
||||||
})
|
|
@ -1,11 +0,0 @@
|
|||||||
License for Code
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
|
@ -1,32 +0,0 @@
|
|||||||
kits = {}
|
|
||||||
kits.all_kits = {}
|
|
||||||
function kits.register_kit(name, items)
|
|
||||||
kits.all_kits[name] = items
|
|
||||||
end
|
|
||||||
|
|
||||||
function kits.select_kit(player, name)
|
|
||||||
kit = kits.all_kits[name]
|
|
||||||
for i, item in ipairs(kit) do
|
|
||||||
player:get_inventory():add_item('main', item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_chatcommand("kit", {
|
|
||||||
params = "<name>",
|
|
||||||
description = "Select your kit.",
|
|
||||||
privs = {interact = true},
|
|
||||||
func = function(plname , name)
|
|
||||||
local player = minetest.get_player_by_name(plname)
|
|
||||||
if kits.all_kits[name] then
|
|
||||||
kits.select_kit(player, name)
|
|
||||||
return true, "You selected ".. name
|
|
||||||
else
|
|
||||||
return true, "There is no kit named ".. name
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
kits.register_kit("basic", {"default:log_3 10", "default:log_1 10"})
|
|
||||||
kits.register_kit("customer", {"default:coin 10", "default:log_3 1", "default:log_1 1"})
|
|
||||||
kits.register_kit("hard", {"default:log_3 1", "default:log_1 1"})
|
|
||||||
kits.register_kit("peasant", {"default:log_3 1", "default:log_1 1", "farming:bowl_with_water", "farming:bowl_with_water", "farming:bowl_with_water", "farming:wheat_seeds 10"})
|
|
@ -1,71 +0,0 @@
|
|||||||
minetest.register_node("lava:lava_source", {
|
|
||||||
description = "Lava Source",
|
|
||||||
drawtype = "liquid",
|
|
||||||
tiles = {"lava_lava.png"},
|
|
||||||
walkable = false,
|
|
||||||
pointable = false,
|
|
||||||
diggable = false,
|
|
||||||
buildable = false,
|
|
||||||
buildable_to = true,
|
|
||||||
paramtype = "light",
|
|
||||||
alpha = 160,
|
|
||||||
drowning = 1,
|
|
||||||
liquidtype = "source",
|
|
||||||
liquid_alternative_flowing = "lava:lava_flowing",
|
|
||||||
liquid_alternative_source = "lava:lava_source",
|
|
||||||
liquid_viscosity = 6,
|
|
||||||
groups = {liquid=3, lava = 1},
|
|
||||||
post_effect_color = {a=100, r=200, g=64, b=0},
|
|
||||||
damage_per_second = 4 * 2,
|
|
||||||
light_source = 10,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("lava:lava_flowing", {
|
|
||||||
description = "Lava Flowing",
|
|
||||||
tiles = {"lava_lava.png"},
|
|
||||||
special_tiles = {
|
|
||||||
{
|
|
||||||
name = "lava_lava.png",
|
|
||||||
backface_culling = false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "lava_lava.png",
|
|
||||||
backface_culling = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
walkable = false,
|
|
||||||
drawtype = "flowingliquid",
|
|
||||||
pointable = false,
|
|
||||||
diggable = false,
|
|
||||||
buildable = false,
|
|
||||||
buildable_to = true,
|
|
||||||
alpha = 160,
|
|
||||||
drowning = 1,
|
|
||||||
paramtype = "light",
|
|
||||||
liquidtype = "flowing",
|
|
||||||
liquid_alternative_flowing = "lava:lava_flowing",
|
|
||||||
liquid_alternative_source = "lava:lava_source",
|
|
||||||
liquid_viscosity = 6,
|
|
||||||
groups = {liquid=3, not_in_creative_inventory=1, lava = 1},
|
|
||||||
post_effect_color = {a=100, r=200, g=64, b=0},
|
|
||||||
damage_per_second = 4 * 2,
|
|
||||||
light_source = 10,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("lava:basalt", {
|
|
||||||
description = "Basalt",
|
|
||||||
tiles = {"lava_basalt.png"},
|
|
||||||
groups = {cracky = 3, stone = 1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"group:lava"},
|
|
||||||
neighbors = {"group:water"},
|
|
||||||
interval = 1.0,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
minetest.set_node(pos, {name = "lava:basalt"})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_lava_source", "lava:lava_source")
|
|
@ -1,172 +0,0 @@
|
|||||||
legendary_items = {}
|
|
||||||
legendary_items.register_rare_weapon = function(name, forlevel, def)
|
|
||||||
minetest.register_tool(":legendary_items:"..name, {
|
|
||||||
description = def.description.."\n For Level: ".. tostring(forlevel).. "\n Damage: " .. tostring(def.damage) .. "\n Rare Item",
|
|
||||||
inventory_image = def.inventory_image,
|
|
||||||
wield_scale = def.wield_scale,
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
damage_groups = {fleshy=def.damage},
|
|
||||||
},
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
if user == nil then return end
|
|
||||||
if pointed_thing.type == "object" then
|
|
||||||
if xp.player_levels[user:get_player_name()] and xp.player_levels[user:get_player_name()] > forlevel-1 then
|
|
||||||
pointed_thing.ref:punch(user, 10,minetest.registered_tools[itemstack:get_name()].tool_capabilities)
|
|
||||||
print("[info]" .. user:get_player_name() .. " is fighting!")
|
|
||||||
else
|
|
||||||
cmsg.push_message_player(user, "[info] You have to be level "..tostring(forlevel).. " to use this weapon!")
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- rare
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("old_hammer", 3, {
|
|
||||||
description = "Old Hammer",
|
|
||||||
inventory_image = "legendary_items_old_hammer.png",
|
|
||||||
wield_scale = {x = 2, y = 2, z =1},
|
|
||||||
damage = 20,
|
|
||||||
})
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("old_hammer_lvl_5", 5, {
|
|
||||||
description = "Old Hammer",
|
|
||||||
inventory_image = "legendary_items_old_hammer.png",
|
|
||||||
wield_scale = {x = 2, y = 2, z =1},
|
|
||||||
damage = 28,
|
|
||||||
})
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("old_hammer_lvl_30", 30, {
|
|
||||||
description = "Old Hammer",
|
|
||||||
inventory_image = "legendary_items_old_hammer.png",
|
|
||||||
wield_scale = {x = 2, y = 2, z =1},
|
|
||||||
damage = 40,
|
|
||||||
})
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("old_hammer_lvl_60", 60, {
|
|
||||||
description = "Old Hammer",
|
|
||||||
inventory_image = "legendary_items_old_hammer.png",
|
|
||||||
wield_scale = {x = 2, y = 2, z =1},
|
|
||||||
damage = 75,
|
|
||||||
})
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("old_hammer_lvl_100", 100, {
|
|
||||||
description = "Old Hammer",
|
|
||||||
inventory_image = "legendary_items_old_hammer.png",
|
|
||||||
wield_scale = {x = 2, y = 2, z =1},
|
|
||||||
damage = 150,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("old_battle_axe", 3, {
|
|
||||||
description = "Old Battle Axe",
|
|
||||||
inventory_image = "legendary_items_old_battle_axe.png",
|
|
||||||
wield_scale = {x = 1.2, y = 1.2, z =1},
|
|
||||||
damage = 21,
|
|
||||||
})
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("old_battle_axe_lvl_10", 10, {
|
|
||||||
description = "Old Battle Axe",
|
|
||||||
inventory_image = "legendary_items_old_battle_axe.png",
|
|
||||||
wield_scale = {x = 1.2, y = 1.2, z =1},
|
|
||||||
damage = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("old_battle_axe_lvl_14", 14, {
|
|
||||||
description = "Old Battle Axe",
|
|
||||||
inventory_image = "legendary_items_old_battle_axe.png",
|
|
||||||
wield_scale = {x = 1.2, y = 1.2, z =1},
|
|
||||||
damage = 33,
|
|
||||||
})
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("sugar_sword_lvl_2", 2, {
|
|
||||||
description = "Sugar Sword",
|
|
||||||
inventory_image = "legendary_items_sugar_sword.png",
|
|
||||||
wield_scale = {x = 1.2, y = 1.2, z =1},
|
|
||||||
damage = 20,
|
|
||||||
})
|
|
||||||
|
|
||||||
legendary_items.register_rare_weapon("sugar_sword_lvl_50", 50, {
|
|
||||||
description = "Sugar Sword",
|
|
||||||
inventory_image = "legendary_items_sugar_sword.png",
|
|
||||||
wield_scale = {x = 1.2, y = 1.2, z =1},
|
|
||||||
damage = 68,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- super rare
|
|
||||||
|
|
||||||
minetest.register_craftitem("legendary_items:paper", {
|
|
||||||
description = "The Legendary Paper",
|
|
||||||
inventory_image = "legendary_items_paper.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("legendary_items:paper_green", {
|
|
||||||
description = "Green Paper (rare)",
|
|
||||||
inventory_image = "legendary_items_paper_green.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("legendary_items:teleporting", {
|
|
||||||
description = "Stick of Teleporting",
|
|
||||||
inventory_image = "legendary_items_tp.png",
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if not placer or not placer:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
placer:setpos(pointed_thing.above)
|
|
||||||
minetest.add_particlespawner({
|
|
||||||
amount = 50,
|
|
||||||
time = 1,
|
|
||||||
minpos = {x=pointed_thing.above.x, y=pointed_thing.above.y, z=pointed_thing.above.z},
|
|
||||||
maxpos = {x=pointed_thing.above.x, y=pointed_thing.above.y, z=pointed_thing.above.z},
|
|
||||||
minvel = {x=-2, y=-2, z=-2},
|
|
||||||
maxvel = {x=2, y=4, z=2},
|
|
||||||
minacc = {x=-2, y=-2, z=-2},
|
|
||||||
maxacc = {x=2, y=4, z=2},
|
|
||||||
minexptime = 1,
|
|
||||||
maxexptime = 1,
|
|
||||||
minsize = 1,
|
|
||||||
maxsize = 1,
|
|
||||||
collisiondetection = false,
|
|
||||||
vertical = false,
|
|
||||||
texture = "heart.png",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_tool("legendary_items:sword", {
|
|
||||||
description = "The Legendary Sword",
|
|
||||||
inventory_image = "legendary_items_sword.png",
|
|
||||||
wield_scale = {x = 2, y=2, z = 1},
|
|
||||||
tool_capabilities = {
|
|
||||||
max_drop_level=3,
|
|
||||||
damage_groups = {fleshy=50},
|
|
||||||
},
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if not placer or not placer:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
placer:set_hp(placer:get_hp()+8)
|
|
||||||
minetest.add_particlespawner({
|
|
||||||
amount = 50,
|
|
||||||
time = 1,
|
|
||||||
minpos = {x=pointed_thing.above.x, y=pointed_thing.above.y, z=pointed_thing.above.z},
|
|
||||||
maxpos = {x=pointed_thing.above.x, y=pointed_thing.above.y, z=pointed_thing.above.z},
|
|
||||||
minvel = {x=-2, y=-2, z=-2},
|
|
||||||
maxvel = {x=2, y=4, z=2},
|
|
||||||
minacc = {x=-2, y=-2, z=-2},
|
|
||||||
maxacc = {x=2, y=4, z=2},
|
|
||||||
minexptime = 1,
|
|
||||||
maxexptime = 1,
|
|
||||||
minsize = 1,
|
|
||||||
maxsize = 1,
|
|
||||||
collisiondetection = false,
|
|
||||||
vertical = false,
|
|
||||||
texture = "heart.png",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
local function get_velocity(v, yaw, y)
|
|
||||||
local x = -math.sin(yaw) * v
|
|
||||||
local z = math.cos(yaw) * v
|
|
||||||
return {x = x, y = y, z = z}
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_entity("mobs:angry_block", {
|
|
||||||
hp_max = 30,
|
|
||||||
physical = true,
|
|
||||||
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
|
||||||
visual = "cube",
|
|
||||||
visual_size = {x=1, y=1},
|
|
||||||
textures = {"mobs_angry_block_top.png", "mobs_angry_block_top.png", "mobs_angry_block.png", "mobs_angry_block.png", "mobs_angry_block.png", "mobs_angry_block.png"},
|
|
||||||
spritediv = {x=1, y=1},
|
|
||||||
initial_sprite_basepos = {x=0, y=0},
|
|
||||||
is_visible = true,
|
|
||||||
makes_footstep_sound = false,
|
|
||||||
automatic_rotate = true,
|
|
||||||
speed = 0,
|
|
||||||
pl = nil,
|
|
||||||
|
|
||||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction)
|
|
||||||
if not puncher or not puncher:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
self.pl = puncher
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
|
||||||
if math.random(0, 50) == 15 then
|
|
||||||
self.object:setvelocity({x=math.random(-2, 2), y=-1, z=math.random(-2, 2)})
|
|
||||||
|
|
||||||
if self.pl ~= nil then
|
|
||||||
self.pl:set_hp(self.pl:get_hp()-3)
|
|
||||||
if vector.distance(self.object:getpos(), self.pl:getpos()) > 5 then
|
|
||||||
self.pl = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mobs:angry_block", {
|
|
||||||
description = "Angry Block",
|
|
||||||
inventory_image = "[inventorycube{mobs_angry_block_top.png{mobs_angry_block.png{mobs_angry_block.png",
|
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if pointed_thing.type ~= "node" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
minetest.add_entity(pointed_thing.above, "mobs:angry_block")
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
@ -1,2 +0,0 @@
|
|||||||
default
|
|
||||||
central_message
|
|
@ -1,161 +0,0 @@
|
|||||||
pets = {}
|
|
||||||
pets.players_pets = {}
|
|
||||||
pets.pet_file = minetest.get_worldpath() .. "/pets"
|
|
||||||
|
|
||||||
local function get_velocity(v, yaw, y)
|
|
||||||
local x = -math.sin(yaw) * v
|
|
||||||
local z = math.cos(yaw) * v
|
|
||||||
return {x = x, y = y, z = z}
|
|
||||||
end
|
|
||||||
|
|
||||||
function pets.register_pet(name, def)
|
|
||||||
minetest.register_entity(name, {
|
|
||||||
hp_max = def.hp_max,
|
|
||||||
physical = true,
|
|
||||||
collisionbox = def.collisionbox,
|
|
||||||
visual = "mesh",
|
|
||||||
visual_size = {x=1, y=1},
|
|
||||||
mesh = def.mesh,
|
|
||||||
textures = def.textures,
|
|
||||||
spritediv = {x=1, y=1},
|
|
||||||
initial_sprite_basepos = {x=0, y=0},
|
|
||||||
is_visible = true,
|
|
||||||
makes_footstep_sound = false,
|
|
||||||
automatic_rotate = true,
|
|
||||||
speed = 0,
|
|
||||||
pl = nil,
|
|
||||||
is_pet = false,
|
|
||||||
|
|
||||||
on_rightclick = function(self, clicker)
|
|
||||||
if not clicker or not clicker:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if pets.players_pets[clicker:get_player_name()] then
|
|
||||||
cmsg.push_message_player(clicker, "[pet] You already have a pet!")
|
|
||||||
else
|
|
||||||
pets.players_pets[clicker:get_player_name()] = name
|
|
||||||
cmsg.push_message_player(clicker, "[pet] + ".. def.description)
|
|
||||||
self.pl = clicker
|
|
||||||
pets.players_pets[clicker:get_player_name()] = name
|
|
||||||
pets.save_pets()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
|
||||||
if self.pl ~= nil then
|
|
||||||
if self.pl:getpos() then
|
|
||||||
self.object:set_armor_groups({fleshy = 0, friendly = 100})
|
|
||||||
if vector.distance(self.object:getpos(), self.pl:getpos()) > 2 then
|
|
||||||
local vec = vector.direction(self.object:getpos(), self.pl:getpos())
|
|
||||||
vec.y = vec.y * 10
|
|
||||||
self.object:setvelocity(vector.multiply(vec, 3))
|
|
||||||
local yaw = math.atan(vec.z/vec.x)+math.pi/2
|
|
||||||
yaw = yaw+(math.pi/2)
|
|
||||||
if self.pl:getpos().x > self.object:getpos().x then
|
|
||||||
yaw = yaw+math.pi
|
|
||||||
end
|
|
||||||
self.object:setyaw(yaw)
|
|
||||||
end
|
|
||||||
if vector.distance(self.object:getpos(), self.pl:getpos()) > 15 then
|
|
||||||
local vec = self.pl:getpos()
|
|
||||||
vec.x = vec.x + math.random(-3, 3)
|
|
||||||
vec.z = vec.z + math.random(-3, 3)
|
|
||||||
vec.y = vec.y + 3
|
|
||||||
self.object:setpos(vec)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if self.is_pet then
|
|
||||||
print("[info] remove pet")
|
|
||||||
self.object:remove()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if math.random(0, 50) == 15 then
|
|
||||||
local vec = {x=math.random(-3, 3), y=-4, z=math.random(-3, 3)}
|
|
||||||
self.object:setvelocity(vec)
|
|
||||||
local yaw = math.atan(vec.z/vec.x)+math.pi/2
|
|
||||||
yaw = yaw+(math.pi/2)
|
|
||||||
if vec.x + self.object:getpos().x > self.object:getpos().x then
|
|
||||||
yaw = yaw+math.pi
|
|
||||||
end
|
|
||||||
self.object:setyaw(yaw)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem(name, {
|
|
||||||
description = def.description,
|
|
||||||
inventory_image = "pets_"..def.description.."_spawn.png",
|
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if pointed_thing.type ~= "node" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
minetest.add_entity(pointed_thing.above, name)
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- load save
|
|
||||||
|
|
||||||
function pets.load_pets()
|
|
||||||
local input = io.open(pets.pet_file, "r")
|
|
||||||
if input then
|
|
||||||
local str = input:read()
|
|
||||||
if str then
|
|
||||||
for k, v1, v2 in str.gmatch(str,"(%w+)=(%w+):(%w+)") do
|
|
||||||
pets.players_pets[k] = v1 .. ":" .. v2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
io.close(input)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function pets.save_pets()
|
|
||||||
if pets.players_pets then
|
|
||||||
local output = io.open(pets.pet_file, "w")
|
|
||||||
local str = ""
|
|
||||||
for k, v in pairs(pets.players_pets) do
|
|
||||||
str = str .. k .. "=" .. v .. ","
|
|
||||||
end
|
|
||||||
str = str:sub(1, #str - 1)
|
|
||||||
output:write(str)
|
|
||||||
io.close(output)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
if pets.players_pets[player:get_player_name()] then
|
|
||||||
local vec = player:getpos()
|
|
||||||
vec.x = vec.x + math.random(-3, 3)
|
|
||||||
vec.z = vec.z + math.random(-3, 3)
|
|
||||||
vec.y = vec.y + 3
|
|
||||||
print("[pets] add entity " .. pets.players_pets[player:get_player_name()])
|
|
||||||
local plpet = minetest.add_entity(vec, pets.players_pets[player:get_player_name()])
|
|
||||||
plpet:get_luaentity().pl = player
|
|
||||||
plpet:get_luaentity().is_pet = true
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
pets.register_pet("pets:pig", {
|
|
||||||
description = "pig",
|
|
||||||
hp_max = 30,
|
|
||||||
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
|
||||||
mesh = "pets_pig.x",
|
|
||||||
textures = {"pets_pig.png",},
|
|
||||||
})
|
|
||||||
|
|
||||||
pets.register_pet("pets:sheep", {
|
|
||||||
description = "sheep",
|
|
||||||
hp_max = 25,
|
|
||||||
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
|
||||||
mesh = "pets_sheep.x",
|
|
||||||
textures = {"pets_sheep.png",},
|
|
||||||
})
|
|
||||||
pets.load_pets()
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
places = {}
|
|
||||||
places.pos = {}
|
|
||||||
places.places_file = minetest.get_worldpath() .. "/places"
|
|
||||||
function places.register_place(name, pos)
|
|
||||||
places.pos[name] = pos
|
|
||||||
end
|
|
||||||
|
|
||||||
function places.load_places()
|
|
||||||
local input = io.open(places.places_file, "r")
|
|
||||||
if input then
|
|
||||||
local str = input:read()
|
|
||||||
if str then
|
|
||||||
print("[INFO] places string : " .. str)
|
|
||||||
if minetest.deserialize(str) then
|
|
||||||
places.pos = minetest.deserialize(str)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print("[WARNING] places file is empty")
|
|
||||||
end
|
|
||||||
io.close(input)
|
|
||||||
else
|
|
||||||
print("[error] couldnt find places file")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function places.save_places()
|
|
||||||
if places.pos then
|
|
||||||
local output = io.open(places.places_file, "w")
|
|
||||||
local str = minetest.serialize(places.pos)
|
|
||||||
output:write(str)
|
|
||||||
io.close(output)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_chatcommand("setplace", {
|
|
||||||
params = "<name>",
|
|
||||||
description = "Set a place",
|
|
||||||
privs = {server=true},
|
|
||||||
func = function(name, text)
|
|
||||||
if places.pos[text] then
|
|
||||||
return true, "There already is a place named " .. text
|
|
||||||
end
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
if player then
|
|
||||||
local pos = player:getpos()
|
|
||||||
pos = {x=math.floor(pos.x), y=math.floor(pos.y), z=math.floor(pos.z)}
|
|
||||||
places.pos[text] = pos
|
|
||||||
places.save_places()
|
|
||||||
return true, "Added a place named " .. text
|
|
||||||
end
|
|
||||||
return true, "Error couldnt find player " .. name
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
if places.pos then
|
|
||||||
for k, v in pairs(places.pos) do
|
|
||||||
player:hud_add({
|
|
||||||
hud_elem_type = "waypoint",
|
|
||||||
name = k,
|
|
||||||
text = "",
|
|
||||||
number = 255,
|
|
||||||
world_pos = v
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
places.load_places()
|
|
@ -1,2 +0,0 @@
|
|||||||
default
|
|
||||||
central_message
|
|
@ -1,143 +0,0 @@
|
|||||||
potions = {}
|
|
||||||
function potions.register_potion(name, def)
|
|
||||||
minetest.register_craftitem(name, {
|
|
||||||
description = def.description,
|
|
||||||
inventory_image = def.img,
|
|
||||||
|
|
||||||
on_drop = function(itemstack, dropper, pos)
|
|
||||||
if not dropper or not dropper:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
return def.on_use(itemstack, dropper)
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
if not user or not user:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
return def.on_use(itemstack, user)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
potions.register_potion("potions:healing", {
|
|
||||||
description = "Potion of Healing",
|
|
||||||
img = "potions_red.png",
|
|
||||||
on_use = function(itemstack, user)
|
|
||||||
if not user or not user:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
cmsg.push_message_player(user, "[hp] + 10")
|
|
||||||
user:set_hp(user:get_hp()+10)
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
potions.register_potion("potions:jumping", {
|
|
||||||
description = "Potion of Jumping",
|
|
||||||
img = "potions_blue.png",
|
|
||||||
on_use = function(itemstack, user)
|
|
||||||
if not user or not user:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
user:set_physics_override({
|
|
||||||
gravity = 0.1,
|
|
||||||
})
|
|
||||||
cmsg.push_message_player(user, "[effect] + jump")
|
|
||||||
|
|
||||||
minetest.after(10.0, function(pl)
|
|
||||||
if not pl or not pl:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
pl:set_physics_override({
|
|
||||||
gravity = 1,
|
|
||||||
})
|
|
||||||
cmsg.push_message_player(pl, "[effect] - jump")
|
|
||||||
end, user)
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
potions.register_potion("potions:running", {
|
|
||||||
description = "Potion of Running",
|
|
||||||
img = "potions_yellow.png",
|
|
||||||
on_use = function(itemstack, user)
|
|
||||||
if not user or not user:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
user:set_physics_override({
|
|
||||||
speed = 3,
|
|
||||||
})
|
|
||||||
cmsg.push_message_player(user, "[effect] + speed")
|
|
||||||
|
|
||||||
minetest.after(10.0, function(pl)
|
|
||||||
if not pl or not pl:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
pl:set_physics_override({
|
|
||||||
speed = 1,
|
|
||||||
})
|
|
||||||
cmsg.push_message_player(pl, "[effect] - speed")
|
|
||||||
end, user)
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("potions:strange", {
|
|
||||||
description = "strange Potion",
|
|
||||||
inventory_image = "potions_black.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("potions:glass", {
|
|
||||||
description = "Glass",
|
|
||||||
inventory_image = "potions_glass.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("potions:upgrading", {
|
|
||||||
description = "Potion of Upgrading",
|
|
||||||
inventory_image = "potions_green.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- crafting
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "potions:strange",
|
|
||||||
recipe = {"potions:glass", "juice:cactus", "juice:cactus", "juice:water"},
|
|
||||||
replacements = {
|
|
||||||
{"juice:cactus", "juice:glass"},
|
|
||||||
{"juice:cactus", "juice:glass"},
|
|
||||||
{"juice:water", "juice:glass"}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "potions:running",
|
|
||||||
recipe = {"juice:water_sugar", "juice:water_sugar", "juice:water_sugar", "potions:glass"},
|
|
||||||
replacements = {
|
|
||||||
{"juice:water_sugar", "juice:glass"},
|
|
||||||
{"juice:water_sugar", "juice:glass"},
|
|
||||||
{"juice:water_sugar", "juice:glass"}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "potions:jumping",
|
|
||||||
recipe = {"juice:water_sugar", "juice:water_sugar", "juice:water", "potions:glass"},
|
|
||||||
replacements = {
|
|
||||||
{"juice:water_sugar", "juice:glass"},
|
|
||||||
{"juice:water_sugar", "juice:glass"},
|
|
||||||
{"juice:water", "juice:glass"}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "potions:upgrading",
|
|
||||||
recipe = {"potions:strange", "default:stone_item", "farming:cactus", "default:sand"},
|
|
||||||
})
|
|
@ -1,3 +0,0 @@
|
|||||||
default
|
|
||||||
central_message
|
|
||||||
xp
|
|
@ -1,178 +0,0 @@
|
|||||||
-- story quests
|
|
||||||
|
|
||||||
quests = {}
|
|
||||||
quests.player_quests = {}
|
|
||||||
quests.file = minetest.get_worldpath() .. "/quests"
|
|
||||||
|
|
||||||
function quests.load_quests()
|
|
||||||
local input = io.open(quests.file, "r")
|
|
||||||
if input then
|
|
||||||
local str = input:read("*all")
|
|
||||||
if str then
|
|
||||||
if minetest.deserialize(str) then
|
|
||||||
quests.player_quests = minetest.deserialize(str)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print("[WARNING] quest file is empty")
|
|
||||||
end
|
|
||||||
io.close(input)
|
|
||||||
else
|
|
||||||
print("[ERROR] couldnt find quest file")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function quests.save_quests()
|
|
||||||
if quests.player_quests then
|
|
||||||
local output = io.open(quests.file, "w")
|
|
||||||
local str = minetest.serialize(quests.player_quests)
|
|
||||||
output:write(str)
|
|
||||||
io.close(output)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function quests.add_quest(player, quest)
|
|
||||||
if not quests.player_quests[player] then
|
|
||||||
quests.player_quests[player] = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(quests.player_quests[player], quest)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_dignode(function(pos, oldnode, digger)
|
|
||||||
if not digger or not digger:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not quests.player_quests[digger:get_player_name()] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
table.foreach(quests.player_quests[digger:get_player_name()], function(k, v)
|
|
||||||
if v.quest_type == "dignode" and newnode.name == v.node then
|
|
||||||
v.progress = v.progress + 1
|
|
||||||
if v.v.progress > (v.max-1) and v.done == false then
|
|
||||||
xp.add_xp(player, v.xp)
|
|
||||||
v.done = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
|
|
||||||
if not placer or not placer:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not quests.player_quests[placer:get_player_name()] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
table.foreach(quests.player_quests[placer:get_player_name()], function(k, v)
|
|
||||||
if v.quest_type == "placenode" and newnode.name == v.node then
|
|
||||||
v.progress = v.progress + 1
|
|
||||||
if v.v.progress > (v.max-1) and v.done == false then
|
|
||||||
xp.add_xp(player, v.xp)
|
|
||||||
v.done = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_newplayer(function(player)
|
|
||||||
quests.player_quests[player:get_player_name()] = {}
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- side quests
|
|
||||||
|
|
||||||
minetest.register_node("quests:quest_block", {
|
|
||||||
description = "Quest Block",
|
|
||||||
tiles = {"quests_block.png"},
|
|
||||||
groups = {quest = 1, cracky = 3},
|
|
||||||
on_punch = function(pos, node, player, pointed_thing)
|
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
if meta:get_string("item") ~= "" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local items = {"default:dirt", "default:sand", "default:iron_lump", "default:stone_item", "default:string"}
|
|
||||||
local item = items[math.random(5)]
|
|
||||||
if minetest.registered_nodes[item] then
|
|
||||||
meta:set_string("infotext", "Bring me some " .. minetest.registered_nodes[item].description .. ", pls :)")
|
|
||||||
else
|
|
||||||
meta:set_string("infotext", "Bring me some " .. minetest.registered_craftitems[item].description .. ", pls :)")
|
|
||||||
end
|
|
||||||
meta:set_string("item", item)
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
print(itemstack)
|
|
||||||
print(itemstack:to_table())
|
|
||||||
if not itemstack or not itemstack:to_table() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if itemstack:to_table().name == meta:get_string("item") then
|
|
||||||
meta:set_string("infotext", "Thank you!")
|
|
||||||
xp.add_xp(player, math.random(3, 30))
|
|
||||||
minetest.add_particlespawner({
|
|
||||||
amount = 500,
|
|
||||||
time = 5,
|
|
||||||
minpos = {x=pos.x, y=pos.y, z=pos.z},
|
|
||||||
maxpos = {x=pos.x, y=pos.y, z=pos.z},
|
|
||||||
minvel = {x=-2, y=0, z=-2},
|
|
||||||
maxvel = {x=2, y=0, z=2},
|
|
||||||
minacc = {x=-2, y=0, z=-2},
|
|
||||||
maxacc = {x=2, y=0, z=2},
|
|
||||||
minexptime = 5,
|
|
||||||
maxexptime = 5,
|
|
||||||
minsize = 1,
|
|
||||||
maxsize = 1,
|
|
||||||
collisiondetection = false,
|
|
||||||
vertical = false,
|
|
||||||
texture = "default_xp.png",
|
|
||||||
})
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
else
|
|
||||||
meta:set_string("infotext", "That isnt the item I am searching for..")
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("quests:map", {
|
|
||||||
description = "Map",
|
|
||||||
tiles = {"quests_map_top.png", "quests_map_top.png", "quests_map.png", "quests_map.png", "quests_map.png", "quests_map.png"},
|
|
||||||
groups = {quest = 1, cracky = 3},
|
|
||||||
on_punch = function(pos, node, player, pointed_thing)
|
|
||||||
xp.add_xp(player, math.random(3, 30))
|
|
||||||
minetest.add_particlespawner({
|
|
||||||
amount = 500,
|
|
||||||
time = 5,
|
|
||||||
minpos = {x=pos.x, y=pos.y, z=pos.z},
|
|
||||||
maxpos = {x=pos.x, y=pos.y, z=pos.z},
|
|
||||||
minvel = {x=-2, y=0, z=-2},
|
|
||||||
maxvel = {x=2, y=0, z=2},
|
|
||||||
minacc = {x=-2, y=0, z=-2},
|
|
||||||
maxacc = {x=2, y=0, z=2},
|
|
||||||
minexptime = 5,
|
|
||||||
maxexptime = 5,
|
|
||||||
minsize = 1,
|
|
||||||
maxsize = 1,
|
|
||||||
collisiondetection = false,
|
|
||||||
vertical = false,
|
|
||||||
texture = "default_xp.png",
|
|
||||||
})
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("quests:ray", {
|
|
||||||
description = "Ray",
|
|
||||||
tiles = {"quests_glowing_ray.png"},
|
|
||||||
groups = {ray=1},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
light_source = 7,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, 0.5, 0.2},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
@ -1,2 +0,0 @@
|
|||||||
default
|
|
||||||
lava
|
|
@ -1,136 +0,0 @@
|
|||||||
stairs = {}
|
|
||||||
function stairs.register_stair_and_slab(name, base)
|
|
||||||
if not minetest.registered_nodes[base] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node(name.."_slab", {
|
|
||||||
description = minetest.registered_nodes[base].description .. " Slab",
|
|
||||||
tiles = minetest.registered_nodes[base].tiles,
|
|
||||||
groups = minetest.registered_nodes[base].groups,
|
|
||||||
paramtype = "light",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
minetest.register_node(name.."_stair", {
|
|
||||||
description = minetest.registered_nodes[base].description .. " Stair",
|
|
||||||
tiles = minetest.registered_nodes[base].tiles,
|
|
||||||
groups = minetest.registered_nodes[base].groups,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
||||||
{-0.5, -0.5, 0, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node(name.."_stair_corner_1", {
|
|
||||||
description = minetest.registered_nodes[base].description .. " Corner",
|
|
||||||
tiles = minetest.registered_nodes[base].tiles,
|
|
||||||
groups = minetest.registered_nodes[base].groups,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
||||||
{-0.5, -0.5, 0, 0.5, 0.5, 0.5},
|
|
||||||
{0, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node(name.."_stair_corner_2", {
|
|
||||||
description = minetest.registered_nodes[base].description .. " Corner",
|
|
||||||
tiles = minetest.registered_nodes[base].tiles,
|
|
||||||
groups = minetest.registered_nodes[base].groups,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
||||||
{0, -0.5, 0, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node(name.."_wall", {
|
|
||||||
description = minetest.registered_nodes[base].description .. " Wall",
|
|
||||||
tiles = minetest.registered_nodes[base].tiles,
|
|
||||||
groups = minetest.registered_nodes[base].groups,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, 0, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node(name.."_wall_corner_1", {
|
|
||||||
description = minetest.registered_nodes[base].description .. " Corner",
|
|
||||||
tiles = minetest.registered_nodes[base].tiles,
|
|
||||||
groups = minetest.registered_nodes[base].groups,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, 0, 0.5, 0.5, 0.5},
|
|
||||||
{0, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node(name.."_wall_corner_2", {
|
|
||||||
description = minetest.registered_nodes[base].description .. " Corner",
|
|
||||||
tiles = minetest.registered_nodes[base].tiles,
|
|
||||||
groups = minetest.registered_nodes[base].groups,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{0, -0.5, 0, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = name.."_stair 3",
|
|
||||||
recipe = {
|
|
||||||
{base, ""},
|
|
||||||
{base, base},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = name.."_slab 4",
|
|
||||||
recipe = {
|
|
||||||
{base, base},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
stairs.register_stair_and_slab("stairs:stonebrick", "default:stonebrick")
|
|
||||||
stairs.register_stair_and_slab("stairs:stone_tile", "default:stone_tile")
|
|
||||||
stairs.register_stair_and_slab("stairs:stone", "default:stone")
|
|
||||||
stairs.register_stair_and_slab("stairs:cobble", "default:cobble")
|
|
||||||
stairs.register_stair_and_slab("stairs:brick", "default:brick")
|
|
||||||
stairs.register_stair_and_slab("stairs:basalt", "lava:basalt")
|
|
||||||
stairs.register_stair_and_slab("stairs:wood", "default:wood")
|
|
||||||
stairs.register_stair_and_slab("stairs:wooden_planks", "default:wooden_planks")
|
|
@ -1,16 +0,0 @@
|
|||||||
License for Code
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
|
||||||
|
|
||||||
License for Media
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
CC-BY-SA 3.0 UNPORTED. Created by cd2 (cdqwertz)
|
|
@ -1,270 +0,0 @@
|
|||||||
-- string
|
|
||||||
function string:split(inSplitPattern, outResults)
|
|
||||||
if not outResults then
|
|
||||||
outResults = {}
|
|
||||||
end
|
|
||||||
local theStart = 1
|
|
||||||
local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart )
|
|
||||||
while theSplitStart do
|
|
||||||
table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) )
|
|
||||||
theStart = theSplitEnd + 1
|
|
||||||
theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart )
|
|
||||||
end
|
|
||||||
table.insert( outResults, string.sub( self, theStart ) )
|
|
||||||
return outResults
|
|
||||||
end
|
|
||||||
|
|
||||||
-- form
|
|
||||||
|
|
||||||
story.talk_form = "size[8,7.5;]"
|
|
||||||
story.talk_form = story.talk_form..default.gui_colors
|
|
||||||
story.talk_form = story.talk_form..default.gui_bg
|
|
||||||
story.talk_form = story.talk_form.."image[0,0.0;3,8;story_player.png]"
|
|
||||||
story.talk_form = story.talk_form.."label[2.5,0;%s]"
|
|
||||||
story.talk_form = story.talk_form.."image[6,0.0;3,8;story_character_1.png]"
|
|
||||||
|
|
||||||
story.get_talk_form = function(text)
|
|
||||||
return string.format(story.talk_form, text)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- hud
|
|
||||||
|
|
||||||
story.hud = {}
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
if story.generator.players_storys[player:get_player_name()] and story.generator.players_storys[player:get_player_name()].pos then
|
|
||||||
story.hud[player:get_player_name()] = player:hud_add({
|
|
||||||
hud_elem_type = "waypoint",
|
|
||||||
name = "story",
|
|
||||||
text = "",
|
|
||||||
number = 0x00FF00,
|
|
||||||
world_pos = story.generator.players_storys[player:get_player_name()].pos
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
story.hud[player:get_player_name()] = player:hud_add({
|
|
||||||
hud_elem_type = "waypoint",
|
|
||||||
name = "story",
|
|
||||||
text = "",
|
|
||||||
number = 0x00FF00,
|
|
||||||
world_pos = {x=0,y=0,z=0}
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- generator
|
|
||||||
|
|
||||||
story.generator = {}
|
|
||||||
story.generator.parts = {}
|
|
||||||
story.generator.dialogs = {}
|
|
||||||
story.generator.players_storys = {}
|
|
||||||
story.generator.file = minetest.get_worldpath() .. "/story"
|
|
||||||
|
|
||||||
function story.generator.load_storys()
|
|
||||||
local input = io.open(story.generator.file, "r")
|
|
||||||
if input then
|
|
||||||
local str = input:read("*all")
|
|
||||||
if str then
|
|
||||||
if minetest.deserialize(str) then
|
|
||||||
story.generator.players_storys = minetest.deserialize(str)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print("[WARNING] story file is empty")
|
|
||||||
end
|
|
||||||
io.close(input)
|
|
||||||
else
|
|
||||||
print("[ERROR] couldnt find story file")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function story.generator.save_storys()
|
|
||||||
if story.generator.players_storys then
|
|
||||||
local output = io.open(story.generator.file, "w")
|
|
||||||
local str = minetest.serialize(story.generator.players_storys)
|
|
||||||
output:write(str)
|
|
||||||
io.close(output)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function story.generator.gen_next_step(player)
|
|
||||||
print("[INFO] generating story...")
|
|
||||||
if not story.generator.players_storys[player:get_player_name()] then
|
|
||||||
print("[ERROR][story] could not find players story")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local part = story.generator.players_storys[player:get_player_name()].part
|
|
||||||
part = story.generator.get_part(story.generator.players_storys[player:get_player_name()].part)
|
|
||||||
if part then
|
|
||||||
local next_part = {}
|
|
||||||
if story.generator.players_storys[player:get_player_name()].wait then
|
|
||||||
next_part = story.generator.run(part, player, story.generator.players_storys[player:get_player_name()].wait_pos+1)
|
|
||||||
else
|
|
||||||
next_part = story.generator.run(part, player, 0)
|
|
||||||
end
|
|
||||||
if next_part.wait then
|
|
||||||
story.generator.players_storys[player:get_player_name()].wait = true
|
|
||||||
story.generator.players_storys[player:get_player_name()].wait_pos = next_part.param
|
|
||||||
else
|
|
||||||
story.generator.players_storys[player:get_player_name()].part = next_part.part
|
|
||||||
story.generator.players_storys[player:get_player_name()].wait_pos = 0
|
|
||||||
end
|
|
||||||
story.generator.save_storys()
|
|
||||||
return
|
|
||||||
else
|
|
||||||
print("[ERROR][story] could not find part file")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function story.generator.new_player(player)
|
|
||||||
-- adds a new entry to the story database
|
|
||||||
story.generator.players_storys[player:get_player_name()] = {}
|
|
||||||
story.generator.players_storys[player:get_player_name()].part = "base"
|
|
||||||
story.generator.players_storys[player:get_player_name()].wait_pos = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function story.generator.get_part(name)
|
|
||||||
if not name then return end
|
|
||||||
if name == "" then return end
|
|
||||||
if not story.generator.parts[name] then
|
|
||||||
local file = io.open(minetest.get_modpath("story").."/parts/"..name..".part", "r")
|
|
||||||
story.generator.parts[name] = file:read("*all")
|
|
||||||
io.close(file)
|
|
||||||
return story.generator.parts[name]
|
|
||||||
else
|
|
||||||
return story.generator.parts[name]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function story.generator.get_dialog(name)
|
|
||||||
if not story.generator.dialogs[name] then
|
|
||||||
local file = io.open(minetest.get_modpath("story").."/parts/"..name..".dialog", "r")
|
|
||||||
story.generator.dialogs[name] = file:read("*all")
|
|
||||||
io.close(file)
|
|
||||||
return story.generator.dialogs[name]
|
|
||||||
else
|
|
||||||
return story.generator.dialogs[name]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function story.generator.run(part, player, line_pos)
|
|
||||||
local out = {}
|
|
||||||
print("[INFO] run script... " .. part)
|
|
||||||
local lines = part:split("\n")
|
|
||||||
if not lines then
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
local i = 0
|
|
||||||
for k,v in pairs(lines) do
|
|
||||||
if i > line_pos-1 then
|
|
||||||
local cmd = v:split(" ")
|
|
||||||
if cmd[1] then
|
|
||||||
print("[INFO] run line... " .. v)
|
|
||||||
if cmd[1] == "$dialog" and cmd[2] then
|
|
||||||
if story.generator.get_dialog(cmd[2]) then
|
|
||||||
story.generator.players_storys[player:get_player_name()].text = story.generator.get_dialog(cmd[2])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if cmd[1] == "$create" then
|
|
||||||
story.generator.show(player, story.generator.players_storys[player:get_player_name()].pos)
|
|
||||||
end
|
|
||||||
if cmd[1] == "$place" and cmd[2] then
|
|
||||||
if places.pos[cmd[2]] then
|
|
||||||
story.generator.players_storys[player:get_player_name()].pos = places.pos[cmd[2]]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if cmd[1] == "$pos" then
|
|
||||||
story.generator.players_storys[player:get_player_name()].pos = {x=0,y=10,z=0}
|
|
||||||
end
|
|
||||||
if cmd[1] == "$next" and cmd[2] then
|
|
||||||
out = {part=cmd[2], wait=false}
|
|
||||||
end
|
|
||||||
if cmd[1] == "$wait" then
|
|
||||||
return {cmd="$wait", param=i, wait=true}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
i = i +1
|
|
||||||
end
|
|
||||||
return out
|
|
||||||
end
|
|
||||||
|
|
||||||
function story.generator.show(player, p)
|
|
||||||
-- update waypoint
|
|
||||||
player:hud_remove(story.hud[player:get_player_name()])
|
|
||||||
story.hud[player:get_player_name()] = player:hud_add({
|
|
||||||
hud_elem_type = "waypoint",
|
|
||||||
name = "story",
|
|
||||||
text = "",
|
|
||||||
number = 0x00FF00,
|
|
||||||
world_pos = p
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.add_entity(p, "story:human")
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_newplayer(function(player)
|
|
||||||
story.generator.new_player(player)
|
|
||||||
story.generator.gen_next_step(player)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- human
|
|
||||||
minetest.register_entity("story:human", {
|
|
||||||
hp_max = 50,
|
|
||||||
physical = true,
|
|
||||||
collisionbox = {-0.4,-1,-0.4, 0.4,1,0.4},
|
|
||||||
visual = "mesh",
|
|
||||||
visual_size = {x=1, y=1},
|
|
||||||
textures = {"character.png",},
|
|
||||||
mesh = "character.x",
|
|
||||||
spritediv = {x=1, y=1},
|
|
||||||
initial_sprite_basepos = {x=0, y=0},
|
|
||||||
is_visible = true,
|
|
||||||
makes_footstep_sound = false,
|
|
||||||
automatic_rotate = true,
|
|
||||||
speed = 0,
|
|
||||||
plname = nil,
|
|
||||||
text = nil,
|
|
||||||
|
|
||||||
on_rightclick = function(self, clicker)
|
|
||||||
if not clicker or not clicker:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not story.generator.players_storys[clicker:get_player_name()] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- shows the dialog
|
|
||||||
if story.generator.players_storys[clicker:get_player_name()].pos then
|
|
||||||
if vector.distance(self.object:getpos(), story.generator.players_storys[clicker:get_player_name()].pos) < 3 then
|
|
||||||
minetest.show_formspec(clicker:get_player_name(), "story:story", story.get_talk_form(story.generator.players_storys[clicker:get_player_name()].text))
|
|
||||||
story.generator.gen_next_step(clicker)
|
|
||||||
-- TODO : delete npc after talking with it (or move it some where else)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
|
||||||
-- nothing
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("story:human", {
|
|
||||||
description = "Human",
|
|
||||||
inventory_image = "story_character_spawn.png",
|
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if pointed_thing.type ~= "node" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local p = pointed_thing.above
|
|
||||||
p.y = p.y + 0.5
|
|
||||||
minetest.add_entity(p, "story:human")
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
story.generator.load_storys()
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
default
|
|
||||||
places
|
|
||||||
quests
|
|
@ -1,23 +0,0 @@
|
|||||||
story = {}
|
|
||||||
|
|
||||||
local modpath = minetest.get_modpath("story")
|
|
||||||
dofile(modpath.."/api.lua")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("story:conversation", {
|
|
||||||
description = "Set Conversation",
|
|
||||||
inventory_image = "story_set_conversation.png",
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if not placer or not placer:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not pointed_thing or not pointed_thing.under then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
story.set_talk_form(pointed_thing.under)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
$dialog test
|
|
||||||
$pos
|
|
||||||
$create
|
|
||||||
$wait
|
|
||||||
$dialog test
|
|
||||||
$place testplace
|
|
||||||
$create
|
|
@ -1,4 +0,0 @@
|
|||||||
<name> Hi! I have bad news for you, some angry blocks destroyed your house :(
|
|
||||||
You : Thats not good...
|
|
||||||
<name> You should build a new one.
|
|
||||||
$quest placenode default:wood 99 15
|
|
@ -1,65 +0,0 @@
|
|||||||
minetest.register_node("torch:torch", {
|
|
||||||
description = "Torch",
|
|
||||||
tiles = {"torch_wood.png"},
|
|
||||||
drawtype = "mesh",
|
|
||||||
mesh = "torch_torch.obj",
|
|
||||||
groups = {crumbly = 3},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
light_source = 14,
|
|
||||||
walkable = false,
|
|
||||||
inventory_image = "torch_torch_inv.png",
|
|
||||||
wield_image = "torch_torch_inv.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"torch:torch"},
|
|
||||||
interval = 10.0,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
pos.y = pos.y + 0.2
|
|
||||||
minetest.add_particlespawner({
|
|
||||||
amount = 10,
|
|
||||||
time = 10,
|
|
||||||
minpos = pos,
|
|
||||||
maxpos = pos,
|
|
||||||
minvel = {x=0, y=0.1, z=0},
|
|
||||||
maxvel = {x=0, y=0, z=0},
|
|
||||||
minacc = {x=0, y=0, z=0},
|
|
||||||
maxacc = {x=0, y=0, z=0},
|
|
||||||
minexptime = 1,
|
|
||||||
maxexptime = 1,
|
|
||||||
minsize = 1,
|
|
||||||
maxsize = 1,
|
|
||||||
collisiondetection = false,
|
|
||||||
vertical = false,
|
|
||||||
texture = "torch_flame.png",
|
|
||||||
})
|
|
||||||
minetest.add_particlespawner({
|
|
||||||
amount = 50,
|
|
||||||
time = 10,
|
|
||||||
minpos = pos,
|
|
||||||
maxpos = pos,
|
|
||||||
minvel = {x=0, y=0.5, z=0},
|
|
||||||
maxvel = {x=0, y=0, z=0},
|
|
||||||
minacc = {x=0, y=0, z=0},
|
|
||||||
maxacc = {x=0, y=0, z=0},
|
|
||||||
minexptime = 1,
|
|
||||||
maxexptime = 1,
|
|
||||||
minsize = 3,
|
|
||||||
maxsize = 3,
|
|
||||||
collisiondetection = false,
|
|
||||||
vertical = false,
|
|
||||||
texture = "torch_smoke.png",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "torch:torch",
|
|
||||||
recipe = {
|
|
||||||
{"", "default:coal_lump", ""},
|
|
||||||
{"", "default:string_strong", ""},
|
|
||||||
{"", "default:log_3", ""},
|
|
||||||
}
|
|
||||||
})
|
|
@ -1 +0,0 @@
|
|||||||
central_message
|
|
@ -1,135 +0,0 @@
|
|||||||
xp = {}
|
|
||||||
xp.lvl = 20
|
|
||||||
xp.player_xp = {}
|
|
||||||
xp.player_levels = {}
|
|
||||||
xp.xp_hud = {}
|
|
||||||
xp.level_hud = {}
|
|
||||||
|
|
||||||
xp.xp_file = minetest.get_worldpath() .. "/xp"
|
|
||||||
xp.lvl_file = minetest.get_worldpath() .. "/levels"
|
|
||||||
|
|
||||||
function xp.add_xp(player, num)
|
|
||||||
if xp.player_xp[player:get_player_name()] then
|
|
||||||
xp.player_xp[player:get_player_name()] = xp.player_xp[player:get_player_name()] + num
|
|
||||||
else
|
|
||||||
xp.player_xp[player:get_player_name()] = num
|
|
||||||
end
|
|
||||||
|
|
||||||
cmsg.push_message_player(player, "You got "..tostring(num).. " xp!")
|
|
||||||
|
|
||||||
if xp.player_levels[player:get_player_name()] then
|
|
||||||
if xp.player_xp[player:get_player_name()] > xp.lvl*xp.player_levels[player:get_player_name()] then
|
|
||||||
xp.player_xp[player:get_player_name()] = xp.player_xp[player:get_player_name()] - xp.lvl*xp.player_levels[player:get_player_name()]
|
|
||||||
xp.add_lvl(player)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
xp.player_levels[player:get_player_name()] = 1
|
|
||||||
end
|
|
||||||
print("[info] xp for player ".. player:get_player_name() .. " " .. xp.player_xp[player:get_player_name()].."/"..xp.lvl*xp.player_levels[player:get_player_name()].." = " .. (xp.player_xp[player:get_player_name()])/(xp.lvl*xp.player_levels[player:get_player_name()]))
|
|
||||||
player:hud_change(xp.xp_hud[player:get_player_name()], "number", 20*((xp.player_xp[player:get_player_name()])/(xp.lvl*xp.player_levels[player:get_player_name()])))
|
|
||||||
xp.save_xp()
|
|
||||||
end
|
|
||||||
|
|
||||||
function xp.add_lvl(player)
|
|
||||||
if xp.player_levels[player:get_player_name()] then
|
|
||||||
xp.player_levels[player:get_player_name()] = xp.player_levels[player:get_player_name()] + 1
|
|
||||||
else
|
|
||||||
xp.player_levels[player:get_player_name()] = 1
|
|
||||||
end
|
|
||||||
xp.save_levels()
|
|
||||||
player:hud_change(xp.level_hud[player:get_player_name()], "text", xp.player_levels[player:get_player_name()])
|
|
||||||
cmsg.push_message_player(player, "Level up! You are now Level " .. tostring(xp.player_levels[player:get_player_name()]))
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
if xp.player_xp[player:get_player_name()] then
|
|
||||||
xp.xp_hud[player:get_player_name()] = player:hud_add({
|
|
||||||
hud_elem_type = "statbar",
|
|
||||||
position = {x=0.5,y=1.0},
|
|
||||||
size = {x=16, y=16},
|
|
||||||
offset = {x=-(32*8+16), y=-(48*2+16)},
|
|
||||||
text = "xp_xp.png",
|
|
||||||
number = 20*((xp.player_xp[player:get_player_name()])/(xp.lvl*xp.player_levels[player:get_player_name()])),
|
|
||||||
})
|
|
||||||
xp.level_hud[player:get_player_name()] = player:hud_add({
|
|
||||||
hud_elem_type = "text",
|
|
||||||
position = {x=0.5,y=1},
|
|
||||||
text = xp.player_levels[player:get_player_name()],
|
|
||||||
number = 0xFFFFFF,
|
|
||||||
alignment = {x=0.5,y=1},
|
|
||||||
offset = {x=0, y=-(48*2+16)},
|
|
||||||
})
|
|
||||||
else
|
|
||||||
xp.xp_hud[player:get_player_name()] = player:hud_add({
|
|
||||||
hud_elem_type = "statbar",
|
|
||||||
position = {x=0.5,y=1.0},
|
|
||||||
size = {x=16, y=16},
|
|
||||||
offset = {x=-(32*8+16), y=-(48*2+16)},
|
|
||||||
text = "xp_xp.png",
|
|
||||||
number = 0,
|
|
||||||
})
|
|
||||||
xp.level_hud[player:get_player_name()] = player:hud_add({
|
|
||||||
hud_elem_type = "text",
|
|
||||||
position = {x=0.5,y=1},
|
|
||||||
text = "1",
|
|
||||||
number = 0xFFFFFF,
|
|
||||||
alignment = {x=0.5,y=1},
|
|
||||||
offset = {x=0, y=-(48*2+16)},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
function xp.load_xp()
|
|
||||||
local input = io.open(xp.xp_file, "r")
|
|
||||||
if input then
|
|
||||||
local str = input:read()
|
|
||||||
if str then
|
|
||||||
for k, v in str.gmatch(str,"(%w+)=(%w+)") do
|
|
||||||
xp.player_xp[k] = tonumber(v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
io.close(input)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function xp.save_xp()
|
|
||||||
if xp.player_xp then
|
|
||||||
local output = io.open(xp.xp_file, "w")
|
|
||||||
local str = ""
|
|
||||||
for k, v in pairs(xp.player_xp) do
|
|
||||||
str = str .. k .. "=" .. v .. ","
|
|
||||||
end
|
|
||||||
str = str:sub(1, #str - 1)
|
|
||||||
output:write(str)
|
|
||||||
io.close(output)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function xp.load_levels()
|
|
||||||
local input = io.open(xp.lvl_file, "r")
|
|
||||||
if input then
|
|
||||||
local str = input:read()
|
|
||||||
if str then
|
|
||||||
for k, v in str.gmatch(str,"(%w+)=(%w+)") do
|
|
||||||
xp.player_levels[k] = tonumber(v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
io.close(input)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function xp.save_levels()
|
|
||||||
if xp.player_xp then
|
|
||||||
local output = io.open(xp.lvl_file, "w")
|
|
||||||
local str = ""
|
|
||||||
for k, v in pairs(xp.player_levels) do
|
|
||||||
str = str .. k .. "=" .. v .. ","
|
|
||||||
end
|
|
||||||
str = str:sub(1, #str - 1)
|
|
||||||
output:write(str)
|
|
||||||
io.close(output)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
xp.load_xp()
|
|
||||||
xp.load_levels()
|
|
Loading…
x
Reference in New Issue
Block a user