Trying to intercept/get wasd input, for alternate car controls.

Place to get help with not working mods / modding interface.
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2165
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Trying to intercept/get wasd input, for alternate car controls.

Post by Ranakastrasz »

So, The idea was pretty much to make a mod that did the cardinal car controls. However, getting the WASD keys isn't directly possible. I tried several ideas, and have a few more, but actually doing some of them is beyond me,

Capture "walking.direction" - only works with character, not when in vehicle.
Capture "player.riding_state" - Works, but I have to set this to alter Car behavior, which causes it to not work. - Current file displays this.
Hotkeys - Only registers keypressed, not holds or releases.

Options that might work.
- Override car behavior entirely. Not actually sure if there is a way to set the acceleration/turning without overriding controls. Might be able to do an on-tick manually cancel out movement (or set acceleration/turning to 0 or infinitesimal) and manually set the location of the car each tick. But I dont actually know how the car has to behave precisely, and those kinds of things tend to hog update cycles.

- Dummy player. Somehow add a dummy player/car that the player controls, rather than the actual vehicle, which can "Move" enough for the direction/riding_state to be set, captured, and not overridden by the car's instructions. Also probably needs to handle 2 players in a car and weapon control and inventory crap and so on, but might be possible.

-Capture Actual keypresses/holds/releases. Can't, API denied, for latency/performance reasons. Wish I could register as hotkeys anways.

Any other ideas, or ideas on how I might get one of the two ideas to work? Or am I missing something obvious?
Attachments
VehicleTurn_1.0.0.zip
(48.12 KiB) Downloaded 12 times
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Bilka
Factorio Staff
Factorio Staff
Posts: 3300
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Trying to intercept/get wasd input, for alternate car controls.

Post by Bilka »

I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2165
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Trying to intercept/get wasd input, for alternate car controls.

Post by Ranakastrasz »

Yea. However, it also has no collisions, different movement, no turn radius, and weird graphics (bouncy, preemptive turning as a side effect)

Might have collision, but no collision damage would have to check on that part.

Edit:

The idea was to got as close as physically possible to purely altering the control scheme, while leaving literally everything else untouched. So turn radius, collision, acceleration, appearance.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
jamiechi1
Fast Inserter
Fast Inserter
Posts: 247
Joined: Wed Jan 03, 2018 10:12 pm

Re: Trying to intercept/get wasd input, for alternate car controls.

Post by jamiechi1 »

You don't want to just look at wasd. Many of us use the arrow keys.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2165
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Trying to intercept/get wasd input, for alternate car controls.

Post by Ranakastrasz »

Arrow or WASD. Doesn't matter. I just want to be able to change car controls to polar controls. Ideally it would work with wasd and arrow keys, just the same.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Post Reply

Return to “Modding help”