Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed "Error while running event Transport_Drones_Meglinge_Fork::on_entity_died (ID 4) LuaForce doesn't contain key kill_count_statistics." #57

Open
Aeside1 opened this issue Nov 9, 2024 · 0 comments

Comments

@Aeside1
Copy link

Aeside1 commented Nov 9, 2024

During my use of this mod, I encountered several crashes of kill_count_statistics due to the destruction of drone entities. After multiple occurrences, I attempted a simple fix.

Upon studying the Lua code for drones, I identified an issue in line 743 of transport_drone.lua based on the provided clash information. This drone mod was hastily adapted for Factorio 2.0, and as a result, the author neglected to update the kill_count_statistics code. In version 2.0, significant changes were made to the planet system (specifically Class LuaSurface), altering how kill_count_statistics is accessed; it can no longer be directly accessed via entity.kill_count_statistics but must instead use get_kill_count_statistics(Surface surface). The retained direct access from ported 1.1 code led to crashes.

Ultimately, I modified the code to utilize get_kill_count_statistics and passed entity.surface as an argument.

This is my first experience with Lua and fixing game code; any guidance would be appreciated...

I dont konw how to upload my code to github item,Here are the fixed mod :
https://drive.google.com/file/d/13i-LySxQOD8mzL_-8w-qQJnKP1MinVf2/view?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant