[0.13.1] Lua event triggering incorrectly

Bugs that are actually features.
Post Reply
barrykun
Inserter
Inserter
Posts: 27
Joined: Tue Jun 07, 2016 7:42 pm
Contact:

[0.13.1] Lua event triggering incorrectly

Post by barrykun »

The event on_preplayer_mined_item is fired when mining is complete while the description says "Called when the player starts mining something."

Rseding91
Factorio Staff
Factorio Staff
Posts: 13861
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.1] Lua event triggering incorrectly

Post by Rseding91 »

The description is wrong - the event is correct.

It's called right before the entity is fully mined after the progress bar has hit 100%.
If you want to get ahold of me I'm almost always on Discord.

barrykun
Inserter
Inserter
Posts: 27
Joined: Tue Jun 07, 2016 7:42 pm
Contact:

Re: [0.13.1] Lua event triggering incorrectly

Post by barrykun »

In that case, is there any event to check permissions for mining? Lets say *player starts mining entity* check who placed the entity, does this person have permission to mine that? if not cancel the action. I thought I could do that with this event, that's what the name/description would suggest. How can that be solved?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13861
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.1] Lua event triggering incorrectly

Post by Rseding91 »

No, Factorio doesn't have any kind of permissions system like that.

Whitelist your server and don't let people join that you don't want to join until the day we might implement such a thing (unlikely).
If you want to get ahold of me I'm almost always on Discord.

barrykun
Inserter
Inserter
Posts: 27
Joined: Tue Jun 07, 2016 7:42 pm
Contact:

Re: [0.13.1] Lua event triggering incorrectly

Post by barrykun »

Sorry I think you misunderstood me, the white-list was just an example. and it would not be kept by server it would be kept by the mod.

Like not deconstructing entities that you did not make?

Code: Select all

script.on_event(defines.events.on_preplayer_mined_item, function(event) -- obviously wrong event by the way it works
  if event.entity.built_by ~= game.players[event.player_index].name then
    return false; -- no idea how to tell the game to cancel the action
  end
end)
This code snippet has two flaws, obviously. But don't you think this should be possible? This topic is probably heading more towards suggestion then bug report, sorry about that.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13861
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.1] Lua event triggering incorrectly

Post by Rseding91 »

Factorio doesn't currently support any kind of event cancellation.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Not a bug”