extends Node2D @export var type : Game.BASE_TYPE @onready var menu : Area2D = $MenuCollider @onready var ship : MainShip = get_tree().current_scene.get_node("MainShip") var want_to_sell : Array[Item] = [] var want_to_buy : Array[Item] = [] var sell_prices : Array[float] = [] var buy_prices : Array[float] = [] func _ready(): ship.minimap.add_marker(self, "base") match type: Game.BASE_TYPE.POWER: want_to_sell.append(Game.get_item("Energy Cell")) want_to_buy.append(Game.get_item("Raw Materials")) want_to_buy.append(Game.get_item("Water Barrel")) want_to_buy.append(Game.get_item("Food Supplies")) Game.BASE_TYPE.MINING: want_to_sell.append(Game.get_item("Raw Materials")) want_to_sell.append(Game.get_item("Water Barrel")) want_to_buy.append(Game.get_item("Energy Cell")) want_to_buy.append(Game.get_item("Food Supplies")) Game.BASE_TYPE.FOOD: want_to_sell.append(Game.get_item("Food Supplies")) want_to_buy.append(Game.get_item("Water Barrel")) want_to_buy.append(Game.get_item("Energy Cell")) want_to_buy.append(Game.get_item("Raw Materials")) Game.BASE_TYPE.TRADING: want_to_sell.append(Game.get_item("Food Supplies")) want_to_sell.append(Game.get_item("Water Barrel")) want_to_sell.append(Game.get_item("Energy Cell")) want_to_sell.append(Game.get_item("Raw Materials")) want_to_buy.append(Game.get_item("Food Supplies")) want_to_buy.append(Game.get_item("Water Barrel")) want_to_buy.append(Game.get_item("Energy Cell")) want_to_buy.append(Game.get_item("Raw Materials")) update_prices() func update_prices(): sell_prices = [] buy_prices = [] var price : float for item in want_to_sell: if type != Game.BASE_TYPE.TRADING: price = randi_range(item.min_price, item.max_price * 100) / 100.0 else: price = randi_range((item.max_price + item.min_price) / 2 * 100, item.max_price * 100) / 100.0 sell_prices.append(price) for item in want_to_buy: if type != Game.BASE_TYPE.TRADING: price = randi_range(item.min_price, item.max_price * 100) / 100.0 else: price = randi_range(item.min_price * 100, (item.max_price + item.min_price) / 2 * 100) / 100.0 buy_prices.append(price)