Skip to content

Commit 87d250a

Browse files
committed
initial
0 parents  commit 87d250a

31 files changed

Lines changed: 3300 additions & 0 deletions

.github/workflows/release.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
package:
13+
name: Package mod
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v5
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Validate release version
23+
shell: bash
24+
run: |
25+
set -euo pipefail
26+
27+
VERSION="$(jq -r '.version' mod.txt)"
28+
29+
if [[ "${GITHUB_REF_TYPE}" == "tag" && "${GITHUB_REF_NAME}" != "v${VERSION}" ]]; then
30+
echo "::error::tag (${GITHUB_REF_NAME}) does not match mod version (v${VERSION})"
31+
exit 1
32+
fi
33+
34+
echo "version=$VERSION" >> "$GITHUB_ENV"
35+
36+
- name: Generate update metadata
37+
shell: bash
38+
run: |
39+
set -euo pipefail
40+
41+
ident="$(jq -r '.updates[0].identifier // empty' mod.txt)"
42+
version="$(jq -r '.version' mod.txt)"
43+
repo="$GITHUB_REPOSITORY"
44+
45+
if [[ -z "$ident" ]]; then
46+
echo "has_update_metadata=false" >> "$GITHUB_ENV"
47+
echo "No mod.txt updates[0].identifier configured; skipping update metadata."
48+
exit 0
49+
fi
50+
51+
mkdir -p generated
52+
jq -n \
53+
--arg ident "$ident" \
54+
--arg version "$version" \
55+
--arg download_url "https://github.com/$repo/releases/download/v$version/BigBankBoxPatternHelper.zip" \
56+
--arg patchnotes_url "https://github.com/$repo/releases/tag/v$version" \
57+
'[{
58+
ident: $ident,
59+
version: $version,
60+
download_url: $download_url,
61+
patchnotes_url: $patchnotes_url
62+
}]' > generated/update_meta.json
63+
64+
echo "has_update_metadata=true" >> "$GITHUB_ENV"
65+
66+
- name: Build SuperBLT zip
67+
shell: bash
68+
run: |
69+
set -euo pipefail
70+
71+
rm -rf package BigBankBoxPatternHelper.zip
72+
mkdir -p package/BigBankBoxPatternHelper
73+
cp -R core.lua hooks mod.txt modules package/BigBankBoxPatternHelper/
74+
75+
if [[ "${has_update_metadata}" == "true" ]]; then
76+
cp generated/update_meta.json package/BigBankBoxPatternHelper/update_meta.json
77+
fi
78+
79+
cd package
80+
zip -r ../BigBankBoxPatternHelper.zip BigBankBoxPatternHelper
81+
82+
- name: Get previous tag
83+
id: previous-tag
84+
shell: bash
85+
run: |
86+
set -euo pipefail
87+
88+
git fetch --tags --force
89+
previous_tag="$(git --no-pager tag --sort=creatordate --merged "${GITHUB_REF_NAME}" | grep -v "^${GITHUB_REF_NAME}$" | tail -1 || true)"
90+
echo "previous_tag=$previous_tag" >> "$GITHUB_OUTPUT"
91+
92+
- name: Generate changelog
93+
id: changelog
94+
if: ${{ steps.previous-tag.outputs.previous_tag != '' }}
95+
uses: requarks/changelog-action@v1
96+
with:
97+
token: ${{ github.token }}
98+
fromTag: ${{ github.ref_name }}
99+
toTag: ${{ steps.previous-tag.outputs.previous_tag }}
100+
writeToFile: false
101+
restrictToTypes: feat,fix,perf
102+
useGitmojis: false
103+
includeInvalidCommits: false
104+
105+
- name: Write release notes
106+
env:
107+
CHANGELOG: ${{ steps.changelog.outputs.changes }}
108+
PREVIOUS_TAG: ${{ steps.previous-tag.outputs.previous_tag }}
109+
shell: bash
110+
run: |
111+
set -euo pipefail
112+
113+
printf 'Big Bank Box Pattern Helper %s\n' "$version" > release-notes.md
114+
115+
if [[ -n "$CHANGELOG" ]]; then
116+
printf '\n%s\n' "$CHANGELOG" >> release-notes.md
117+
elif [[ -z "$PREVIOUS_TAG" ]]; then
118+
printf '\nInitial release.\n' >> release-notes.md
119+
else
120+
printf '\nMaintenance release.\n' >> release-notes.md
121+
fi
122+
123+
- name: Upload release asset
124+
env:
125+
GITHUB_TOKEN: ${{ github.token }}
126+
TAG: ${{ github.ref_name }}
127+
shell: bash
128+
run: |
129+
set -euo pipefail
130+
131+
assets=(BigBankBoxPatternHelper.zip)
132+
if [[ "${has_update_metadata}" == "true" ]]; then
133+
assets+=(generated/update_meta.json)
134+
fi
135+
136+
if gh release view "$TAG" >/dev/null 2>&1; then
137+
gh release edit "$TAG" --notes-file release-notes.md
138+
gh release upload "$TAG" "${assets[@]}" --clobber
139+
else
140+
gh release create "$TAG" "${assets[@]}" \
141+
--title "$TAG" \
142+
--notes-file release-notes.md
143+
fi
144+
145+
- name: Publish update metadata
146+
if: ${{ env.has_update_metadata == 'true' }}
147+
env:
148+
TAG: ${{ github.ref_name }}
149+
shell: bash
150+
run: |
151+
set -euo pipefail
152+
153+
cp generated/update_meta.json update_meta.json
154+
155+
if git diff --quiet -- update_meta.json; then
156+
echo "update_meta.json already matches $TAG"
157+
exit 0
158+
fi
159+
160+
git config user.name "github-actions[bot]"
161+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
162+
git add update_meta.json
163+
git commit -m "chore: update release metadata for $TAG"
164+
git push origin HEAD:main

