online multiplayer chess game (note server currently down)
Diffstat (limited to 'Globals.gd')
-rw-r--r--Globals.gd41
1 files changed, 37 insertions, 4 deletions
diff --git a/Globals.gd b/Globals.gd
index 43f0c67..132e892 100644
--- a/Globals.gd
+++ b/Globals.gd
@@ -1,9 +1,12 @@
extends Node
-var __nosethalfmove = false
+const pieces = "NKQRBP"
+var __nosethalfmove = false
var pawns = [] # PoolPawnArray
+var team = true
var grid: Grid = null
+var network: Network = null
var piece_set := "california"
var fullmove := 1
var halfmove := 0
@@ -15,7 +18,34 @@ var turn := true # true for white, false for black
# true cuz white goes first
-func turns(_winner) -> int:
+func reset_vars() -> void:
+ __nosethalfmove = false
+ pawns = []
+ team = true
+ grid = null
+ fullmove = 1
+ halfmove = 0
+ in_check = false
+ checking_piece = null
+ white_king = null
+ black_king = null
+ turn = true
+ Utils.reset_vars()
+
+
+func pack_vars() -> Dictionary:
+ return {
+ "fullmove": fullmove,
+ "halfmove": halfmove,
+ "turn": turn,
+ }
+
+
+func get_var(key):
+ return self.get(key)
+
+
+func turns() -> int:
return fullmove
@@ -25,12 +55,15 @@ func reset_halfmove() -> void:
func add_turn() -> void:
+ Events.emit_signal("just_before_turn_over")
if !turn:
fullmove += 1
if __nosethalfmove:
__nosethalfmove = false
- return
- halfmove += 1
+ else:
+ halfmove += 1
+ turn = not turn
+ Events.emit_signal("turn_over")
func _ready() -> void: