This package has been marked as deprecated, and it's suggested another
alternative is used.
You are viewing a potentially older version of this package.
View all versions.
HelperFunctions
A collection of helper functions for modding.
Date uploaded | 7 months ago |
Version | 1.0.1 |
Download link | Klehrik-HelperFunctions-1.0.1.zip |
Downloads | 217 |
Dependency string | Klehrik-HelperFunctions-1.0.1 |
This mod requires the following mods to function
README
A collection of helper functions for modding.
To use, paste this line in your code (you can rename the Helper
table):
mods.on_all_mods_loaded(function() for k, v in pairs(mods) do if type(v) == "table" and v.hfuncs then Helper = v end end end)
Installation Instructions
- Navigate to the folder containing the Risk of Rain Returns executable (.exe) file. (
Steam/steamapps/common/Risk of Rain Returns
) - Download
version.dll
from either Thunderstore or the unofficial modding GitHub page and place it into the folder. - Run the game, and a folder called
ReturnOfModding
should be created. - Close the game, navigate to the new folder, and extract the mod .zip into the
plugins
subfolder. - Run the game again, and the mod should now be loaded. Enjoy!
Functions
Instances
find_active_instance(index) -> instance or nil
index The object_index of the instance
Returns the first active instance of the specified
object_index, or nil if none can be found.
find_active_instance_all(index) -> table, bool
index The object_index of the instance
Returns:
1. a table of all active instances of the specified object_index
2. true if the table is not empty
instance_exists(inst) -> bool
inst The instance to check
Returns true if the instance exists.
Specific Instances
get_client_player() -> instance or nil
Returns the player instance belonging to
this client, or nil if none can be found.
get_teleporter() -> instance or nil
Returns the stage teleporter,
or nil if there isn't one.
If there is more than one, the first one
found is returned, and the Divine Teleporter
takes precedence over standard teleporters.
get_chests() -> table, bool
Returns:
1. a table of all chests on the stage
2. true if the table is not empty
get_multishops() -> table, bool
Returns:
1. a table of all multishops on the stage
2. true if the table is not empty
Misc.
ease_in(x, n) -> float
x The input value
n The easing power (default 2 (quadratic))
Returns an ease in value for
a given value x between 0 and 1.
ease_out(x, n) -> float
x The input value
n The easing power (default 2 (quadratic))
Returns an ease out value for
a given value x between 0 and 1.
chance(n) -> bool
n The chance to succeed (between 0 and 1)
Returns true on success.
Items
rarities = {
white = 1,
green = 2,
red = 3,
equipment = 4,
boss = 5,
purple = 6,
food = 7,
notier = 8
}
initialize_item_table() -> void
Initializes a table of item data tables.
Called internally by the item
functions below, but can be
reinitialized anytime.
Each item data table contains:
.id The object_index of the item
.localization The localization string of the item (i.e., "item.crowbar.name")
.name The name of the item in the current language
.rarity The rarity of the item (number)
* This also corresponds to the .rarities enum at the top
* White (Common) is indexed from 1 here, while in-game it is tier 0
get_all_items(rarity) -> table
rarity Item rarity filter (optional)
Returns a table of item data tables (see initialize_item_table).
If given, only returns items of a specified rarity.
find_item(identifier) -> table or nil
identifier object_index or localization string of the item
Returns the item data table (see initialize_item_table)
if it exists, or nil otherwise.
CHANGELOG
v1.0.10
- Marked as deprecated on Thunderstore.
- Fixed
chat_add_user_message
hook firing for every message after receiving first Net message.
v1.0.9
- Added: is_lobby_client
- Added: spawn_crate
- string_to_table now reads nil correctly.
- find_item and get_all_items now return new copies of the item data tables.
- This is to prevent direct manipulation of the main one, which is shared by all mods.
- Net functionality now intercepts messages instead of scanning chat and deleting.
v1.0.8
- Added: net_clear
v1.0.7
- Added: is_singleplayer_or_host
- net_send can now exclude a player.
v1.0.6
- Added: table_to_string
- Added: string_to_table
- Added: net_send
- Added: net_listen
- Added: net_has
- Added: is_singleplayer
- Added: get_player_from_name
v1.0.5
- get_client_player works in Trials mode now.
v1.0.4
- find_item works with "namespace-identifier" strings now.
- Added: get_host_player
- Added: is_lobby_host
- Added: table_merge
v1.0.3
- Updated manifest dependency.
- Added add_chat_message (from ShareItem).
v1.0.2
- Added more fields to item data tables.
v1.0.1
- Edited documentation a bit.
v1.0.0
- Initial release.