This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
odyssey-old/Actors/Components/PowerManager.gd
2020-07-09 16:50:34 +02:00

32 lines
615 B
GDScript

extends Node
class_name PowerManager
signal power_connected()
signal power_disconnected()
var socket = false
var working = false
var wired setget , get_wired
export var power_usage = 0.0
export var power_source = 0.0
var power_load = 0.0
var available = 0.0
var powered = false setget set_powered
func get_wired() -> bool:
return socket != null
func set_powered(val: bool) -> void:
var current = powered
powered = val
if current and not val:
emit_signal("power_disconnected")
elif not current and val:
emit_signal("power_connected")
func _physics_process(_delta: float) -> void:
if wired:
pass