Cancellable events
Cancellable events
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.
Re: Cancellable events
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?)
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?)
- Ranakastrasz
- Smart Inserter
- Posts: 2174
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: Cancellable events
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
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Re: Cancellable events
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 !
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 !
Re: Cancellable events
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)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.
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)
Re: Cancellable events
well there are these options obviously, but they are tedious to implement and could make a difference CPU wise, right ?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)
Re: Cancellable events
Well not really...StanFear wrote:well there are these options obviously, but they are tedious to implement and could make a difference CPU wise, right ?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)
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.