UI and other changes
This commit is contained in:
parent
87b5c11fcf
commit
215e24e246
79 changed files with 70023 additions and 2201 deletions
|
|
@ -5,13 +5,12 @@ extends Node3D
|
|||
## the rest added here); a pile shows one prop per `per` units, up to all of them. Every prop has
|
||||
## collision, and all of them are in place when the farm's navigation is built, so a pile's
|
||||
## footprint never changes for enemies; a hidden prop only stops colliding for the scarecrow and
|
||||
## shots. Each pile has a spot in front of it where supply thieves stand to fill their sacks, and a
|
||||
## label with the amount while the scarecrow is nearby.
|
||||
## shots. Each pile has a spot in front of it where supply thieves stand to fill their sacks. (How
|
||||
## much the shed holds shows in the HUD's pouch panel, ResourceHud.)
|
||||
|
||||
const PREF := "res://assets/farm/ithappy/farm/prefabs/assets/"
|
||||
const LABEL_RANGE := 9.0
|
||||
## material -> adopt (scene props under the shed zone, in fill order), extra ([prefab, world
|
||||
## position, yaw in degrees, scale]), per (units per prop), front (thieves' spot), label (world).
|
||||
## position, yaw in degrees, scale]), per (units per prop), front (thieves' spot).
|
||||
const PILES := {
|
||||
"wood": {
|
||||
"adopt": ["firewood_010_1", "firewood_010_2"],
|
||||
|
|
@ -24,7 +23,6 @@ const PILES := {
|
|||
],
|
||||
"per": 4,
|
||||
"front": Vector2(2.6, -18.6),
|
||||
"label": Vector3(4.2, 2.2, -18.7),
|
||||
},
|
||||
"scrap": {
|
||||
"adopt": ["box_004_1", "box_004_2", "case_001_1", "box_004_3"],
|
||||
|
|
@ -38,7 +36,6 @@ const PILES := {
|
|||
],
|
||||
"per": 3,
|
||||
"front": Vector2(-3.0, -15.1),
|
||||
"label": Vector3(-3.4, 2.8, -18.6),
|
||||
},
|
||||
"straw": {
|
||||
"adopt": ["hay_001_1"],
|
||||
|
|
@ -51,9 +48,8 @@ const PILES := {
|
|||
],
|
||||
"per": 4,
|
||||
"front": Vector2(6.75, -16.25),
|
||||
"label": Vector3(6.2, 3.2, -18.4),
|
||||
},
|
||||
## No pile of its own yet (placeholder: it never shows props), but it needs a real front/label
|
||||
## No pile of its own yet (placeholder: it never shows props), but it needs a real front
|
||||
## spot so a supply thief sent for it (once it's the shed's most-stocked material) has
|
||||
## somewhere reachable to stand; the wood pile's spot is already proven walkable.
|
||||
"alien_goop": {
|
||||
|
|
@ -61,26 +57,22 @@ const PILES := {
|
|||
"extra": [],
|
||||
"per": 1,
|
||||
"front": Vector2(2.6, -18.6),
|
||||
"label": Vector3(4.2, 2.6, -18.3),
|
||||
},
|
||||
}
|
||||
|
||||
var campaign: CampaignController
|
||||
var player: Node3D
|
||||
## material -> Array[Node3D], in fill order.
|
||||
var slots := {}
|
||||
var shown := {}
|
||||
|
||||
var _labels := {}
|
||||
var _bodies := {} # material -> Array (per slot: Array[CollisionObject3D])
|
||||
var _last := {}
|
||||
|
||||
|
||||
## Before the navigation is built: adopts the scene's piles and adds the extra props (every prop
|
||||
## present and colliding).
|
||||
func setup(p_campaign: CampaignController, shed_zone: Node3D, p_player: Node3D) -> void:
|
||||
func setup(p_campaign: CampaignController, shed_zone: Node3D) -> void:
|
||||
campaign = p_campaign
|
||||
player = p_player
|
||||
for m: String in PILES:
|
||||
var pile: Dictionary = PILES[m]
|
||||
var list: Array[Node3D] = []
|
||||
|
|
@ -99,18 +91,6 @@ func setup(p_campaign: CampaignController, shed_zone: Node3D, p_player: Node3D)
|
|||
for n in list:
|
||||
bodies.append(n.find_children("*", "CollisionObject3D", true, false))
|
||||
_bodies[m] = bodies
|
||||
var l := Label3D.new()
|
||||
l.billboard = BaseMaterial3D.BILLBOARD_ENABLED
|
||||
l.no_depth_test = true
|
||||
l.shaded = false
|
||||
l.font_size = 44
|
||||
l.outline_size = 10
|
||||
l.pixel_size = 0.0075
|
||||
l.modulate = GatherNode.COLORS[m]
|
||||
l.visible = false
|
||||
add_child(l)
|
||||
l.global_position = pile["label"]
|
||||
_labels[m] = l
|
||||
|
||||
|
||||
## Where supply thieves stand to take this material.
|
||||
|
|
@ -148,10 +128,3 @@ func _process(_delta: float) -> void:
|
|||
if int(shed.get(m, 0)) != int(_last.get(m, -1)):
|
||||
refresh()
|
||||
break
|
||||
var near := player != null
|
||||
for m: String in _labels:
|
||||
var l := _labels[m] as Label3D
|
||||
var at: Vector3 = PILES[m]["label"]
|
||||
l.visible = near and Vector2(player.global_position.x - at.x, player.global_position.z - at.z).length() < LABEL_RANGE
|
||||
if l.visible:
|
||||
l.text = "%s %d" % [m.capitalize(), int(shed.get(m, 0))]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue