---Returns one or many values matching the type or subtypes of the requested field. Reports error and returns nil if the field type is not supported or field was not found.
---Sets the value of a field. Value(s) should have a type matching the field type. Reports error if the values weren't given in correct type, the field type is not supported, or the component does not exist.
---Returns one or many values matching the type or subtypes of the requested field in a component subobject. Reports error and returns nil if the field type is not supported or 'object_name' is not a metaobject.
---Sets the value of a field in a component subobject. Value(s) should have a type matching the field type. Reports error if the values weren't given in correct type, the field type is not supported or 'object_name' is not a metaobject.
---Creates a component of type 'component_type_name' and adds it to 'entity_id'. 'table_of_component_values' should be a string-indexed table, where keys are field names and values are field values of correct type. The value setting works like ComponentObjectSetValue2(), with the exception that multivalue types are not supported. Additional supported values are _tags:comma_separated_string and _enabled:bool, which basically work like the those fields work in entity XML files. Returns the created component, if creation succeeded, or nil.
---Can be used to read biome configs. Returns one or many values matching the type or subtypes of the requested field. Reports error and returns nil if the field type is not supported or field was not found.
---@param filename string
---@param field_name string
---@return any
functionBiomeGetValue(filename,field_name)end
---Can be used to edit biome configs during initialization. See biome_modifiers.lua for an usage example.
---Can be used to edit biome config MaterialComponents during initialization. Sets the given value in all found VegetationComponent with matching tree_material. See biome_modifiers.lua for an usage example.
---Can be used to edit biome config MaterialComponents during initialization. Sets the given value in the first found MaterialComponent with matching material_name. See biome_modifiers.lua for an usage example.
---Can be used to read biome config MaterialComponents during initialization. Returns the given value in the first found MaterialComponent with matching material_name. See biome_modifiers.lua for an usage example.
---Returns the camera rectangle. This may not be 100% pixel perfect with regards to what you see on the screen. 'x','y' = top left corner of the rectangle.
---'shooter_entity' can be 0. Warning: If 'projectile_entity' has PhysicsBodyComponent and ItemComponent, components without the "enabled_in_world" tag will be disabled, as if the entity was thrown by player.
---Has the same effects that would occur if 'entity' eats 'amount' number of cells of 'material_type' from the game world. Use this instead of directly modifying IngestionComponent values, if possible. Might not work with non-player entities. Use CellFactory_GetType() to convert a material name to material type.
---Adds random visible stains of 'material_type' to entity. 'amount' controls the number of stain cells added. Does nothing if 'entity' doesn't have a SpriteStainsComponent. Use CellFactory_GetType() to convert a material name to material type.
---Returns the centroid of first enabled HitboxComponent found in entity, the position of the entity if no hitbox is found, or nil if the entity does not exist. All returned positions are in world coordinates.
---@param entity_id number
---@return number (x, number)|nil y
functionEntityGetFirstHitboxCenter(entity_id)end
---Does a raytrace that stops on any cell it hits.
---@param x1 number
---@param y1 number
---@param x2 number
---@param y2 number
---@return boolean did_hit, number hit_x, number hit_y
functionRaytrace(x1,y1,x2,y2)end
---Does a raytrace that stops on any cell that is not fluid, gas (yes, technically gas is a fluid), or fire.
---@param x1 number
---@param y1 number
---@param x2 number
---@param y2 number
---@return boolean did_hit, number hit_x, number hit_y
functionRaytraceSurfaces(x1,y1,x2,y2)end
---Does a raytrace that stops on any cell that is not gas or fire.
---@param x1 number
---@param y1 number
---@param x2 number
---@param y2 number
---@return boolean did_hit, number hit_x, number hit_y
---This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.
---@param width number
---@param height number
functionBiomeMapSetSize(width,height)end
---if BIOME_MAP in magic_numbers.xml points to a lua file returns that context, if not will return the biome_map size
---@return number width, number height
functionBiomeMapGetSize()end
---This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.
---@param x number
---@param y number
---@param color_int number
functionBiomeMapSetPixel(x,y,color_int)end
---This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.
---@param x number
---@param y number
---@return number color
functionBiomeMapGetPixel(x,y)end
---Swaps red and blue channels of 'color'. This can be used make sense of the BiomeMapGetPixel() return values. E.g. if( BiomeMapGetPixel( x, y ) == BiomeMapConvertPixelFromUintToInt( 0xFF36D517 ) ) then print('hills') end
---This is kinda messy. If given 0 arguments, returns number between 0.0 and 1.0. If given 1 arguments, returns int between 0 and 'a'. If given 2 arguments returns int between 'a' and 'b'.
---@param a number optional
---@param b number optional
---@return number|number
functionRandom(a,b)end
---This is kinda messy. If given 0 arguments, returns number between 0.0 and 1.0. If given 1 arguments, returns number between 0.0 and 'a'. If given 2 arguments returns number between 'a' and 'b'.
---This is kinda messy. If given 2 arguments, returns number between 0.0 and 1.0. If given 3 arguments, returns int between 0 and 'a'. If given 4 arguments returns number between 'a' and 'b'.
---@param x number
---@param y number
---@param a number optional
---@param b number optional
---@return number|number
functionProceduralRandom(x,y,a,b)end
---This is kinda messy. If given 2 arguments, returns number between 0.0 and 1.0. If given 3 arguments, returns a number between 0 and 'a'. If given 4 arguments returns a number between 'a' and 'b'.
---@param x number
---@param y number
---@param a number optional
---@param b number optional
---@return number
functionProceduralRandomf(x,y,a,b)end
---This is kinda messy. If given 2 arguments, returns 0 or 1. If given 3 arguments, returns an int between 0 and 'a'. If given 4 arguments returns an int between 'a' and 'b'.
---@param x number
---@param y number
---@param a number optional
---@param b number optional
---@return number
functionProceduralRandomi(x,y,a,b)end
---Does not work with PhysicsBody2Component. Returns the id of the created physics body.
---Applies a force calculated by 'calculate_force_for_body_fn' to all bodies in an area. 'calculate_force_for_body_fn' should be a lua function with the following signature: function( body_entity:int, body_mass:number, body_x:number, body_y:number, body_vel_x:number, body_vel_y:number, body_vel_angular:number ) -> force_world_pos_x:number,force_world_pos_y:number,force_x:number,force_y:number,force_angular:number
---Plays a sound loop through an AudioLoopComponent tagged with 'component_tag' in 'entity'. 'intensity' affects the intensity passed to the audio event. Must be called every frame when the sound should play.
---Can be used to pass custom parameters to the post_final shader, or override values set by the game code. The shader uniform called 'name' will be set to the latest given values on this and following frames.
---@param name string
---@param x number
---@param y number
---@param z number
---@param w number
functionGameSetPostFxParameter(name,x,y,z,w)end
---Will remove a post_final shader parameter value binding set via game GameSetPostFxParameter().
---Sets the options that apply to widgets during this frame. For 'option' use the values in the GUI_OPTION table in "data/scripts/lib/utilities.lua". Values from consecutive calls will be combined. For example calling this with the values GUI_OPTION.Align_Left and GUI_OPTION.GamepadDefaultWidget will set both options for the next widget. The options will be cleared on next call to GuiStartFrame().
---@param gui userdata
---@param option number
functionGuiOptionsAdd(gui,option)end
---Sets the options that apply to widgets during this frame. For 'option' use the values in the GUI_OPTION table in "data/scripts/lib/utilities.lua". Values from consecutive calls will be combined. For example calling this with the values GUI_OPTION.Align_Left and GUI_OPTION.GamepadDefaultWidget will set both options for the next widget. The options will be cleared on next call to GuiStartFrame().
---@param gui userdata
---@param option number
functionGuiOptionsRemove(gui,option)end
---Clears the options that apply to widgets during this frame.
---@param gui userdata
functionGuiOptionsClear(gui)end
---Sets the options that apply to the next widget during this frame. For 'option' use the values in the GUI_OPTION table in "data/scripts/lib/utilities.lua". Values from consecutive calls will be combined. For example calling this with the values GUI_OPTION.Align_Left and GUI_OPTION.GamepadDefaultWidget will set both options for the next widget.
---@param gui userdata
---@param option number
functionGuiOptionsAddForNextWidget(gui,option)end
---Sets the color of the next widget during this frame. Color components should be in the 0-1 range.
---Sets the rendering depth ('z') of the widgets following this call. Larger z = deeper. The z will be set to 0 on the next call to GuiStartFrame().
---@param gui userdata
---@param z number
functionGuiZSet(gui,z)end
---Sets the rendering depth ('z') of the next widget following this call. Larger z = deeper.
---@param gui userdata
---@param z number
functionGuiZSetForNextWidget(gui,z)end
---Can be used to solve ID conflicts. All ids given to Gui* functions will be hashed with the ids stacked (and hashed together) using GuiIdPush() and GuiIdPop(). The id stack has a max size of 1024, and calls to the function will do nothing if the size is exceeded.
---@param gui userdata
---@param id number
functionGuiIdPush(gui,id)end
---Pushes the hash of 'str' as a gui id. See GuiIdPush().
---@param gui userdata
---@param str string
functionGuiIdPushString(gui,str)end
---See GuiIdPush().
---@param gui userdata
functionGuiIdPop(gui)end
---Starts a scope where animations initiated using GuiAnimateAlphaFadeIn() etc. will be applied to all widgets.
---@param gui userdata
functionGuiAnimateBegin(gui)end
---Ends a scope where animations initiated using GuiAnimateAlphaFadeIn() etc. will be applied to all widgets.
---@param gui userdata
functionGuiAnimateEnd(gui)end
---Does an alpha tween animation for all widgets inside a scope set using GuiAnimateBegin() and GuiAnimateEnd().
---The old parameter order where 'id' is the last parameter is still supported. The function dynamically picks the correct order based on the type of the 4th parameter.
---This can be used to create a container with a vertical scroll bar. Widgets between GuiBeginScrollContainer() and GuiEndScrollContainer() will be positioned relative to the container.
---If 'position_in_ui_scale' is 1, x and y will be in the same scale as other gui positions, otherwise x and y are given as a percentage (0-100) of the gui screen size.
---If 'position_in_ui_scale' is 1, x and y will be in the same scale as other gui positions, otherwise x and y are given as a percentage (0-100) of the gui screen size.
---Puts following things to a new layout layer. Can be used to create non-layouted widgets inside a layout.
---@param gui userdata
functionGuiLayoutBeginLayer(gui)end
---@param gui userdata
functionGuiLayoutEndLayer(gui)end
---Returns dimensions of viewport in the gui coordinate system (which is equal to the coordinates of the screen bottom right corner in gui coordinates). The values returned may change depending on the game resolution because the UI is scaled for pixel-perfect text rendering.
---@param gui userdata
---@return number width, number height
functionGuiGetScreenDimensions(gui)end
---Returns size of the given text in the gui coordinate system.
---Returns the final position, size etc calculated for a widget. Some values aren't supported by all widgets.
---@param gui userdata
---@return boolean clicked, boolean right_clicked, boolean hovered, number x, number y, number width, number height, number draw_x, number draw_y, number draw_width, number draw_height
---Converts 'material_from' to 'material_to' everwhere in the game world, replaces 'material_from_type' to 'material_to_type' in the material (CellData) global table, and marks 'material_from' as a "Transformed" material. Every call will add a new entry to WorldStateComponent which serializes these changes, so please call sparingly. The material conversion will be spread over multiple frames. 'material_from' will still retain the original name id and wang color. Use CellFactory_GetType() to convert a material name to material type.
---Converts cells of 'material_from_type' to 'material_to_type' in the given area. If 'box2d_trim' is true, will attempt to trim the created cells where they might otherwise cause physics glitching. 'update_edge_graphics_dummy' is not yet supported.
---Returns true if a mod with the id 'mod_id' is currently active. For example mod_id = "nightmare".
---@param mod_id string
---@return boolean
functionModIsEnabled(mod_id)end
---Returns a table filled with the IDs of currently active mods.
---@return string[] string
functionModGetActiveModIDs()end
---@return number
functionModGetAPIVersion()end
---Returns the value of a mod setting. 'id' should normally be in the format 'mod_name.setting_id'. Cache the returned value in your lua context if possible.
---@param id string
---@return boolean|number|string|nil
functionModSettingGet(id)end
---Sets the value of a mod setting. 'id' should normally be in the format 'mod_name.setting_id'.
---@param id string
---@param value boolean|number|string
functionModSettingSet(id,value)end
---Returns the latest value set by the user, which might not be equal to the value that is used in the game (depending on the 'scope' value selected for the setting).
---@param id string
---@return boolean|number|string|nil
functionModSettingGetNextValue(id)end
---Sets the latest value set by the user, which might not be equal to the value that is displayed to the game (depending on the 'scope' value selected for the setting).
---Returns the name of a random stream viewer who recently sent a chat message. Returns "" if the 'Creatures can be named after viewers' setting is off.
---Cancels whatever is currently going on, and starts a new voting. _streaming_on_vote_start() and _streaming_get_event_for_vote() will be called as usually.
functionStreamingForceNewVoting()end
---Turns the voting UI on or off.
---@param enabled boolean
functionStreamingSetVotingEnabled(enabled)end
---Basically calls dofile(from_filename) at the end of 'to_filename'. Available only during mod initialization.
---Returns the current (modded or not) content of the data file 'filename'. Allows access only to data files and files from enabled mods. Available only during mod initialization.
---@param filename string
---@return string string
functionModTextFileGetContent(filename)end
---Sets the content the game sees for the file 'filename'. Allows access only to mod and data files. Available only during mod initialization.
---Please supply a path starting with "mods/YOUR_MOD_HERE/" or "data/". If override_existing is true, will always generate new maps, overriding existing files. UV maps are generated when you start or continue a game with your mod enabled. Available only during mod initialization via noita_dev.exe
---Runs the script only once per lua context, returns the script's return value, if any. Returns nil,error_string if the script had errors. For performance reasons it is recommended scripts use dofile_once(), unless the standard dofile behaviour is required.
---@param filename string
---@return any script_return_type, string|nil error_string