typed-factorio 0.5.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ interface CustomInputEvent {
15
15
  /** Information about the prototype that is selected when the custom input is used. `nil` if none is selected. */
16
16
  readonly selected_prototype?: SelectedPrototypeData
17
17
  /** Identifier of the event */
18
- readonly name: defines.events
18
+ readonly name: string
19
19
  /** Tick the event was generated. */
20
20
  readonly tick: uint
21
21
  }
@@ -347,6 +347,8 @@ interface OnCutsceneCancelledEvent {
347
347
  *
348
348
  * This refers to an index in the table previously passed to set_controller which started the cutscene.
349
349
  *
350
+ * **Note**: Due to implementation omission, waypoint_index is 0-based.
351
+ *
350
352
  * {@link https://lua-api.factorio.com/next/Events.html#on_cutscene_waypoint_reached View documentation}
351
353
  */
352
354
  interface OnCutsceneWaypointReachedEvent {
@@ -2959,201 +2961,16 @@ interface ScriptRaisedSetTilesEvent {
2959
2961
  readonly tick: uint
2960
2962
  }
2961
2963
 
2962
- interface EventTypes {
2963
- [defines.events.on_tick]: OnTickEvent
2964
- [defines.events.on_gui_click]: OnGuiClickEvent
2965
- [defines.events.on_gui_confirmed]: OnGuiConfirmedEvent
2966
- [defines.events.on_gui_text_changed]: OnGuiTextChangedEvent
2967
- [defines.events.on_gui_checked_state_changed]: OnGuiCheckedStateChangedEvent
2968
- [defines.events.on_entity_died]: OnEntityDiedEvent
2969
- [defines.events.on_post_entity_died]: OnPostEntityDiedEvent
2970
- [defines.events.on_entity_damaged]: OnEntityDamagedEvent
2971
- [defines.events.on_picked_up_item]: OnPickedUpItemEvent
2972
- [defines.events.on_built_entity]: OnBuiltEntityEvent
2973
- [defines.events.on_sector_scanned]: OnSectorScannedEvent
2974
- [defines.events.on_player_mined_item]: OnPlayerMinedItemEvent
2975
- [defines.events.on_pre_build]: OnPreBuildEvent
2976
- [defines.events.on_rocket_launched]: OnRocketLaunchedEvent
2977
- [defines.events.on_pre_player_mined_item]: OnPrePlayerMinedItemEvent
2978
- [defines.events.on_chunk_generated]: OnChunkGeneratedEvent
2979
- [defines.events.on_player_crafted_item]: OnPlayerCraftedItemEvent
2980
- [defines.events.on_robot_built_entity]: OnRobotBuiltEntityEvent
2981
- [defines.events.on_robot_pre_mined]: OnRobotPreMinedEvent
2982
- [defines.events.on_robot_mined]: OnRobotMinedEvent
2983
- [defines.events.on_research_started]: OnResearchStartedEvent
2984
- [defines.events.on_research_finished]: OnResearchFinishedEvent
2985
- [defines.events.on_research_reversed]: OnResearchReversedEvent
2986
- [defines.events.on_player_rotated_entity]: OnPlayerRotatedEntityEvent
2987
- [defines.events.on_marked_for_deconstruction]: OnMarkedForDeconstructionEvent
2988
- [defines.events.on_cancelled_deconstruction]: OnCancelledDeconstructionEvent
2989
- [defines.events.on_trigger_created_entity]: OnTriggerCreatedEntityEvent
2990
- [defines.events.on_trigger_fired_artillery]: OnTriggerFiredArtilleryEvent
2991
- [defines.events.on_train_changed_state]: OnTrainChangedStateEvent
2992
- [defines.events.on_player_created]: OnPlayerCreatedEvent
2993
- [defines.events.on_resource_depleted]: OnResourceDepletedEvent
2994
- [defines.events.on_player_driving_changed_state]: OnPlayerDrivingChangedStateEvent
2995
- [defines.events.on_force_created]: OnForceCreatedEvent
2996
- [defines.events.on_forces_merging]: OnForcesMergingEvent
2997
- [defines.events.on_player_cursor_stack_changed]: OnPlayerCursorStackChangedEvent
2998
- [defines.events.on_pre_entity_settings_pasted]: OnPreEntitySettingsPastedEvent
2999
- [defines.events.on_entity_settings_pasted]: OnEntitySettingsPastedEvent
3000
- [defines.events.on_player_main_inventory_changed]: OnPlayerMainInventoryChangedEvent
3001
- [defines.events.on_player_armor_inventory_changed]: OnPlayerArmorInventoryChangedEvent
3002
- [defines.events.on_player_ammo_inventory_changed]: OnPlayerAmmoInventoryChangedEvent
3003
- [defines.events.on_player_gun_inventory_changed]: OnPlayerGunInventoryChangedEvent
3004
- [defines.events.on_player_placed_equipment]: OnPlayerPlacedEquipmentEvent
3005
- [defines.events.on_player_removed_equipment]: OnPlayerRemovedEquipmentEvent
3006
- [defines.events.on_pre_player_died]: OnPrePlayerDiedEvent
3007
- [defines.events.on_player_died]: OnPlayerDiedEvent
3008
- [defines.events.on_player_respawned]: OnPlayerRespawnedEvent
3009
- [defines.events.on_player_joined_game]: OnPlayerJoinedGameEvent
3010
- [defines.events.on_player_left_game]: OnPlayerLeftGameEvent
3011
- [defines.events.on_player_built_tile]: OnPlayerBuiltTileEvent
3012
- [defines.events.on_player_mined_tile]: OnPlayerMinedTileEvent
3013
- [defines.events.on_robot_built_tile]: OnRobotBuiltTileEvent
3014
- [defines.events.on_robot_mined_tile]: OnRobotMinedTileEvent
3015
- [defines.events.on_player_selected_area]: OnPlayerSelectedAreaEvent
3016
- [defines.events.on_player_alt_selected_area]: OnPlayerAltSelectedAreaEvent
3017
- [defines.events.on_player_changed_surface]: OnPlayerChangedSurfaceEvent
3018
- [defines.events.on_selected_entity_changed]: OnSelectedEntityChangedEvent
3019
- [defines.events.on_market_item_purchased]: OnMarketItemPurchasedEvent
3020
- [defines.events.on_player_dropped_item]: OnPlayerDroppedItemEvent
3021
- [defines.events.on_biter_base_built]: OnBiterBaseBuiltEvent
3022
- [defines.events.on_player_changed_force]: OnPlayerChangedForceEvent
3023
- [defines.events.on_entity_renamed]: OnEntityRenamedEvent
3024
- [defines.events.on_gui_selection_state_changed]: OnGuiSelectionStateChangedEvent
3025
- [defines.events.on_runtime_mod_setting_changed]: OnRuntimeModSettingChangedEvent
3026
- [defines.events.on_difficulty_settings_changed]: OnDifficultySettingsChangedEvent
3027
- [defines.events.on_surface_created]: OnSurfaceCreatedEvent
3028
- [defines.events.on_surface_deleted]: OnSurfaceDeletedEvent
3029
- [defines.events.on_pre_surface_deleted]: OnPreSurfaceDeletedEvent
3030
- [defines.events.on_player_mined_entity]: OnPlayerMinedEntityEvent
3031
- [defines.events.on_robot_mined_entity]: OnRobotMinedEntityEvent
3032
- [defines.events.on_train_created]: OnTrainCreatedEvent
3033
- [defines.events.on_gui_elem_changed]: OnGuiElemChangedEvent
3034
- [defines.events.on_player_setup_blueprint]: OnPlayerSetupBlueprintEvent
3035
- [defines.events.on_player_deconstructed_area]: OnPlayerDeconstructedAreaEvent
3036
- [defines.events.on_player_configured_blueprint]: OnPlayerConfiguredBlueprintEvent
3037
- [defines.events.on_console_chat]: OnConsoleChatEvent
3038
- [defines.events.on_console_command]: OnConsoleCommandEvent
3039
- [defines.events.on_player_removed]: OnPlayerRemovedEvent
3040
- [defines.events.on_pre_player_removed]: OnPrePlayerRemovedEvent
3041
- [defines.events.on_player_used_capsule]: OnPlayerUsedCapsuleEvent
3042
- [defines.events.script_raised_built]: ScriptRaisedBuiltEvent
3043
- [defines.events.script_raised_destroy]: ScriptRaisedDestroyEvent
3044
- [defines.events.script_raised_revive]: ScriptRaisedReviveEvent
3045
- [defines.events.script_raised_set_tiles]: ScriptRaisedSetTilesEvent
3046
- [defines.events.on_player_promoted]: OnPlayerPromotedEvent
3047
- [defines.events.on_player_demoted]: OnPlayerDemotedEvent
3048
- [defines.events.on_combat_robot_expired]: OnCombatRobotExpiredEvent
3049
- [defines.events.on_worker_robot_expired]: OnWorkerRobotExpiredEvent
3050
- [defines.events.on_player_changed_position]: OnPlayerChangedPositionEvent
3051
- [defines.events.on_mod_item_opened]: OnModItemOpenedEvent
3052
- [defines.events.on_gui_opened]: OnGuiOpenedEvent
3053
- [defines.events.on_gui_closed]: OnGuiClosedEvent
3054
- [defines.events.on_gui_value_changed]: OnGuiValueChangedEvent
3055
- [defines.events.on_player_muted]: OnPlayerMutedEvent
3056
- [defines.events.on_player_unmuted]: OnPlayerUnmutedEvent
3057
- [defines.events.on_player_cheat_mode_enabled]: OnPlayerCheatModeEnabledEvent
3058
- [defines.events.on_player_cheat_mode_disabled]: OnPlayerCheatModeDisabledEvent
3059
- [defines.events.on_character_corpse_expired]: OnCharacterCorpseExpiredEvent
3060
- [defines.events.on_pre_ghost_deconstructed]: OnPreGhostDeconstructedEvent
3061
- [defines.events.on_player_pipette]: OnPlayerPipetteEvent
3062
- [defines.events.on_player_display_resolution_changed]: OnPlayerDisplayResolutionChangedEvent
3063
- [defines.events.on_player_display_scale_changed]: OnPlayerDisplayScaleChangedEvent
3064
- [defines.events.on_pre_player_crafted_item]: OnPrePlayerCraftedItemEvent
3065
- [defines.events.on_player_cancelled_crafting]: OnPlayerCancelledCraftingEvent
3066
- [defines.events.on_chunk_charted]: OnChunkChartedEvent
3067
- [defines.events.on_technology_effects_reset]: OnTechnologyEffectsResetEvent
3068
- [defines.events.on_force_reset]: OnForceResetEvent
3069
- [defines.events.on_land_mine_armed]: OnLandMineArmedEvent
3070
- [defines.events.on_forces_merged]: OnForcesMergedEvent
3071
- [defines.events.on_player_trash_inventory_changed]: OnPlayerTrashInventoryChangedEvent
3072
- [defines.events.on_pre_player_left_game]: OnPrePlayerLeftGameEvent
3073
- [defines.events.on_pre_surface_cleared]: OnPreSurfaceClearedEvent
3074
- [defines.events.on_surface_cleared]: OnSurfaceClearedEvent
3075
- [defines.events.on_chunk_deleted]: OnChunkDeletedEvent
3076
- [defines.events.on_pre_chunk_deleted]: OnPreChunkDeletedEvent
3077
- [defines.events.on_train_schedule_changed]: OnTrainScheduleChangedEvent
3078
- [defines.events.on_player_banned]: OnPlayerBannedEvent
3079
- [defines.events.on_player_kicked]: OnPlayerKickedEvent
3080
- [defines.events.on_player_unbanned]: OnPlayerUnbannedEvent
3081
- [defines.events.on_rocket_launch_ordered]: OnRocketLaunchOrderedEvent
3082
- [defines.events.on_script_path_request_finished]: OnScriptPathRequestFinishedEvent
3083
- [defines.events.on_ai_command_completed]: OnAiCommandCompletedEvent
3084
- [defines.events.on_marked_for_upgrade]: OnMarkedForUpgradeEvent
3085
- [defines.events.on_cancelled_upgrade]: OnCancelledUpgradeEvent
3086
- [defines.events.on_player_toggled_map_editor]: OnPlayerToggledMapEditorEvent
3087
- [defines.events.on_entity_cloned]: OnEntityClonedEvent
3088
- [defines.events.on_area_cloned]: OnAreaClonedEvent
3089
- [defines.events.on_brush_cloned]: OnBrushClonedEvent
3090
- [defines.events.on_game_created_from_scenario]: OnGameCreatedFromScenarioEvent
3091
- [defines.events.on_surface_imported]: OnSurfaceImportedEvent
3092
- [defines.events.on_surface_renamed]: OnSurfaceRenamedEvent
3093
- [defines.events.on_player_toggled_alt_mode]: OnPlayerToggledAltModeEvent
3094
- [defines.events.on_player_repaired_entity]: OnPlayerRepairedEntityEvent
3095
- [defines.events.on_player_fast_transferred]: OnPlayerFastTransferredEvent
3096
- [defines.events.on_pre_robot_exploded_cliff]: OnPreRobotExplodedCliffEvent
3097
- [defines.events.on_robot_exploded_cliff]: OnRobotExplodedCliffEvent
3098
- [defines.events.on_entity_spawned]: OnEntitySpawnedEvent
3099
- [defines.events.on_cutscene_waypoint_reached]: OnCutsceneWaypointReachedEvent
3100
- [defines.events.on_unit_group_created]: OnUnitGroupCreatedEvent
3101
- [defines.events.on_unit_added_to_group]: OnUnitAddedToGroupEvent
3102
- [defines.events.on_unit_removed_from_group]: OnUnitRemovedFromGroupEvent
3103
- [defines.events.on_unit_group_finished_gathering]: OnUnitGroupFinishedGatheringEvent
3104
- [defines.events.on_build_base_arrived]: OnBuildBaseArrivedEvent
3105
- [defines.events.on_chart_tag_added]: OnChartTagAddedEvent
3106
- [defines.events.on_chart_tag_modified]: OnChartTagModifiedEvent
3107
- [defines.events.on_chart_tag_removed]: OnChartTagRemovedEvent
3108
- [defines.events.on_lua_shortcut]: OnLuaShortcutEvent
3109
- [defines.events.on_gui_location_changed]: OnGuiLocationChangedEvent
3110
- [defines.events.on_gui_selected_tab_changed]: OnGuiSelectedTabChangedEvent
3111
- [defines.events.on_gui_switch_state_changed]: OnGuiSwitchStateChangedEvent
3112
- [defines.events.on_force_cease_fire_changed]: OnForceCeaseFireChangedEvent
3113
- [defines.events.on_force_friends_changed]: OnForceFriendsChangedEvent
3114
- [defines.events.on_string_translated]: OnStringTranslatedEvent
3115
- [defines.events.on_script_trigger_effect]: OnScriptTriggerEffectEvent
3116
- [defines.events.on_player_set_quick_bar_slot]: OnPlayerSetQuickBarSlotEvent
3117
- [defines.events.on_pre_player_toggled_map_editor]: OnPrePlayerToggledMapEditorEvent
3118
- [defines.events.on_pre_script_inventory_resized]: OnPreScriptInventoryResizedEvent
3119
- [defines.events.on_script_inventory_resized]: OnScriptInventoryResizedEvent
3120
- [defines.events.on_entity_destroyed]: OnEntityDestroyedEvent
3121
- [defines.events.on_player_clicked_gps_tag]: OnPlayerClickedGpsTagEvent
3122
- [defines.events.on_player_flushed_fluid]: OnPlayerFlushedFluidEvent
3123
- [defines.events.on_permission_group_edited]: OnPermissionGroupEditedEvent
3124
- [defines.events.on_pre_permission_string_imported]: OnPrePermissionStringImportedEvent
3125
- [defines.events.on_permission_string_imported]: OnPermissionStringImportedEvent
3126
- [defines.events.on_pre_permission_group_deleted]: OnPrePermissionGroupDeletedEvent
3127
- [defines.events.on_permission_group_deleted]: OnPermissionGroupDeletedEvent
3128
- [defines.events.on_permission_group_added]: OnPermissionGroupAddedEvent
3129
- [defines.events.on_cutscene_cancelled]: OnCutsceneCancelledEvent
3130
- [defines.events.on_player_configured_spider_remote]: OnPlayerConfiguredSpiderRemoteEvent
3131
- [defines.events.on_player_used_spider_remote]: OnPlayerUsedSpiderRemoteEvent
3132
- [defines.events.on_spider_command_completed]: OnSpiderCommandCompletedEvent
3133
- [defines.events.on_entity_logistic_slot_changed]: OnEntityLogisticSlotChangedEvent
3134
- [defines.events.on_equipment_inserted]: OnEquipmentInsertedEvent
3135
- [defines.events.on_equipment_removed]: OnEquipmentRemovedEvent
3136
- }
3137
-
3138
- interface EventFilters {
3139
- [defines.events.on_entity_died]: LuaEntityDiedEventFilter
3140
- [defines.events.on_post_entity_died]: LuaPostEntityDiedEventFilter
3141
- [defines.events.on_entity_damaged]: LuaEntityDamagedEventFilter
3142
- [defines.events.on_built_entity]: LuaPlayerBuiltEntityEventFilter
3143
- [defines.events.on_sector_scanned]: LuaSectorScannedEventFilter
3144
- [defines.events.on_pre_player_mined_item]: LuaPrePlayerMinedEntityEventFilter
3145
- [defines.events.on_robot_built_entity]: LuaRobotBuiltEntityEventFilter
3146
- [defines.events.on_robot_pre_mined]: LuaPreRobotMinedEntityEventFilter
3147
- [defines.events.on_marked_for_deconstruction]: LuaEntityMarkedForDeconstructionEventFilter
3148
- [defines.events.on_cancelled_deconstruction]: LuaEntityDeconstructionCancelledEventFilter
3149
- [defines.events.on_player_mined_entity]: LuaPlayerMinedEntityEventFilter
3150
- [defines.events.on_robot_mined_entity]: LuaRobotMinedEntityEventFilter
3151
- [defines.events.script_raised_built]: LuaScriptRaisedBuiltEventFilter
3152
- [defines.events.script_raised_destroy]: LuaScriptRaisedDestroyEventFilter
3153
- [defines.events.script_raised_revive]: LuaScriptRaisedReviveEventFilter
3154
- [defines.events.on_pre_ghost_deconstructed]: LuaPreGhostDeconstructedEventFilter
3155
- [defines.events.on_marked_for_upgrade]: LuaEntityMarkedForUpgradeEventFilter
3156
- [defines.events.on_cancelled_upgrade]: LuaUpgradeCancelledEventFilter
3157
- [defines.events.on_entity_cloned]: LuaEntityClonedEventFilter
3158
- [defines.events.on_player_repaired_entity]: LuaPlayerRepairedEntityEventFilter
2964
+ /** An event id. */
2965
+ type EventId<T extends table, F extends table | void = void> = uint & {
2966
+ readonly _eventData: T
2967
+ readonly _filter: F
2968
+ }
2969
+
2970
+ /**
2971
+ * An event id generated by {@link LuaBootstrap.generate_event_name LuaBootstrap::generate_event_name} and raisable via
2972
+ * {@link LuaBootstrap.raise_event LuaBootstrap::raise_event}.
2973
+ */
2974
+ type CustomEventId<T extends table> = EventId<T> & {
2975
+ _customEventIdBrand: any
3159
2976
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typed-factorio",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Featureful typescript definitions for the the Factorio modding lua api.",
5
5
  "keywords": [
6
6
  "factorio",
@@ -25,7 +25,8 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "lua-types": "^2.10.1",
28
- "typescript-to-lua": "^0.42.0"
28
+ "typescript": "~4.3.5",
29
+ "typescript-to-lua": "^1.0.0"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@types/jest": "^26.0.24",
@@ -33,7 +34,6 @@
33
34
  "jest": "^27.0.6",
34
35
  "prettier": "^2.3.2",
35
36
  "ts-jest": "^27.0.4",
36
- "ts-node": "^10.1.0",
37
- "typescript": "^4.3.5"
37
+ "ts-node": "^10.1.0"
38
38
  }
39
39
  }