This commit is contained in:
RealBadAngel 2016-01-07 17:50:00 +01:00
commit dd25e5fb2e
40 changed files with 9959 additions and 0 deletions

1
depends.txt Normal file
View File

@ -0,0 +1 @@

314
gate_defs.lua Normal file
View File

@ -0,0 +1,314 @@
function swap_gate_node(pos,name,dir)
local node = core.get_node(pos)
local meta = core.get_meta(pos)
local meta0 = meta:to_table()
node.name = name
node.param1=0
node.param2=dir
core.set_node(pos,node)
meta:from_table(meta0)
end
function getDir (player)
local dir=player:get_look_dir()
if math.abs(dir.x)>math.abs(dir.z) then
if dir.x>0 then return 0 end
return 1
end
if dir.z>0 then return 2 end
return 3
end
function checkNode (pos)
local node=core.get_node(pos)
if node.name == "air" then return 0 end
return 1
end
function addGateNode (gateNodes,i,pos)
gateNodes[i].pos.x=pos.x
gateNodes[i].pos.y=pos.y
gateNodes[i].pos.z=pos.z
end
function placeGate (player,pos)
local player_name=player:get_player_name()
local dir=minetest.dir_to_facedir(player:get_look_dir())
local pos1=pos
local gateNodes={}
for i=1,9,1 do
gateNodes[i]={}
gateNodes[i].pos={}
end
if dir==1 then
addGateNode(gateNodes,1,pos1)
pos1.z=pos1.z+1
addGateNode(gateNodes,2,pos1)
pos1.z=pos1.z-2
addGateNode(gateNodes,3,pos1)
pos1.z=pos1.z+1
pos1.y=pos1.y+1
addGateNode(gateNodes,4,pos1)
pos1.z=pos1.z+1
addGateNode(gateNodes,5,pos1)
pos1.z=pos1.z-2
addGateNode(gateNodes,6,pos1)
pos1.z=pos1.z+1
pos1.y=pos1.y+1
addGateNode(gateNodes,7,pos1)
pos1.z=pos1.z+1
addGateNode(gateNodes,8,pos1)
pos1.z=pos1.z-2
addGateNode(gateNodes,9,pos1)
end
if dir==3 then
addGateNode(gateNodes,1,pos1)
pos1.z=pos1.z+1
addGateNode(gateNodes,3,pos1)
pos1.z=pos1.z-2
addGateNode(gateNodes,2,pos1)
pos1.z=pos1.z+1
pos1.y=pos1.y+1
addGateNode(gateNodes,4,pos1)
pos1.z=pos1.z+1
addGateNode(gateNodes,6,pos1)
pos1.z=pos1.z-2
addGateNode(gateNodes,5,pos1)
pos1.z=pos1.z+1
pos1.y=pos1.y+1
addGateNode(gateNodes,7,pos1)
pos1.z=pos1.z+1
addGateNode(gateNodes,9,pos1)
pos1.z=pos1.z-2
addGateNode(gateNodes,8,pos1)
end
if dir==2 then
addGateNode(gateNodes,1,pos1)
pos1.x=pos1.x+1
addGateNode(gateNodes,2,pos1)
pos1.x=pos1.x-2
addGateNode(gateNodes,3,pos1)
pos1.x=pos1.x+1
pos1.y=pos1.y+1
addGateNode(gateNodes,4,pos1)
pos1.x=pos1.x+1
addGateNode(gateNodes,5,pos1)
pos1.x=pos1.x-2
addGateNode(gateNodes,6,pos1)
pos1.x=pos1.x+1
pos1.y=pos1.y+1
addGateNode(gateNodes,7,pos1)
pos1.x=pos1.x+1
addGateNode(gateNodes,8,pos1)
pos1.x=pos1.x-2
addGateNode(gateNodes,9,pos1)
end
if dir==0 then
addGateNode(gateNodes,1,pos1)
pos1.x=pos1.x+1
addGateNode(gateNodes,3,pos1)
pos1.x=pos1.x-2
addGateNode(gateNodes,2,pos1)
pos1.x=pos1.x+1
pos1.y=pos1.y+1
addGateNode(gateNodes,4,pos1)
pos1.x=pos1.x+1
addGateNode(gateNodes,6,pos1)
pos1.x=pos1.x-2
addGateNode(gateNodes,5,pos1)
pos1.x=pos1.x+1
pos1.y=pos1.y+1
addGateNode(gateNodes,7,pos1)
pos1.x=pos1.x+1
addGateNode(gateNodes,9,pos1)
pos1.x=pos1.x-2
addGateNode(gateNodes,8,pos1)
end
for i=1,9,1 do
local node=core.get_node(gateNodes[i].pos)
if node.name ~= "air" then return false end
end
core.set_node(gateNodes[1].pos,{name="stargate:gatenode_off", param1=0, param2=dir})
local meta = core.get_meta(gateNodes[1].pos)
meta:set_string("infotext", "Stargate\nOwned by: "..player_name)
meta:set_string("gateNodes",minetest.serialize(gateNodes))
meta:set_int("gateActive",0)
meta:set_string("owner",player_name)
meta:set_string("dont_destroy","false")
stargate.registerGate(player_name,gateNodes[1].pos,dir)
return true
end
function removeGate (pos)
local meta = core.get_meta(pos)
if meta:get_string("dont_destroy") == "true" then return end
local player_name=meta:get_string("owner")
local gateNodes=minetest.deserialize(meta:get_string("gateNodes"))
if gateNodes ~= nil then
core.remove_node(gateNodes[1].pos)
stargate.unregisterGate(player_name,gateNodes[1].pos)
end
end
function activateGate (pos)
local node = core.get_node(pos)
local dir=node.param2
local meta = core.get_meta(pos)
local gateNodes=minetest.deserialize(meta:get_string("gateNodes"))
meta:set_int("gateActive",1)
meta:set_string("dont_destroy","true")
minetest.sound_play("gateOpen", {pos = pos, gain = 1.0,loop = false, max_hear_distance = 72,})
swap_gate_node(gateNodes[1].pos,"stargate:gatenode_on",dir)
meta:set_string("dont_destroy","false")
end
function deactivateGate (pos)
local node = core.get_node(pos)
local dir=node.param2
local meta = core.get_meta(pos)
local gateNodes=minetest.deserialize(meta:get_string("gateNodes"))
meta:set_int("gateActive",0)
meta:set_string("dont_destroy","true")
minetest.sound_play("gateClose", {pos = pos, gain = 1.0,loop = false, max_hear_distance = 72,})
swap_gate_node(gateNodes[1].pos,"stargate:gatenode_off",dir)
meta:set_string("dont_destroy","false")
end
gateCanDig = function(pos,player)
local player_name = player:get_player_name()
local meta = core.get_meta(pos)
if meta:get_string("dont_destroy") == "true" then return end
local owner=meta:get_string("owner")
if player_name==owner then return true
else return false end
end
sg_collision_box = {
type = "fixed",
fixed={{-1.5,-0.5,-3/20,1.5,2.5,3/20},},
}
sg_selection_box = {
type = "fixed",
fixed={{-1.5,-0.5,-3/20,1.5,2.5,3/20},},
}
sg_groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}
sg_groups1 = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
minetest.register_node("stargate:gatenode_on",{
tiles = {
{name = "gray.png"},
{
name = "puddle_animated2.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
{name = "0003.png"},
{name = "0002.png"},
{name = "0001.png"},
{name = "null.png"},
},
drawtype = "mesh",
mesh = "stargate.obj",
visual_scale = 3.0,
groups = sg_groups,
drop="stargate:gatenode_off",
paramtype2 = "facedir",
paramtype = "light",
light_source = 10,
selection_box = sg_selection_box,
collision_box = sg_collision_box,
can_dig = gateCanDig,
on_destruct = function (pos)
removeGate(pos)
end,
on_rightclick=stargate.gateFormspecHandler,
})
minetest.register_node("stargate:gatenode_off",{
description = "Stargate",
inventory_image = "stargate.png",
wield_image = "stargate.png",
tiles = {
{name = "gray.png"},
{name = "null.png"},
{name = "0003.png"},
{name = "0002.png"},
{name = "0001.png"},
{name = "null.png"},
},
groups = sg_groups1,
paramtype2 = "facedir",
paramtype = "light",
drawtype = "mesh",
mesh = "stargate.obj",
visual_scale = 3.0,
selection_box = sg_selection_box,
collision_box = sg_collision_box,
can_dig = gateCanDig,
on_destruct = function (pos)
removeGate(pos)
end,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
if placeGate(placer,pos)==true then
itemstack:take_item(1)
return itemstack
else
return
end
end,
on_rightclick=stargate.gateFormspecHandler,
})
minetest.register_abm({
nodenames = {"stargate:gatenode_on"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = core.get_meta(pos)
for _,object in ipairs(core.get_objects_inside_radius(pos, 1)) do
if object:is_player() then
local player_name = object:get_player_name()
local owner=meta:get_string("owner")
local gate=stargate.findGate (pos)
if gate==nil then print("Gate is not registered!") return end
local pos1={}
pos1.x=gate["destination"].x
pos1.y=gate["destination"].y
pos1.z=gate["destination"].z
local dest_gate=stargate.findGate (pos1)
if dest_gate==nil then
gate["destination"]=nil
deactivateGate(pos)
stargate.save_data(owner)
return
end
if player_name~=owner and gate["type"]=="private" then return end
local dir1=gate["destination_dir"]
local dest_angle
if dir1 == 0 then
pos1.z = pos1.z-2
dest_angle = 180
elseif dir1 == 1 then
pos1.x = pos1.x-2
dest_angle = 90
elseif dir1 == 2 then
pos1.z=pos1.z+2
dest_angle = 0
elseif dir1 == 3 then
pos1.x = pos1.x+2
dest_angle = -90
end
object:moveto(pos1,false)
object:set_look_yaw(math.rad(dest_angle))
core.sound_play("enterEventHorizon", {pos = pos, gain = 1.0,loop = false, max_hear_distance = 72,})
end
end
end
})

9
init.lua Normal file
View File

@ -0,0 +1,9 @@
-- Minetest 0.4.5 : stargate
--data tables definitions
stargate={}
stargate_network = {}
modpath=minetest.get_modpath("stargate")
dofile(modpath.."/stargate_gui.lua")
dofile(modpath.."/gate_defs.lua")

9223
models/stargate.obj Normal file

File diff suppressed because it is too large Load Diff

BIN
sounds/click.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
sounds/gateClose.ogg Normal file

Binary file not shown.

BIN
sounds/gateOpen.ogg Normal file

Binary file not shown.

BIN
sounds/gateSpin.ogg Normal file

Binary file not shown.

BIN
sounds/gate_activate.ogg Normal file

Binary file not shown.

BIN
sounds/irisClose.ogg Normal file

Binary file not shown.

BIN
sounds/irisOpen.ogg Normal file

Binary file not shown.

BIN
sounds/paperflip2.ogg Normal file

Binary file not shown.

412
stargate_gui.lua Normal file
View File

@ -0,0 +1,412 @@
-- default GUI page
stargate.default_page = "main"
stargate_network["players"]={}
stargate.current_page={}
local function table_empty(tab)
for key in pairs(tab) do return false end
return true
end
stargate.save_data = function(table_pointer)
if table_empty(stargate_network[table_pointer]) then return end
local data = minetest.serialize( stargate_network[table_pointer] )
local path = minetest.get_worldpath().."/stargate_"..table_pointer..".data"
local file = io.open( path, "w" )
if( file ) then
file:write( data )
file:close()
return true
else return nil
end
end
stargate.restore_data = function(table_pointer)
local path = minetest.get_worldpath().."/stargate_"..table_pointer..".data"
local file = io.open( path, "r" )
if( file ) then
local data = file:read("*all")
stargate_network[table_pointer] = minetest.deserialize( data )
file:close()
if table_empty(stargate_network[table_pointer]) then os.remove(path) end
return true
else return nil
end
end
-- load Stargates network data
if stargate.restore_data("registered_players") ~= nil then
for __,tab in ipairs(stargate_network["registered_players"]) do
if stargate.restore_data(tab["player_name"]) == nil then
--print ("[stargate] Error loading data!")
stargate_network[tab["player_name"]] = {}
end
end
else
print ("[stargate] Error loading data! Creating new file.")
stargate_network["registered_players"]={}
stargate.save_data("registered_players")
end
-- register_on_joinplayer
minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
local registered=nil
for __,tab in ipairs(stargate_network["registered_players"]) do
if tab["player_name"] == player_name then registered = true break end
end
if registered == nil then
local new={}
new["player_name"]=player_name
table.insert(stargate_network["registered_players"],new)
stargate_network[player_name]={}
stargate.save_data("registered_players")
stargate.save_data(player_name)
end
stargate_network["players"][player_name]={}
stargate_network["players"][player_name]["formspec"]=""
stargate_network["players"][player_name]["current_page"]=stargate.default_page
stargate_network["players"][player_name]["own_gates"]={}
stargate_network["players"][player_name]["own_gates_count"]=0
stargate_network["players"][player_name]["public_gates"]={}
stargate_network["players"][player_name]["public_gates_count"]=0
stargate_network["players"][player_name]["current_index"]=0
stargate_network["players"][player_name]["temp_gate"]={}
end)
stargate.registerGate = function(player_name,pos,dir)
if stargate_network[player_name]==nil then
stargate_network[player_name]={}
end
local new_gate ={}
new_gate["pos"]=pos
new_gate["type"]="private"
new_gate["description"]=""
new_gate["dir"]=dir
new_gate["owner"]=player_name
table.insert(stargate_network[player_name],new_gate)
if stargate.save_data(player_name)==nil then
print ("[stargate] Couldnt update network file!")
end
end
stargate.unregisterGate = function(player_name,pos)
for __,gates in ipairs(stargate_network[player_name]) do
if gates["pos"].x==pos.x and gates["pos"].y==pos.y and gates["pos"].z==pos.z then
table.remove(stargate_network[player_name], __)
break
end
end
if stargate.save_data(player_name)==nil then
print ("[stargate] Couldnt update network file!")
end
end
stargate.findGate = function(pos)
for __,tab in ipairs(stargate_network["registered_players"]) do
local player_name=tab["player_name"]
if type(stargate_network[player_name])=="table" then
for __,gates in ipairs(stargate_network[player_name]) do
if gates then
if gates["pos"].x==pos.x and gates["pos"].y==pos.y and gates["pos"].z==pos.z then
return gates
end
end
end
end
end
return nil
end
--show formspec to player
stargate.gateFormspecHandler = function(pos, node, clicker, itemstack)
local player_name = clicker:get_player_name()
local meta = minetest.env:get_meta(pos)
local owner=meta:get_string("owner")
if player_name~=owner then return end
local current_gate=nil
stargate_network["players"][player_name]["own_gates"]={}
stargate_network["players"][player_name]["public_gates"]={}
local own_gates_count=0
local public_gates_count=0
for __,gates in ipairs(stargate_network[player_name]) do
if gates["pos"].x==pos.x and gates["pos"].y==pos.y and gates["pos"].z==pos.z then
current_gate=gates
else
own_gates_count=own_gates_count+1
table.insert(stargate_network["players"][player_name]["own_gates"],gates)
end
end
stargate_network["players"][player_name]["own_gates_count"]=own_gates_count
-- get all public gates
for __,tab in ipairs(stargate_network["registered_players"]) do
local temp=tab["player_name"]
if type(stargate_network[temp])=="table" and temp~=player_name then
for __,gates in ipairs(stargate_network[temp]) do
if gates["type"]=="public" then
public_gates_count=public_gates_count+1
table.insert(stargate_network["players"][player_name]["public_gates"],gates)
end
end
end
end
print(dump(stargate_network["players"][player_name]["public_gates"]))
if current_gate==nil then
print ("Gate not registered in network! Please remove it and place once again.")
return nil
end
stargate_network["players"][player_name]["current_index"]=0
stargate_network["players"][player_name]["temp_gate"]["type"]=current_gate["type"]
stargate_network["players"][player_name]["temp_gate"]["description"]=current_gate["description"]
stargate_network["players"][player_name]["temp_gate"]["pos"]={}
stargate_network["players"][player_name]["temp_gate"]["pos"].x=current_gate["pos"].x
stargate_network["players"][player_name]["temp_gate"]["pos"].y=current_gate["pos"].y
stargate_network["players"][player_name]["temp_gate"]["pos"].z=current_gate["pos"].z
if current_gate["destination"] then
stargate_network["players"][player_name]["temp_gate"]["destination_description"]=current_gate["destination_description"]
stargate_network["players"][player_name]["temp_gate"]["destination_dir"]=current_gate["destination_dir"]
stargate_network["players"][player_name]["temp_gate"]["destination"]={}
stargate_network["players"][player_name]["temp_gate"]["destination"].x=current_gate["destination"].x
stargate_network["players"][player_name]["temp_gate"]["destination"].y=current_gate["destination"].y
stargate_network["players"][player_name]["temp_gate"]["destination"].z=current_gate["destination"].z
else
stargate_network["players"][player_name]["temp_gate"]["destination"]=nil
end
stargate_network["players"][player_name]["current_gate"]=current_gate
stargate_network["players"][player_name]["dest_type"]="own"
local formspec=stargate.get_formspec(player_name,"main")
stargate_network["players"][player_name]["formspec"]=formspec
if formspec ~=nil then minetest.show_formspec(player_name, "stargate_main", formspec) end
end
-- get_formspec
stargate.get_formspec = function(player_name,page)
if player_name==nil then return nil end
stargate_network["players"][player_name]["current_page"]=page
local temp_gate=stargate_network["players"][player_name]["temp_gate"]
local formspec = "size[14,10]"
--background
formspec = formspec .."background[-0.19,-0.2;14.38,10.55;ui_form_bg.png]"
formspec = formspec.."label[0,0.0;Stargate DHD]"
formspec = formspec.."label[0,.5;Position: ("..temp_gate["pos"].x..","..temp_gate["pos"].y..","..temp_gate["pos"].z..")]"
formspec = formspec.."image_button[3.5,.6;.6,.6;toggle_icon.png;toggle_type;]"
formspec = formspec.."label[4,.5;Type: "..temp_gate["type"].."]"
formspec = formspec.."image_button[6.5,.6;.6,.6;pencil_icon.png;edit_desc;]"
formspec = formspec.."label[0,1.1;Destination: ]"
if temp_gate["destination"] then
formspec = formspec.."label[2.5,1.1;("..temp_gate["destination"].x..","
..temp_gate["destination"].y..","
..temp_gate["destination"].z..") "
..temp_gate["destination_description"].."]"
formspec = formspec.."image_button[2,1.2;.6,.6;cancel_icon.png;remove_dest;]"
else
formspec = formspec.."label[2,1.1;Not connected]"
end
formspec = formspec.."label[0,1.7;Aviable destinations:]"
formspec = formspec.."image_button[3.5,1.8;.6,.6;toggle_icon.png;toggle_dest_type;]"
formspec = formspec.."label[4,1.7;Filter: "..stargate_network["players"][player_name]["dest_type"].."]"
if page=="main" then
formspec = formspec.."image_button[6.5,.6;.6,.6;pencil_icon.png;edit_desc;]"
formspec = formspec.."label[7,.5;Description: "..temp_gate["description"].."]"
end
if page=="edit_desc" then
formspec = formspec.."image_button[6.5,.6;.6,.6;ok_icon.png;save_desc;]"
formspec = formspec.."field[7.3,.7;5,1;desc_box;Edit gate description:;"..temp_gate["description"].."]"
end
local list_index=stargate_network["players"][player_name]["current_index"]
local page=math.floor(list_index / 24 + 1)
local pagemax
if stargate_network["players"][player_name]["dest_type"] == "own" then
pagemax = math.floor((stargate_network["players"][player_name]["own_gates_count"] / 24) + 1)
local x,y
for y=0,7,1 do
for x=0,2,1 do
local gate_temp=stargate_network["players"][player_name]["own_gates"][list_index+1]
if gate_temp then
formspec = formspec.."image_button["..(x*4.5)..","..(2.5+y*.87)..";.6,.6;stargate_icon.png;list_button"..list_index..";]"
formspec = formspec.."label["..(x*4.5+.5)..","..(2.3+y*.87)..";("..gate_temp["pos"].x..","..gate_temp["pos"].y..","..gate_temp["pos"].z..") "..gate_temp["type"].."]"
formspec = formspec.."label["..(x*4.5+.5)..","..(2.7+y*.87)..";"..gate_temp["description"].."]"
end
list_index=list_index+1
end
end
else
pagemax = math.floor((stargate_network["players"][player_name]["public_gates_count"] / 24) + 1)
local x,y
for y=0,7,1 do
for x=0,2,1 do
local gate_temp=stargate_network["players"][player_name]["public_gates"][list_index+1]
if gate_temp then
formspec = formspec.."image_button["..(x*4.5)..","..(2.5+y*.87)..";.6,.6;stargate_icon.png;list_button"..list_index..";]"
formspec = formspec.."label["..(x*4.5+.5)..","..(2.3+y*.87)..";("..gate_temp["pos"].x..","..gate_temp["pos"].y..","..gate_temp["pos"].z..") "..gate_temp["owner"].."]"
formspec = formspec.."label["..(x*4.5+.5)..","..(2.7+y*.87)..";"..gate_temp["description"].."]"
end
list_index=list_index+1
end
end
end
formspec=formspec.."label[7.5,1.7;Page: "..page.." of "..pagemax.."]"
formspec = formspec.."image_button[6.5,1.8;.6,.6;left_icon.png;page_left;]"
formspec = formspec.."image_button[6.9,1.8;.6,.6;right_icon.png;page_right;]"
formspec = formspec.."image_button_exit[6.1,9.3;.8,.8;ok_icon.png;save_changes;]"
formspec = formspec.."image_button_exit[7.1,9.3;.8,.8;cancel_icon.png;discard_changes;]"
return formspec
end
-- register_on_player_receive_fields
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not formname == "stargate_main" then return "" end
local player_name = player:get_player_name()
local temp_gate=stargate_network["players"][player_name]["temp_gate"]
local current_gate=stargate_network["players"][player_name]["current_gate"]
local formspec
if fields.toggle_type then
if temp_gate["type"] == "private" then
temp_gate["type"] = "public"
else temp_gate["type"] = "private" end
stargate_network["players"][player_name]["current_index"]=0
formspec= stargate.get_formspec(player_name,"main")
stargate_network["players"][player_name]["formspec"] = formspec
minetest.show_formspec(player_name, "stargate_main", formspec)
minetest.sound_play("click", {to_player=player_name, gain = 0.5})
return
end
if fields.toggle_dest_type then
if stargate_network["players"][player_name]["dest_type"] == "own" then
stargate_network["players"][player_name]["dest_type"] = "all public"
else stargate_network["players"][player_name]["dest_type"] = "own" end
stargate_network["players"][player_name]["current_index"] = 0
formspec = stargate.get_formspec(player_name,"main")
stargate_network["players"][player_name]["formspec"] = formspec
minetest.show_formspec(player_name, "stargate_main", formspec)
minetest.sound_play("click", {to_player=player_name, gain = 0.5})
return
end
if fields.edit_desc then
formspec= stargate.get_formspec(player_name,"edit_desc")
stargate_network["players"][player_name]["formspec"]=formspec
minetest.show_formspec(player_name, "stargate_main", formspec)
minetest.sound_play("click", {to_player=player_name, gain = 0.5})
return
end
if fields.save_desc then
temp_gate["description"]=fields.desc_box
formspec= stargate.get_formspec(player_name,"main")
stargate_network["players"][player_name]["formspec"]=formspec
minetest.show_formspec(player_name, "stargate_main", formspec)
minetest.sound_play("click", {to_player=player_name, gain = 0.5})
return
end
-- page controls
local start=math.floor(stargate_network["players"][player_name]["current_index"]/24 +1 )
local start_i=start
local pagemax = math.floor(((stargate_network["players"][player_name]["own_gates_count"]-1) / 24) + 1)
if fields.page_left then
minetest.sound_play("paperflip2", {to_player=player_name, gain = 1.0})
start_i = start_i - 1
if start_i < 1 then start_i = 1 end
if not (start_i == start) then
stargate_network["players"][player_name]["current_index"] = (start_i-1)*24
formspec = stargate.get_formspec(player_name,"main")
stargate_network["players"][player_name]["formspec"] = formspec
minetest.show_formspec(player_name, "stargate_main", formspec)
end
end
if fields.page_right then
minetest.sound_play("paperflip2", {to_player=player_name, gain = 1.0})
start_i = start_i + 1
if start_i > pagemax then start_i = pagemax end
if not (start_i == start) then
stargate_network["players"][player_name]["current_index"] = (start_i-1)*24
formspec = stargate.get_formspec(player_name,"main")
stargate_network["players"][player_name]["formspec"] = formspec
minetest.show_formspec(player_name, "stargate_main", formspec)
end
end
if fields.remove_dest then
minetest.sound_play("click", {to_player=player_name, gain = 0.5})
temp_gate["destination"]=nil
temp_gate["destination_description"]=nil
formspec = stargate.get_formspec(player_name,"main")
stargate_network["players"][player_name]["formspec"] = formspec
minetest.show_formspec(player_name, "stargate_main", formspec)
end
if fields.save_changes then
minetest.sound_play("click", {to_player=player_name, gain = 0.5})
local meta = minetest.env:get_meta(temp_gate["pos"])
local infotext=""
current_gate["type"]=temp_gate["type"]
current_gate["description"]=temp_gate["description"]
current_gate["pos"]={}
current_gate["pos"].x=temp_gate["pos"].x
current_gate["pos"].y=temp_gate["pos"].y
current_gate["pos"].z=temp_gate["pos"].z
current_gate["dest"]=temp_gate["dest"]
if temp_gate["destination"] then
current_gate["destination"]={}
current_gate["destination"].x=temp_gate["destination"].x
current_gate["destination"].y=temp_gate["destination"].y
current_gate["destination"].z=temp_gate["destination"].z
current_gate["destination_description"]=temp_gate["destination_description"]
current_gate["destination_dir"]=temp_gate["destination_dir"]
else
current_gate["destination"]=nil
end
if current_gate["destination"] then
activateGate (current_gate["pos"])
else
deactivateGate (current_gate["pos"])
end
if current_gate["type"]=="private" then infotext="Private" else infotext="Public" end
infotext=infotext.." Gate: "..current_gate["description"].."\n"
infotext=infotext.."Owned by "..player_name.."\n"
if current_gate["destination"] then
infotext=infotext.."Destination: ("..current_gate["destination"].x..","..current_gate["destination"].y..","..current_gate["destination"].z..") "
infotext=infotext..current_gate["destination_description"]
end
meta:set_string("infotext",infotext)
if stargate.save_data(player_name)==nil then
print ("[stargate] Couldnt update network file!")
end
end
if fields.discard_changes then
minetest.sound_play("click", {to_player=player_name, gain = 0.5})
end
local list_index=stargate_network["players"][player_name]["current_index"]
local i
for i=0,23,1 do
local button="list_button"..i+list_index
if fields[button] then
minetest.sound_play("click", {to_player=player_name, gain = 1.0})
local gate=stargate_network["players"][player_name]["temp_gate"]
local dest_gate
if stargate_network["players"][player_name]["dest_type"] == "own" then
dest_gate=stargate_network["players"][player_name]["own_gates"][list_index+i+1]
else
dest_gate=stargate_network["players"][player_name]["public_gates"][list_index+i+1]
end
gate["destination"]={}
gate["destination"].x=dest_gate["pos"].x
gate["destination"].y=dest_gate["pos"].y
gate["destination"].z=dest_gate["pos"].z
gate["destination_description"]=dest_gate["description"]
gate["destination_dir"]=dest_gate["dir"]
formspec = stargate.get_formspec(player_name,"main")
stargate_network["players"][player_name]["formspec"] = formspec
minetest.show_formspec(player_name, "stargate_main", formspec)
end
end
end)

BIN
textures/0001.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
textures/0001_normal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
textures/0002.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
textures/0002_normal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

BIN
textures/0003.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 KiB

BIN
textures/0003_normal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 KiB

BIN
textures/cancel_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
textures/dialog-ok.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
textures/dot_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

BIN
textures/gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

BIN
textures/left_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
textures/null.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
textures/ok_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
textures/ok_ikon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
textures/pencil_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
textures/right_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
textures/save_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
textures/st1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

BIN
textures/st2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

BIN
textures/st3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

BIN
textures/stargate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
textures/stargate_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
textures/toggle_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

BIN
textures/unnamed.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB