From 918a0edeb08aee87198670bdc60e5296a9ca6aae Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Sat, 4 Sep 2010 10:43:12 +0000 Subject: [PATCH] Fix saving while controlling a creature Fix fire bolt for the Imp summon git-svn-id: http://svn.net-core.org/repos/t-engine4@1138 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/engines/default/engine/Map.lua | 4 ++-- game/engines/default/engine/interface/ActorAI.lua | 1 + game/engines/default/special/mainmenu/class/Game.lua | 2 +- game/modules/tome/class/Game.lua | 7 ++++--- game/modules/tome/data/achievements/kills.lua | 2 +- game/modules/tome/data/quests/escort-duty.lua | 4 ++-- game/modules/tome/data/talents/gifts/summon-distance.lua | 2 +- game/modules/tome/data/talents/gifts/summon-utility.lua | 6 +++--- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/game/engines/default/engine/Map.lua b/game/engines/default/engine/Map.lua index 3337a9fafe..76eab03ba2 100644 --- a/game/engines/default/engine/Map.lua +++ b/game/engines/default/engine/Map.lua @@ -406,9 +406,9 @@ function _M:updateMap(x, y) -- This is to improve speed, we create a function for each spot that checks entities it knows are there -- This avoid a costly for iteration over a pairs() and this allows luajit to compile only code that is needed local ce = {} - local fstr = [[p = m[%s]:check(what, x, y, ...) if p then return p end ]] + local fstr = [[if m[%s] then p = m[%s]:check(what, x, y, ...) if p then return p end end ]] ce[#ce+1] = [[return function(self, x, y, what, ...) local p local m = self.map[x + y * self.w] ]] - for idx, e in pairs(self.map[x + y * self.w]) do ce[#ce+1] = fstr:format(idx) end + for idx, e in pairs(self.map[x + y * self.w]) do ce[#ce+1] = fstr:format(idx, idx) end ce[#ce+1] = [[end]] local ce = table.concat(ce) self._check_entities[x + y * self.w] = self._check_entities_store[ce] or loadstring(ce)() diff --git a/game/engines/default/engine/interface/ActorAI.lua b/game/engines/default/engine/interface/ActorAI.lua index fb4d9dbbd5..1fbb80a62d 100644 --- a/game/engines/default/engine/interface/ActorAI.lua +++ b/game/engines/default/engine/interface/ActorAI.lua @@ -121,6 +121,7 @@ end --- Main entry point for AIs function _M:doAI() if not self.ai then return end + if self.dead then return end -- if self.x < game.player.x - 10 or self.x > game.player.x + 10 or self.y < game.player.y - 10 or self.y > game.player.y + 10 then return end -- If we have a target but it is dead (it was not yet garbage collected but it'll come) diff --git a/game/engines/default/special/mainmenu/class/Game.lua b/game/engines/default/special/mainmenu/class/Game.lua index 3609343ab1..8a8ebce93a 100644 --- a/game/engines/default/special/mainmenu/class/Game.lua +++ b/game/engines/default/special/mainmenu/class/Game.lua @@ -237,7 +237,7 @@ Now go and have some fun!]] end self.step.do_tooltip = true - self:installNewEngine() +-- self:installNewEngine() if not self.firstrunchecked then -- Check first time run for online profile diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index f87e1afcce..edbcdb7b64 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -239,13 +239,14 @@ function _M:save() end function _M:getSaveDescription() + local player = self.player:resolveSource() return { - name = self.player.name, + name = player.name, description = ([[%s the level %d %s %s. Difficulty: %s Exploring level %d of %s.]]):format( - self.player.name, self.player.level, self.player.descriptor.subrace, self.player.descriptor.subclass, - self.player.descriptor.difficulty, + player.name, player.level, player.descriptor.subrace, player.descriptor.subclass, + player.descriptor.difficulty, self.level.level, self.zone.name ), } diff --git a/game/modules/tome/data/achievements/kills.lua b/game/modules/tome/data/achievements/kills.lua index ed06bda422..ec5378c8a7 100644 --- a/game/modules/tome/data/achievements/kills.lua +++ b/game/modules/tome/data/achievements/kills.lua @@ -52,7 +52,7 @@ newAchievement{ mode = "player", can_gain = function(self, who, target) if target.type == "humanoid" then - self.nb = (self.nb or 0) + 500 + self.nb = (self.nb or 0) + 1 if self.nb >= 1000 then return true end end end, diff --git a/game/modules/tome/data/quests/escort-duty.lua b/game/modules/tome/data/quests/escort-duty.lua index c52b4d0422..dd251f143a 100644 --- a/game/modules/tome/data/quests/escort-duty.lua +++ b/game/modules/tome/data/quests/escort-duty.lua @@ -312,10 +312,10 @@ on_grant = function(self, who) on_move = function(self, x, y, who) if not who.escort_quest then return end game.player:setQuestStatus(who.quest_id, engine.Quest.DONE) - who:disappear() - who:removed() local Chat = require "engine.Chat" Chat.new("escort-quest", who, game.player, {npc=who}):invoke() + who:disappear() + who:removed() end, } g:resolve() g:resolve(nil, true) diff --git a/game/modules/tome/data/talents/gifts/summon-distance.lua b/game/modules/tome/data/talents/gifts/summon-distance.lua index 4a00b83d32..2a67d505d5 100644 --- a/game/modules/tome/data/talents/gifts/summon-distance.lua +++ b/game/modules/tome/data/talents/gifts/summon-distance.lua @@ -25,7 +25,7 @@ newTalent{ short_name = "FIRE_IMP_BOLT", range = 20, reflectable = true, action = function(self, t) - local tg = {type="hit", range=self:getTalentRange(t), talent=t} + local tg = {type="bolt", range=self:getTalentRange(t), talent=t} local x, y = self:getTarget(tg) if not x or not y then return nil end self:project(tg, x, y, DamageType.FIRE, self:spellCrit(self:combatTalentSpellDamage(t, 8, 120)), {type="flame"}) diff --git a/game/modules/tome/data/talents/gifts/summon-utility.lua b/game/modules/tome/data/talents/gifts/summon-utility.lua index 877f68f5a4..d02438ce3e 100644 --- a/game/modules/tome/data/talents/gifts/summon-utility.lua +++ b/game/modules/tome/data/talents/gifts/summon-utility.lua @@ -354,11 +354,11 @@ newTalent{ action = function(self, t) local tg = {type="hit", range=self:getTalentRange(t), nolock=true, talent=t, first_target="friend"} local tx, ty, target = self:getTarget(tg) - if not tx or not ty or not target then print("1") return nil end + if not tx or not ty or not target then return nil end local _ _, tx, ty = self:canProject(tg, tx, ty) target = game.level.map(tx, ty, Map.ACTOR) - if target == self then print("2") return nil end - if not target.summoner == game.player then print("3") return nil end + if not target or target == self then return nil end + if not target.summoner == game.player then return nil end local ot = target target = mod.class.Player.new(target) -- GitLab