Player Health
Posted: Fri Aug 09, 2013 1:38 pm
Is there an event for detecting change to the players health, and is there a way to modify the players health?
Code: Select all
game.player.character.health = game.player.character.health + 1
Thanks!slpwnd wrote:You can modify any entity's health. It works as an attribute.
for instance
It is a good habit to check whether the character exists (game might be in the god mode for instance).Code: Select all
game.player.character.health = game.player.character.health + 1
It makes all the sense. Even though we have a lot of access to the base code via the lua stuff, there's still a lot of compiled code in the game that modders can't see, but should be documented.ssilk wrote:Hm. Does a "Docs" subboard make sense? I would like to discuss how the information in the wiki can be partitioned in more useful parts and have some ideas for that. It should also help to join some users for that job.
bump? I'm just curious if any devs are planning on updating the wiki. I haven't looked at it lately, so I'm sorry if you already have.zer0t3ch wrote:It makes all the sense. Even though we have a lot of access to the base code via the lua stuff, there's still a lot of compiled code in the game that modders can't see, but should be documented.ssilk wrote:Hm. Does a "Docs" subboard make sense? I would like to discuss how the information in the wiki can be partitioned in more useful parts and have some ideas for that. It should also help to join some users for that job.
For example, anything in the game.<whatever> is compiled code (I think) and therefor we can only know about what's there based on what the devs put there, and there hasn't been a whole lot of dev activity lately.
I wonder whether we shouldn't just open the source for the modding part of Factorio. There are calls to the core engine so the code on itself is useless and won't even be compilable. On the other hand it is the up to date reference on what can be done with the lua interface.zer0t3ch wrote: It makes all the sense. Even though we have a lot of access to the base code via the lua stuff, there's still a lot of compiled code in the game that modders can't see, but should be documented.
Vacation time:) But it is nearly over.zer0t3ch wrote: and there hasn't been a whole lot of dev activity lately.
Hm. I've had a project, which uses that. They opened the interface-code for everybody. The result was, that the developers found bugs, which they use to do things, that the interface wasn't thought for. The end was, that they developed a second (closed) interface, because they didn't want to maintain the "bug-is-a-feature" in the open code (by fixing the bugs they would make everything incompatible, because they all used the bugs ).slpwnd wrote:I wonder whether we shouldn't just open the source for the modding part of Factorio. There are calls to the core engine so the code on itself is useless and won't even be compilable. On the other hand it is the up to date reference on what can be done with the lua interface.
Yes. Works in all projects I have been working on very well! Inline-documentation is the only way I know, where you can document an API during development. Otherwise documentation and code run in different directions. Always.The other option would be to write the comments directly into our c++ code and then use some comments / documentation extractor (ala doxygen) to generate up to date reference.
Almost like javadocs?slpwnd wrote:I wonder whether we shouldn't just open the source for the modding part of Factorio. There are calls to the core engine so the code on itself is useless and won't even be compilable. On the other hand it is the up to date reference on what can be done with the lua interface.zer0t3ch wrote: It makes all the sense. Even though we have a lot of access to the base code via the lua stuff, there's still a lot of compiled code in the game that modders can't see, but should be documented.
The other option would be to write the comments directly into our c++ code and then use some comments / documentation extractor (ala doxygen) to generate up to date reference.