extends Resource class_name PlanetData signal quota_number_updated(quota : int) signal contamination_updated(decontamination_surface : float) const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 400. const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 100. const DEFAULT_BASE_SIZE = Vector2(2000,2000) @export var base_size : Vector2 = Vector2(2000,2000) @export var contamination : TerrainData @export var quota_number : int = 0 : set(v): quota_number = v quota_number_updated.emit(v) func _init(_base_size : Vector2 = DEFAULT_BASE_SIZE): base_size = _base_size contamination = TerrainData.new(base_size) contamination.draw_random_zone( DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE, DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE, base_size/2 ) contamination_updated.emit(get_decontamination_surface()) func impact_contamination(position : Vector2, impact_radius : float, to_value : float = 1.): contamination.draw_circle( position, impact_radius, to_value ) contamination_updated.emit(get_decontamination_surface()) func is_in_base(point): return ( point.x > 0 and point.y > 0 and point.x < base_size.x and point.y < base_size.y) func get_contamination(point : Vector2) -> float: return contamination.get_value(point) func get_decontamination_coverage() -> float: return contamination.get_value_coverage() func get_decontamination_surface() -> float: return contamination.get_value_surface() * 10 #endregion #region ------------------ Objectives ------------------ func generate_objective_rewards(level = 0) -> Array[ObjectiveReward]: var amount = level + 1 var possible_objective_rewards_path : Array[ObjectiveReward] = [ UpgradePlayerMaxEnergyReward.new(), UpgradePlayerInventorySizeReward.new(), LootRandomSeedsReward.new(randi_range(4+level, 6+level)) ] var objectives_reward : Array[ObjectiveReward] = [] var i = 0 while i < amount and len(possible_objective_rewards_path) > 0: var r = possible_objective_rewards_path.pick_random() possible_objective_rewards_path.erase(r) objectives_reward.append(r) i += 1 return objectives_reward #endregion #region ------------------ Quotas ------------------ func get_quota(n = 0) -> int: var first_quota = 100 var quota_adding = n * 150 if n == 0: return first_quota elif n < 0: return 0 return get_quota(n - 1) + quota_adding #endregion