From c1f866bbdb46c3bbb34e3c922a574645f10e7f95 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Thu, 6 Dec 2012 10:36:23 +0000
Subject: [PATCH] Old battle field and Tombstones events now display graves
 opened when they were

git-svn-id: http://svn.net-core.org/repos/t-engine4@5943 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Game.lua                          | 7 +------
 .../modules/tome/data/general/events/old-battle-field.lua | 8 ++++++++
 game/modules/tome/data/general/events/tombstones.lua      | 8 ++++++++
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua
index f9e627213b..2fa60ec4f4 100644
--- a/game/modules/tome/class/Game.lua
+++ b/game/modules/tome/class/Game.lua
@@ -1254,12 +1254,7 @@ function _M:setupCommands()
 			end end
 		end end,
 		[{"_g","ctrl"}] = function() if config.settings.cheat then
-			local o = game.zone:makeEntity(game.level,"object", {random_object=true}, nil, true)
-			o:identify(true)
-			if o then game.zone:addEntity(game.level, o, "object", game.player.x, game.player.y) end
-			
-do return end
-			local f, err = loadfile("/data/general/events/glowing-chest.lua")
+			local f, err = loadfile("/data/general/events/old-battle-field.lua")
 			print(f, err)
 			setfenv(f, setmetatable({level=self.level, zone=self.zone}, {__index=_G}))
 			print(pcall(f))
diff --git a/game/modules/tome/data/general/events/old-battle-field.lua b/game/modules/tome/data/general/events/old-battle-field.lua
index 8bdec04f18..d8fbe32b50 100644
--- a/game/modules/tome/data/general/events/old-battle-field.lua
+++ b/game/modules/tome/data/general/events/old-battle-field.lua
@@ -129,6 +129,14 @@ if tries < 100 then
 			if game.level.event_battlefield_entered then return false end
 			who:runStop("grave")
 			require("engine.ui.Dialog"):yesnoPopup("Grave", "Do you wish to disturb the grave?", function(ret) if ret then
+				local g = game.level.map(x, y, engine.Map.TERRAIN)
+				g:removeAllMOs()
+				if g.add_displays then
+					local ov = g.add_displays[#g.add_displays]
+					ov.image = "terrain/grave_opened_0"..rng.range(1, 3).."_64.png"
+				end
+				game.level.map:updateMap(x, y)
+
 				self.block_move = nil
 				self:change_level_check()
 				require("engine.ui.Dialog"):simplePopup("Fall...", "As you tried to dig the grave the ground fell under you. You find yourself stranded in an eerie lit cavern.")
diff --git a/game/modules/tome/data/general/events/tombstones.lua b/game/modules/tome/data/general/events/tombstones.lua
index 95481e9086..1040de533f 100644
--- a/game/modules/tome/data/general/events/tombstones.lua
+++ b/game/modules/tome/data/general/events/tombstones.lua
@@ -43,6 +43,14 @@ if tries < 100 then
 		if not who or not who.player or not act then return false end
 		who:runStop("grave")
 		require("engine.ui.Dialog"):yesnoPopup("Grave", "Do you wish to disturb the grave?", function(ret) if ret then
+			local g = game.level.map(x, y, engine.Map.TERRAIN)
+			g:removeAllMOs()
+			if g.add_displays then
+				local ov = g.add_displays[#g.add_displays]
+				ov.image = "terrain/grave_opened_0"..rng.range(1, 3).."_64.png"
+			end
+			game.level.map:updateMap(x, y)
+
 			self.block_move = nil
 			if rng.percent(20) then game.log("There is nothing there.") return end
 
-- 
GitLab