Tony Hacks Pro Rails: Help planning API consumption

Place to get help with not working mods / modding interface.
Post Reply
cdaringe
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Mar 17, 2018 3:42 am
Contact:

Tony Hacks Pro Rails: Help planning API consumption

Post by cdaringe »

Hi all:

I've started my 2nd mod. The source code lives here: https://github.com/cdaringe/tony-hacks-pro-rails . I'm new to lua and factorio modding, so I thought it may be helpful to get a seasoned modder to help me navigate the factorio APIs.
Screen Shot 2018-07-02 at 11.50.33 PM.png
Screen Shot 2018-07-02 at 11.50.33 PM.png (167.24 KiB) Viewed 906 times
I'm looking for advice on what the ideal set of events/APIs would be to wire into to enable this mod.

The tentative workflow is as follows:
  • research skateboarding
  • buy skateboard weapon?
  • when holding SKATE_KEY? or firing "skateboard weapon" if near rail, init grinding
  • when holding SKATE_KEY? or firing "skateboard weapon" while grinding continue grinding
  • if grinding, pressing ALT_SKATE_KEY? inits a jump, which helps velocity increase
  • while grinding, track train rail position, move player along rail. (maybe i secretly init an invisible train somehow??)
if i make it that far, i may want to figure out how to load the board img and play skate effects!

anyway, im not sure what the best strategy. there don't seem to be generic keypress events listed here: https://lua-api.factorio.com/latest/, so any tips would be great! thanks!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Tony Hacks Pro Rails: Help planning API consumption

Post by eradicator »

Mmh...

An "invisible" locomotice would also be required to prevent trains from running you over while on rails. (No, your reaction time is not fast enough to manually get off the rail when a train rams you up front.)

So...make the skateboard a not-so-invisible train, automatically accelerate the train, forget about jumping as you don't have an animation for that anyway.

Keys: https://wiki.factorio.com/Prototype/CustomInput
Also factorio has no concept of "holding down" a key. You only get a one-tick event for pressing it down. So maybe consecutive presses? (I don't like click/key spamming :p).

What game stage is that for? It would need to be faster than at least 5 exos to be worth it in endgame.

Also personally i never think about graphics last. If you can't make it look half-way decent, it's gonna end up as Tony Awkwards.

Conclusion:
Interesting idea, but there's lots of technical and conceptual things that need to be worked out.

cdaringe
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Mar 17, 2018 3:42 am
Contact:

Re: Tony Hacks Pro Rails: Help planning API consumption

Post by cdaringe »

Thanks for the input.

- i'm perfectly ok getting run over by the train :) i have another mod for prevent train death
- thx for the info on custom input
- "What game stage is that for?" early. however, if i was playing around with the idea of adding a "jump" move whilst grinding that would allow the user to accelerate themselves

Post Reply

Return to “Modding help”