core.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
_G.BigBankDepositPatternHighlighter = _G.BigBankDepositPatternHighlighter or {}
2+
3+
local BB = _G.BigBankDepositPatternHighlighter
4+
5+
BB.ready = false
6+
7+
local source = debug.getinfo(1, "S").source
8+
local core_path = source and source:sub(1, 1) == "@" and source:sub(2) or nil
9+
local current_mod_path = core_path and core_path:match("^(.*[/\\])core%.lua$")
10+
11+
BB.ModPath = current_mod_path or BB.ModPath or ModPath or "mods/Big Bank Deposit Pattern Highlighter/"
12+
13+
dofile(BB.ModPath .. "modules/shared/bootstrap.lua")
14+
15+
BB:InstallModules()
16+
BB:InstallRuntime()

hooks/unitbase.lua

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
local function load_core()
2+
if not _G.BigBankDepositPatternHighlighter or not _G.BigBankDepositPatternHighlighter.ready then
3+
local path = ModPath or "mods/Big Bank Deposit Pattern Highlighter/"
4+
local ok, err = pcall(dofile, path .. "core.lua")
5+
6+
if not ok and path ~= "mods/Big Bank Deposit Pattern Highlighter/" then
7+
_G.BigBankDepositPatternHighlighter = nil
8+
9+
local previous_mod_path = ModPath
10+
ModPath = "mods/Big Bank Deposit Pattern Highlighter/"
11+
12+
local fallback_ok, fallback_err = pcall(dofile, "mods/Big Bank Deposit Pattern Highlighter/core.lua")
13+
ModPath = previous_mod_path
14+
15+
if not fallback_ok and log then
16+
log("[Big Bank Deposit Pattern Highlighter] Failed to load core.lua: " .. tostring(err) .. " | fallback: " .. tostring(fallback_err))
17+
end
18+
elseif not ok and log then
19+
log("[Big Bank Deposit Pattern Highlighter] Failed to load core.lua: " .. tostring(err))
20+
end
21+
end
22+
23+
local mod = _G.BigBankDepositPatternHighlighter
24+
25+
if mod and mod.ready then
26+
return mod
27+
end
28+
29+
_G.BigBankDepositPatternHighlighter = nil
30+
end
31+
32+
local BigBankDepositPatternHighlighter = load_core()
33+
34+
if BigBankDepositPatternHighlighter and BigBankDepositPatternHighlighter.RegisterPotentialDepositWall and Hooks and UnitBase then
35+
Hooks:PostHook(UnitBase, "init", "BigBankDepositPatternHighlighter_UnitBase_init", function(_, unit)
36+
if BigBankDepositPatternHighlighter.ready and BigBankDepositPatternHighlighter.RegisterPotentialDepositWall then
37+
BigBankDepositPatternHighlighter:RegisterPotentialDepositWall(unit)
38+
end
39+
40+
if BigBankDepositPatternHighlighter.ready and BigBankDepositPatternHighlighter.RegisterDepositBox then
41+
local interaction
42+
43+
if unit and unit.interaction then
44+
local ok, result = pcall(unit.interaction, unit)
45+
46+
if ok then
47+
interaction = result
48+
end
49+
end
50+
51+
BigBankDepositPatternHighlighter:RegisterDepositBox(unit, interaction)
52+
end
53+
54+
if BigBankDepositPatternHighlighter.ready and BigBankDepositPatternHighlighter.ObserveCarryUnit then
55+
BigBankDepositPatternHighlighter:ObserveCarryUnit(unit)
56+
end
57+
end)
58+
end

