Add transparent enemy unit art
This commit is contained in:
@@ -29,6 +29,9 @@ func hydrate_deployment(deployment: Dictionary) -> Dictionary:
|
||||
var class_def := _get_dict(classes, class_id)
|
||||
var equipment := _merged_equipment(officer.get("equipment", {}), deployment.get("equipment", {}))
|
||||
var range_pair := _resolve_attack_range(class_def, equipment)
|
||||
var unit_officer_id := str(deployment.get("officer_id", ""))
|
||||
var unit_team := str(deployment.get("team", "enemy"))
|
||||
var sprite_info := _resolved_unit_sprite(deployment, officer, class_def, unit_team, unit_officer_id)
|
||||
|
||||
var stats := {}
|
||||
_overlay_stats(stats, officer.get("base", {}))
|
||||
@@ -38,13 +41,14 @@ func hydrate_deployment(deployment: Dictionary) -> Dictionary:
|
||||
|
||||
var unit := {}
|
||||
unit["id"] = str(deployment.get("unit_id", deployment.get("id", deployment.get("officer_id", ""))))
|
||||
unit["officer_id"] = str(deployment.get("officer_id", ""))
|
||||
unit["officer_id"] = unit_officer_id
|
||||
unit["name"] = str(deployment.get("name", officer.get("name", unit["id"])))
|
||||
unit["portrait"] = str(deployment.get("portrait", officer.get("portrait", "")))
|
||||
unit["sprite"] = str(deployment.get("sprite", officer.get("sprite", class_def.get("sprite", ""))))
|
||||
unit["sprite"] = str(sprite_info.get("path", ""))
|
||||
unit["uses_enemy_sprite"] = bool(sprite_info.get("uses_enemy_sprite", false))
|
||||
unit["class_id"] = class_id
|
||||
unit["class"] = str(class_def.get("name", class_id.capitalize()))
|
||||
unit["team"] = str(deployment.get("team", "enemy"))
|
||||
unit["team"] = unit_team
|
||||
unit["pos"] = deployment.get("pos", [0, 0])
|
||||
unit["requires_joined"] = bool(deployment.get("requires_joined", false))
|
||||
unit["controllable"] = bool(deployment.get("controllable", true))
|
||||
@@ -76,6 +80,19 @@ func hydrate_deployment(deployment: Dictionary) -> Dictionary:
|
||||
return unit
|
||||
|
||||
|
||||
func _resolved_unit_sprite(deployment: Dictionary, officer: Dictionary, class_def: Dictionary, team: String, officer_id: String) -> Dictionary:
|
||||
var deployment_sprite := str(deployment.get("sprite", "")).strip_edges()
|
||||
if not deployment_sprite.is_empty():
|
||||
return {"path": deployment_sprite, "uses_enemy_sprite": false}
|
||||
var officer_sprite := str(officer.get("sprite", "")).strip_edges()
|
||||
if not officer_sprite.is_empty():
|
||||
return {"path": officer_sprite, "uses_enemy_sprite": false}
|
||||
var enemy_sprite := str(class_def.get("enemy_sprite", "")).strip_edges()
|
||||
if team == "enemy" and officer_id.strip_edges().is_empty() and not enemy_sprite.is_empty():
|
||||
return {"path": enemy_sprite, "uses_enemy_sprite": true}
|
||||
return {"path": str(class_def.get("sprite", "")).strip_edges(), "uses_enemy_sprite": false}
|
||||
|
||||
|
||||
func get_runtime_terrain_defs(default_defs: Dictionary) -> Dictionary:
|
||||
var result := default_defs.duplicate(true)
|
||||
for key in terrain.keys():
|
||||
|
||||
@@ -1436,6 +1436,8 @@ func _fit_texture_rect(texture: Texture2D, target: Rect2) -> Rect2:
|
||||
func _unit_sprite_modulate(unit: Dictionary, acted: bool) -> Color:
|
||||
if acted:
|
||||
return Color(0.60, 0.62, 0.66, 0.82)
|
||||
if bool(unit.get("uses_enemy_sprite", false)):
|
||||
return Color(1.0, 1.0, 1.0, 0.98)
|
||||
if _is_generic_enemy_unit(unit):
|
||||
return Color(1.0, 0.82, 0.74, 0.94)
|
||||
return Color.WHITE
|
||||
|
||||
Reference in New Issue
Block a user