RodOfRecall stop recharging.Any temporary fixes availabe?

Everything about ToME 4.x.x. No spoilers, please

Moderator: Moderator

Post Reply
Message
Author
Postman
Archmage
Posts: 335
Joined: Fri Dec 03, 2010 5:34 pm

RodOfRecall stop recharging.Any temporary fixes availabe?

#1 Post by Postman »

Kind of tiresome to climb all way back without RoR. I know it's fixed in SVN, but are there any fixes which I can easily copy-past into 18b install?

Massimiliano Marangio
Sher'Tul
Posts: 1120
Joined: Mon Sep 30, 2002 9:52 pm
Location: Germany

Re: RodOfRecall stop recharging.Any temporary fixes availabe

#2 Post by Massimiliano Marangio »

I had the same problem in an old beta, and I simply changed the code of the jeweller to also recharge not-charged artifacts, but I don't have the code anymore.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: RodOfRecall stop recharging.Any temporary fixes availabe

#3 Post by yufra »

Here are the fixes that are in the SVN and slated for beta19. Everything with a "+" at the beginning of the line should be inserted into the correct file and location. Note that this will disable with online updates so your character sheet on te4.org will stop updating.

Code: Select all

Index: engines/default/engine/Object.lua
===================================================================
--- engines/default/engine/Object.lua	(revision 2337)
+++ engines/default/engine/Object.lua	(revision 2338)
@@ -52,6 +52,13 @@
 	end
 end
 
+--- Loaded, we add ourself back to the game
+function _M:loaded()
+	engine.Entity.loaded(self)
+
+	if not game:hasEntity(self) then game:addEntity(self) end
+end
+
 --- Can this object act at all
 -- Most object will want to answer false, only recharging and stuff needs them
 function _M:canAct()

Code: Select all

Index: engines/default/engine/interface/ObjectActivable.lua
===================================================================
--- engines/default/engine/interface/ObjectActivable.lua	(revision 2337)
+++ engines/default/engine/interface/ObjectActivable.lua	(revision 2338)
@@ -61,6 +61,9 @@
 end
 
 function _M:useObject(who, ...)
+	-- Make sure the object is registered with the game, if need be
+	if not game:hasEntity(self) then game:addEntity(self) end
+
 	if self.use_power then
 		if self.power >= self.use_power.power then
 			local rets = { self.use_power.use(self, who, ...) }

Code: Select all

Index: engines/default/engine/interface/ActorInventory.lua
===================================================================
--- engines/default/engine/interface/ActorInventory.lua	(revision 2337)
+++ engines/default/engine/interface/ActorInventory.lua	(revision 2338)
@@ -103,6 +103,9 @@
 
 	self:onAddObject(o)
 
+	-- Make sure the object is registered with the game, if need be
+	if not game:hasEntity(o) then game:addEntity(o) end
+
 	return true, #inven
 end
 
@@ -171,6 +174,9 @@
 
 	self:onRemoveObject(o)
 
+	-- Make sure the object is registered with the game, if need be
+	if not game:hasEntity(o) then game:addEntity(o) end
+
 	return o, finish
 end
 

Code: Select all

Index: engines/default/engine/GameEnergyBased.lua
===================================================================
--- engines/default/engine/GameEnergyBased.lua	(revision 2337)
+++ engines/default/engine/GameEnergyBased.lua	(revision 2338)
@@ -121,3 +121,8 @@
 	if not self.entities[e.uid] then error("Entity "..e.uid.." not present in the game") end
 	self.entities[e.uid] = nil
 end
+
+--- Does the game have this entity ?
+function _M:hasEntity(e)
+	return self.entities[e.uid]
+end
<DarkGod> lets say it's intended

Post Reply