parent
9f4e022d52
commit
fa769010ec
|
@ -543,13 +543,13 @@ end
|
|||
-- load data on server start
|
||||
--local modpath = minetest.get_modpath("basic_protect")
|
||||
local modpath = minetest.get_worldpath();
|
||||
local f = io.open(modpath .. "\\swap.dat", "r"); local swapstring = "";
|
||||
local f = io.open(modpath .. "/swap.dat", "r"); local swapstring = "";
|
||||
if f then swapstring = f:read("*all") or "";f:close() end
|
||||
|
||||
basic_protect.swap = minetest.deserialize(swapstring) or {};
|
||||
|
||||
minetest.register_on_shutdown(function() -- save swap data on shutdown
|
||||
local f = assert(io.open(modpath .. "\\swap.dat", "w"))
|
||||
local f = assert(io.open(modpath .. "/swap.dat", "w"))
|
||||
local swapstring = f:write(minetest.serialize(basic_protect.swap))
|
||||
f:close()
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
basic_robot = {};
|
||||
------ SETTINGS --------
|
||||
basic_robot.call_limit = {50,200,1500,10^9}; -- how many execution calls per script run allowed, for auth levels 0,1,2 (normal, robot, puzzle, admin)
|
||||
basic_robot.count = {2,4,16,128} -- how many robots player can have
|
||||
basic_robot.count = {2,6,16,128} -- how many robots player can have
|
||||
|
||||
basic_robot.radius = 32; -- divide whole world into blocks of this size - used for managing events like keyboard punches
|
||||
basic_robot.password = "raN___dOM_ p4S"; -- IMPORTANT: change it before running mod, password used for authentifications
|
||||
|
@ -25,7 +25,7 @@ basic_robot.bad_inventory_blocks = { -- disallow taking from these nodes invento
|
|||
|
||||
basic_robot.http_api = minetest.request_http_api();
|
||||
|
||||
basic_robot.version = "2019/09/27a";
|
||||
basic_robot.version = "2019/10/01a";
|
||||
|
||||
basic_robot.gui = {}; local robogui = basic_robot.gui -- gui management
|
||||
basic_robot.data = {}; -- stores all robot related data
|
||||
|
@ -1324,6 +1324,7 @@ local on_receive_robot_form = function(pos, formname, fields, sender)
|
|||
end
|
||||
|
||||
if fields.spawn then
|
||||
minetest.log("action", "basic_robot manual start by " .. name .. " at " .. pos.x .. " " .. pos.y .. " " .. pos.z)
|
||||
spawn_robot(pos,0,0);
|
||||
return
|
||||
end
|
||||
|
|
|
@ -172,8 +172,8 @@ local help_pages = {
|
|||
" activate.direction(mode) activates target block",
|
||||
" pickup(r) picks up all items around robot in radius r<8 and returns list",
|
||||
" or nil",
|
||||
" craft(item,idx,mode) crafts item if required materials are present in",
|
||||
" inventory, mode = 1 returns recipe, optional recipe idx",
|
||||
" craft(item,idx,mode,amount) crafts item if required materials are present in",
|
||||
" inventory, mode = 1 returns recipe, optional recipe idx, optional ammount",
|
||||
" take.direction(item, inventory) takes item from target inventory into",
|
||||
" robot inventory",
|
||||
},
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
if lvl == nil then return end
|
||||
if lvl <0 or lvl >89 then return end
|
||||
|
||||
local file = _G.io.open(minetest.get_modpath("basic_robot").."\\scripts\\sokoban.txt","r")
|
||||
local file = _G.io.open(minetest.get_modpath("basic_robot").."/scripts/sokoban.txt","r")
|
||||
if not file then return end
|
||||
local str = ""; local s; local p = {x=pos.x,y=pos.y,z=pos.z}; local i,j;i=0;
|
||||
local lvl_found = false
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
if not init then
|
||||
init = true; self.listen(1);
|
||||
|
||||
_G.minetest.forceload_block(self.pos(),true)
|
||||
self.spam(1); self.label("help bot")
|
||||
|
||||
talk = function(msg) minetest.chat_send_all("<help bot> " .. msg) end
|
||||
keywords = {
|
||||
{"tp", 14},
|
||||
{"tpr", 14},
|
||||
{"tpy",19},
|
||||
{"help",
|
||||
{"robot",6},{"",1}
|
||||
},
|
||||
{"how",
|
||||
{"play",1},{"robot", 6},{"stone",4},{"tree",3},{"wood",3},{"lava",5},{"cobble",4},{"dirt",10},
|
||||
{"do i get",1},{"do i make",1}, {"to get",1}
|
||||
{"play",1},{"island",17},{"robot", 6},{"stone",4},{"tree",3},{"wood",3},{"lava",5},{"mossy",16},{"cobble",4},{"dirt",10},
|
||||
{"do i get",1},{"do i make",1}, {"to get",1},{"farm",15},
|
||||
},
|
||||
{"i need",
|
||||
{"wood",3}
|
||||
|
@ -22,11 +25,12 @@ if not init then
|
|||
{" hard",{"",9}}, -- word matched can appear anywhere
|
||||
{" died", {"",9}},
|
||||
{" die",{"",8}}, {" dead",{"",8}},
|
||||
{"rnd",{"",11}},
|
||||
-- {"rnd",{"",11}},
|
||||
{"bye",{"",12}},
|
||||
{"!!",{"",9}},
|
||||
|
||||
{"calc", 13},
|
||||
{"day",18},
|
||||
}
|
||||
answers = {
|
||||
"%s open inventory, click 'Quests' and do them to get more stuff", --1
|
||||
|
@ -38,21 +42,38 @@ if not init then
|
|||
"wb %s",
|
||||
"dont die, you lose your stuff and it will reset your level on level 1",
|
||||
"you suck %s!", -- 9
|
||||
"to get dirt craft composter and use it with leaves", -- 10
|
||||
"to get dirt craft composter, put leaves on it, punch it and wait until its ready.", -- 10
|
||||
"rnd is afk. in the meantime i can answer your questions",
|
||||
"bye %s",
|
||||
function(speaker,msg) -- 13, calc
|
||||
local expr = string.sub(msg,5); if string.find(expr,"%a") then return end
|
||||
local res = _G.loadstring("return " .. expr)(); say(expr .. " = " .. res)
|
||||
local expr = string.sub(msg,5);
|
||||
if string.find(expr,"%a") then return end;
|
||||
if string.find(expr,"{") then return end;
|
||||
local exprfunc = _G.loadstring("return " .. expr);
|
||||
local res = exprfunc and exprfunc() or say("error in expression: " .. expr);
|
||||
if type(res) == "number" then say(expr .. " = " .. res) end
|
||||
end,
|
||||
function(speaker,msg) -- 14,tp
|
||||
local p1 = minetest.get_player_by_name(speaker);
|
||||
local p2 = minetest.get_player_by_name(string.sub(msg,4));
|
||||
function(speaker,msg) -- 14,tpr
|
||||
tpr[1] = speaker
|
||||
tpr[2] = string.sub(msg,5) or "";
|
||||
minetest.chat_send_player(tpr[2], "#TPR: " .. speaker .. " wants to teleport to you. say \\tpy")
|
||||
end,
|
||||
"to make farm craft composter, put leaves on it and wait until its ready (it has dirt). Then put composter in it and plant your crops on top.", -- 15
|
||||
"put cobble near water and wait.", --16
|
||||
"you get your own island when you finish all quests on level 1", --17
|
||||
function(speaker,msg) -- 18, day
|
||||
minetest.set_timeofday(0.25); say("time set to day")
|
||||
end,
|
||||
function(speaker,msg) -- 19,tpy
|
||||
if tpr[2] ~= speaker then return end;
|
||||
local p1 = minetest.get_player_by_name(tpr[1]);
|
||||
local p2 = minetest.get_player_by_name(tpr[2]);tpr[2] = ""
|
||||
if p1 and p2 then
|
||||
p1:setpos(p2:getpos())
|
||||
end
|
||||
end,
|
||||
}
|
||||
tpr = {"",""} -- used for teleport
|
||||
end
|
||||
|
||||
speaker,msg = self.listen_msg();
|
||||
|
@ -71,7 +92,6 @@ if msg then
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ basic_shop.show_shop_gui = function(name)
|
|||
|
||||
if filter == "" then
|
||||
for i = 1,#data do idxdata[i] = i end
|
||||
guidata.count = #data
|
||||
guidata.count = #idxdata
|
||||
else
|
||||
for i = 1,#data do
|
||||
if string.find(data[i][1],filter) then
|
||||
|
@ -360,6 +360,8 @@ minetest.register_on_player_receive_fields(
|
|||
end
|
||||
end
|
||||
|
||||
if seller == name then shop_item[2] = shop_item[6] end -- this will sell all items if owner buys
|
||||
|
||||
local inv = player:get_inventory();
|
||||
inv:add_item("main",shop_item[1] .. " " .. shop_item[2]);
|
||||
-- remove item from shop
|
||||
|
|
|
@ -81,7 +81,7 @@ local function frame_on_rightclick(pos, node, clicker, itemstack, pointed_thing)
|
|||
end
|
||||
minetest.sound_play(def.sounds.place, {pos = pos})
|
||||
minetest.swap_node(pos, {name = name, param2 = node.param2})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
@ -89,6 +89,8 @@ end
|
|||
|
||||
function frame.register(name)
|
||||
assert(name, "no content passed")
|
||||
assert(string.sub(name, 1, 1) ~= ":", "name must not start with ':'")
|
||||
|
||||
local tiles
|
||||
|
||||
local def = minetest.registered_nodes[name]
|
||||
|
@ -149,9 +151,7 @@ function frame.register(name)
|
|||
end
|
||||
assert(def, name .. " is not a known node or item")
|
||||
|
||||
minetest.register_node("frame:" .. name:gsub(":", "_"), {
|
||||
inventory_image = def.inventory_image or "",
|
||||
wield_image = def.inventory_image or "",
|
||||
minetest.register_node(":frame:" .. name:gsub(":", "_"), {
|
||||
description = "Item Frame with " .. def.description,
|
||||
drawtype = "mesh",
|
||||
mesh = "frame.obj",
|
||||
|
@ -218,6 +218,9 @@ for _, node in pairs({
|
|||
"bucket:bucket_lava",
|
||||
"bucket:bucket_river_water",
|
||||
"bucket:bucket_water",
|
||||
"butterflies:butterfly_white",
|
||||
"butterflies:butterfly_red",
|
||||
"butterflies:butterfly_violet",
|
||||
"carts:brakerail",
|
||||
"carts:cart",
|
||||
"carts:powerrail",
|
||||
|
@ -265,6 +268,10 @@ for _, node in pairs({
|
|||
"default:coral_brown",
|
||||
"default:coral_orange",
|
||||
"default:coral_skeleton",
|
||||
"default:coral_green",
|
||||
"default:coral_pink",
|
||||
"default:coral_cyan",
|
||||
"default:cave_ice",
|
||||
"default:desert_cobble",
|
||||
"default:desert_sand",
|
||||
"default:desert_stone",
|
||||
|
@ -277,14 +284,27 @@ for _, node in pairs({
|
|||
"default:dirt_with_grass",
|
||||
"default:dirt_with_grass_footsteps",
|
||||
"default:dirt_with_snow",
|
||||
"default:dirt_with_rainforest_litter",
|
||||
"default:dirt_with_coniferous_litter",
|
||||
"default:permafrost",
|
||||
"default:permafrost_with_stones",
|
||||
"default:dry_grass_1",
|
||||
"default:dry_grass_2",
|
||||
"default:dry_grass_3",
|
||||
"default:dry_grass_4",
|
||||
"default:dry_grass_5",
|
||||
"default:dry_shrub",
|
||||
"default:emergent_jungle_sapling",
|
||||
"default:flint",
|
||||
"default:furnace",
|
||||
"default:fence_rail_aspen_wood",
|
||||
"default:fence_rail_pine_wood",
|
||||
"default:fence_rail_wood",
|
||||
"default:fence_rail_acacia_wood",
|
||||
"default:fence_rail_junglewood",
|
||||
"default:fern_1",
|
||||
"default:fern_2",
|
||||
"default:fern_3",
|
||||
"default:glass",
|
||||
"default:goldblock",
|
||||
"default:gold_ingot",
|
||||
|
@ -308,6 +328,7 @@ for _, node in pairs({
|
|||
"default:lava_flowing",
|
||||
"default:lava_source",
|
||||
"default:leaves",
|
||||
"default:large_cactus_seedling",
|
||||
"default:mese",
|
||||
"default:mese_crystal",
|
||||
"default:mese_crystal_fragment",
|
||||
|
@ -372,6 +393,10 @@ for _, node in pairs({
|
|||
"default:water_flowing",
|
||||
"default:water_source",
|
||||
"default:wood",
|
||||
"default:marram_grass_1",
|
||||
"default:marram_grass_2",
|
||||
"default:marram_grass_3",
|
||||
"default:sand_with_kelp",
|
||||
"doors:door_glass",
|
||||
"doors:door_obsidian_glass",
|
||||
"doors:door_steel",
|
||||
|
@ -436,11 +461,13 @@ for _, node in pairs({
|
|||
"flowers:tulip",
|
||||
"flowers:viola",
|
||||
"flowers:waterlily",
|
||||
"nyancat:nyancat",
|
||||
"nyancat:nyancat_rainbow",
|
||||
"flowers:chrysanthemum_green",
|
||||
"flowers:tulip_black",
|
||||
"fireflies:firefly",
|
||||
"fireflies:bug_net",
|
||||
"fireflies:firefly_bottle",
|
||||
"screwdriver:screwdriver",
|
||||
"tnt:gunpowder",
|
||||
"tnt:tnt",
|
||||
"vessels:drinking_glass",
|
||||
"vessels:glass_bottle",
|
||||
"vessels:glass_fragments",
|
||||
|
@ -463,10 +490,12 @@ for _, node in pairs({
|
|||
"wool:yellow",
|
||||
"xpanes:bar_flat",
|
||||
"xpanes:pane_flat",
|
||||
"xpanes:obsidian_pane",
|
||||
"binoculars:binoculars",
|
||||
"map:mapping_kit",
|
||||
}) do
|
||||
frame.register(node)
|
||||
end
|
||||
|
||||
-- inception!
|
||||
frame.register("frame:empty")
|
||||
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
name = frame
|
||||
depends = default
|
||||
optional_depends = beds, boats, bucket, carts, doors, dye, farming, fire, flowerpot, flowers, tnt, vessels, wool, xpanes, binoculars, map, fireflies, butterflies
|
||||
description = A stylish item and node frame that causes no lag/server load.
|
|
@ -10,7 +10,7 @@ local database = helloip.db;
|
|||
local modpath = minetest.get_modpath("helloip")
|
||||
|
||||
-- load csv db
|
||||
local f = assert(io.open(modpath .. "\\dbip-country-2017-03.csv", "r"))
|
||||
local f = assert(io.open(modpath .. "/dbip-country-2017-03.csv", "r"))
|
||||
local csv = f:read("*all")
|
||||
f:close()
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ minetest.register_on_leaveplayer(function(player, timed_out)
|
|||
inv:set_stack("oldplayer", 1, ItemStack("oldplayer"));
|
||||
else -- delete player profile
|
||||
|
||||
local filename = worldpath .. "\\players\\" .. name;
|
||||
local filename = worldpath .. "/players/" .. name;
|
||||
|
||||
-- PROBLEM: deleting doesnt always work? seems minetest itself is saving stuff.
|
||||
-- so we wait a little and then delete
|
||||
|
@ -90,7 +90,7 @@ end
|
|||
|
||||
-- delete file if not old player
|
||||
local function remove_non_old_player_file(name)
|
||||
local filename = worldpath.."\\players\\"..name;
|
||||
local filename = worldpath.."/players/"..name;
|
||||
local f=io.open(filename,"r")
|
||||
local s = f:read("*all"); f:close();
|
||||
if string.find(s,"Item oldplayer") then return false else os.remove(filename) return true end
|
||||
|
@ -98,20 +98,20 @@ end
|
|||
|
||||
-- deletes data with no corresponding playerfiles from auth.txt and creates auth_new.txt
|
||||
local function player_file_exists(name)
|
||||
local f=io.open(worldpath.."\\players\\"..name,"r")
|
||||
local f=io.open(worldpath.."/players/"..name,"r")
|
||||
if f~=nil then io.close(f) return true else return false end
|
||||
end
|
||||
|
||||
local function remove_missing_players_from_auth()
|
||||
|
||||
local playerfilelist = minetest.get_dir_list(worldpath.."\\players", false);
|
||||
local playerfilelist = minetest.get_dir_list(worldpath.."/players", false);
|
||||
|
||||
local f = io.open(worldpath.."\\auth.txt", "r");
|
||||
local f = io.open(worldpath.."/auth.txt", "r");
|
||||
if not f then return end
|
||||
local s = f:read("*a");f:close();
|
||||
local p1,p2;
|
||||
|
||||
f = io.open(worldpath.."\\auth_new.txt", "w");
|
||||
f = io.open(worldpath.."/auth_new.txt", "w");
|
||||
if not f then return end
|
||||
|
||||
local playerlist = {};
|
||||
|
@ -159,7 +159,7 @@ local function remove_missing_players_from_auth()
|
|||
end
|
||||
|
||||
local function remove_non_old_player_files()
|
||||
local playerfilelist = minetest.get_dir_list(worldpath.."\\players", false);
|
||||
local playerfilelist = minetest.get_dir_list(worldpath.."/players", false);
|
||||
|
||||
local count = 0;
|
||||
for _,name in ipairs(playerfilelist) do
|
||||
|
|
Loading…
Reference in New Issue