New items + base typing + price generation + new menu template
This commit is contained in:
parent
ff19560f0b
commit
50be4a0bb2
20 changed files with 408 additions and 37 deletions
55
scripts/objects/Base.gd
Normal file
55
scripts/objects/Base.gd
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
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:
|
||||
price = randi_range(item.min_price * 100, item.max_price * 100) / 100
|
||||
sell_prices.append(price)
|
||||
for item in want_to_buy:
|
||||
if type != Game.BASE_TYPE.TRADING:
|
||||
price = randi_range((item.max_price + item.min_price) / 2 * 100, item.max_price * 100) / 100
|
||||
else:
|
||||
price = randi_range(item.min_price * 100, (item.max_price + item.min_price) / 2 * 100) / 100
|
||||
buy_prices.append(price)
|
||||
print(sell_prices, buy_prices)
|
||||
|
|
@ -2,12 +2,14 @@ extends Node2D
|
|||
|
||||
class_name Hull
|
||||
|
||||
@export var max_hp : int = 30
|
||||
@export var max_fuel : int = 1000
|
||||
|
||||
@onready var hp = max_hp
|
||||
@export var max_hp : float = 30
|
||||
@export var max_fuel : float = 1000
|
||||
@export var max_weight : float = 100
|
||||
@onready var hp : float = max_hp
|
||||
@onready var fuel : float = max_fuel
|
||||
|
||||
var weight : float = 0
|
||||
|
||||
var ammunition = {
|
||||
"n/a" : 0,
|
||||
"Laser Energy" : 100,
|
||||
|
|
@ -19,3 +21,5 @@ var max_ammunition = {
|
|||
"Laser Energy" : 100,
|
||||
"Rockets" : 20
|
||||
}
|
||||
|
||||
var cargo = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue