Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
925 B
GDScript
31 lines
925 B
GDScript
@tool
|
|
class_name ImplantTextBlock
|
|
extends RichTextLabel
|
|
## Multi-line wrapping text block for narrative content (GTTR excerpts, etc.).
|
|
|
|
var _max_lines: int = -1
|
|
var _text_alpha: float = 0.75
|
|
|
|
|
|
func _init(content: String = "", max_lines: int = -1) -> void:
|
|
_max_lines = max_lines
|
|
text = content.replace("**", "") # strip markdown bold
|
|
bbcode_enabled = false
|
|
fit_content = true
|
|
scroll_active = false
|
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
size_flags_horizontal = Control.SIZE_FILL
|
|
|
|
|
|
func set_content(content: String, max_lines: int = -1) -> void:
|
|
text = content.replace("**", "") # strip markdown bold
|
|
_max_lines = max_lines
|
|
|
|
|
|
func apply_implant_theme(t: ImplantTheme) -> void:
|
|
add_theme_font_size_override("normal_font_size", t.font_small)
|
|
add_theme_color_override(
|
|
"default_color", Color(t.text_primary.r, t.text_primary.g, t.text_primary.b, _text_alpha)
|
|
)
|