Warming border added
This commit is contained in:
@@ -162,6 +162,8 @@ Ct не получает часы. Инициализация отсутству
|
||||
|
||||
В Unity в первой формуле было `−7`; это ошибка, не позволяющая указателю двигаться. Здесь исправлено на `+7`. Переключение шкалы меняет и заголовок/описание индикатора. Само наступление апокалипсиса индикатор не запускает.
|
||||
|
||||
Общая рамка `Background/WarningBorder` получает цвета Unity `WarningUI` в формате RGBA: при плотности ≤1e-5 — `C040407F`, ≤1e-6 — `DF2020BF`, ≤1e-7 — `FF0000FF`; при плотности ≥0,9 — `40A0C07F`, ≥0,97 — `20B0DFBF`, ≥1 — `00C0FFFF`. В нормальном диапазоне рамка прозрачна. Она обновляется вместе с индикаторами, не перехватывает нажатия и снимается при восстановлении плотности. Необратимая последовательность апокалипсиса Unity сюда не входит.
|
||||
|
||||
### Горючесть, взрывчатость и агрессия
|
||||
|
||||
`world_parameters` хранит Bur, Exp и Agg в диапазоне 1…19, начальное значение — 10. Эффективный множитель `M(x) = 10^((x−10)/9)`: крайние значения 0,1 и 10, нейтральное — 1.
|
||||
|
||||
+1
-1
@@ -229,7 +229,7 @@ func item_activated(item: OwniverseItem) -> void:
|
||||
_set_item_description(item)
|
||||
|
||||
if item.item_id == "S" or item.item_id == "H":
|
||||
var _value = owniverse.produce_hs(item.item_id, 100_000)
|
||||
var _value = owniverse.produce_hs(item.item_id, 100_000_000_000_000)
|
||||
|
||||
|
||||
func _check_counters(delta: float) -> Array:
|
||||
|
||||
@@ -155,6 +155,25 @@ func run() -> void:
|
||||
stage.owniverse.state.world_parameters.Bur = 19.0
|
||||
stage.owniverse.state.trends.Integration = 0.75
|
||||
stage.world_indicators.update(stage.owniverse)
|
||||
var warning: TextureRect = scene.get_node("Background/WarningBorder")
|
||||
check(warning.mouse_filter == Control.MOUSE_FILTER_IGNORE, "Warning overlay does not block input")
|
||||
var environments: Array = [
|
||||
[1.0e-7, "ff0000ff"], [1.0e-6, "df2020bf"], [1.0e-5, "c040407f"],
|
||||
[0.1, "00000000"], [0.9, "40a0c07f"], [0.97, "20b0dfbf"], [1.0, "00c0ffff"],
|
||||
[0.1, "00000000"],
|
||||
]
|
||||
for sample in environments:
|
||||
check(Parameters.density_warning_color(sample[0]).is_equal_approx(Color.html(sample[1])), "Unity warning threshold: " + str(sample[0]))
|
||||
stage.owniverse.state.amount.H = 1e14
|
||||
stage.world_indicators.update(stage.owniverse)
|
||||
check(warning.self_modulate.is_equal_approx(Color.html("00c0ffff")), "Compression warning uses current universe density")
|
||||
stage.owniverse.state.amount.H = 0.0
|
||||
stage.owniverse.state.amount.S = 1e24
|
||||
stage.world_indicators.update(stage.owniverse)
|
||||
check(warning.self_modulate.is_equal_approx(Color.html("ff0000ff")), "Rip warning replaces compression warning")
|
||||
stage.owniverse.state.amount.S = 0.0
|
||||
stage.world_indicators.update(stage.owniverse)
|
||||
check(warning.self_modulate.a == 0.0, "Warning clears when density returns to normal")
|
||||
for bar in stage.world_indicators.energy_bars:
|
||||
check(bar.scale.x == 0.25, "Energy fill is synchronized on both pages")
|
||||
var pointer: Control = stage.world_indicators.pointers.Bur
|
||||
|
||||
@@ -5,8 +5,10 @@ var energy_bars: Array = []
|
||||
var density_indicators: Array = []
|
||||
var pointers: Dictionary = {}
|
||||
var trend_bars: Array = []
|
||||
var warning_border: TextureRect
|
||||
|
||||
func _init(stage: Node) -> void:
|
||||
warning_border = stage.get_node("../Background/WarningBorder")
|
||||
var pages: Node = stage.get_node("World/PageScroller/HBoxContainer")
|
||||
for path in ["ResourcePage/ResourceHeader", "StructurePage/StructureHeader"]:
|
||||
energy_bars.append(pages.get_node(path + "/EnergyIndicator/Indicator"))
|
||||
@@ -32,7 +34,9 @@ func update(world) -> void:
|
||||
var source: Dictionary = world.state
|
||||
var energy: float = clampf(source.energy / Parameters.INITIAL_ENERGY, 0.0, 1.0)
|
||||
for bar in energy_bars: bar.scale.x = energy
|
||||
var density: Dictionary = Parameters.density_display(world.stellar_environment(source).density)
|
||||
var density_value: float = world.stellar_environment(source).density
|
||||
var density: Dictionary = Parameters.density_display(density_value)
|
||||
warning_border.self_modulate = Parameters.density_warning_color(density_value)
|
||||
for indicator in density_indicators:
|
||||
for mode in ["Density", "DensityRip", "DensityCrunch"]:
|
||||
indicator.get_node(mode).visible = mode == density.mode
|
||||
|
||||
@@ -45,6 +45,16 @@ static func density_display(density: float) -> Dictionary:
|
||||
return {"mode": "DensityCrunch", "position": clampf((density - 0.9) * 10.0, 0.0, 1.0)}
|
||||
return {"mode": "Density", "position": clampf(log(density * 1.0e5) / log(9.0e4), 0.0, 1.0)}
|
||||
|
||||
## Unity ApocalypseCheck thresholds and WarningUI colors; visual warning only.
|
||||
static func density_warning_color(density: float) -> Color:
|
||||
if density >= 1.0: return Color.html("00c0ffff")
|
||||
if density >= 0.97: return Color.html("20b0dfbf")
|
||||
if density >= 0.9: return Color.html("40a0c07f")
|
||||
if density <= 1.0e-7: return Color.html("ff0000ff")
|
||||
if density <= 1.0e-6: return Color.html("df2020bf")
|
||||
if density <= 1.0e-5: return Color.html("c040407f")
|
||||
return Color(0.0, 0.0, 0.0, 0.0)
|
||||
|
||||
## Integrate the population present at the start of the simulation interval.
|
||||
## Thresholds use whole event counts; no per-year loop at high speeds.
|
||||
static func advance(previous: Dictionary, target: Dictionary, rules: Dictionary, years: float) -> void:
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://c46h78ewwlafk" path="res://ui/credits/credits.en.png" id="62_vu83j"]
|
||||
[ext_resource type="Texture2D" uid="uid://drvvkd724g8hy" path="res://ui/credits/kid_gp_light.png" id="64_rur7c"]
|
||||
[ext_resource type="Texture2D" uid="uid://b33ji4mpyw4ks" path="res://ui/credits/kid_gp.png" id="65_y1rwn"]
|
||||
[ext_resource type="Texture2D" uid="uid://dgt52qiyuirso" path="res://ui/indicators/density/warning_border.png" id="66_rur7c"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ifjjt"]
|
||||
|
||||
@@ -76,6 +77,14 @@
|
||||
script = ExtResource("1_ifjjt")
|
||||
STARRY_SKY_LAYER = ExtResource("2_behgl")
|
||||
|
||||
[node name="WarningBorder" type="TextureRect" parent="Background" unique_id=1892364212]
|
||||
self_modulate = Color(0, 0, 0, 0)
|
||||
z_index = 1
|
||||
offset_right = 1080.0
|
||||
offset_bottom = 1920.0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("66_rur7c")
|
||||
|
||||
[node name="Timer" type="Timer" parent="Background" unique_id=188844703]
|
||||
autostart = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user