あ
This commit is contained in:
parent
8f9f5b5100
commit
f1c3af2b89
49 changed files with 989 additions and 310 deletions
|
|
@ -168,6 +168,7 @@ function findNearbyBuildMaterial(world, tarinai, type, maxDist = 520) {
|
|||
}
|
||||
|
||||
function buildOwnedStructureFromGrass(t, world, type, label) {
|
||||
if (!(world?.canAddObjects?.(1) ?? true)) return false;
|
||||
const material = findNearbyBuildMaterial(world, t, type, 520);
|
||||
if (!material || !globalThis.StructureRegistry) return false;
|
||||
t.buildPlan = {
|
||||
|
|
@ -208,6 +209,9 @@ function continueBuildPlan(t, world, dt) {
|
|||
if (!spot) {
|
||||
return stopFailedBuildPlan(t, world, plan.type, "\u4F5C\u308B\u5834\u6240\u304C\u898B\u3064\u304B\u3089\u306A\u3044");
|
||||
}
|
||||
if (!(world?.canAddObjects?.(1) ?? true)) {
|
||||
return stopFailedBuildPlan(t, world, plan.type, "\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u4e0a\u9650\u306b\u9054\u3057\u3066\u3044\u308b");
|
||||
}
|
||||
consumeGrassMaterial(material, structureGrassStageCost(plan.type));
|
||||
const structure = globalThis.StructureRegistry.create(plan.type, t, spot.x, spot.y, world);
|
||||
if (!structure) {
|
||||
|
|
@ -219,7 +223,7 @@ function continueBuildPlan(t, world, dt) {
|
|||
structure.x = t.x;
|
||||
structure.y = t.y - Math.max(28, (t.radius || 24) * 1.28);
|
||||
}
|
||||
const addedStructure = world.addItem?.(structure, `build:${plan.type}`) || (world.items.push(structure), structure);
|
||||
const addedStructure = world.addItem?.(structure, `build:${plan.type}`) || null;
|
||||
if (!addedStructure) {
|
||||
return stopFailedBuildPlan(t, world, plan.type, "\u4f5c\u308b\u5834\u6240\u304c\u898b\u3064\u304b\u3089\u306a\u3044");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue