Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes shooting in adventure mode #1217

Merged
merged 7 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions fix/shooting.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-- Fixes shooting/throwing options stacking on each other, causing null pointers and crashes
--@ enable = true
myk002 marked this conversation as resolved.
Show resolved Hide resolved
--@ module = true

local aim_projectile = df.global.game.main_interface.adventure.aim_projectile

local overlay = require('plugins.overlay')

FixShootingOverlay = defclass(FixShootingOverlay, overlay.OverlayWidget)
FixShootingOverlay.ATTRS{
desc='Adds keywords to conversation entries.',
myk002 marked this conversation as resolved.
Show resolved Hide resolved
default_enabled=true,
viewscreens={
'dungeonmode/Inventory',
'dungeonmode/AimProjectile'
},
frame={w=0, h=0},
overlay_onupdate_max_freq_seconds=0,
myk002 marked this conversation as resolved.
Show resolved Hide resolved
}

function FixShootingOverlay:overlay_onupdate()
if aim_projectile.open == false then
aim_projectile.shooter_it = nil
aim_projectile.ammo_it = nil
aim_projectile.thrown_it = nil
aim_projectile.shooting = false
elseif aim_projectile.shooting then
aim_projectile.thrown_it = nil
end
end
myk002 marked this conversation as resolved.
Show resolved Hide resolved

OVERLAY_WIDGETS = {
fixshooting=FixShootingOverlay,
}
2 changes: 2 additions & 0 deletions internal/control-panel/registry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ COMMANDS_BY_IDX = {
{command='preserve-tombs', group='bugfix', mode='enable', default=true},
{command='reaction-gloves', help_command='tweak', group='bugfix', mode='tweak', default=true,
desc='Fixes reactions not producing gloves in sets with correct handedness.'},
{command='fix/shooting', group='bugfix', mode='tweak', default=true,
myk002 marked this conversation as resolved.
Show resolved Hide resolved
desc='Fixes shooting your weapon in adventure mode breaking your Throw action in increasibly dangerous ways.'},

-- gameplay tools
{command='agitation-rebalance', group='gameplay', mode='enable'},
Expand Down
Loading