fairy stuff

fairy quest and attack mode
This commit is contained in:
2026-10-05 18:19:49 +02:00
parent d56540785f
commit 002d1e83bf
17 changed files with 1435 additions and 526 deletions
+26 -4
View File
@@ -271,6 +271,8 @@
diary: { type: "diary" },
player: { type: "player" },
quest_point: { type: "quest_giver" },
fairy_spot: { type: "fairy_spot" },
fairy_dust: { type: "fairy_dust" },
};
// Type fallbacks used when no object def provides a radius.
const TYPE_DEFAULT_RADII = { light_source: 180, save_point: 90 };
@@ -496,7 +498,7 @@
const type = p.type || p.kind || "light_source";
const object_id = p.object_id || p.objectId || null;
const radius = +p.radius || getDefaultRadiusForType(type, object_id);
r.props.push({ x, y, type, radius, object_id, layer: +(p.layer||0), quest_id: p.quest_id || p.questId || "", coins: Array.isArray(p.coins) ? deepClone(p.coins) : undefined });
r.props.push({ x, y, type, radius, object_id, layer: +(p.layer||0), quest_id: p.quest_id || p.questId || "", dialogue_id: p.dialogue_id || p.dialogueId || "", auto: !!p.auto, coins: Array.isArray(p.coins) ? deepClone(p.coins) : undefined });
}
}
@@ -2377,8 +2379,9 @@ Cancel = Choose whether to remove without saving`);
if(!p) return "<div class='muted'>Selection missing.</div>";
const prDefault = getDefaultRadiusForType(p.type || "light_source", p.object_id || p.objectId || null);
const objId = p.object_id || p.objectId || "";
const hint = ({light_source:"Butterfly (charge regen 2x)", save_point:"Lantern (save point - press F to save)", butterfly_jar:"Butterfly-in-jar (collectible)", diary:"Boss diary (interact)", house:"Standalone house", player:"Player size reference (no in-game effect)", quest_giver:"Quest point (name it below)"})[p.type||"light_source"] || "";
const hint = ({light_source:"Butterfly (charge regen 2x)", save_point:"Lantern (save point - press F to save)", butterfly_jar:"Butterfly-in-jar (collectible)", diary:"Boss diary (interact)", house:"Standalone house", player:"Player size reference (no in-game effect)", quest_giver:"Quest point (name it below)", fairy_spot:"Fairy spot (press F to hear the fairy; set quest id for a quest)", fairy_dust:"Fairy dust (collect with F)"})[p.type||"light_source"] || "";
const isQuest = (p.type||"") === "quest_giver";
const isFairySpot = (p.type||"") === "fairy_spot";
return `
<div><b>Prop</b> #${sel.index}${hint ? ` <span class="mini">· ${hint}</span>` : ""}</div>
<div class="hr"></div>
@@ -2390,10 +2393,19 @@ Cancel = Choose whether to remove without saving`);
<div class="mini">type</div>
<input id="prtype" type="text" value="${p.type||"light_source"}"/>
</div>
${isQuest ? `
${(isQuest || isFairySpot) ? `
<div style="margin-top:8px;">
<div class="mini">quest id (name)</div>
<input id="prqid" type="text" value="${p.quest_id||""}" placeholder="e.g. quest_save_the_well"/>
<input id="prqid" type="text" value="${p.quest_id||""}" placeholder="e.g. quest_fairy_dust"/>
</div>` : ""}
${isFairySpot ? `
<div style="margin-top:8px;">
<div class="mini">dialogue id (from data/config/fairy.json)</div>
<input id="prdialogue" type="text" value="${p.dialogue_id||""}" placeholder="e.g. spot_greeting"/>
</div>
<div style="margin-top:8px;">
<div class="mini">auto trigger</div>
<input id="prauto" type="checkbox" ${p.auto ? "checked" : ""}/>
</div>` : ""}
<div style="margin-top:8px;">
<div class="mini">object id</div>
@@ -2648,6 +2660,14 @@ Cancel = Choose whether to remove without saving`);
const v = prqid.value.trim();
if(v){ p.quest_id = v; } else { delete p.quest_id; }
}));
const prdialogue=q("prdialogue"), prauto=q("prauto");
if(prdialogue) prdialogue.addEventListener("change", ()=>pushAnd(()=>{
const v = prdialogue.value.trim();
if(v){ p.dialogue_id = v; } else { delete p.dialogue_id; }
}));
if(prauto) prauto.addEventListener("change", ()=>pushAnd(()=>{
if(prauto.checked){ p.auto = true; } else { delete p.auto; }
}));
if(probjid) probjid.addEventListener("change", ()=>pushAnd(()=>{
const v = probjid.value.trim();
if(v){ p.object_id = v; } else { delete p.object_id; }
@@ -3492,6 +3512,8 @@ Cancel = Choose whether to remove without saving`);
if(p.object_id) out.object_id = p.object_id;
if(p.layer) out.layer = p.layer;
if(p.quest_id) out.quest_id = p.quest_id;
if(p.dialogue_id) out.dialogue_id = p.dialogue_id;
if(p.auto) out.auto = true;
if(Array.isArray(p.coins)) out.coins = p.coins;
return out;
});