From 37fa32962a093038f2e9dd611acb480e84f2384e Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Tue, 24 Aug 2010 15:03:11 +0000 Subject: [PATCH] Added Map:checkAllEntitiesNoStop() taht will iterate over all entities no matter if a result is found Changed engine version to 0.9.10 (from 1.0.0), your module will not display anymore in the list until you change your init.lua accordingly git-svn-id: http://svn.net-core.org/repos/t-engine4@1053 51575b47-30f0-44d4-a5cc-537603b46e54 --- bootstrap/boot.lua | 10 ++++++++++ game/engine/Map.lua | 15 ++++++++++++++- game/engine/init.lua | 2 +- game/modules/example/init.lua | 2 +- game/modules/tome/init.lua | 2 +- game/special/mainmenu/class/Game.lua | 9 ++++++++- 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/bootstrap/boot.lua b/bootstrap/boot.lua index d6f51d256b..1eded18029 100644 --- a/bootstrap/boot.lua +++ b/bootstrap/boot.lua @@ -19,9 +19,19 @@ if __SELFEXE then print("SelfExe gave us app directory of:", dir) fs.mount(dir..fs.getPathSeparator().."game"..fs.getPathSeparator().."thirdparty", "/", true) fs.mount(dir..fs.getPathSeparator().."game", "/", true) + if fs.exists("/engine.teae") and fs.exists("/thirdparty.teae") then + fs.mount(dir..fs.getPathSeparator().."game/engine.teae", "/", true) + fs.mount(dir..fs.getPathSeparator().."game/thirdparty.teae", "/", true) + print("Using engine.teae") + end else fs.mount("game"..fs.getPathSeparator().."thirdparty", "/", true) fs.mount("game", "/", true) + if fs.exists("/engine.teae") and fs.exists("/thirdparty.teae") then + fs.mount(dir..fs.getPathSeparator().."game/engine.teae", "/", true) + fs.mount(dir..fs.getPathSeparator().."game/thirdparty.teae", "/", true) + print("Using engine.teae") + end end -- We need it no more, lets forget about it just it case some malovelant script tried something silly diff --git a/game/engine/Map.lua b/game/engine/Map.lua index 636e69674c..a27ec4bca9 100644 --- a/game/engine/Map.lua +++ b/game/engine/Map.lua @@ -553,7 +553,7 @@ function _M:applyESP(x, y, v) end end ---- Check all entities of the grid for a property +--- Check all entities of the grid for a property until it finds one/returns one -- @param x position -- @param y position -- @param what property to check @@ -567,6 +567,19 @@ function _M:checkAllEntities(x, y, what, ...) end end +--- Check all entities of the grid for a property, discarding the results +-- @param x position +-- @param y position +-- @param what property to check +function _M:checkAllEntitiesNoStop(x, y, what, ...) + if x < 0 or x >= self.w or y < 0 or y >= self.h then return end + if self.map[x + y * self.w] then + for _, e in pairs(self.map[x + y * self.w]) do + e:check(what, x, y, ...) + end + end +end + --- Check specified entity position of the grid for a property -- @param x position -- @param y position diff --git a/game/engine/init.lua b/game/engine/init.lua index e9dda1835c..65ecc955c0 100644 --- a/game/engine/init.lua +++ b/game/engine/init.lua @@ -34,7 +34,7 @@ require "engine.PlayerProfile" engine.Tiles.prefix = "/data/gfx/" -- Engine Version -engine.version = {1,0,0} +engine.version = {0,9,10} -- Setup the user directory engine.homepath = fs.getUserPath()..fs.getPathSeparator()..fs.getHomePath()..fs.getPathSeparator().."4.0" diff --git a/game/modules/example/init.lua b/game/modules/example/init.lua index a2c541f3a3..bfa3720fcc 100644 --- a/game/modules/example/init.lua +++ b/game/modules/example/init.lua @@ -23,7 +23,7 @@ short_name = "example" author = { "DarkGod", "darkgod@te4.org" } homepage = "http://te4.org/modules:example" version = {1,0,0} -engine = {1,0,0} +engine = {0,9,10} description = [[ This is *NOT* a game, just an example/template to make your own using the T-Engine4. ]] diff --git a/game/modules/tome/init.lua b/game/modules/tome/init.lua index 34f2f97ba5..0f1f4aa894 100644 --- a/game/modules/tome/init.lua +++ b/game/modules/tome/init.lua @@ -23,7 +23,7 @@ short_name = "tome" author = { "DarkGod", "darkgod@te4.org" } homepage = "http://tome.te4.org/" version = {4,0,0} -engine = {1,0,0} +engine = {0,9,10} description = [[ Morgoth is banned to the Void, Sauron has been vanquished, the #ff0000#One Ring#ffffff# destroyed. The nations of Men, Dwarves, Elves and Hobbits are freed from the tyranny of the Rings. diff --git a/game/special/mainmenu/class/Game.lua b/game/special/mainmenu/class/Game.lua index d189ece70e..994e39ca90 100644 --- a/game/special/mainmenu/class/Game.lua +++ b/game/special/mainmenu/class/Game.lua @@ -49,6 +49,7 @@ function _M:run() self:selectStepMain() self:checkLogged() + self:engineVersion() -- Ok everything is good to go, activate the game in the engine! self:setCurrent() @@ -60,12 +61,16 @@ end function _M:checkLogged() if profile.auth then - self.s_log = core.display.drawStringNewSurface(self.profile_font, "Online Profile: "..profile.auth.name.."[http://te4.org/players/"..profile.auth.page.."]", 255, 255, 0) + self.s_log = core.display.drawStringBlendedNewSurface(self.profile_font, "Online Profile: "..profile.auth.name.."[http://te4.org/players/"..profile.auth.page.."]", 255, 255, 0) else self.s_log = nil end end +function _M:engineVersion() + self.s_version = core.display.drawStringBlendedNewSurface(self.profile_font, ("T-Engine4 version: %d.%d.%d"):format(engine.version[1], engine.version[2], engine.version[3]), 185, 225, 0) +end + function _M:tick() return true end @@ -82,6 +87,8 @@ function _M:display() local w, h = self.s_log:getSize() self.s_log:toScreen(self.w - w, self.h - h) end + local w, h = self.s_version:getSize() + self.s_version:toScreen(0, self.h - h) if self.step.do_tooltip then self.tooltip:display() -- GitLab