From 366761197034a20d444282431e4a8edeb7882840 Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Wed, 7 Sep 2022 14:16:17 -0400 Subject: whoops, fixed reorg --- scenes/environment/CaptureFlag.gd | 84 --------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 scenes/environment/CaptureFlag.gd (limited to 'scenes/environment/CaptureFlag.gd') diff --git a/scenes/environment/CaptureFlag.gd b/scenes/environment/CaptureFlag.gd deleted file mode 100644 index 81a9fc5..0000000 --- a/scenes/environment/CaptureFlag.gd +++ /dev/null @@ -1,84 +0,0 @@ -extends Spatial - -onready var flag = $flag_mesh -const flag_high : float = 5.4 -const flag_low : float = 1.0 -var capture_speed : float = 1 - -var state = "IDLE_HIGH" #IDLE_HIGH, IDLE_LOW, CAPTURING, HOISTING. capturing cannot be blocked, hoisting can - -var teams_in_zone = [] -var foreign_in_zone = false -var team = "NONE" - -# Called when the node enters the scene tree for the first time. -func _ready(): - $flag_mesh/Label.text = team - -remotesync func update_text(text): - $flag_mesh/Label.text = text - -remote func update_position(height): - flag.transform.origin.y = height - -remotesync func capture(): - $flag_mesh/capture_audio.play() - -func _physics_process(delta): - if is_network_master(): - teams_in_zone = [] - foreign_in_zone = false - for body in $CaptureArea.get_overlapping_bodies(): - if body.is_in_group("player") and !(body.team in teams_in_zone): - if body.team != team: - foreign_in_zone = true - teams_in_zone.append(body.team) - if state == "IDLE_HIGH" and foreign_in_zone: - state = "CAPTURING" - if state == "CAPTURING" and !foreign_in_zone: - state = "IDLE_HIGH" - if state == "IDLE_LOW" and team in teams_in_zone: - state = "HOISTING" - if state == "HOISTING" and !(team in teams_in_zone): - state = "IDLE_LOW" - - if state == "CAPTURING": - if flag.transform.origin.y > flag_low: - flag.transform.origin.y -= delta * capture_speed - rpc("update_position",flag.transform.origin.y) - else: - flag.transform.origin.y = flag_low - state = "IDLE_LOW" - team = "NONE" - rpc("update_text",team) - if state == "IDLE_HIGH": - if flag.transform.origin.y <= flag_high: - flag.transform.origin.y += delta * capture_speed - rpc("update_position",flag.transform.origin.y) - if state == "IDLE_LOW": - if flag.transform.origin.y > flag_low: - flag.transform.origin.y -= delta * capture_speed - rpc("update_position",flag.transform.origin.y) - else: - team = "NONE" - rpc("update_text",team) - flag.transform.origin.y = flag_low - if team == "NONE" and len(teams_in_zone) == 1: - team = teams_in_zone[0] - rpc("update_text",team) - state = "HOISTING" - if state == "HOISTING": - if len(teams_in_zone) == 1: - flag.transform.origin.y += delta * capture_speed - rpc("update_position",flag.transform.origin.y) - if flag.transform.origin.y >= flag_high: - rpc("capture") - state = "IDLE_HIGH" - -func mp_init(init_info): - flag.transform.origin.y = init_info["height"] - team = init_info["team"] - $flag_mesh/Label.text = team - -func get_init_info(): #info necessary to replicate item - return {"height" : flag.transform.origin.y, "team" : team } -- cgit v1.2.3