Option to not raise on_driving_state_changed

Things that already exist in the current mod API
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1647
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Option to not raise on_driving_state_changed

Post by Pi-C »

The destroy() method has these options
destroy(opts) → boolean

Destroys the entity.

Parameters
opts (optional): Table with the following fields:

do_cliff_correction :: boolean (optional): If neighbouring cliffs should be corrected. Defaults to false.
raise_destroy :: boolean (optional): If true; defines.events.script_raised_destroy will be called.
I'd like to have something like raise_destroy for set_driver() and set_passenger(), so that they don't raise the on_driving_state_changed event.

Reason: In this mod, I want to move vehicles with driver/passenger between surfaces. As only players can be moved with teleport(), I need to clone the vehicle to the new surface and then place driver/passenger inside it. Technically, they change the driving state because they leave one vehicle and enter another one. However, from the player's perspective, they would remain in the same vehicle, so not raising the event would mean not running (unnecessarily) a lot of code.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2242
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Option to not raise on_driving_state_changed

Post by boskid »

FactorioBot wrote:
Tue Oct 15, 2019 8:19 pm
Scripting
  • Added support to teleport car entity types between surfaces.
For now i will throw this request to Won't Implement because ability to teleport cars should solve your underlying issue.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1647
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Option to not raise on_driving_state_changed

Post by Pi-C »

boskid wrote:
Wed Oct 16, 2019 1:29 am
FactorioBot wrote:
Tue Oct 15, 2019 8:19 pm
Scripting
  • Added support to teleport car entity types between surfaces.
For now i will throw this request to Won't Implement because ability to teleport cars should solve your underlying issue.
Ooops, didn't see the announcement yet. Nice thing to wake up to! If cross-surface teleporting really works now, it would indeed solve the problem and simplify my code significantly. I'll try it out later, thanks! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Already exists”