Added SQLiteExact script

This commit is contained in:
LeMagnesium 2015-07-09 15:32:54 +02:00
parent 322926fc5b
commit 8261c92e01
48 changed files with 164 additions and 15 deletions

View File

@ -146,7 +146,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
return itemstack
end
-- Upside down slabs
if p0.y-1 == p1.y then
-- Turn into full block if pointing at a existing slab
@ -275,7 +275,7 @@ stairs.register_stair_and_slab("sandstone", "default:sandstone",
"Sandstone Stair",
"Sandstone Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("sandstonebrick", "default:sandstonebrick",
{crumbly=2,cracky=2},
{"default_sandstone_brick.png"},

0
minetestforfun_game/mods/stairs/models/stairs.obj Normal file → Executable file
View File

0
mods/arrow_signs/models/arrow_sign.obj Normal file → Executable file
View File

0
mods/warps/LICENSE Normal file → Executable file
View File

0
mods/warps/README Normal file → Executable file
View File

0
mods/warps/depends.txt Normal file → Executable file
View File

0
mods/warps/description.txt Normal file → Executable file
View File

0
mods/warps/init.lua Normal file → Executable file
View File

0
mods/warps/models/warps_warpstone.obj Normal file → Executable file
View File

0
mods/warps/sounds/LICENSE Normal file → Executable file
View File

0
mods/warps/sounds/warps_plop.ogg Normal file → Executable file
View File

0
mods/warps/sounds/warps_woosh.ogg Normal file → Executable file
View File

0
mods/warps/textures/warps_warpstone.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
mods/warps/textures/warps_warpstone_guide.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 199 B

0
mods/watershed/README.txt Normal file → Executable file
View File

0
mods/watershed/depends.txt Normal file → Executable file
View File

0
mods/watershed/functions.lua Normal file → Executable file
View File

26
mods/watershed/init.lua Normal file → Executable file
View File

@ -229,7 +229,7 @@ local nobj_cave1 = nil
local nobj_cave2 = nil
local nobj_cave3 = nil
local nobj_cave4 = nil
local nobj_mid = nil
local nobj_base = nil
local nobj_xlscale = nil
@ -271,7 +271,7 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
local c_clay = minetest.get_content_id("default:clay")
local c_grass5 = minetest.get_content_id("default:grass_5")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_wsfreshwater = minetest.get_content_id("watershed:freshwater")
local c_wsmixwater = minetest.get_content_id("watershed:mixwater")
local c_wsstone = minetest.get_content_id("watershed:stone")
@ -301,7 +301,7 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
nobj_cave2 = nobj_cave2 or minetest.get_perlin_map(np.cave2, chulensxyz)
nobj_cave3 = nobj_cave3 or minetest.get_perlin_map(np.cave3, chulensxyz)
nobj_cave4 = nobj_cave4 or minetest.get_perlin_map(np.cave4, chulensxyz)
nobj_mid = nobj_mid or minetest.get_perlin_map(np.mid, chulensxz)
nobj_base = nobj_base or minetest.get_perlin_map(np.base, chulensxz)
nobj_xlscale = nobj_xlscale or minetest.get_perlin_map(np.xlscale, chulensxz)
@ -317,7 +317,7 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
local nvals_cave2 = nobj_cave2:get3dMap_flat(minposxyz)
local nvals_cave3 = nobj_cave3:get3dMap_flat(minposxyz)
local nvals_cave4 = nobj_cave4:get3dMap_flat(minposxyz)
local nvals_mid = nobj_mid:get2dMap_flat(minposxz)
local nvals_base = nobj_base:get2dMap_flat(minposxz)
local nvals_xlscale = nobj_xlscale:get2dMap_flat(minposxz)
@ -348,7 +348,7 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
local n_cave2 = nvals_cave2[nixyz]
local n_cave3 = nvals_cave3[nixyz]
local n_cave4 = nvals_cave4[nixyz]
local n_absmid = math.abs(nvals_mid[nixz])
local n_absbase = math.abs(nvals_base[nixz])
local n_xlscale = nvals_xlscale[nixz]
@ -373,13 +373,13 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
local tlava = TLAVA * (1 - n_magma ^ 4 * terblen ^ 16 * 0.6) -- lava threshold
local ysand = YSAV + n_fissure * SAMP + math.random() * 2 -- sandline
local bergdep = math.abs(n_seam) * BERGDEP -- iceberg depth
local nofis = false -- set fissure bool
if math.abs(n_fissure) >= TFIS
if math.abs(n_fissure) >= TFIS
and n_cave1 ^ 2 + n_cave2 ^ 2 + n_cave3 ^ 2 + n_cave4 ^ 2 >= 0.07 then -- from Valleys Mapgen
nofis = true
end
local biome = false -- select biome for node
if n_temp < LOTET + (math.random() - 0.5) * BLEND then
if n_humid < LOHUT + (math.random() - 0.5) * BLEND then
@ -406,7 +406,7 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
biome = 5 -- grassland
end
end
-- overgeneration and in-chunk generation
if y == y0 - 1 then -- node layer below chunk, initialise tables
under[si] = 0
@ -626,7 +626,7 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
end
end
elseif under[si] == 10 then -- dunes
if math.random(flora.DUGCHA) == 2 and y > YSAV
if math.random(flora.DUGCHA) == 2 and y > YSAV
and biome >= 4 then
data[vi] = c_wsgoldengrass
end
@ -727,7 +727,7 @@ minetest.register_chatcommand("regen",{
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
local data = vm:get_data()
watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
vm:set_data(data)
minetest.generate_ores(vm, minp, maxp)
@ -758,7 +758,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local x0 = minp.x
local y0 = minp.y
local z0 = minp.z
print ("[watershed] generate mapchunk minp ("..x0.." "..y0.." "..z0..")")
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
@ -774,7 +774,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
vm:calc_lighting()
vm:write_to_map(data)
vm:update_liquids()
local chugent = math.ceil((os.clock() - t1) * 1000)
print ("[watershed] "..chugent.." ms")
end)

0
mods/watershed/license.txt Normal file → Executable file
View File

0
mods/watershed/nodes.lua Normal file → Executable file
View File

0
mods/watershed/textures/watershed_acacialeaf.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 340 B

0
mods/watershed/textures/watershed_acacialing.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 359 B

0
mods/watershed/textures/watershed_acaciatree.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 682 B

0
mods/watershed/textures/watershed_acaciatreetop.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 731 B

After

Width:  |  Height:  |  Size: 731 B

0
mods/watershed/textures/watershed_acaciawood.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

0
mods/watershed/textures/watershed_bucketfreshwater.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 330 B

After

Width:  |  Height:  |  Size: 330 B

0
mods/watershed/textures/watershed_cloud.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 136 B

0
mods/watershed/textures/watershed_drygrass.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 771 B

After

Width:  |  Height:  |  Size: 771 B

0
mods/watershed/textures/watershed_freshice.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 780 B

After

Width:  |  Height:  |  Size: 780 B

0
mods/watershed/textures/watershed_freshwater.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 713 B

0
mods/watershed/textures/watershed_freshwateranim.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

0
mods/watershed/textures/watershed_goldengrass.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 683 B

0
mods/watershed/textures/watershed_icydirt.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 746 B

After

Width:  |  Height:  |  Size: 746 B

0
mods/watershed/textures/watershed_light.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

0
mods/watershed/textures/watershed_luxcrystal.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

0
mods/watershed/textures/watershed_luxore.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 311 B

After

Width:  |  Height:  |  Size: 311 B

0
mods/watershed/textures/watershed_mixwater.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 716 B

0
mods/watershed/textures/watershed_mixwateranim.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

0
mods/watershed/textures/watershed_mixwaterflowanim.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

0
mods/watershed/textures/watershed_needles.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 860 B

After

Width:  |  Height:  |  Size: 860 B

0
mods/watershed/textures/watershed_permafrost.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 897 B

After

Width:  |  Height:  |  Size: 897 B

0
mods/watershed/textures/watershed_pineling.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

0
mods/watershed/textures/watershed_pinetree.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 693 B

0
mods/watershed/textures/watershed_pinetreetop.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 802 B

After

Width:  |  Height:  |  Size: 802 B

0
mods/watershed/textures/watershed_pinewood.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

0
mods/watershed/textures/watershed_redcobble.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 686 B

After

Width:  |  Height:  |  Size: 686 B

View File

@ -0,0 +1,149 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os, sqlite3
home = os.environ.get("HOME")
db = "%s/rollback/rollback.sqlite" % (home)
def select_all_nodes(stamp):
try:
conn = sqlite3.connect(db)
conn.text_factory = str
cur = conn.cursor()
except sqlite3.OperationalError as err:
print(err)
sys.exit(1)
try:
cur.execute("SELECT * FROM action WHERE timestamp >=:stamp", {"stamp":stamp})
except sqlite3.OperationalError as err:
print(err)
sys.exit(1)
else:
result = cur.fetchall()
finally:
cur.close()
conn.close()
return(result)
def select_nodes_id():
try:
conn = sqlite3.connect(db)
cur = conn.cursor()
except sqlite3.OperationalError as err:
print(err)
sys.exit(1)
try:
cur.execute("SELECT * FROM node")
except sqlite3.OperationalError as err:
print(err)
sys.exit(1)
else:
result = cur.fetchall()
finally:
cur.close()
conn.close()
return(result)
def get_node(nodeid):
if not nodeid:
return None
try:
return select_nodes_id()[nodeid-1][1]
except IndexError:
print(nodeid)
def select_player_id(table, player_name):
try:
conn = sqlite3.connect(db)
cur = conn.cursor()
except:
print("Problème avec la base de données")
return("")
try:
cur.execute("SELECT id FROM " + str(table) + " WHERE name=:name", {"name": "player:%s" % player_name})
except sqlite3.OperationalError as err:
print(err)
return ("")
else:
result = cur.fetchall()
finally:
cur.close()
conn.close()
return(result)
def get_player(id):
try:
conn = sqlite3.connect(db)
cur = conn.cursor()
except:
print("problème avec la base de données")
return ("")
try:
cur.execute("SELECT name from actor WHERE id=%d" % id)
except sqlite3.OperationalError as err:
print(err)
return ("")
else:
result = cur.fetchall()[0][0]
finally:
cur.close()
conn.close()
return result[len("player:"):]
def ston(a):
if a:
return str(a)
else:
return a
def write_list(nodes):
try:
name = "database-output.txt"
f = open(name, "w")
except Exception as err:
print(err)
sys.exit(1)
for node in nodes:
f.write("[")
f.write("id=%d" % node[0])
f.write(";actor=%s" % get_player(node[1]))
f.write(";type=%d" % node[3])
f.write(";list=%s" % ston(node[4]))
f.write(",index=%s" % ston(node[5]))
f.write(",add=%s" % ston(node[6]))
f.write(",stacknode=%s" % get_node(node[7]))
f.write(",stackquantity=%s" % ston(node[8]))
f.write(",nodemeta=%s" % ston(node[9]))
f.write(";x=%s,y=%s,z=%s" % (node[10], node[11], node[12]))
f.write(";oldnode=%s" % get_node(node[13]))
f.write(",oldparam1=%s" % node[14])
f.write(",oldparam2=%s" % ston(node[15]))
f.write(",oldmeta=%s" % ston(node[16]))
f.write(":newnode=%s" % get_node(node[17]))
f.write(",newparam1=%s" % ston(node[18]))
f.write(",newparam2=%s" % ston(node[19]))
f.write(",newmeta=%s" % ston(node[20]))
f.write("]\n")
f.close()
if __name__ == '__main__':
#select all nodes player as set i where time >= time
all_nodes = select_all_nodes(0) #1418613979)
# write in file
# for x in range(0,len(all_nodes)):
# print(all_nodes[x])
write_list(all_nodes)