mod.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name" : "Big Bank Box Pattern Helper",
3+
"description" : "Marks Big Bank deposit slots that can contain baggable loot according to the deposit pattern sequence variables.",
4+
"author" : "Perry",
5+
"version" : "1.0.0",
6+
"blt_version" : 2,
7+
"priority" : 0,
8+
"updates" : [
9+
{
10+
"identifier" : "perry519.big_bank_box_pattern_helper",
11+
"host" : {
12+
"meta" : "https://raw.githubusercontent.com/perry519/BigBankBoxPatternHelper/main/update_meta.json"
13+
}
14+
}
15+
],
16+
"hooks" : [
17+
{ "hook_id" : "lib/units/unitbase", "script_path" : "hooks/unitbase.lua" }
18+
],
19+
"persist_scripts" : [
20+
{ "global" : "BigBankDepositPatternHighlighter", "script_path" : "core.lua" }
21+
]
22+
}

modules/config/game_ids.lua

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
local BB = _G.BigBankDepositPatternHighlighter
2+
3+
local WALL_UNIT_KEYS = {
4+
[Idstring("units/payday2/architecture/bnk/bnk_int_panel_wall4m_deposit_a1"):key()] = true,
5+
[Idstring("units/payday2/architecture/bnk/bnk_int_panel_wall4m_deposit_a2"):key()] = true,
6+
[Idstring("units/payday2/architecture/bnk/bnk_int_panel_wall4m_deposit_a3"):key()] = true,
7+
[Idstring("units/payday2/architecture/bnk/bnk_int_panel_wall4m_deposit_b1"):key()] = true
8+
}
9+
10+
local BAG_CARRY_IDS = {
11+
gold = true,
12+
money = true
13+
}
14+
15+
local SMALL_LOOT_INTERACTION_IDS = {
16+
cas_chips_pile = true,
17+
diamond_pickup = true,
18+
diamond_pickup_axis = true,
19+
diamond_pickup_pal = true,
20+
money_wrap_single_bundle = true,
21+
money_wrap_single_bundle_active = true,
22+
money_wrap_single_bundle_dyn = true,
23+
pickup_phone = true,
24+
pickup_tablet = true,
25+
safe_loot_pickup = true
26+
}
27+
28+
local NON_PATTERN_PICKUP_INTERACTION_IDS = {}
29+
30+
for id in pairs(SMALL_LOOT_INTERACTION_IDS) do
31+
NON_PATTERN_PICKUP_INTERACTION_IDS[id] = true
32+
end
33+
34+
NON_PATTERN_PICKUP_INTERACTION_IDS.press_take_folder = true
35+
NON_PATTERN_PICKUP_INTERACTION_IDS.take_confidential_folder_icc = true
36+
37+
local SPAWN_LOOT_UNIT_KEYS = {
38+
[Idstring("units/pd2_dlc1/vehicles/str_vehicle_truck_gensec_transport/spawn_deposit/spawn_gold"):key()] = "gold",
39+
[Idstring("units/pd2_dlc1/vehicles/str_vehicle_truck_gensec_transport/spawn_deposit/spawn_money"):key()] = "money"
40+
}
41+
42+
local config = {
43+
BAG_CARRY_IDS = BAG_CARRY_IDS,
44+
NON_PATTERN_PICKUP_INTERACTION_IDS = NON_PATTERN_PICKUP_INTERACTION_IDS,
45+
SMALL_LOOT_INTERACTION_IDS = SMALL_LOOT_INTERACTION_IDS,
46+
SPAWN_LOOT_UNIT_KEYS = SPAWN_LOOT_UNIT_KEYS,
47+
WALL_UNIT_KEYS = WALL_UNIT_KEYS
48+
}
49+
50+
if BB then
51+
BB.shared = BB.shared or {}
52+
BB.shared.config_parts = BB.shared.config_parts or {}
53+
BB.shared.config_parts.game_ids = config
54+
end
55+
56+
return config

