Issue961

Title Problem in FDnpc.drain_health
Priority release-blocker Status resolved
Assigned To fluzz Keywords
Linked issues FreedroidRPG 1.0RC2 encountered a problem in function: resume_lua_coroutine, hcf.py does not destroy/kill the bot (tested bots in comment)
View: 971, 970
Watchers fluzz

Submitted on 2019-11-08 10h24 by bircoph, last changed by fluzz.

Messages
Author: bircoph Date: 2019-11-08   10h24
Hi!

I play freedroidRPG-1.0rc2 configured with embedded lua. I repeatedly receive the following error:

---------------------------------------------------------------------------------
FreedroidRPG 1.0RC2 encountered a problem in function: resume_lua_coroutine
Error running Lua code: /usr/share/freedroidrpg/lua_modules/FDnpc_lfuns.lua:82: bad argument #1 to 'hurt' (number has no integer representation).
Erroneous LuaCode={
76  function FDnpc.drain_health(self)
77      --[[ For example, if NPC's health = 10, hurt_tux(-10) will heal tux by 10 HP
78           To have the difficulty lvl influence the HP tux gets we divide the
79           HP by the difficulty_lvl+1 (to prevent division by zero)
80           -10/2 (difficulty_lvl = 3/hard) = -5.  Tux will be healed by 5 HP ]]--
81      local tux = FDrpg.get_tux()
>82     tux:hurt(-(self:get_health())/(difficulty_level()+1))
83      self:drop_dead()
84  end
}


If you encounter this message, please inform the FreedroidRPG developers about it!
You can
  send an e-mail to                    freedroid-discussion AT lists.sourceforge.net
  mention it on our IRC channel        #freedroid on irc.freenode.net
  or report the bug on our tracker at  http://bugs.freedroid.org/

Thank you!
---------------------------------------------------------------------------------

The game continues to work fine, at least no visible problems except these messages.
Author: jesusalva Date: 2019-11-11   01h15
fluzz do you believe this could be a bug 
involving floating pointers?
Author: fluzz Date: 2022-08-01   18h57
yes, definitely
Author: fluzz Date: 2022-08-01   18h58
Fixed in commit d7830f80b
History
Date User Action Args
2022-08-01 18:58:31fluzzsetstatus: open -> resolved
messages: + msg3731
2022-08-01 18:57:58fluzzsetmessages: + msg3730
2021-11-05 13:19:57fluzzsetassignedto: fluzz
nosy: + fluzz
2021-11-05 13:12:07jesusalvasetlinked: + FreedroidRPG 1.0RC2 encountered a problem in function: resume_lua_coroutine
2021-11-05 13:11:53jesusalvalinkissue971 linked
2021-11-05 13:06:05jesusalvasetpriority: bug -> release-blocker
linked: + hcf.py does not destroy/kill the bot (tested bots in comment)
2021-11-05 13:05:47jesusalvalinkissue970 linked
2019-11-11 01:15:09jesusalvasetmessages: + msg3664
2019-11-08 10:24:08bircophcreate