[0.10.1 MINOR] help function and createentity train
Posted: Sat Jun 21, 2014 2:46 am
by FreeER
So, I thought I'd use the new makefile method to make a list of the help 'documentation' and found that these do not have a help method/property, or at least I've no idea how to find it lol.
Also, in the control script you have to access 'help' as a property, not as a function, aka whatever.help and not whatever.help() (but you do have to use whatever.help() in the console...), not sure if that was actually intended...
While testing I found that game.createentity{name="diesel-locomotive", position=game.findnoncollidingposition("diesel-locomotive", game.player.position, 100, 1)} will fail "for an unknown reason", unless there are tracks close enough for it to be placed on, in which case it works (basically...I've found the reason lol).
script I used for testing if you care to see it
script
Ignore all of the pcalls...I was initially going to loop through all of the entityprototypes, and use pcall(createentity{name...}.help) (because some entities can't be created through createentity, flame-thower-explosion, and others require more than just name and position, like a 'shooting target'?) and I just started copying and pasting later they should really be removed though because they do absolutely nothing, Factorio 'handles' the error internally (by halting the script) instead of passing the error onto the script for it to handle
Values:
members [R]
position [R]
state [R]
valid [R]
Re: [0.10.1 MINOR] help function and createentity train
Posted: Wed Jun 25, 2014 9:21 am
by cube
Thanks for the reports.
I added the missing help methods for 0.10.2.
the help methods are mehtods everywhere. you use it as a property only as an argument to pcall (it takes a function as an argument and calls it -- basically it adds the method call brackets by itself)
Train can be only placed on rails, that is a feature I changed the error message so that it doesn't sound so "unknown reason"
Re: [0.10.1 MINOR] help function and createentity train
Posted: Wed Jun 25, 2014 4:32 pm
by FreeER
cube wrote:I added the missing help methods for 0.10.2.
Awesome thanks!
cube wrote:you use it as a property only as an argument to pcall
...this makes me feel like an idiot now
cube wrote:Train can be only placed on rails, that is a feature
I did assume that Of course it could be argued that mining drills 'can only be placed on ore' but I wouldn't really want that implemented in createentity A more descriptive error message which was the reason I mentioned it though, so thanks for that too
Re: [0.10.1 MINOR] help function and createentity train
Posted: Thu Jun 26, 2014 8:33 am
by cube
FreeER wrote:A more descriptive error message which was the reason I mentioned it though, so thanks for that too
It won't be more descriptive, it just won't say that it is an unknown reason