A little cleanup
This commit is contained in:
parent
1cb2c7ebdb
commit
bedeee894a
15 changed files with 21 additions and 124 deletions
|
|
@ -77,31 +77,32 @@ func _process(_delta):
|
|||
## Sets dock state to Ready
|
||||
func dock_ready():
|
||||
dock_state = DockState.Ready
|
||||
gate_static.visible = true
|
||||
gate_static.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
gate_area.visible = false
|
||||
dock_area.visible = false
|
||||
enable_gate()
|
||||
## Sets dock state to Process
|
||||
func dock_process():
|
||||
dock_state = DockState.Process
|
||||
gate_static.visible = false
|
||||
gate_static.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
gate_area.visible = true
|
||||
dock_area.visible = true
|
||||
disable_gate()
|
||||
## Sets dock state to Busy
|
||||
func dock_busy():
|
||||
dock_state = DockState.Busy
|
||||
gate_static.visible = true
|
||||
gate_static.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
gate_area.visible = false
|
||||
dock_area.visible = false
|
||||
enable_gate()
|
||||
# opening base menu
|
||||
var menu_instance = menu.instantiate()
|
||||
menu_instance.base = self
|
||||
player_ship.non_colorable_gui.add_child(menu_instance)
|
||||
|
||||
## Sets dock state to Leave
|
||||
func dock_leave():
|
||||
dock_state = DockState.Leave
|
||||
disable_gate()
|
||||
|
||||
func enable_gate():
|
||||
gate_static.visible = true
|
||||
gate_static.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
gate_area.visible = false
|
||||
dock_area.visible = false
|
||||
|
||||
func disable_gate():
|
||||
gate_static.visible = false
|
||||
gate_static.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
gate_area.visible = true
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ class_name Game
|
|||
|
||||
## TODO: rewrite item system
|
||||
|
||||
enum ITEM_TYPE {VALUABLE, WEAPON, HULL, SHIELD, ENGINE, AMMUNITION}
|
||||
enum AMMO_TYPE {NULL, LASER_ENERGY, ROCKETS}
|
||||
enum BASE_TYPE {POWER, MINING, FOOD, TRADING, MODULE}
|
||||
enum ItemType {Valuable, Weapon, Hull, Shield, Engine, Ammunition}
|
||||
enum AmmoType {None, LaserEnergy, Rockets}
|
||||
enum BaseType {Power, Mining, Food, Trading, Module}
|
||||
enum Faction {None, Player, Peaceful, Neutral, Aggressive}
|
||||
|
||||
#const DEFAULT_ITEM = preload("res://items/test_item.tres")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ var target : Node2D = self
|
|||
func _ready():
|
||||
get_tree().create_timer(lifetime).timeout.connect(queue_free)
|
||||
collider.body_entered.connect(_on_collision)
|
||||
areyouready()
|
||||
|
||||
func _physics_process(delta):
|
||||
if rotation_speed == 0: destination_angle = global_rotation_degrees
|
||||
|
|
@ -43,6 +42,3 @@ func _on_collision(body):
|
|||
if target != self:
|
||||
target.queue_free()
|
||||
queue_free()
|
||||
|
||||
func areyouready():
|
||||
pass
|
||||
|
|
@ -39,8 +39,6 @@ func _ready():
|
|||
else:
|
||||
# or add it to root node lol
|
||||
add_child(pause_controller)
|
||||
|
||||
|
||||
pause_controller.visible = false
|
||||
|
||||
## Pause the game. Remember to unpause it when switching scenes!
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
extends Area2D
|
||||
|
||||
@export var menu : PackedScene
|
||||
@onready var base_collider = $"../BaseCollider/BaseColliderDetector"
|
||||
var menu_inst
|
||||
var ship_in_menu = false
|
||||
|
||||
func onbcbodyentered(body):
|
||||
if body is MainShip:
|
||||
body.engine.speed = 0
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventKey and ship_in_menu:
|
||||
if Input.is_action_just_released("hide_menu"):
|
||||
menu_inst.visible = !menu_inst.visible
|
||||
|
||||
func _on_body_entered(body):
|
||||
if body is MainShip:
|
||||
ship_in_menu = true
|
||||
body.allow_shooting = false
|
||||
menu_inst = menu.instantiate()
|
||||
menu_inst.modulate = get_parent().material.get_shader_parameter('color')
|
||||
menu_inst.base = get_parent()
|
||||
body.find_child("GUI").add_child(menu_inst)
|
||||
body.minimap.visible = false
|
||||
if body.quest.type == Quest.TYPE.DELIVERY:
|
||||
if body.quest.data['destination'] == get_parent():
|
||||
body.quest.do_progress()
|
||||
|
||||
func _on_body_exited(body):
|
||||
if body is MainShip:
|
||||
body.allow_shooting = true
|
||||
body.minimap.visible = true
|
||||
menu_inst.queue_free()
|
||||
ship_in_menu = false
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
extends Control
|
||||
|
||||
@onready var ship = $"../../.."
|
||||
|
||||
func _on_unpause_button_button_up():
|
||||
get_tree().current_scene.unpause()
|
||||
|
||||
|
||||
func _on_exit_button_button_up():
|
||||
get_tree().current_scene.unpause()
|
||||
Game.profile_save(get_tree().current_scene)
|
||||
get_tree().change_scene_to_file("res://scenes/MainMenu.tscn")
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
extends Line2D
|
||||
|
||||
@onready var ship = $"../../.."
|
||||
var engine
|
||||
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 : float = engine.speed / engine.max_speed * 100
|
||||
var new_points = [Vector2.ZERO, Vector2(speed_percentage, 0)]
|
||||
points = PackedVector2Array(new_points)
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
extends GPUParticles2D
|
||||
|
||||
@onready var engine = $".."
|
||||
|
||||
func _process(_delta):
|
||||
var speed_percentage = engine.speed / engine.max_speed if engine.ship is MainShip else 0
|
||||
emitting = speed_percentage > 1
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
extends Label
|
||||
|
||||
func _ready():
|
||||
text = "GammaCosmicRays version {version}".format({"version" : Game.gameversion})
|
||||
if OS.has_feature("editor"):
|
||||
text += " uncompiled\nThis is a debug/prerelease version."
|
||||
else:
|
||||
if Game.beta:
|
||||
text += " beta\nThis is a closed beta version."
|
||||
Loading…
Add table
Add a link
Reference in a new issue