Page 1 of 1

Player Health

Posted: Fri Aug 09, 2013 1:38 pm
by zer0t3ch
Is there an event for detecting change to the players health, and is there a way to modify the players health?

Re: Player Health

Posted: Sun Aug 11, 2013 8:41 am
by slpwnd
You can modify any entity's health. It works as an attribute.

for instance

Code: Select all

game.player.character.health = game.player.character.health + 1
It is a good habit to check whether the character exists (game might be in the god mode for instance).

Re: Player Health

Posted: Sun Aug 11, 2013 2:41 pm
by zer0t3ch
slpwnd wrote:You can modify any entity's health. It works as an attribute.

for instance

Code: Select all

game.player.character.health = game.player.character.health + 1
It is a good habit to check whether the character exists (game might be in the god mode for instance).
Thanks! :)

Out of curiosity, are any of the devs actively updating the wiki?

Re: Player Health

Posted: Tue Aug 13, 2013 9:58 pm
by kovarex
Not now, but we plan to :)

Re: Player Health

Posted: Wed Aug 14, 2013 4:09 am
by ssilk
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.

Re: Player Health

Posted: Wed Aug 14, 2013 11:29 am
by zer0t3ch
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.
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.

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.

Re: Player Health

Posted: Sun Aug 18, 2013 12:13 am
by zer0t3ch
zer0t3ch wrote:
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.
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.

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.
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. :|

Re: Player Health

Posted: Mon Aug 19, 2013 12:02 pm
by slpwnd
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.
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.

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.
zer0t3ch wrote: and there hasn't been a whole lot of dev activity lately.
Vacation time:) But it is nearly over.

Re: Player Health

Posted: Mon Aug 19, 2013 12:48 pm
by ssilk
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.
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 :) ).
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.
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.

PS: I'm sure that you know that, but for the other case I mention it: look for some autogenerators of the inline-docu. In most IDE's you'll write "/**" then enter and the inline-docu is autofilled with the information that can be collected from the method or whatever is below.

Re: Player Health

Posted: Mon Aug 19, 2013 2:19 pm
by zer0t3ch
slpwnd wrote:
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.
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.

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?