Page 1 of 1
[15.10] on_robot_mined_entity event doesn't always trigger
Posted: Fri May 12, 2017 5:26 pm
by Ahsous
Hello,
I wrote a mod that uses the on_robot_mined_entity event and noticed that this event doesn't trigger when deconstructing entities that are close to the player.
When I deconstruct entities that are close to the player the construction robots don't really fly to the entity but instead just pop up above the player and vanish shortly after.
I wrote a simply mod that outputs test to the console when the event is triggered:
Code: Select all
script.on_event(defines.events.on_robot_mined_entity, function(event)
game.print("test")
end)
Cheers,
Ahsous
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Fri May 12, 2017 6:45 pm
by Rseding91
Yes it does. You're printing the same message over and over which hits the spam prevention and doesn't show the extra messages since they're all identical.
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 10:28 am
by kikker450
Rseding91 wrote:Yes it does. You're printing the same message over and over which hits the spam prevention and doesn't show the extra messages since they're all identical.
Quick side question, I've searched through the forums (on "spam prevention") and looked through the settings ingame but is there a way to turn spam prevention off?
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 4:33 pm
by Bilka
Just print something that always changes, such as game.tick.
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 5:25 pm
by Ahsous
I don't think this has something to do with spam protection (since it's that way on the first message too and I don't send that many messages anyway)
I uploaded a video showcasing it (with printing game.tick instead of "test"):
https://www.youtube.com/watch?v=lnac6cc ... e=youtu.be
As you can see I don't get a message on entities that are right next to the player.
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 6:08 pm
by Klonan
Ahsous wrote:I don't think this has something to do with spam protection (since it's that way on the first message too and I don't send that many messages anyway)
I uploaded a video showcasing it (with printing game.tick instead of "test"):
https://www.youtube.com/watch?v=lnac6cc ... e=youtu.be
As you can see I don't get a message on entities that are right next to the player.
Use game.write_file, which doesn't prevent a spam of messages, to make sure it truly isn't triggering
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 6:20 pm
by gheift
or as an alternative you can use this
Code: Select all
local debug_idx = 0
script.on_event(defines.events.on_robot_mined_entity, function(event)
game.print("test (" .. debug_idx .. ")")
print("test (" .. debug_idx .. ")") -- this prints to the console/stdout, at least under linux
debug_idx = debug_idx + 1
end)
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 6:32 pm
by Ahsous
Using:
Code: Select all
script.on_event(defines.events.on_robot_mined_entity, function(event)
game.write_file("bugTest.txt", tostring(game.tick) .. "\n", true)
game.print(game.tick)
end)
https://www.youtube.com/watch?v=Iz0pN0Q ... e=youtu.be
Results in the following bugTest.txt:
14569890
14570062
14570774
Same numbers as the ingame output even if I cut more than 3 trees (in 3 different steps).
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 7:00 pm
by Klonan
Ahsous wrote:Using:
Code: Select all
script.on_event(defines.events.on_robot_mined_entity, function(event)
game.write_file("bugTest.txt", tostring(game.tick) .. "\n", true)
game.print(game.tick)
end)
https://www.youtube.com/watch?v=Iz0pN0Q ... e=youtu.be
Results in the following bugTest.txt:
14569890
14570062
14570774
Same numbers as the ingame output even if I cut more than 3 trees (in 3 different steps).
I tested by deconstructing 10 trees near me, and the log output shows 10 trees were deconstructed
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 7:07 pm
by Rseding91
The videos you've uploaded are private so I can't see them.
When I test it myself it produces exactly as it should:
http://imgur.com/a/WVlxn
Code: Select all
script.on_event(defines.events.on_robot_mined_entity, function(event)
log(event.tick)
end)
Re: [15.10] on_robot_mined_entity event doesn't always trigger
Posted: Sat May 13, 2017 7:20 pm
by Ahsous
Oh god, I should've tested it without any mods active.
I had the mod Bluebuild installed (and forgot about it after getting bots). That mod deconstructs stuff without bots (and instantly removes entities around the player). That's why it looked like the bot came out of the player and instantly returned (I made the videos public now btw).
The event works like intended, sorry that I wasted your time
