A little folders cleanup

This commit is contained in:
2ndbeam 2024-05-14 22:01:33 +03:00
commit 545da7be1f
90 changed files with 68 additions and 1661 deletions

View file

@ -1,3 +0,0 @@
extends StaticBody2D
var faction = "none"

View file

@ -1,5 +0,0 @@
extends Area2D
func _on_body_entered(body):
if body is NPCShip:
body.switchdestination()

View file

@ -1,29 +0,0 @@
extends Camera2D
@onready var ship = get_parent()
var engine
@onready var cur_scale = zoom.x
@onready var min_scale = cur_scale / 1.5
@onready var max_scale = cur_scale * 2
var rdy = false
func _ready():
get_tree().create_timer(0.05).timeout.connect(is_rdy)
func is_rdy():
rdy = true
engine = ship.engine
func _process(_delta):
if !rdy:
return
engine = ship.engine
var speed_percentage = engine.max_speed / engine.speed
var factor : float
if get_parent().allow_shooting:
factor = clamp(speed_percentage, min_scale, max_scale)
if engine.speed < 0:
factor = max_scale
else:
factor = 1.0
zoom = Vector2(factor, factor)

View file

@ -1,32 +0,0 @@
extends Label
@export var counter_id : String
@onready var ship = $"../../.."
var hull
var shield
var rdy = false
func _ready():
get_tree().create_timer(0.05).timeout.connect(is_rdy)
func is_rdy():
rdy = true
hull = ship.hull
shield = ship.shield
func _process(_delta) -> void:
if !rdy:
return
hull = ship.hull
shield = ship.shield
match counter_id:
"ammo":
text = str(hull.ammunition)
"fuel":
text = "Fuel: {fuel} / {max} units".format({"fuel":hull.fuel, "max":hull.max_fuel})
"hp":
text = "Hull Strength: {hp} / {max} units".format({"hp":"%0.2f" % hull.hp, "max":hull.max_hp})
"money":
text = "Available Money: {money} units".format({"money":ship.money})
"shield":
text = "Shield Capacity: {shield} / {max} units".format({"shield":"%0.2f" % shield.capacity, "max":shield.max_capacity})

View file

@ -1,8 +0,0 @@
extends GPUParticles2D
@onready var engine = $".."
func _process(_delta):
var speed_percentage = clamp(engine.speed / engine.max_speed, 0.75, 1.5)
speed_scale = speed_percentage if engine.speed > 0 else 1
emitting = engine.speed > 0

View file

@ -1,13 +0,0 @@
extends Node2D
@export var faction : bool
func changeitemscolor():
var items = get_children()
var ship = get_tree().current_scene.ship
for item in items:
#item.modulate = modulate
if item.material:
item.material.set_shader_parameter("color",modulate)
if faction:
ship.minimap.add_marker(item, "hostile")

View file

@ -1,11 +0,0 @@
extends Node
class_name ProjectileContainer
static var instance : ProjectileContainer
func _ready():
instance = self
func _exit_tree():
instance = null

View file

@ -1,25 +0,0 @@
extends Node
## Star scene
@export var star : PackedScene
## Affects how many stars will be generated and places on whole system
@export var stars_amount = 1000
## Affects how much space on borders of the star system will be empty
@export_range(0, 1) var compress_space_amount = 0.1
## Shortcut to get_parent()
@onready var star_system: = get_parent()
func _ready():
var compress_multiplier = 1.0 - compress_space_amount
var parallax_layers = get_children()
var width_halved = star_system.width / 2
var height_halved = star_system.height / 2
for i in range(stars_amount):
var star_inst = star.instantiate()
var x = randi_range(-width_halved, width_halved) * compress_multiplier
var y = randi_range(-height_halved, height_halved) * compress_multiplier
# Decides parallax layer which star belongs to
var distance = randi_range(0, get_child_count() - 1)
parallax_layers[distance].add_child(star_inst)
var position = Vector2(x, y)
star_inst.position = position