on_player_main_inventory_changed unreliable
Posted: Sun Jan 12, 2020 4:39 pm
I'm trying to determine when a bot takes an item out of my hand
To achieve this, i registered some events for on_player_main_inventory_changed, on_player_cursor_stack_changed and on_player_fast_transferred
Then i wrote an on_tick script that compares the last-registered on_player_main_inventory_changed and on_player_cursor_stack_changed ticks and makes sure the player didn't fast-transfer something on the same tick.
But when i proceeded to test my system with concrete, i often got items taken out of my hand without the scripts noticing. (randomly)
After further investigation, i found out that the on_player_main_inventory_changed event didn't fire reliably
I also disabled all other mods to make sure no other mod was swallowing the events, like when a mod destroys a robot on a robot_built event.
i attached the mods, to test you might need to sell a few reactors for some money first and toggle the checkbox next to the red + green buttons in the crafting menu
let me know if you need more information or different testing methods
i dont remember anymore why i monitored both events but it looks like i can solve my problem without the main_inventory_changed event.
still it would be really nice if all events were reliable
To achieve this, i registered some events for on_player_main_inventory_changed, on_player_cursor_stack_changed and on_player_fast_transferred
Then i wrote an on_tick script that compares the last-registered on_player_main_inventory_changed and on_player_cursor_stack_changed ticks and makes sure the player didn't fast-transfer something on the same tick.
But when i proceeded to test my system with concrete, i often got items taken out of my hand without the scripts noticing. (randomly)
After further investigation, i found out that the on_player_main_inventory_changed event didn't fire reliably
I also disabled all other mods to make sure no other mod was swallowing the events, like when a mod destroys a robot on a robot_built event.
i attached the mods, to test you might need to sell a few reactors for some money first and toggle the checkbox next to the red + green buttons in the crafting menu
let me know if you need more information or different testing methods
i dont remember anymore why i monitored both events but it looks like i can solve my problem without the main_inventory_changed event.
still it would be really nice if all events were reliable