PyroFire wrote: Thu Dec 19, 2019 9:32 am
... What? This sounds like nonsense.
Code: Select all
defines = {
...
events = {
on_ai_command_completed = 113,
on_area_cloned = 118,
on_biter_base_built = 55,
on_built_entity = 6,
on_cancelled_deconstruction = 21,
on_cancelled_upgrade = 115,
on_character_corpse_expired = 90,
on_chart_tag_added = 135,
on_chart_tag_modified = 136,
on_chart_tag_removed = 137,
on_chunk_charted = 98,
on_chunk_deleted = 106,
on_chunk_generated = 12,
on_combat_robot_expired = 80,
on_console_chat = 71,
on_console_command = 72,
on_cutscene_waypoint_reached = 33,
on_difficulty_settings_changed = 60,
on_entity_cloned = 117,
on_entity_damaged = 97,
on_entity_died = 4,
on_entity_renamed = 57,
on_entity_settings_pasted = 31,
on_entity_spawned = 129,
on_force_cease_fire_changed = 143,
on_force_created = 27,
on_force_friends_changed = 142,
on_forces_merged = 101,
on_forces_merging = 28,
on_game_created_from_scenario = 119,
on_gui_checked_state_changed = 3,
on_gui_click = 1,
on_gui_closed = 84,
on_gui_confirmed = 138,
on_gui_elem_changed = 67,
on_gui_location_changed = 139,
on_gui_opened = 83,
on_gui_selected_tab_changed = 140,
on_gui_selection_state_changed = 58,
on_gui_switch_state_changed = 141,
on_gui_text_changed = 2,
on_gui_value_changed = 85,
on_land_mine_armed = 100,
on_lua_shortcut = 34,
on_marked_for_deconstruction = 20,
on_marked_for_upgrade = 114,
on_market_item_purchased = 53,
on_mod_item_opened = 82,
on_picked_up_item = 5,
on_player_alt_selected_area = 50,
on_player_ammo_inventory_changed = 36,
on_player_armor_inventory_changed = 35,
on_player_banned = 108,
on_player_built_tile = 45,
on_player_cancelled_crafting = 96,
on_player_changed_force = 56,
on_player_changed_position = 81,
on_player_changed_surface = 51,
on_player_cheat_mode_disabled = 89,
on_player_cheat_mode_enabled = 88,
on_player_configured_blueprint = 70,
on_player_crafted_item = 13,
on_player_created = 24,
on_player_cursor_stack_changed = 29,
on_player_deconstructed_area = 69,
on_player_demoted = 76,
on_player_died = 41,
on_player_display_resolution_changed = 93,
on_player_display_scale_changed = 94,
on_player_driving_changed_state = 26,
on_player_dropped_item = 54,
on_player_fast_transferred = 124,
on_player_gun_inventory_changed = 37,
on_player_joined_game = 43,
on_player_kicked = 109,
on_player_left_game = 44,
on_player_main_inventory_changed = 32,
on_player_mined_entity = 65,
on_player_mined_item = 8,
on_player_mined_tile = 46,
on_player_muted = 86,
on_player_pipette = 92,
on_player_placed_equipment = 38,
on_player_promoted = 75,
on_player_removed = 73,
on_player_removed_equipment = 39,
on_player_repaired_entity = 123,
on_player_respawned = 42,
on_player_rotated_entity = 19,
on_player_selected_area = 49,
on_player_setup_blueprint = 68,
on_player_toggled_alt_mode = 122,
on_player_toggled_map_editor = 116,
on_player_trash_inventory_changed = 102,
on_player_unbanned = 110,
on_player_unmuted = 87,
on_player_used_capsule = 74,
on_post_entity_died = 128,
on_pre_chunk_deleted = 125,
on_pre_entity_settings_pasted = 30,
on_pre_ghost_deconstructed = 91,
on_pre_player_crafted_item = 95,
on_pre_player_died = 40,
on_pre_player_left_game = 103,
on_pre_player_mined_item = 11,
on_pre_player_removed = 130,
on_pre_robot_exploded_cliff = 126,
on_pre_surface_cleared = 105,
on_pre_surface_deleted = 63,
on_put_item = 9,
on_research_finished = 18,
on_research_started = 17,
on_resource_depleted = 25,
on_robot_built_entity = 14,
on_robot_built_tile = 47,
on_robot_exploded_cliff = 127,
on_robot_mined = 16,
on_robot_mined_entity = 64,
on_robot_mined_tile = 48,
on_robot_pre_mined = 15,
on_rocket_launch_ordered = 111,
on_rocket_launched = 10,
on_runtime_mod_setting_changed = 59,
on_script_path_request_finished = 112,
on_sector_scanned = 7,
on_selected_entity_changed = 52,
on_string_translated = 144,
on_surface_cleared = 104,
on_surface_created = 61,
on_surface_deleted = 62,
on_surface_imported = 120,
on_surface_renamed = 121,
on_technology_effects_reset = 99,
on_tick = 0,
on_train_changed_state = 23,
on_train_created = 66,
on_train_schedule_changed = 107,
on_trigger_created_entity = 22,
on_trigger_fired_artillery = 134,
on_unit_added_to_group = 132,
on_unit_group_created = 131,
on_unit_removed_from_group = 133,
script_raised_built = 77,
script_raised_destroy = 78,
script_raised_revive = 79
},
...
I can act on an event being present or not present.
It's almost like you're posting without actually reading the thread or informing yourself of what's being discussed just to get your post count up for the sake of having a post count:
Rseding91 wrote: Tue Nov 12, 2019 11:18 am
I was thinking about what it would take to check everything passed through rase_event and it's just not a task that I think any sane human would want to sign up for. There are currently 144 events. The checks for all of them on the C++ side is around 3000 lines of code and that's not counting all of the functions they call themselves. The Lua version is typically 4 times larger due to all the mechanics of interacting with Lua data on the C++ side.
That's (at a guess) around 12'000 lines of code that someone would have to write all just to handle the rotten-eggs case of mods doing things wrong.
That doesn't make sense to me to do.
As long as the events API page is accurate, I'm already writing a parser to convert it to LUA, so each "Contains" requirement does actually contain what it does, only what it is supposed to, and all the types match. Pretty easy to do, tbh. Work smarter not harder. One a skeleton is done, anyone can c+p for their own validation library (out and in), and it's proof it's not a stupid concept to validate your damn data when they already do it all over the place.
You seem to not understand what's being discussed here (the removal of script.raise_event), nor why it is being discussed.
I could explain it here again, but i'm not going to because it has been discussed and explained at length over the past few pages.
But then, it was brought up that we have no way to verify anything given to us from script.raise_event and it got me thinking that it would be nice to change how script.raise_event works.
Unless that is not what the topic was, correct me.
entity.damage raises on_entity_damaged internally.
What's the issue?
What's wrong with on_player_changed_position and on_player_changed_surface?
Again, you have not given any reason why those events need to be script.raise_event'd.
damage has a useful function for it (not near the define at all of course), but what about movement? built? Does every single event have a corresponding function we can use to trigger the raising of that event?
on_player_changed_position will be triggered constantly, and on_player_changed_surface is not necessary for a character to be teleported. You're the warptorio2 dev and you can't imagine
any reason someone would want to know when someone teleported without having to check every single movement? Ironically, on_player_changed_position doesn't fire if the player moved surface but stayed at the same position. Funny.
These always fire for non-character actions too, and without explicitly checking for a blueprint in their cursor, I can't act on it. Even when I know they had a blueprint tool, I have to check where they aimed it, go through the blueprint, procedurally determine the bounds of the blueprint, map it to a real area, and work from there, instead of a single event that tells me where they pointed it and the area it consumed immediately. An example for this for is when people don't want cliffs deconstructed with blueprints. I have to use janky workarounds, and this is only for cliff entities. If someone wanted to act on blueprinting without jumping through all the hoops, I could raise an on_character_used_blueprint event, and pass the information to them, without remote interfacing or them having to implement any of my code.
You clearly didn't read the thread. Mods like bluebuild need script.raise_event to simulate certain player actions.
Code: Select all
script_raised_built = 77,
script_raised_destroy = 78,
script_raised_revive = 79
Are you srs. Do you think bluebuild should be explicitly forbidden from raising base-game events like on_put_item, entity.destroy, and entity.revive? I already have enough arguments with the devs implementing things consistently, and as-is, we can generate base events, and if that is taken away, we're either stuck with raising no events, using what will be a limited selection of actions to trigger events, or raising custom events that nobody is going to listen to.