mirror of
https://github.com/shadoll/dev.shadoll.git
synced 2026-08-28 11:33:15 +00:00
feat: replace DNA icon with Cell icon in evolution system and update related logic
This commit is contained in:
@@ -174,7 +174,7 @@ The other 25 are present on disk but not yet wired into the evolution system.
|
|||||||
|
|
||||||
| filename | label | type | group |
|
| filename | label | type | group |
|
||||||
|----------------------------------|-------------|---------|----------|
|
|----------------------------------|-------------|---------|----------|
|
||||||
| dna-bold-duotone.svg | DNA | good | biology |
|
| cell.svg | cell | good | biology |
|
||||||
| bug-bold-duotone.svg | Bug | bad | tech |
|
| bug-bold-duotone.svg | Bug | bad | tech |
|
||||||
| buildings-3-bold-duotone.svg | Buildings | good | economy |
|
| buildings-3-bold-duotone.svg | Buildings | good | economy |
|
||||||
| chat-round-dots-bold-duotone.svg | Chat | neutral | social |
|
| chat-round-dots-bold-duotone.svg | Chat | neutral | social |
|
||||||
@@ -202,7 +202,7 @@ Create a new group in `icons.groups` if needed.
|
|||||||
|
|
||||||
## Current spawn behaviour
|
## Current spawn behaviour
|
||||||
|
|
||||||
Only `dna-bold-duotone` spawns by default; the spawn logic is the next target for extension.
|
Only `cell` spawns by default; the spawn logic is the next target for extension.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -60,9 +60,9 @@
|
|||||||
<div class="guide-section">
|
<div class="guide-section">
|
||||||
<p class="guide-section__label">entities</p>
|
<p class="guide-section__label">entities</p>
|
||||||
<ul class="guide-entities">
|
<ul class="guide-entities">
|
||||||
<li class="guide-entity" style="--c:#a8ffb8" data-count-key="dna-bold-duotone">
|
<li class="guide-entity" style="--c:#a8ffb8" data-count-key="cell">
|
||||||
<span class="guide-entity__icon" data-guide-icon="dna-bold-duotone"></span>
|
<span class="guide-entity__icon" data-guide-icon="cell"></span>
|
||||||
<span class="guide-entity__name">dna</span>
|
<span class="guide-entity__name">cell</span>
|
||||||
<span class="guide-entity__role">base lifeform</span>
|
<span class="guide-entity__role">base lifeform</span>
|
||||||
<span class="guide-entity__count">0</span>
|
<span class="guide-entity__count">0</span>
|
||||||
</li>
|
</li>
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
<li class="guide-rule">
|
<li class="guide-rule">
|
||||||
<span class="guide-entity__icon" data-guide-icon="bug"></span>
|
<span class="guide-entity__icon" data-guide-icon="bug"></span>
|
||||||
<span class="guide-rule__op">+</span>
|
<span class="guide-rule__op">+</span>
|
||||||
<span class="guide-entity__icon" data-guide-icon="dna-bold-duotone"></span>
|
<span class="guide-entity__icon" data-guide-icon="cell"></span>
|
||||||
<span class="guide-rule__op">→</span>
|
<span class="guide-rule__op">→</span>
|
||||||
<span class="guide-entity__icon" data-guide-icon="virus-filled"></span>
|
<span class="guide-entity__icon" data-guide-icon="virus-filled"></span>
|
||||||
<span class="guide-rule__desc">bug infects</span>
|
<span class="guide-rule__desc">bug infects</span>
|
||||||
@@ -104,13 +104,13 @@
|
|||||||
<span class="guide-rule__op">+</span>
|
<span class="guide-rule__op">+</span>
|
||||||
<span class="guide-entity__icon" data-guide-icon="virus-filled"></span>
|
<span class="guide-entity__icon" data-guide-icon="virus-filled"></span>
|
||||||
<span class="guide-rule__op">→</span>
|
<span class="guide-rule__op">→</span>
|
||||||
<span class="guide-entity__icon" data-guide-icon="dna-bold-duotone"></span>
|
<span class="guide-entity__icon" data-guide-icon="cell"></span>
|
||||||
<span class="guide-rule__desc">bug cures virus</span>
|
<span class="guide-rule__desc">bug cures virus</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="guide-rule">
|
<li class="guide-rule">
|
||||||
<span class="guide-entity__icon" data-guide-icon="virus-filled"></span>
|
<span class="guide-entity__icon" data-guide-icon="virus-filled"></span>
|
||||||
<span class="guide-rule__op">+</span>
|
<span class="guide-rule__op">+</span>
|
||||||
<span class="guide-entity__icon" data-guide-icon="dna-bold-duotone"></span>
|
<span class="guide-entity__icon" data-guide-icon="cell"></span>
|
||||||
<span class="guide-rule__op">→</span>
|
<span class="guide-rule__op">→</span>
|
||||||
<span class="guide-rule__pct">90%</span>
|
<span class="guide-rule__pct">90%</span>
|
||||||
<span class="guide-rule__desc">virus kills</span>
|
<span class="guide-rule__desc">virus kills</span>
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
<li class="guide-rule">
|
<li class="guide-rule">
|
||||||
<span class="guide-entity__icon" data-guide-icon="virus-filled"></span>
|
<span class="guide-entity__icon" data-guide-icon="virus-filled"></span>
|
||||||
<span class="guide-rule__op">+</span>
|
<span class="guide-rule__op">+</span>
|
||||||
<span class="guide-entity__icon" data-guide-icon="dna-bold-duotone"></span>
|
<span class="guide-entity__icon" data-guide-icon="cell"></span>
|
||||||
<span class="guide-rule__op">→</span>
|
<span class="guide-rule__op">→</span>
|
||||||
<span class="guide-entity__icon" data-guide-icon="bacteria"></span>
|
<span class="guide-entity__icon" data-guide-icon="bacteria"></span>
|
||||||
<span class="guide-rule__pct">10%</span>
|
<span class="guide-rule__pct">10%</span>
|
||||||
|
|||||||
+3
-10
@@ -2,7 +2,7 @@
|
|||||||
"_comment": "Icon registry for the evolution system. Each icon has a type (good/bad/neutral/viral) and belongs to a group. Types define the visual colour tint. Spawn config controls initial entity creation and rare spawns.",
|
"_comment": "Icon registry for the evolution system. Each icon has a type (good/bad/neutral/viral) and belongs to a group. Types define the visual colour tint. Spawn config controls initial entity creation and rare spawns.",
|
||||||
|
|
||||||
"groups": [
|
"groups": [
|
||||||
{ "id": "biology", "label": "Biology", "icons": ["dna-bold-duotone", "bacteria"] },
|
{ "id": "biology", "label": "Biology", "icons": ["cell", "bacteria"] },
|
||||||
{ "id": "tech", "label": "Technology", "icons": ["database-bold-duotone", "display-line-duotone", "bug-bold-duotone"] },
|
{ "id": "tech", "label": "Technology", "icons": ["database-bold-duotone", "display-line-duotone", "bug-bold-duotone"] },
|
||||||
{ "id": "social", "label": "Social", "icons": ["chat-round-dots-bold-duotone", "chat-round-unread-bold-duotone"] },
|
{ "id": "social", "label": "Social", "icons": ["chat-round-dots-bold-duotone", "chat-round-unread-bold-duotone"] },
|
||||||
{ "id": "economy", "label": "Economy", "icons": ["chat-round-money-bold-duotone", "delivery-bold-duotone", "buildings-3-bold-duotone"] },
|
{ "id": "economy", "label": "Economy", "icons": ["chat-round-money-bold-duotone", "delivery-bold-duotone", "buildings-3-bold-duotone"] },
|
||||||
@@ -10,15 +10,8 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
"icons": {
|
"icons": {
|
||||||
"dna-bold-duotone": { "label": "DNA", "type": "good", "group": "biology" },
|
"cell": { "label": "Cell", "type": "good", "group": "biology" },
|
||||||
"bug-bold-duotone": { "label": "Bug", "type": "bad", "group": "tech" },
|
"bug-bold-duotone": { "label": "Bug", "type": "bad", "group": "tech" },
|
||||||
"buildings-3-bold-duotone": { "label": "Buildings", "type": "good", "group": "economy" },
|
|
||||||
"chat-round-dots-bold-duotone": { "label": "Chat", "type": "neutral", "group": "social" },
|
|
||||||
"chat-round-money-bold-duotone": { "label": "Chat Money", "type": "neutral", "group": "economy" },
|
|
||||||
"chat-round-unread-bold-duotone": { "label": "Unread Chat", "type": "neutral", "group": "social" },
|
|
||||||
"database-bold-duotone": { "label": "Database", "type": "good", "group": "tech" },
|
|
||||||
"delivery-bold-duotone": { "label": "Delivery", "type": "good", "group": "economy" },
|
|
||||||
"display-line-duotone": { "label": "Display", "type": "neutral", "group": "tech" },
|
|
||||||
"bug": { "label": "Bug (rare)", "type": "bad", "group": "threat", "isRare": true, "behavior": "infect", "infectWith": "virus-filled" },
|
"bug": { "label": "Bug (rare)", "type": "bad", "group": "threat", "isRare": true, "behavior": "infect", "infectWith": "virus-filled" },
|
||||||
"virus-filled": { "label": "Virus", "type": "viral", "group": "threat" },
|
"virus-filled": { "label": "Virus", "type": "viral", "group": "threat" },
|
||||||
"bacteria": { "label": "Bacteria", "type": "mutant", "group": "biology" }
|
"bacteria": { "label": "Bacteria", "type": "mutant", "group": "biology" }
|
||||||
@@ -33,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"spawn": {
|
"spawn": {
|
||||||
"initial": "dna-bold-duotone",
|
"initial": "cell",
|
||||||
"rare": "bug",
|
"rare": "bug",
|
||||||
"rareChance": 0.08
|
"rareChance": 0.08
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="currentColor"><path d="M7.828 14.84v1.067a.206.206 0 0 1-.412 0V14.84a.206.206 0 1 1 .412 0"/><path fill-rule="evenodd" d="M15.03 11.424a2.272 2.272 0 1 0 0 4.544a2.272 2.272 0 0 0 0-4.544m1.515 2.272a1.515 1.515 0 1 1-3.03 0a1.515 1.515 0 0 1 3.03 0" clip-rule="evenodd"/><path fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10M11.044 5.247a5.91 5.91 0 0 0-5.842 5.976a.757.757 0 0 0 1.515-.017a4.37 4.37 0 0 1 .76-2.52l1.179 1.18a.757.757 0 0 0 1.071-1.07L8.531 7.598a4.37 4.37 0 0 1 2.53-.837a.757.757 0 1 0-.017-1.515M5.901 14.84a1.72 1.72 0 1 1 3.442 0v1.066a1.72 1.72 0 1 1-3.442 0zm5.342-1.145a3.787 3.787 0 1 1 7.574 0a3.787 3.787 0 0 1-7.574 0" clip-rule="evenodd"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 822 B |
+8
-8
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* 1. Spawning — after a random interval (SPAWN_DELAY_MIN … SPAWN_DELAY_MAX),
|
* 1. Spawning — after a random interval (SPAWN_DELAY_MIN … SPAWN_DELAY_MAX),
|
||||||
* an icon appears at a random viewport position. Most spawns produce the
|
* an icon appears at a random viewport position. Most spawns produce the
|
||||||
* "initial" icon (dna-bold-duotone); with rareChance probability the rare
|
* "initial" icon (cell); with rareChance probability the rare
|
||||||
* "bug" icon spawns instead.
|
* "bug" icon spawns instead.
|
||||||
*
|
*
|
||||||
* 2. Physics loop — a single rAF loop drives all live entities each frame.
|
* 2. Physics loop — a single rAF loop drives all live entities each frame.
|
||||||
@@ -126,7 +126,7 @@ export class EvolutionController {
|
|||||||
* Manually spawn a specific icon by name at a random viewport position.
|
* Manually spawn a specific icon by name at a random viewport position.
|
||||||
* Used by the guide panel when the user clicks an entity row.
|
* Used by the guide panel when the user clicks an entity row.
|
||||||
*
|
*
|
||||||
* @param {string} iconName Key from icons.json (e.g. 'dna-bold-duotone', 'bug')
|
* @param {string} iconName Key from icons.json (e.g. 'cell', 'bug')
|
||||||
*/
|
*/
|
||||||
async spawnNamed(iconName) {
|
async spawnNamed(iconName) {
|
||||||
if (!this.#container || !this.#iconsData) return;
|
if (!this.#container || !this.#iconsData) return;
|
||||||
@@ -384,22 +384,22 @@ export class EvolutionController {
|
|||||||
: '#ff4d6d';
|
: '#ff4d6d';
|
||||||
|
|
||||||
// bug + normal entity → infects with virus
|
// bug + normal entity → infects with virus
|
||||||
// bug + virus-filled → backwards-transforms virus back to DNA (cure)
|
// bug + virus-filled → backwards-transforms virus back to cell (cure)
|
||||||
const dnaMeta = this.#iconsData.icons['dna-bold-duotone'];
|
const cellMeta = this.#iconsData.icons['cell'];
|
||||||
const dnaColor = dnaMeta
|
const cellColor = cellMeta
|
||||||
? (this.#iconsData.types[dnaMeta.type]?.color ?? '#a8ffb8')
|
? (this.#iconsData.types[cellMeta.type]?.color ?? '#a8ffb8')
|
||||||
: '#a8ffb8';
|
: '#a8ffb8';
|
||||||
const bugImmune = new Set(['bug', 'bacteria']);
|
const bugImmune = new Set(['bug', 'bacteria']);
|
||||||
|
|
||||||
if (a.entityKey === 'bug') {
|
if (a.entityKey === 'bug') {
|
||||||
if (b.entityKey === 'virus-filled') {
|
if (b.entityKey === 'virus-filled') {
|
||||||
b.infectWith('dna-bold-duotone', dnaColor, { force: true });
|
b.infectWith('cell', cellColor, { force: true });
|
||||||
} else if (!bugImmune.has(b.entityKey)) {
|
} else if (!bugImmune.has(b.entityKey)) {
|
||||||
b.infectWith('virus-filled', virusColor);
|
b.infectWith('virus-filled', virusColor);
|
||||||
}
|
}
|
||||||
} else if (b.entityKey === 'bug') {
|
} else if (b.entityKey === 'bug') {
|
||||||
if (a.entityKey === 'virus-filled') {
|
if (a.entityKey === 'virus-filled') {
|
||||||
a.infectWith('dna-bold-duotone', dnaColor, { force: true });
|
a.infectWith('cell', cellColor, { force: true });
|
||||||
} else if (!bugImmune.has(a.entityKey)) {
|
} else if (!bugImmune.has(a.entityKey)) {
|
||||||
a.infectWith('virus-filled', virusColor);
|
a.infectWith('virus-filled', virusColor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function normalizeSvg(raw) {
|
|||||||
* Load and cache an SVG icon by name.
|
* Load and cache an SVG icon by name.
|
||||||
* Subsequent calls for the same name are synchronous (cache hit).
|
* Subsequent calls for the same name are synchronous (cache hit).
|
||||||
*
|
*
|
||||||
* @param {string} name Filename without extension, e.g. 'dna-bold-duotone'
|
* @param {string} name Filename without extension, e.g. 'cell'
|
||||||
* @returns {Promise<string>} Normalised SVG markup
|
* @returns {Promise<string>} Normalised SVG markup
|
||||||
*/
|
*/
|
||||||
export async function loadIcon(name) {
|
export async function loadIcon(name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user