Hi there, I noticed a bug while working on a mod of mine. In your on_runtime_mod_setting_changed handler (line 87), your code assumes that the event will have player_index, but player_index is nil when the mod setting is changed by script. A simple check for player_index == nil will fix it.
Screenshot: https://drive.google.com/open?id=1wNI-xDDbzVc2zECgQCx7CozZ_UgI675e