Cancellable events

Things that we aren't going to implement
Post Reply
maciekmm
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Jul 20, 2015 10:22 am
Contact:

Cancellable events

Post by maciekmm »

Make cancelling events (reverting actions) possible. I'm aware this can cause many issues, but would be very handy to make protection mods for public servers for example.

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Cancellable events

Post by daniel34 »

I'm not sure what you mean by cancelling events / reverting actions. The gameplay in Factorio is deterministic, it reevaluates the game state 60 times per second. You can't just cancel one event/action and still continue with the game, because the outcome of that cancellation would render the future gamestates different, and therefore invalid. The only thing you can do is revert to an earlier autosave. Mods don't have the ability to do that (and probably never will).
How would these protection mods you are talking about work? What is their purpose? You can already protect a server by disabling console commands.
(Well, you could write a mod that prevents you from deconstructing the whole base or parts of it, but how do you know this action wasn't done on goodwill because they wanted to redo the layout?)
quick links: log file | graphical issues | wiki

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

Re: Cancellable events

Post by Ranakastrasz »

Sounds more like he wants to be able to register a particular action a player takes and if it meets some criteria, block it, or revert it or something.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: Cancellable events

Post by StanFear »

yeah like being able, when an entity is being mined (in on_robot_pre_mined for instance) to be able to do something like envent.canceled = true

then the robot would not get the item, and the entity would still be there

obviously, all events can't be reversible, like on_train_changed_state

but only the actions made by the player and robots would be greate already !

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Cancellable events

Post by Klonan »

maciekmm wrote:Make cancelling events (reverting actions) possible. I'm aware this can cause many issues, but would be very handy to make protection mods for public servers for example.
Theres no need for a separate event as there is a fairly simple way to implement this without cancelling the event (which can't be cancelled really because it happens in a single tick)

First there is forces support, which prevents mining of entities if they are from different forces (you can also set global mining speed for each force)
Second you can script so that when an entity is mined, you can check if the player mining it is the 'owner' of the entity, and if not, then place the entity back down where it was (and remove the mined item from the players inventory)

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: Cancellable events

Post by StanFear »

Klonan wrote:First there is forces support, which prevents mining of entities if they are from different forces (you can also set global mining speed for each force)
Second you can script so that when an entity is mined, you can check if the player mining it is the 'owner' of the entity, and if not, then place the entity back down where it was (and remove the mined item from the players inventory)
well there are these options obviously, but they are tedious to implement and could make a difference CPU wise, right ?

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Cancellable events

Post by Klonan »

StanFear wrote:
Klonan wrote:First there is forces support, which prevents mining of entities if they are from different forces (you can also set global mining speed for each force)
Second you can script so that when an entity is mined, you can check if the player mining it is the 'owner' of the entity, and if not, then place the entity back down where it was (and remove the mined item from the players inventory)
well there are these options obviously, but they are tedious to implement and could make a difference CPU wise, right ?
Well not really...

Theres also the option to make a small 'tool' an admin can hold in their hand, with this you can set entities to 'mineable = false' and 'destructible = false' to prevent griefing, this would be a pretty foolproof, easy and cpu efficient way to prevent trolls in your servers.

Post Reply

Return to “Won't implement”