diff --git a/game/engine/Actor.lua b/game/engine/Actor.lua index 271f7740690468da554757c12b5d84111140c42d..a6449ddd7811c73f37b282ae73408191a09ce95b 100644 --- a/game/engine/Actor.lua +++ b/game/engine/Actor.lua @@ -39,15 +39,6 @@ function _M:init(t, no_default) Entity.init(self, t, no_default) self.compute_vals = {n=0} - self.can_see_cache = {} - self:loaded() -end - - ---- Called when loaded --- Will setup the metatable on can_see_cache to be weak keys -function _M:loaded() - setmetatable(self.can_see_cache, {__mode='k'}) end --- Called when it is time to act @@ -270,9 +261,8 @@ end -- @param actor the target actor to check -- @param def the default -- @param def_pct the default percent chance --- @param nocache if true does not save value in the cache (not used, it's up to the module to use the cache) -- @return true or false and a number from 0 to 100 representing the "chance" to be seen -function _M:canSee(actor, def, def_pct, nocache) +function _M:canSee(actor, def, def_pct) return true, 100 end diff --git a/game/engine/Module.lua b/game/engine/Module.lua index 2aa87b442857160afd61d805feda5869d5bab16d..29d0fae576e1a1f3015bc38585db61c2257299a7 100644 --- a/game/engine/Module.lua +++ b/game/engine/Module.lua @@ -138,6 +138,7 @@ function _M:setupWrite(mod) -- Create module directory fs.setWritePath(engine.homepath) fs.mkdir(mod.short_name) + fs.mkdir(mod.short_name.."/save") -- Enter module directory local base = engine.homepath .. fs.getPathSeparator() .. mod.short_name diff --git a/game/engine/Store.lua b/game/engine/Store.lua index b4fa75a1f562eada1688a06341e1da3bdea50e17..69418048aea89963c2dc09dffe7127d664ab8385 100644 --- a/game/engine/Store.lua +++ b/game/engine/Store.lua @@ -80,7 +80,7 @@ function _M:interact(who) q.qty = o:getNumber() game:registerDialog(q) else - self:doBuy(who, o, item, 1) + self:doBuy(who, o, item, 1, d) end else if o:getNumber() > 1 then @@ -89,7 +89,7 @@ function _M:interact(who) q.qty = o:getNumber() game:registerDialog(q) else - self:doSell(who, o, item, 1) + self:doSell(who, o, item, 1, d) end end end, function(what, o) diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index f848d30d47a4314a35c1f2a79a13d763e5d66465..6bd5a4d6827381d94a6bceacd62378e7276e5cac 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -555,6 +555,13 @@ function _M:learnStats(statorder) end end +function _M:resetToFull() + self.life = self.max_life + self.mana = self.max_mana + self.stamina = self.max_stamina + self.equilibrium = 0 +end + function _M:levelup() self.unused_stats = self.unused_stats + 3 + self:getRankStatAdjust() if self.level % 5 == 0 then self.unused_talents = self.unused_talents + 1 end @@ -582,11 +589,8 @@ function _M:levelup() self:incMaxStamina(self.stamina_rating) self:incMaxPositive(self.positive_negative_rating) self:incMaxNegative(self.positive_negative_rating) - -- Healp up on new level - self.life = self.max_life - self.mana = self.max_mana - self.stamina = self.max_stamina - self.equilibrium = 0 + -- Heal up on new level + self:resetToFull() -- Auto levelup ? if self.autolevel then @@ -960,11 +964,8 @@ end --- Can the actor see the target actor -- This does not check LOS or such, only the actual ability to see it.<br/> -- Check for telepathy, invisibility, stealth, ... -function _M:canSee(actor, def, def_pct, nocache) +function _M:canSee(actor, def, def_pct) if not actor then return false, 0 end - if not nocache and self.can_see_cache[actor] and self.can_see_cache[actor].turn >= game.turn then - return self.can_see_cache[actor].seen, self.can_see_cache[actor].chance - end -- ESP, see all, or only types/subtypes if self:attr("esp") then @@ -974,24 +975,20 @@ function _M:canSee(actor, def, def_pct, nocache) if game.level then game.level.map.seens(actor.x, actor.y, 1) end - if not nocache then self.can_see_cache[actor] = {turn=game.turn, seen=true, chance=100} end return true, 100 end -- Type based ESP if esp[actor.type] and esp[actor.type] > 0 then - if not nocache then self.can_see_cache[actor] = {turn=game.turn, seen=true, chance=100} end return true, 100 end if esp[actor.type.."/"..actor.subtype] and esp[actor.type.."/"..actor.subtype] > 0 then - if not nocache then self.can_see_cache[actor] = {turn=game.turn, seen=true, chance=100} end return true, 100 end end -- Blindness means can't see anything if self:attr("blind") then - if not nocache then self.can_see_cache[actor] = {turn=game.turn, seen=false, chance=0} end return false, 0 end @@ -1000,7 +997,6 @@ function _M:canSee(actor, def, def_pct, nocache) local def = self.level / 2 + self:getCun(25) local hit, chance = self:checkHit(def, actor:attr("stealth") + (actor:attr("inc_stealth") or 0), 0, 100) if not hit then - if not nocache then self.can_see_cache[actor] = {turn=game.turn+100, seen=false, chance=chance} end return false, chance end end @@ -1011,15 +1007,12 @@ function _M:canSee(actor, def, def_pct, nocache) if not self:attr("see_invisible") then return false, 0 end local hit, chance = self:checkHit(self:attr("see_invisible"), actor:attr("invisible"), 0, 100) if not hit then - if not nocache then self.can_see_cache[actor] = {turn=game.turn+100, seen=false, chance=chance} end return false, chance end end if def ~= nil then - if not nocache then self.can_see_cache[actor] = {turn=game.turn+100, seen=def, chance=def_pct} end return def, def_pct else - if not nocache then self.can_see_cache[actor] = {turn=game.turn+100, seen=true, chance=100} end return true, 100 end end diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index d0caa03b7911486e2e833630c84129f4e53e1cc1..2fbf1646cd9472156bfd37520643aef4f44366ac 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -145,6 +145,7 @@ function _M:newGame() print("[PLAYER BIRTH] resolved!") self.player:grantQuest(self.player.starting_quest) self:registerDialog(require("mod.dialogs.IntroDialog").new(self.player)) + self.player:resetToFull() end, quickbirth) self:registerDialog(birth) end diff --git a/game/modules/tome/data/general/grids/forest.lua b/game/modules/tome/data/general/grids/forest.lua index 04552701001d8139e48b8ea26885fbc8ccc816e0..56cdddec564cbb7e00f26daf3f6e575ab5e62c82 100644 --- a/game/modules/tome/data/general/grids/forest.lua +++ b/game/modules/tome/data/general/grids/forest.lua @@ -27,6 +27,7 @@ newEntity{ define_as = "TREE", name = "tree", image = "terrain/tree.png", display = '#', color=colors.LIGHT_GREEN, back_color={r=44,g=95,b=43}, +-- shader = "forest", textures = { {"image","terrain/tree_test2.png"}, function() return _3DNoise, true end }, always_remember = true, can_pass = {pass_tree=1}, does_block_move = true, diff --git a/game/modules/tome/data/quests/mage-apprentice.lua b/game/modules/tome/data/quests/mage-apprentice.lua index be8060f03b3a56d4a9c6d496f94bb4447d681ccc..19fe4849e21d0ea758b8908a11132d1ec6ec680d 100644 --- a/game/modules/tome/data/quests/mage-apprentice.lua +++ b/game/modules/tome/data/quests/mage-apprentice.lua @@ -117,6 +117,7 @@ access_angolwen = function(self, player) game:setAllowedBuild("mage", true) world:gainAchievement("THE_SECRET_CITY", player) + player:setQuestStatus(self, self.DONE) end ring_gift = function(self, player) @@ -127,4 +128,5 @@ ring_gift = function(self, player) game.zone:addEntity(game.level, o, "object") game.logPlayer(player, "You receive: %s", o:getName{do_color=true}) end + player:setQuestStatus(self, self.DONE) end diff --git a/src/main.c b/src/main.c index 38bf620f29ec465baf38910c573b01763b991772..d5c09bf1ded7c96b6a7a8de98d2f747374b03543 100644 --- a/src/main.c +++ b/src/main.c @@ -599,10 +599,11 @@ int main(int argc, char *argv[]) resizeWindow(WIDTH, HEIGHT); // Get OpenGL capabilities - multitexture_active = glewIsSupported("GL_ARB_multitexture"); - shaders_active = glewIsSupported("GL_ARB_shader_objects"); - fbo_active = glewIsSupported("GL_EXT_framebuffer_object") || glewIsSupported("GL_ARB_framebuffer_object"); + multitexture_active = GLEW_ARB_multitexture; + shaders_active = GLEW_ARB_shader_objects; + fbo_active = GLEW_EXT_framebuffer_object || GLEW_ARB_framebuffer_object; if (!multitexture_active) shaders_active = FALSE; + if (!GLEW_VERSION_2_1) fbo_active = FALSE; boot_lua(2, FALSE, argc, argv);