Skip to content

Conversation

@usagirei
Copy link
Collaborator

@usagirei usagirei commented Oct 15, 2025

Purpose of change (The Why)

  • Updates lua dynamic iuse_actor to support tick / can_use
    • game.iuse_functions[...] = ... now accepts a table with 3 functions: use, can_use, tick,
    • A single function is still supported for backward compatibility
  • Adds a reset_countdown method for item
    • use in conjunction with use and/or tick, and countdown_action actor to have the item call a lua method periodically without using on_every_x hook while active (e.g via item:activate())
  • Adds/modifies a few functions for item manipulation to return a DetachedItem or MapStack
    • Map: get_items_in_radius, create_item_at
    • Character: add_item, create_item
    • Item: spawn
  • Add bindings to DetachedItem
  • Add bindings to ItemStack (and MapStack)
  • Add bindings for ItypeRaw fields (via ItypeId:obj()) / Islot* objects:
    • Container
    • Tool
    • Comestible
    • Brewable
    • Pet Armor
    • Book
    • Mod
    • Engine
    • Wheel
    • Fuel
    • Magazine
    • Battery
    • Bionic
    • Seed
    • Artifact
    • Milling
    • Armor
    • Ammo
    • Gun
    • Gunmod
    • Relic

Describe the solution (The How)

N/A

Describe alternatives you've considered

N/A

Testing

N/A

Additional context

WIP, will include example lua mod using new features

Checklist

Mandatory

usagirei and others added 21 commits October 14, 2025 11:45
expose Islot types to lua
…oes, and what iuse_explosion expects to trigger.

expose set_charges to lua
add get_item_at_with, get_items_in_radius, get_items_in_radius_with to map
…am#7362)

1. it's highly annoying
2. there's already too much missing parentheses
3. not much benefit in fixing them all taking the huge diff toll
@github-actions github-actions bot added the src changes related to source code. label Oct 15, 2025
@autofix-ci
Copy link
Contributor

autofix-ci bot commented Oct 15, 2025

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

@github-actions github-actions bot added docs PRs releated to docs page tests changes related to tests lua PRs and issues related to Lua scripting labels Oct 15, 2025
@github-actions github-actions bot added the JSON related to game datas in JSON format. label Oct 19, 2025
@github-actions github-actions bot removed the JSON related to game datas in JSON format. label Oct 21, 2025
@scarf005 scarf005 changed the title feat: More Lua Bindings feat(lua)!: add more bindings Oct 24, 2025
@Relgar
Copy link
Contributor

Relgar commented Oct 29, 2025

Can I request the lua binding when it's time for an NPC to take their turn so we can implement LUA NPC intelligence :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs PRs releated to docs page lua PRs and issues related to Lua scripting src changes related to source code. tests changes related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants