Player Health

Place to get help with not working mods / modding interface.
User avatar
zer0t3ch
Fast Inserter
Fast Inserter
Posts: 118
Joined: Fri Jul 26, 2013 6:06 am
Contact:

Player Health

Post by zer0t3ch »

Is there an event for detecting change to the players health, and is there a way to modify the players health?
"F**k thy hater"
-George Watsky

Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com

Image

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: Player Health

Post 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).

User avatar
zer0t3ch
Fast Inserter
Fast Inserter
Posts: 118
Joined: Fri Jul 26, 2013 6:06 am
Contact:

Re: Player Health

Post 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?
"F**k thy hater"
-George Watsky

Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com

Image

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Player Health

Post by kovarex »

Not now, but we plan to :)

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Player Health

Post 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.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
zer0t3ch
Fast Inserter
Fast Inserter
Posts: 118
Joined: Fri Jul 26, 2013 6:06 am
Contact:

Re: Player Health

Post 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.
"F**k thy hater"
-George Watsky

Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com

Image

User avatar
zer0t3ch
Fast Inserter
Fast Inserter
Posts: 118
Joined: Fri Jul 26, 2013 6:06 am
Contact:

Re: Player Health

Post 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. :|
"F**k thy hater"
-George Watsky

Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com

Image

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: Player Health

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

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Player Health

Post 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.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
zer0t3ch
Fast Inserter
Fast Inserter
Posts: 118
Joined: Fri Jul 26, 2013 6:06 am
Contact:

Re: Player Health

Post 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?
"F**k thy hater"
-George Watsky

Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com

Image

Post Reply

Return to “Modding help”