Skip to content
Snippets Groups Projects
Commit eeba6bd3 authored by dg's avatar dg
Browse files

Zigur arena and Derth arena now allows to collect loot before leaving

git-svn-id: http://svn.net-core.org/repos/t-engine4@2999 51575b47-30f0-44d4-a5cc-537603b46e54
parent f09aaaea
No related branches found
No related tags found
No related merge requests found
......@@ -320,6 +320,7 @@ end
-- @param src the url to load the list from, if nil it will default to te4.org
-- @return a linda object (see lua lanes documentation) which should be waited upon like this <code>local mylist = l:receive("moduleslist")</code>. Also returns a thread handle
function _M:loadRemoteList(src)
--[[
local l = lanes.linda()
function list_handler(src)
......@@ -362,4 +363,8 @@ function _M:loadRemoteList(src)
local h = lanes.gen("*", list_handler)(src or "http://te4.org/modules.lualist")
return l, h
]]
local DownloadDialog = require "engine.dialogs.DownloadDialog"
local d = DownloadDialog.new("Fetching updates", "http://te4.org/dl/t-engine/t-engine4-windows-1.0.0beta21.zip")
d:startDownload()
end
......@@ -18,9 +18,11 @@
-- darkgod@te4.org
require "engine.class"
require "engine.Dialog"
local ispatch = require "dispatch"
local Dialog = require "engine.ui.Dialog"
local Textzone = require "engine.ui.Textzone"
module(..., package.seeall, class.inherit(engine.Dialog))
module(..., package.seeall, class.inherit(Dialog))
function _M:init(title, url, on_chunk, on_finish, on_error)
self.url = url
......@@ -29,48 +31,22 @@ function _M:init(title, url, on_chunk, on_finish, on_error)
self.on_finish = on_finish
self.on_error = on_error
local font = core.display.newFont("/data/font/Vera.ttf", 12)
engine.Dialog.init(self, title or "Downloading...", math.max(400, font:size("From: "..url) + 10), 75, nil, nil, nil, font)
Dialog.init(self, title or "Download", 1, 1)
self:keyCommands({
},{
})
end
function _M:drawDialog(s)
if self.th then
local ck = self.linda:receive(0, "received")
while ck do
if ck then
if not ck.error then
self.received = ck.size
self.on_chunk(ck.chunk)
else
self.on_error(ck.error)
break
end
end
ck = self.linda:receive(0, "received")
end
local t = self.linda:receive(0, "final")
local desc = Textzone.new{text="Downloading from "..url, width=400, auto_height=true}
local v, err = self.th:join(0)
if err then error(err) end
self:loadUI{
{left=0, top=0, ui=desc},
}
self:setupUI(true, true)
if t then
self.changed = false
self.linda = nil
self.th = nil
game:unregisterDialog(self)
self:on_finish()
end
end
s:drawStringBlended(self.font, "From: "..self.url, 2, 2, 255, 255, 255)
s:drawStringBlended(self.font, "Received: "..self.received, 2, 25, 255, 255, 255)
self.key:addBinds{
EXIT = function() game:unregisterDialog(self) end,
}
end
function _M:startDownload()
--[[
local l = lanes.linda()
function list_handler(src)
......@@ -94,4 +70,38 @@ function _M:startDownload()
self.th = lanes.gen("*", list_handler)(self.url)
self.linda = l
-- ]]
--[[
local co = coroutine.create(function()
local http = require "socket.http"
local ltn12 = require "ltn12"
local size = 0
http.TIMEOUT = 1200
print("Downloading from", self.url)
http.request{url = self.url, sink = function(chunk, err)
coroutine.yield()
return 1
end}
game:unregisterDialog(self)
end)
game:registerCoroutine("download module list", co)
]]
local http = require "socket.http"
local ltn12 = require "ltn12"
local handler = dispatch.newhandler("coroutine")
local done = false
handler:start(function()
http.request{
url = self.url,
sink = function(chunk, err) print("=====") end,
create = handler.tcp,
}
done = true
end)
while not done do
handler:step()
coroutine.yield()
end
end
......@@ -34,7 +34,7 @@ function _M:init()
{name="Load Game", fct=function() game:registerDialog(require("mod.dialogs.LoadGame").new()) end},
{name="Player Profile", fct=function() game:registerDialog(require("mod.dialogs.Profile").new()) end},
-- {name="Install Module", fct=function() end},
{name="Update", fct=function() game:registerDialog(require("mod.dialogs.UpdateAll").new()) end},
-- {name="Update", fct=function() game:registerDialog(require("mod.dialogs.UpdateAll").new()) end},
{name="Options", fct=function()
local menu menu = require("engine.dialogs.GameMenu").new{
"resume",
......
......@@ -62,10 +62,9 @@ function _M:display(...)
end
function _M:generateList()
local linda, th = Module:loadRemoteList()
local list = Module:loadRemoteList()
local mod_list = Module:listModules()
local rawdllist = linda:receive("moduleslist")
th:join()
do return end
local dllist = {}
for i, mod in ipairs(rawdllist) do
......
......@@ -77,7 +77,12 @@ Come to the arena when you are done with your adventures, will you?.
]],
answers = {
{ "I will. Farewell for now.", action = function (self, player)
game:changeLevel(1, "town-derth")
local g = game.zone:makeEntityByName(game.level, "terrain", "SAND_UP_WILDERNESS")
g.change_level = 1
g.change_zone = "town-derth"
g.name = "exit to Derth"
game.zone:addEntity(game.level, g, "terrain", player.x, player.y)
player.unused_generics = player.unused_generics + 2
game:setAllowedBuild("campaign_arena", true)
game.player:setQuestStatus("arena-unlock", engine.Quest.COMPLETED)
......
......@@ -35,6 +35,8 @@ defineTile(":", "FLOOR")
defineTile("&", "POST")
defineTile("@", "FLOOR", nil, "PROTECTOR_MYSSIL")
defineTile("'", "DOOR")
defineTile("*", "CLOSED_GATE")
defineTile("^", "OPEN_GATE")
defineTile('1', "HARDWALL", nil, nil, "TRAINER")
defineTile('2', "HARDWALL", nil, nil, "WEAPON_STORE")
......@@ -53,7 +55,7 @@ addSpot({39, 8}, "portal", "portal")
addSpot({38, 15}, "portal", "portal")
addSpot({32, 15}, "portal", "portal")
addSpot({35, 11}, "quest", "arena")
addSpot({28, 12}, "quest", "outside-arena")
addSpot({29, 12}, "quest", "sealed-gate")
addSpot({15, 31}, "arrival", "rhaloren")
addSpot({16, 31}, "arrival", "rhaloren")
addSpot({17, 31}, "arrival", "rhaloren")
......@@ -129,7 +131,7 @@ return [[
~~~~~tttt......###._.###.....==??????????==..###tt
~~~~~ttt..........._.........=????????????=..###tt
~~~~tttt........._____.......=????????????==.4#ttt
~~~tttt.........._ttt_....___=??????????!??=...ttt
~~~tttt.........._ttt_....___*??????????!??=...ttt
~~~ttttt........._ttt_..___..=?????????!???=...ttt
~~...ttt.........________....==???!???????==...ttt
~~..............._ttt_........=???????????=.....tt
......@@ -166,4 +168,4 @@ return [[
~~~~~~~~~~~~~~~~~~~~~~~,,tttttttttttttttttttt..ttt
~~~~~~~~~~~~~~~~~~~~~~~~,ttttttttttttttttttttttttt
~~~~~~~~~~~~~~~~~~~~~~~~,ttttttttttttttttttttttttt
~~~~~~~~~~~~~~~~~~~~~~~~<ttttttttttttttttttttttttt]]
\ No newline at end of file
~~~~~~~~~~~~~~~~~~~~~~~~<ttttttttttttttttttttttttt]]
......@@ -60,8 +60,10 @@ next_combat = function(self)
elseif self.wave < 9 then
self:add_foe(true, false, 4)
else
local spot = game.level:pickSpot{type="quest", subtype="outside-arena"}
game.player:move(spot.x, spot.y, true)
local spot = game.level:pickSpot{type="quest", subtype="sealed-gate"}
local g = game.zone:makeEntityByName(game.level, "terrain", "OPEN_GATE")
game.zone:addEntity(game.level, g, "terrain", spot.x, spot.y)
local p = game.party:findMember{main=true}
p.entered_level = {x=game.level.default_up.x, y=game.level.default_up.y}
......
......@@ -67,6 +67,7 @@ newTalent{
end
-- Find space
if game.level.map:checkEntity(tx, ty, Map.TERRAIN, "block_move", self) then return nil end
local fx, fy = util.findFreeGrid(tx, ty, 5, true, {[Map.ACTOR]=true})
if not fx then
return
......
......@@ -57,3 +57,23 @@ newEntity{ base = "HARDWALL", define_as = "ROCK",
image="terrain/oldstone_floor.png", add_displays = {class.new{image="terrain/maze_rock.png"}},
nice_tiler = false,
}
newEntity{
define_as = "CLOSED_GATE",
name = "closed gate", image = "terrain/sealed_door.png",
display = '+', color=colors.WHITE, back_color=colors.DARK_UMBER,
notice = true,
always_remember = true,
block_sight = true,
does_block_move = true,
}
newEntity{
define_as = "OPEN_GATE",
type = "wall", subtype = "floor",
name = "open gate", image = "terrain/sealed_door_cracked.png",
display = "'", color=colors.WHITE, back_color=colors.DARK_UMBER,
notice = true,
always_remember = true,
}
......@@ -194,7 +194,7 @@ int main(int argc, char **argv)
if (!strncmp(arg, "-M", 2)) core_def->reboot_module = strdup(arg+2);
if (!strncmp(arg, "-u", 2)) core_def->reboot_name = strdup(arg+2);
if (!strncmp(arg, "-E", 2)) core_def->reboot_einfo = strdup(arg+2);
if (!strncmp(arg, "-n", 2)) core_def->reboot_new = 0;
if (!strncmp(arg, "-n", 2)) core_def->reboot_new = 1;
if (!strncmp(arg, "--flush-stdout", 14)) setvbuf(stdout, (char *) NULL, _IOLBF, 0);;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment