Fixed various bugs from alpha testing.

;)
This commit is contained in:
drwhut 2022-08-19 23:19:28 +01:00
parent 525b49ce95
commit ea8e342c0b
12 changed files with 267 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/FastCircleInner.png-4f36c5efec8d3b1a997b14f230374020.s3tc.stex"
path.etc="res://.import/FastCircleInner.png-4f36c5efec8d3b1a997b14f230374020.etc.stex"
metadata={
"imported_formats": [ "s3tc", "etc" ],
"vram_texture": true
}
[deps]
source_file="res://Images/FastCircleInner.png"
dest_files=[ "res://.import/FastCircleInner.png-4f36c5efec8d3b1a997b14f230374020.s3tc.stex", "res://.import/FastCircleInner.png-4f36c5efec8d3b1a997b14f230374020.etc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=1
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/FastCircleOuter.png-16e0bd08147bd64b75db74fc8d62219a.s3tc.stex"
path.etc="res://.import/FastCircleOuter.png-16e0bd08147bd64b75db74fc8d62219a.etc.stex"
metadata={
"imported_formats": [ "s3tc", "etc" ],
"vram_texture": true
}
[deps]
source_file="res://Images/FastCircleOuter.png"
dest_files=[ "res://.import/FastCircleOuter.png-16e0bd08147bd64b75db74fc8d62219a.s3tc.stex", "res://.import/FastCircleOuter.png-16e0bd08147bd64b75db74fc8d62219a.etc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=1
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -46,6 +46,12 @@ Author: SVG Repo
License: CC0
URL: https://www.svgrepo.com/svg/72555/eraser
Images/FastCircle{Inner,Outer}.png
==============================
Author: Rebekka
License: CC0
Modified By: Benjamin \"drwhut\" Beddows
Images/FlickIcon.svg
==================
Author: SVG Repo
@ -138,4 +144,11 @@ Sounds/WoodLight/impactWood_light_00{0,1,2,3,4}.ogg
==============================================
Author: Kenney.nl
License: CC0
URL: https://kenney.nl/assets/impact-sounds"
URL: https://kenney.nl/assets/impact-sounds
Sounds/Misc/circle.wav
====================
Author: JaggedStone
License: CC0
URL: https://opengameart.org/content/magic-spell-sfx
"

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Images/FastCircleOuter.png" type="Texture" id=1]
[ext_resource path="res://Images/FastCircleInner.png" type="Texture" id=2]
[ext_resource path="res://Scripts/Game/3D/FastCircle.gd" type="Script" id=3]
[ext_resource path="res://Sounds/Misc/circle.ogg" type="AudioStream" id=4]
[sub_resource type="PlaneMesh" id=1]
size = Vector2( 1, 1 )
[sub_resource type="SpatialMaterial" id=4]
flags_transparent = true
albedo_texture = ExtResource( 2 )
[sub_resource type="SpatialMaterial" id=3]
flags_transparent = true
albedo_texture = ExtResource( 1 )
[node name="FastCircle" type="Spatial"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01, 0 )
script = ExtResource( 3 )
[node name="InnerCircle" type="MeshInstance" parent="."]
transform = Transform( 0.65, 0, 0, 0, 1, 0, 0, 0, 0.65, 0, 0.01, 0 )
mesh = SubResource( 1 )
material/0 = SubResource( 4 )
[node name="OuterCircle" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.014, 0, 0 )
mesh = SubResource( 1 )
material/0 = SubResource( 3 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )
bus = "Effects"
[connection signal="tree_exiting" from="." to="." method="_on_FastCircle_tree_exiting"]

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Scenes/Game/CameraController.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scenes/Game/3D/HiddenArea.tscn" type="PackedScene" id=2]
[ext_resource path="res://Scripts/Game/3D/Room.gd" type="Script" id=3]
[ext_resource path="res://Scenes/Game/3D/FastCircle.tscn" type="PackedScene" id=4]
[sub_resource type="ProceduralSky" id=1]
@ -53,6 +54,9 @@ visible = false
collision_layer = 2
monitoring = false
[node name="FastCircle" parent="." instance=ExtResource( 4 )]
visible = false
[node name="LimboCleanTimer" type="Timer" parent="."]
wait_time = 5.0
autostart = true
@ -79,6 +83,7 @@ autostart = true
[connection signal="setting_hidden_area_preview_visible" from="CameraController" to="." method="_on_CameraController_setting_hidden_area_preview_visible"]
[connection signal="setting_hover_position_multiple" from="CameraController" to="." method="_on_CameraController_setting_hover_position_multiple"]
[connection signal="setting_spawn_point" from="CameraController" to="." method="_on_CameraController_setting_spawn_point"]
[connection signal="spawning_fast_circle" from="CameraController" to="." method="_on_CameraController_spawning_fast_circle"]
[connection signal="spawning_piece_at" from="CameraController" to="." method="_on_CameraController_spawning_piece_at"]
[connection signal="spawning_piece_in_container" from="CameraController" to="." method="_on_CameraController_spawning_piece_in_container"]
[connection signal="stack_collect_all_requested" from="CameraController" to="." method="_on_CameraController_stack_collect_all_requested"]

View File

@ -0,0 +1,71 @@
# tabletop-club
# Copyright (c) 2020-2022 Benjamin 'drwhut' Beddows.
# Copyright (c) 2021-2022 Tabletop Club contributors (see game/CREDITS.tres).
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
extends Spatial
const ROTATE_SPEED = 0.25
var _fade_offset: float = 0.0
var _inner_material: SpatialMaterial
var _outer_material: SpatialMaterial
# Restart the fade-in animation.
func restart() -> void:
set_process(true)
_fade_offset = 0.0
visible = true
Engine.time_scale = 2.0
$AudioStreamPlayer.play()
func _ready():
_inner_material = $InnerCircle.get_surface_material(0)
_outer_material = $OuterCircle.get_surface_material(0)
func _process(delta):
rotate_y(ROTATE_SPEED * delta)
if _fade_offset < 1.0:
_set_alpha(_fade_offset)
elif _fade_offset > 19.0:
if _fade_offset > 20.0:
set_process(false)
visible = false
Engine.time_scale = 1.0
else:
_set_alpha(20.0 - _fade_offset)
else:
_set_alpha(1.0)
_fade_offset += 0.5 * delta
# Set the alpha transparency of the circle.
# alpha: The transparency value.
func _set_alpha(alpha: float) -> void:
_inner_material.albedo_color.a = alpha
_outer_material.albedo_color.a = alpha
func _on_FastCircle_tree_exiting():
Engine.time_scale = 1.0

View File

@ -31,6 +31,7 @@ signal undo_stack_empty()
signal undo_stack_pushed()
onready var _camera_controller = $CameraController
onready var _fast_circle = $FastCircle
onready var _hand_positions = $Table/HandPositions
onready var _hands = $Hands
onready var _hidden_areas = $HiddenAreas
@ -1366,6 +1367,10 @@ master func request_set_table(table_entry_path: String) -> void:
rpc("set_table", table_entry_path)
# Request the server to spawn the fast circle.
master func request_spawn_fast_circle() -> void:
rpc("spawn_fast_circle")
# Request the server to get a stack to collect all of the pieces that it can
# stack.
# stack_name: The name of the collecting stack.
@ -1686,6 +1691,12 @@ remotesync func set_table(table_entry_path: String) -> void:
hand_pos.queue_free()
if not table_entry.empty():
if table_entry.has("bounding_box"):
var bounding_box: Array = table_entry["bounding_box"]
var size: Vector3 = bounding_box[1] - bounding_box[0]
var side_length = 3.0 * max(size.x, size.z)
_fast_circle.scale = Vector3(side_length, 1.0, side_length)
if table_entry.has("scene_path"):
if not table_entry["scene_path"].empty():
_table_body = PieceBuilder.build_table(table_entry)
@ -1714,6 +1725,14 @@ remotesync func set_table(table_entry_path: String) -> void:
_paint_plane.scale = Vector3(paint_plane_size.x, 1.0, paint_plane_size.y)
_paint_plane.clear_paint()
# Spawn the fast circle.
remotesync func spawn_fast_circle() -> void:
if get_tree().get_rpc_sender_id() != 1:
return
if not _fast_circle.is_processing():
_fast_circle.restart()
# Get the next hand transform. Note that there may not be a next transform, in
# which case the function returns the identity transform.
# Returns: The next hand transform.
@ -1834,6 +1853,8 @@ func _ready():
var table = AssetDB.random_asset("TabletopClub", "tables", true)
if not table.empty():
set_table(table["entry_path"])
_fast_circle.set_process(false)
func _physics_process(_delta):
var timers_to_manage = _srv_undo_state_events.keys()
@ -2438,6 +2459,10 @@ func _on_CameraController_setting_hover_position_multiple(position: Vector3):
func _on_CameraController_setting_spawn_point(position: Vector3):
emit_signal("setting_spawn_point", position)
func _on_CameraController_spawning_fast_circle():
if not _fast_circle.is_processing():
rpc_id(1, "request_spawn_fast_circle")
func _on_CameraController_spawning_piece_at(position: Vector3):
emit_signal("spawning_piece_at", position)

View File

@ -85,6 +85,7 @@ signal setting_hidden_area_preview_points(point1, point2)
signal setting_hidden_area_preview_visible(is_visible)
signal setting_hover_position_multiple(position)
signal setting_spawn_point(position)
signal spawning_fast_circle()
signal spawning_piece_at(position)
signal spawning_piece_in_container(container_name)
signal stack_collect_all_requested(stack, collect_stacks)
@ -178,6 +179,7 @@ var _container_multi_context: PieceContainer = null
var _cursor_on_table = false
var _cursor_position = Vector3()
var _drag_camera_anchor = Vector3()
var _fast_circle_seq = []
var _flick_piece_origin = Vector3()
var _flick_placing_point2 = false
var _future_clipboard_position = Vector3()
@ -782,6 +784,29 @@ func _unhandled_input(event):
elif event.scancode == KEY_V:
_future_clipboard_position = _cursor_position
_paste_clipboard()
if event.pressed:
var add_true = false
var add_false = false
if event.scancode == KEY_1 or event.scancode == KEY_KP_1:
add_false = true
elif event.scancode == KEY_4 or event.scancode == KEY_KP_4:
add_true = true
if add_true or add_false:
if _fast_circle_seq.size() < 7:
_fast_circle_seq.append(add_true)
else:
for i in range(6):
_fast_circle_seq[i] = _fast_circle_seq[i+1]
_fast_circle_seq[6] = add_true
if _fast_circle_seq == [true, true, true, false, true, true, true]:
emit_signal("spawning_fast_circle")
_fast_circle_seq = []
elif not _fast_circle_seq.empty():
_fast_circle_seq[-1] = false
# NOTE: Mouse events are caught by the MouseGrab node, see
# _on_MouseGrab_gui_input().

BIN
game/Sounds/Misc/circle.ogg Normal file

Binary file not shown.

View File

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/circle.ogg-5a883994ec2d731ae33bf682ab6149b4.oggstr"
[deps]
source_file="res://Sounds/Misc/circle.ogg"
dest_files=[ "res://.import/circle.ogg-5a883994ec2d731ae33bf682ab6149b4.oggstr" ]
[params]
loop=false
loop_offset=0