modules/config/marker.lua

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
local BB = _G.BigBankDepositPatternHighlighter
2+
3+
local MARKER_ALPHA = 0.055
4+
local INITIAL_MARKER_COLOR = Color(0.075, 1, 0.45, 0)
5+
6+
local PATTERN_MARKER_COLORS = {
7+
[1] = Color(MARKER_ALPHA, 1, 0, 0),
8+
[2] = Color(MARKER_ALPHA, 1, 1, 0),
9+
[3] = Color(MARKER_ALPHA, 0, 1, 0),
10+
[4] = Color(MARKER_ALPHA, 0, 0, 1),
11+
[5] = Color(MARKER_ALPHA, 0, 1, 1),
12+
[6] = Color(MARKER_ALPHA, 1, 0, 1)
13+
}
14+
15+
local config = {
16+
MARKER_DISPLAY_DISTANCE_SQ = 384400,
17+
OPENABLE_BOX_MATCH_DISTANCE_SQ = 90000,
18+
PATTERN_MARKER_COLORS = PATTERN_MARKER_COLORS,
19+
PROBE_GUIDE_INITIAL_MARKER_COLOR = INITIAL_MARKER_COLOR,
20+
SHOW_FULL_PATTERN = true,
21+
WORLD_MARKER_COLOR = INITIAL_MARKER_COLOR,
22+
WORLD_MARKER_FACE_OFFSET = 0.5,
23+
WORLD_MARKER_HEIGHT = 30,
24+
WORLD_MARKER_HEIGHT_INSET = 1,
25+
WORLD_MARKER_PIXEL_HEIGHT = 86,
26+
WORLD_MARKER_PIXEL_WIDTH = 112,
27+
WORLD_MARKER_LOCK_TO_CENTER_Y = 0.44,
28+
WORLD_MARKER_STROKE = 4,
29+
WORLD_MARKER_VERSION = 65,
30+
WORLD_MARKER_WIDTH = 42,
31+
WORLD_MARKER_WIDTH_INSET = 0.98
32+
}
33+
34+
if BB then
35+
BB.shared = BB.shared or {}
36+
BB.shared.config_parts = BB.shared.config_parts or {}
37+
BB.shared.config_parts.marker = config
38+
end
39+
40+
return config

0 commit comments

Comments
 (0)