# Hurry Curry! - a game about cooking # Copyright (C) 2025 Hurry Curry! contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, version 3 of the License only. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # class_name ExteriorTree extends Grass const SCALE: Vector3 = Vector3(100., 100., 100.) const ROT: Vector3 = Vector3(1.5 * PI, 0., 0.) func _init(ctx: TileFactory.TileCC): super(ctx) var random = RandomNumberGenerator.new() random.seed = str(ctx.position).hash() var tree: int = random.randi_range(1,5) var trunk: Mesh = load("res://map/tiles/tree/trunk_%d.res" % tree) var leaves: Mesh = load("res://map/tiles/tree/leaves_%d_%s.res" % [ tree, "lq" if Settings.read("graphics.lq_trees") else "hq" ]) var trunk_instance: MeshInstance3D = MeshInstance3D.new() trunk_instance.mesh = trunk trunk_instance.scale = SCALE trunk_instance.rotation = ROT var leaves_instance: MeshInstance3D = MeshInstance3D.new() leaves_instance.mesh = leaves leaves_instance.scale = SCALE leaves_instance.rotation = ROT var tree_node: Node3D = Node3D.new() tree_node.add_child(trunk_instance) tree_node.add_child(leaves_instance) tree_node.name = "Tree" base.add_child(tree_node)