forked from interstellar_development/freeftf
		
	new work towards M8
This commit is contained in:
		
							parent
							
								
									5cd0c24223
								
							
						
					
					
						commit
						bb7fd5cb3b
					
				
					 13 changed files with 194 additions and 75 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								assets/textures/freezer.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								assets/textures/freezer.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 242 B | 
							
								
								
									
										36
									
								
								assets/textures/freezer.png.import
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								assets/textures/freezer.png.import
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | ||||||
|  | [remap] | ||||||
|  | 
 | ||||||
|  | importer="texture" | ||||||
|  | type="CompressedTexture2D" | ||||||
|  | uid="uid://d37e3563corb3" | ||||||
|  | path.s3tc="res://.godot/imported/freezer.png-8fa8893be43b27ab4ae198357986b92f.s3tc.ctex" | ||||||
|  | path.etc2="res://.godot/imported/freezer.png-8fa8893be43b27ab4ae198357986b92f.etc2.ctex" | ||||||
|  | metadata={ | ||||||
|  | "imported_formats": ["s3tc_bptc", "etc2_astc"], | ||||||
|  | "vram_texture": true | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [deps] | ||||||
|  | 
 | ||||||
|  | source_file="res://assets/textures/freezer.png" | ||||||
|  | dest_files=["res://.godot/imported/freezer.png-8fa8893be43b27ab4ae198357986b92f.s3tc.ctex", "res://.godot/imported/freezer.png-8fa8893be43b27ab4ae198357986b92f.etc2.ctex"] | ||||||
|  | 
 | ||||||
|  | [params] | ||||||
|  | 
 | ||||||
|  | compress/mode=2 | ||||||
|  | compress/high_quality=false | ||||||
|  | compress/lossy_quality=0.7 | ||||||
|  | compress/hdr_compression=1 | ||||||
|  | compress/normal_map=0 | ||||||
|  | compress/channel_pack=0 | ||||||
|  | mipmaps/generate=true | ||||||
|  | mipmaps/limit=-1 | ||||||
|  | roughness/mode=0 | ||||||
|  | roughness/src_normal="" | ||||||
|  | process/fix_alpha_border=true | ||||||
|  | process/premult_alpha=false | ||||||
|  | process/normal_map_invert_y=false | ||||||
|  | process/hdr_as_srgb=false | ||||||
|  | process/hdr_clamp_exposure=false | ||||||
|  | process/size_limit=0 | ||||||
|  | detect_3d/compress_to=0 | ||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -70,5 +70,39 @@ theme_override_font_sizes/font_size = 32 | ||||||
| disabled = true | disabled = true | ||||||
| text = "Start Game" | text = "Start Game" | ||||||
| 
 | 
 | ||||||
|  | [node name="options" type="VBoxContainer" parent="."] | ||||||
|  | visible = false | ||||||
|  | layout_mode = 1 | ||||||
|  | anchors_preset = 1 | ||||||
|  | anchor_left = 1.0 | ||||||
|  | anchor_right = 1.0 | ||||||
|  | offset_left = -272.0 | ||||||
|  | offset_bottom = 53.0 | ||||||
|  | grow_horizontal = 0 | ||||||
|  | 
 | ||||||
|  | [node name="map_name" type="HBoxContainer" parent="options"] | ||||||
|  | layout_mode = 2 | ||||||
|  | size_flags_horizontal = 8 | ||||||
|  | size_flags_vertical = 4 | ||||||
|  | 
 | ||||||
|  | [node name="Label" type="Label" parent="options/map_name"] | ||||||
|  | layout_mode = 2 | ||||||
|  | theme_override_font_sizes/font_size = 32 | ||||||
|  | text = "Map" | ||||||
|  | 
 | ||||||
|  | [node name="OptionButton" type="OptionButton" parent="options/map_name"] | ||||||
|  | layout_mode = 2 | ||||||
|  | size_flags_horizontal = 4 | ||||||
|  | size_flags_vertical = 4 | ||||||
|  | theme_override_font_sizes/font_size = 32 | ||||||
|  | disabled = true | ||||||
|  | alignment = 1 | ||||||
|  | selected = 0 | ||||||
|  | item_count = 2 | ||||||
|  | popup/item_0/text = "Mansion" | ||||||
|  | popup/item_1/text = "Placeholder" | ||||||
|  | popup/item_1/id = 1 | ||||||
|  | 
 | ||||||
| [connection signal="pressed" from="player_customization/join" to="." method="_on_join_pressed"] | [connection signal="pressed" from="player_customization/join" to="." method="_on_join_pressed"] | ||||||
| [connection signal="pressed" from="start/start" to="." method="_on_start_pressed"] | [connection signal="pressed" from="start/start" to="." method="_on_start_pressed"] | ||||||
|  | [connection signal="item_selected" from="options/map_name/OptionButton" to="." method="_on_option_button_item_selected"] | ||||||
|  |  | ||||||
|  | @ -60,7 +60,7 @@ grow_vertical = 0 | ||||||
| [node name="Label" type="Label" parent="ver_string"] | [node name="Label" type="Label" parent="ver_string"] | ||||||
| layout_mode = 2 | layout_mode = 2 | ||||||
| theme_override_font_sizes/font_size = 32 | theme_override_font_sizes/font_size = 32 | ||||||
| text = "M7 B2" | text = "M7" | ||||||
| horizontal_alignment = 2 | horizontal_alignment = 2 | ||||||
| 
 | 
 | ||||||
| [connection signal="pressed" from="main_content/join" to="." method="_on_join_pressed"] | [connection signal="pressed" from="main_content/join" to="." method="_on_join_pressed"] | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| [gd_scene load_steps=4 format=3 uid="uid://bldbqjmabjemn"] | [gd_scene load_steps=5 format=3 uid="uid://bldbqjmabjemn"] | ||||||
| 
 | 
 | ||||||
| [ext_resource type="Script" path="res://scripts/freezer.gd" id="1_nmqkg"] | [ext_resource type="Script" path="res://scripts/freezer.gd" id="1_nmqkg"] | ||||||
|  | [ext_resource type="Texture2D" uid="uid://d37e3563corb3" path="res://assets/textures/freezer.png" id="2_w8rv5"] | ||||||
| 
 | 
 | ||||||
| [sub_resource type="CylinderShape3D" id="CylinderShape3D_pkxhd"] | [sub_resource type="CylinderShape3D" id="CylinderShape3D_pkxhd"] | ||||||
| height = 2.5 | height = 2.5 | ||||||
|  | @ -50,5 +51,13 @@ billboard = 1 | ||||||
| text = "Dead" | text = "Dead" | ||||||
| font_size = 64 | font_size = 64 | ||||||
| 
 | 
 | ||||||
|  | [node name="Sprite3D" type="Sprite3D" parent="."] | ||||||
|  | visible = false | ||||||
|  | pixel_size = 0.0025 | ||||||
|  | billboard = 1 | ||||||
|  | no_depth_test = true | ||||||
|  | fixed_size = true | ||||||
|  | texture = ExtResource("2_w8rv5") | ||||||
|  | 
 | ||||||
| [connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"] | [connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"] | ||||||
| [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] | [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] | ||||||
|  |  | ||||||
|  | @ -80,21 +80,26 @@ func player_hit(target, beast): | ||||||
| 		Game.player_hit(target, beast) | 		Game.player_hit(target, beast) | ||||||
| 
 | 
 | ||||||
| @rpc("any_peer", "call_local", "unreliable") | @rpc("any_peer", "call_local", "unreliable") | ||||||
| func sync_player(node_name, position, rotation): | func sync_player(node_path, position, rotation): | ||||||
| 	if is_valid(multiplayer.get_remote_sender_id(), false): | 	if is_valid(multiplayer.get_remote_sender_id(), false): | ||||||
| 		Game.sync_player(node_name, position, rotation) | 		Game.sync_player(node_path, position, rotation) | ||||||
| 
 | 
 | ||||||
| @rpc("any_peer", "call_local", "unreliable") | @rpc("any_peer", "call_local", "unreliable") | ||||||
| func sync_hammer(node_name, rotation): | func sync_hammer(node_path, rotation): | ||||||
| 	if is_valid(multiplayer.get_remote_sender_id(), false): | 	if is_valid(multiplayer.get_remote_sender_id(), false): | ||||||
| 		Game.sync_hammer(node_name, rotation) | 		Game.sync_hammer(node_path, rotation) | ||||||
| 
 | 
 | ||||||
| @rpc("any_peer", "call_local", "reliable") | @rpc("any_peer", "call_local", "reliable") | ||||||
| func sync_computers(node_name, current): | func sync_computers(node_path, current): | ||||||
| 	if is_valid(multiplayer.get_remote_sender_id(), true): | 	if is_valid(multiplayer.get_remote_sender_id(), true): | ||||||
| 		Game.sync_computers(node_name, current) | 		Game.sync_computers(node_path, current) | ||||||
| 
 | 
 | ||||||
| @rpc("any_peer", "call_local", "reliable") | @rpc("any_peer", "call_local", "reliable") | ||||||
| func sync_beast(player): | func sync_beast(player): | ||||||
| 	if is_valid(multiplayer.get_remote_sender_id(), true): | 	if is_valid(multiplayer.get_remote_sender_id(), true): | ||||||
| 		Game.sync_beast(player) | 		Game.sync_beast(player) | ||||||
|  | 
 | ||||||
|  | @rpc("any_peer", "call_local", "reliable") | ||||||
|  | func sync_level(map_name): | ||||||
|  | 	if is_valid(multiplayer.get_remote_sender_id(), true): | ||||||
|  | 		Game.map_name = map_name | ||||||
|  |  | ||||||
|  | @ -23,7 +23,7 @@ func _on_computer_tick_timeout(): | ||||||
| 	if Game.is_server: | 	if Game.is_server: | ||||||
| 		current += pc_occupied | 		current += pc_occupied | ||||||
| 		for id in Game.player_list: | 		for id in Game.player_list: | ||||||
| 			Client.rpc_id(id,"sync_computers",name, current) | 			Client.rpc_id(id,"sync_computers",get_path(), current) | ||||||
| 	if current >= TARGET: | 	if current >= TARGET: | ||||||
| 		current = "Complete" | 		current = "Complete" | ||||||
| 		$computer_tick.stop() | 		$computer_tick.stop() | ||||||
|  |  | ||||||
|  | @ -11,9 +11,29 @@ extends Control | ||||||
| 
 | 
 | ||||||
| var elevated = false | var elevated = false | ||||||
| var done | var done | ||||||
|  | var map_name = "mansion" | ||||||
| 
 | 
 | ||||||
| func _ready(): | func _ready(): | ||||||
|  | 	$player_customization/name.text = Game.settings["username"] | ||||||
|  | 	var username_cmdline | ||||||
|  | 	var roomname_cmdline | ||||||
|  | 	for argument in OS.get_cmdline_args(): | ||||||
|  | 		if argument == "--username": | ||||||
|  | 			username_cmdline = "ready" | ||||||
|  | 			continue | ||||||
|  | 		if argument == "--roomname": | ||||||
|  | 			roomname_cmdline = "ready" | ||||||
|  | 			continue | ||||||
|  | 		if argument == "--autojoin": | ||||||
|  | 			_on_join_pressed() | ||||||
|  | 		if username_cmdline == "ready": | ||||||
|  | 			username_cmdline = null | ||||||
|  | 			$player_customization/name.text = argument | ||||||
|  | 		if roomname_cmdline == "ready": | ||||||
|  | 			roomname_cmdline = null | ||||||
|  | 			$player_customization/ip.text = argument | ||||||
| 	multiplayer.connected_to_server.connect(_on_connected_ok) | 	multiplayer.connected_to_server.connect(_on_connected_ok) | ||||||
|  | 	multiplayer.peer_connected.connect(_sync_options) | ||||||
| 	 | 	 | ||||||
| func server_prepare(): | func server_prepare(): | ||||||
| 	if Game.is_server: | 	if Game.is_server: | ||||||
|  | @ -23,6 +43,8 @@ func server_prepare(): | ||||||
| 		$start/start.show() | 		$start/start.show() | ||||||
| 		$start/start.disabled = false | 		$start/start.disabled = false | ||||||
| 		$player_list/list.text = " " | 		$player_list/list.text = " " | ||||||
|  | 		$options.show() | ||||||
|  | 		$options/map_name/OptionButton.disabled = false | ||||||
| 
 | 
 | ||||||
| func _process(_delta): | func _process(_delta): | ||||||
| 	server_prepare() | 	server_prepare() | ||||||
|  | @ -55,3 +77,17 @@ func _on_connected_ok(): | ||||||
| 	$player_customization/join.disabled = true | 	$player_customization/join.disabled = true | ||||||
| 	$player_customization/name.editable = false | 	$player_customization/name.editable = false | ||||||
| 	$player_customization/ip.editable = false | 	$player_customization/ip.editable = false | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | func _on_option_button_item_selected(index): | ||||||
|  | 	match index: | ||||||
|  | 		0: | ||||||
|  | 			map_name = "mansion" | ||||||
|  | 		_: | ||||||
|  | 			map_name = "mansion" | ||||||
|  | 	for id in Game.player_list: | ||||||
|  | 			Client.rpc_id(id, "sync_level", map_name) | ||||||
|  | 
 | ||||||
|  | func _sync_options(): | ||||||
|  | 	for id in Game.player_list: | ||||||
|  | 			Client.rpc_id(id, "sync_level", map_name) | ||||||
|  |  | ||||||
|  | @ -14,12 +14,14 @@ var occupied = false | ||||||
| var living = true | var living = true | ||||||
| 
 | 
 | ||||||
| func _process(_delta): | func _process(_delta): | ||||||
| 	if occupied: |  | ||||||
| 		trapped_body.position = global_position |  | ||||||
| 	if occupied and trapped_body.hp == 0 and living: | 	if occupied and trapped_body.hp == 0 and living: | ||||||
| 		Game.died() | 		Game.died() | ||||||
| 		living = false | 		living = false | ||||||
| 		$dead.show() | 		$dead.show() | ||||||
|  | 		$Sprite3D.hide() | ||||||
|  | 	elif occupied: | ||||||
|  | 		trapped_body.position = global_position | ||||||
|  | 		$Sprite3D.show() | ||||||
| 
 | 
 | ||||||
| func _on_area_3d_body_entered(body): | func _on_area_3d_body_entered(body): | ||||||
| 	if body is CharacterBody3D: | 	if body is CharacterBody3D: | ||||||
|  |  | ||||||
|  | @ -79,7 +79,6 @@ func reset(): | ||||||
| func save_setting(setting_name, value): | func save_setting(setting_name, value): | ||||||
| 	settings[setting_name] = value | 	settings[setting_name] = value | ||||||
| 	Save.saveJSON("user://settings.json", settings) | 	Save.saveJSON("user://settings.json", settings) | ||||||
| 	print("saved") |  | ||||||
| 
 | 
 | ||||||
| func apply_settings(): | func apply_settings(): | ||||||
| 	players = player_list.size() - 1 | 	players = player_list.size() - 1 | ||||||
|  | @ -105,24 +104,24 @@ func start_game(): | ||||||
| 	apply_settings() | 	apply_settings() | ||||||
| 
 | 
 | ||||||
| func player_hit(target, beast): | func player_hit(target, beast): | ||||||
| 	target = get_tree().root.get_node("./"+map_name+"/"+target) | 	target = get_tree().root.get_node(target) | ||||||
| 	beast = get_tree().root.get_node("./"+map_name+"/"+beast) | 	beast = get_tree().root.get_node(beast) | ||||||
| 	if !target.is_frozen: | 	if !target.is_frozen: | ||||||
| 		target.captured(beast) | 		target.captured(beast) | ||||||
| 		beast.got_one(target) | 		beast.got_one(target) | ||||||
| 
 | 
 | ||||||
| func sync_player(node_name, position, rotation): | func sync_player(node_path, position, rotation): | ||||||
| 	if get_tree().root.has_node("./"+map_name+"/"+node_name): | 	if get_tree().root.has_node(node_path): | ||||||
| 		var current_character = get_tree().root.get_node("./"+map_name+"/"+node_name) | 		var current_character = get_tree().root.get_node(node_path) | ||||||
| 		current_character.position = position | 		current_character.position = position | ||||||
| 		current_character.rotation = rotation | 		current_character.rotation = rotation | ||||||
| 
 | 
 | ||||||
| func sync_hammer(node_name, rotation): | func sync_hammer(node_path, rotation): | ||||||
| 	var current_character = get_tree().root.get_node("./"+map_name+"/"+node_name+"/hammer") | 	var current_character = get_tree().root.get_node(node_path) | ||||||
| 	current_character.rotation = rotation | 	current_character.rotation = rotation | ||||||
| 
 | 
 | ||||||
| func sync_computers(node_name, current): | func sync_computers(node_path, current): | ||||||
| 	var current_character = get_tree().root.get_node("./"+map_name+"/computers/"+node_name) | 	var current_character = get_tree().root.get_node(node_path) | ||||||
| 	current_character.current = current | 	current_character.current = current | ||||||
| 
 | 
 | ||||||
| func sync_beast(player): | func sync_beast(player): | ||||||
|  |  | ||||||
|  | @ -14,9 +14,6 @@ func matchmaking(): | ||||||
| 
 | 
 | ||||||
| func _ready(): | func _ready(): | ||||||
| 	Game.reset() | 	Game.reset() | ||||||
| 	if !OS.is_debug_build(): |  | ||||||
| 		$main_content/matchmaking.hide() |  | ||||||
| 		$main_content/matchmaking.disabled = true |  | ||||||
| 	if DisplayServer.get_name() == "headless": | 	if DisplayServer.get_name() == "headless": | ||||||
| 		matchmaking() | 		matchmaking() | ||||||
| 
 | 
 | ||||||
|  | @ -24,6 +21,5 @@ func _on_join_pressed(): | ||||||
| 	get_tree().change_scene_to_file("res://menus/create.tscn") | 	get_tree().change_scene_to_file("res://menus/create.tscn") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| func _on_settings_pressed(): | func _on_settings_pressed(): | ||||||
| 	get_tree().change_scene_to_file("res://menus/settings.tscn") | 	get_tree().change_scene_to_file("res://menus/settings.tscn") | ||||||
|  |  | ||||||
|  | @ -71,11 +71,11 @@ func _physics_process(delta): | ||||||
| 		if Input.is_action_pressed("click") and $hammer.rotation_degrees.x > 0: | 		if Input.is_action_pressed("click") and $hammer.rotation_degrees.x > 0: | ||||||
| 			$hammer.rotation_degrees.x -= 10 | 			$hammer.rotation_degrees.x -= 10 | ||||||
| 			for id in Game.player_list: | 			for id in Game.player_list: | ||||||
| 				Client.rpc_id(id,"sync_hammer",name, $hammer.rotation) | 				Client.rpc_id(id,"sync_hammer",$hammer.get_path(), $hammer.rotation) | ||||||
| 		elif $hammer.rotation_degrees.x < 90 and !Input.is_action_pressed("click"): | 		elif $hammer.rotation_degrees.x < 90 and !Input.is_action_pressed("click"): | ||||||
| 			$hammer.rotation_degrees.x += 10 | 			$hammer.rotation_degrees.x += 10 | ||||||
| 			for id in Game.player_list: | 			for id in Game.player_list: | ||||||
| 				Client.rpc_id(id,"sync_hammer",name, $hammer.rotation) | 				Client.rpc_id(id,"sync_hammer",$hammer.get_path(), $hammer.rotation) | ||||||
| 		 | 		 | ||||||
| 		var input_dir = Input.get_vector("left", "right", "forwards", "backwards") | 		var input_dir = Input.get_vector("left", "right", "forwards", "backwards") | ||||||
| 		var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() | 		var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() | ||||||
|  | @ -90,7 +90,7 @@ func _physics_process(delta): | ||||||
| 	 | 	 | ||||||
| 	if !npc: | 	if !npc: | ||||||
| 		for id in Game.player_list: | 		for id in Game.player_list: | ||||||
| 				Client.rpc_id(id,"sync_player",name, position, rotation) | 				Client.rpc_id(id,"sync_player",get_path(), position, rotation) | ||||||
| 		if mouse_locked and !has_node("./game_menu"): | 		if mouse_locked and !has_node("./game_menu"): | ||||||
| 			Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) | 			Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) | ||||||
| 		else: | 		else: | ||||||
|  | @ -138,24 +138,26 @@ func beast_init(): | ||||||
| func _on_detect_hit_body_entered(body): | func _on_detect_hit_body_entered(body): | ||||||
| 	if enabled and body is CharacterBody3D and !got_person: | 	if enabled and body is CharacterBody3D and !got_person: | ||||||
| 		for id in Game.player_list: | 		for id in Game.player_list: | ||||||
| 				Client.rpc_id(id,"player_hit",body.name, name) | 				Client.rpc_id(id,"player_hit",body.get_path(), get_path()) | ||||||
| 
 | 
 | ||||||
| func captured(beast2): | func captured(beast2): | ||||||
| 	if !npc: | 	if !beast: | ||||||
| 		$in_bag.visible = true | 		if !npc: | ||||||
| 	$time_in_bag.start() | 			$in_bag.visible = true | ||||||
| 	visible = false | 		$time_in_bag.start() | ||||||
| 	enabled = false | 		visible = false | ||||||
| 	caught = true | 		enabled = false | ||||||
| 	captured_by = beast2 | 		caught = true | ||||||
| 	position_pre = position | 		captured_by = beast2 | ||||||
| 	position = Vector3(10000, 10000, 10000) | 		position_pre = position | ||||||
|  | 		position = Vector3(10000, 10000, 10000) | ||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
| func got_one(target): | func got_one(target): | ||||||
| 	caught_body = target | 	if !target.beast: | ||||||
| 	got_person = true | 		caught_body = target | ||||||
| 	$bag/CSGSphere3D.show() | 		got_person = true | ||||||
|  | 		$bag/CSGSphere3D.show() | ||||||
| 
 | 
 | ||||||
| func lost_one(): | func lost_one(): | ||||||
| 	got_person = false | 	got_person = false | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 patrick_pluto
						patrick_pluto