Skip to content

Lua Hooks to disable drops from players#8485

Open
Trihedraf wants to merge 1 commit intodiasurgical:masterfrom
Trihedraf:lua-drops
Open

Lua Hooks to disable drops from players#8485
Trihedraf wants to merge 1 commit intodiasurgical:masterfrom
Trihedraf:lua-drops

Conversation

@Trihedraf
Copy link
Copy Markdown
Collaborator

@Trihedraf Trihedraf commented Feb 28, 2026

Adds lua hooks for players to disable drops on death.

events.OnPlayerDeathDropEar
events.OnPlayerDeathDropGold
events.OnPlayerDeathDropItem

Example lua mod that disables dropping items on death.

local events = require("devilutionx.events")

events.OnPlayerDeathDropItem.add(function(player)
  return false
end)

@Trihedraf Trihedraf marked this pull request as draft March 3, 2026 04:57
@Trihedraf Trihedraf marked this pull request as ready for review March 7, 2026 14:16
@Trihedraf Trihedraf requested a review from StephenCWills March 7, 2026 14:16
Copy link
Copy Markdown
Member

@StephenCWills StephenCWills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting how you can't use these functions to force a player to drop their items in PvP, for example. They were clearly designed with a laser-focused goal in mind. Since the call site is the same for all three events, I wonder if it wouldn't be better to somehow consolidate these into a single OnPlayerDeath() function call. You could pass the three boolean values in and let the Lua functions tweak them instead of making assumptions about the purpose of the Lua script.

@yuripourre
Copy link
Copy Markdown
Collaborator

Interesting how you can't use these functions to force a player to drop their items in PvP, for example. They were clearly designed with a laser-focused goal in mind. Since the call site is the same for all three events, I wonder if it wouldn't be better to somehow consolidate these into a single OnPlayerDeath() function call. You could pass the three boolean values in and let the Lua functions tweak them instead of making assumptions about the purpose of the Lua script.

That's a really good idea, making the lua events as high level as possible.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants