P08-03: 配置の通常操作受入
This commit is contained in:
+13
-1
@@ -2124,7 +2124,19 @@ func _preview_failure_message(report: Dictionary) -> String:
|
||||
var codes_value: Variant = report.get(&"error_codes", [])
|
||||
if codes_value is Array and not codes_value.is_empty():
|
||||
var code := String(codes_value[0])
|
||||
return "配置不可: %s" % PREVIEW_REASON_NAMES.get(code, code)
|
||||
if PREVIEW_REASON_NAMES.has(code):
|
||||
return "配置不可: %s" % PREVIEW_REASON_NAMES[code]
|
||||
var code_reasons: Variant = report.get(&"reasons", [])
|
||||
if code_reasons is Array and not code_reasons.is_empty():
|
||||
var reason: Variant = code_reasons[0]
|
||||
for candidate: Variant in code_reasons:
|
||||
if candidate is Dictionary and String(candidate.get(&"code", "")) == code:
|
||||
reason = candidate
|
||||
break
|
||||
if reason is Dictionary:
|
||||
var message := String(reason.get(&"message", ""))
|
||||
if not message.is_empty():
|
||||
return "配置不可: %s" % message
|
||||
var reasons_value: Variant = report.get(&"reasons", [])
|
||||
if reasons_value is Array and not reasons_value.is_empty() and reasons_value[0] is Dictionary:
|
||||
return "配置不可: %s" % String(reasons_value[0].get(&"message", "条件を満たしていません"))
|
||||
|
||||
@@ -202,6 +202,12 @@ func get_build_preview_report(cell: Variant = null) -> Dictionary:
|
||||
var target: Variant = _hovered_cell if cell == null else cell
|
||||
if build_definition == null or not target is Vector3i:
|
||||
return INVALID_PREVIEW.duplicate(true)
|
||||
if _runtime != null and _runtime.has_method(&"preview_build_facility"):
|
||||
var result: Dictionary = _runtime.call(&"preview_build_facility", build_definition.id, Vector3i(target.x, target.y, layer_mode), build_rotation)
|
||||
result[&"connection"] = _build_connection_report(
|
||||
_cells_from_serialized(result.get(&"cells", [])),
|
||||
Vector3i(target.x, target.y, layer_mode))
|
||||
return result
|
||||
var construction: Variant = _service(&"construction_service")
|
||||
if construction != null and construction.has_method(&"validate_placement"):
|
||||
var report: Variant = construction.call(
|
||||
|
||||
Reference in New Issue
Block a user