aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-07 23:39:19 -0400
committerhistoria <[not public]>2026-07-07 23:39:19 -0400
commit14428577e1c7a6c2bdc96f700b7df0d68ec06ba6 (patch)
tree8136d3c25b2f7ff21aa8f074fc3bdce3b1799d06 /internal
parent59a844137138b328cf415d29b8a1bc40c6469a31 (diff)
downloadthehouseoficarus-14428577e1c7a6c2bdc96f700b7df0d68ec06ba6.tar.gz
fix: add respawn on hide field to admin gui, add explanation text to gather card
Diffstat (limited to 'internal')
-rw-r--r--internal/admin/static/objecteditor.js48
1 files changed, 40 insertions, 8 deletions
diff --git a/internal/admin/static/objecteditor.js b/internal/admin/static/objecteditor.js
index 2046f2e..b99ca74 100644
--- a/internal/admin/static/objecteditor.js
+++ b/internal/admin/static/objecteditor.js
@@ -49,7 +49,7 @@ var SECTIONS = [
['deplete_timer', 'Deplete', 'number', '45', 'narrow', function(d) { return d.skill === 'woodcutting'; }],
['nest_chance', 'Nest 1/n', 'number', '256', 'narrow', function(d) { return d.skill === 'woodcutting'; }],
]},
- {label:'Tools', key:'tools', type:'tools_checkbox'},
+ {label:'Tools', key:'tools', type:'tools_checkbox', hint:'any one is sufficient (OR)'},
],
subtables: [
{label:'Drops', key:'drops', fields:[
@@ -67,10 +67,11 @@ var SECTIONS = [
['tier', 'Tier', 'number', '1', 'narrow'],
['max_block_size', 'Max Block Size', 'select', '|small|medium|large|massive'],
['max_occupants', 'Max Occupants', 'number', '1', 'narrow'],
- ['unsafe_chance', 'Unsafe Chance', 'number', '0.05', 'narrow'],
- ['decay_ticks', 'Decay Ticks', 'number', '100', 'narrow'],
- ['decay_chance', 'Decay Chance', 'number', '0.1', 'narrow'],
- ['respawn_ticks', 'Respawn Ticks', 'number', '50', 'narrow'],
+ ['unsafe_chance', 'Unsafe Chance', 'number', '0 = never, e.g. 0.05', 'narrow'],
+ ['decay_ticks', 'Decay Ticks', 'number', '0 = never, e.g. 100', 'narrow'],
+ ['decay_chance', 'Decay Chance', 'number', '0 = never, e.g. 0.01', 'narrow'],
+ ['respawn_ticks', 'Respawn Ticks', 'number', '0 = no respawn, e.g. 50', 'narrow'],
+ ['respawn_on_hide', 'Respawn on hide', 'checkbox'],
],
subtables: [
{label:'Levels of Decay', key:'levels', fields:[
@@ -298,6 +299,27 @@ function renderCard(sec, data) {
h += renderSubtable(sec, st, data);
});
}
+
+ if (sec.id === 'safespot') {
+ var helpCollapsed = window._safespotHelpCollapsed === undefined ? true : window._safespotHelpCollapsed;
+ h += '<div style="margin-top:8px;border:1px solid rgba(100,160,255,.15);border-radius:4px;overflow:hidden">';
+ h += '<div style="padding:6px 10px;background:rgba(100,160,255,.08);cursor:pointer;font-size:10px;color:#6af;font-weight:bold;text-transform:uppercase;letter-spacing:.5px" onclick="toggleSafespotHelp()">';
+ h += '<span style="font-size:8px;margin-right:4px">' + (helpCollapsed ? '&#9654;' : '&#9660;') + '</span>';
+ h += 'How Tiers, Levels, Decay &amp; Respawn Work';
+ h += '</div>';
+ if (!helpCollapsed) {
+ h += '<div style="padding:8px;background:rgba(100,160,255,.05);font-size:10px;color:#aaa;line-height:1.6">';
+ h += '<b>Tier</b> &mdash; Player tier (base 1; +1 with <code>unlocked_rock_cover</code> flag) must be &ge; safespot tier to hide.<br>';
+ h += '<b>Levels of Decay</b> &mdash; Degradation stages (N levels above all subtable entries). Level messages shown when hiding; degrade messages broadcast when damaged. Level 0 = destroyed, all occupants evicted.<br>';
+ h += '<b>Decay</b> &mdash; Two independent paths: <code>decay_ticks</code> (forced degrade after N ticks of use) and <code>decay_chance</code> (per-tick random degrade). Either or both can be set; 0 disables that path.<br>';
+ h += '<b>Respawn on hide</b> &mdash; Resets the cover to full levels when the first person hides on an empty/unused cover.<br>';
+ h += '<b>Respawn ticks</b> &mdash; Auto-reforms the cover after N ticks when fully destroyed (level 0). 0 = instance permanently removed.<br>';
+ h += '<b>Max Block Size</b> &mdash; Determines which mob sizes are blocked (small &lt; medium &lt; large &lt; massive). Empty = blocks everything.<br>';
+ h += '<b>Unsafe Chance</b> &mdash; Per-tick probability of being forced out of cover regardless of decay (0 = never forced out).';
+ h += '</div>';
+ }
+ h += '</div>';
+ }
}
h += '</div>';
}
@@ -688,10 +710,11 @@ function renderToolsCheckbox(sec, il, data) {
return '<span style="color:#888;font-size:11px">Loading tool types...</span>';
}
if (arr.length === 0) {
- return '<button class="btn btn-sm obj-sub-add" onclick="addToolRow(\'' + sec.id + '\',\'' + il.key + '\')">+ Add Tools</button>';
+ var hint = il.hint ? '<div style="font-size:10px;color:#888;margin-bottom:4px;font-style:italic">' + esc(il.hint) + '</div>' : '';
+ return hint + '<button class="btn btn-sm obj-sub-add" onclick="addToolRow(\'' + sec.id + '\',\'' + il.key + '\')">+ Add Tools</button>';
}
var h = '<div class="obj-inline-group">';
- h += '<span class="obj-inline-label">' + esc(il.label) + '</span>';
+ h += '<span class="obj-inline-label">' + esc(il.label) + (il.hint ? ' <span style="color:#666;font-size:10px;font-weight:normal;font-style:italic">(' + esc(il.hint) + ')</span>' : '') + '</span>';
h += '<div style="display:flex;flex-direction:column;gap:3px;margin-top:4px">';
arr.forEach(function(t, idx) {
h += '<div style="display:flex;gap:4px">';
@@ -751,6 +774,15 @@ function toggleCardWidth(id) {
renderCurrent();
}
+function toggleSafespotHelp() {
+ if (window._safespotHelpCollapsed === undefined) {
+ window._safespotHelpCollapsed = false;
+ } else {
+ window._safespotHelpCollapsed = !window._safespotHelpCollapsed;
+ }
+ renderCurrent();
+}
+
function removeSection(id) {
var sec = SECTIONS.find(function(s) { return s.id === id; });
if (!sec) return;
@@ -778,7 +810,7 @@ function addSection() {
} else if (sec.id === 'gather') {
objectData[sec.path] = {skill:'', tools:[], success:{base:0, per_level:0, cap:1}, drops:[], gather_message:'', fail_message:'', respawn_timer:0, respawn_broadcast:'', deplete_timer:0, nest_chance:0};
} else if (sec.id === 'safespot') {
- objectData[sec.path] = {tier:1, max_block_size:'', max_occupants:1, unsafe_chance:0, decay_ticks:0, decay_chance:0, respawn_on_hide:false, respawn_ticks:0, levels:[]};
+ objectData[sec.path] = {tier:1, max_block_size:'', max_occupants:1, unsafe_chance:'', decay_ticks:'', decay_chance:'', respawn_on_hide:false, respawn_ticks:'', levels:[]};
} else {
objectData[sec.path] = {};
}