ComfyFactory / ComfyFactorio

A compilation of factorio scenarios, featuring many different maps.
GNU General Public License v3.0
51 stars 54 forks source link

Do not feed a player who is trying to spellcast #409

Closed M-Evans closed 11 months ago

M-Evans commented 1 year ago

All Submissions:

Tested Changes:

  1. [x] Have you lint your code (lua lint) locally prior to submission?

Changes to Core Features:

Comments

explanation: I enabled both hunger and rpg (v2) locally, and noticed that the "player used capsule" handlers" fire simultaneously. the effect is that trying to spellcast causes the player to bloat, with no recourse.

my attempt at a fix here is to detect whether a player has spellcasting active, and use this to prevent updating the hunger value. this works for me locally.

note that this introduces a dependency on modules.rpg.table; nothing in the require path will cause rpg to be enabled where it is not currently enabled. I understand this pattern is a bit precarious, though, so please let me know if there is a better way to accomplish this.

hanakocz commented 1 year ago

There should not be necessary to require rpg table, that bloats the scenarios that don't use rpg while using this module. For this functionality, there is this function that returns the module if it is required somewhere else: is_loaded()

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.