Bomb
This commit is contained in:
parent
388fe1ccce
commit
6b939d241c
12 changed files with 128 additions and 68 deletions
|
|
@ -8,7 +8,11 @@ Current plans:
|
|||
^ Player teams
|
||||
^ Team spawns
|
||||
Different damage based on body part
|
||||
Bomb
|
||||
Bomb:
|
||||
^ Animation
|
||||
^ In-game animation
|
||||
Droppable
|
||||
Explosion after time
|
||||
Bomb site
|
||||
Weapon system's drop
|
||||
Molikman's abilities:
|
||||
|
|
|
|||
Binary file not shown.
BIN
models/molikman_hands_tex_bomb.png
Normal file
BIN
models/molikman_hands_tex_bomb.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 KiB |
44
models/molikman_hands_tex_bomb.png.import
Normal file
44
models/molikman_hands_tex_bomb.png.import
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://2fho0wsa054v"
|
||||
path.s3tc="res://.godot/imported/molikman_hands_tex_bomb.png-7baac85b3f254b7ca25ecb123abd1736.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "478cd944aa7bbc08b6e05bea8b51b71e"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://models/molikman_hands_tex_bomb.png"
|
||||
dest_files=["res://.godot/imported/molikman_hands_tex_bomb.png-7baac85b3f254b7ca25ecb123abd1736.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=23 format=3 uid="uid://dpsr6ug3pkb40"]
|
||||
[gd_scene load_steps=24 format=3 uid="uid://dpsr6ug3pkb40"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"]
|
||||
[ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
[ext_resource type="Script" uid="uid://u0e2b2mvij1k" path="res://scripts/player/states/standing.gd" id="10_a8ls1"]
|
||||
[ext_resource type="Script" uid="uid://cwasvwhm5yg0o" path="res://scripts/player/states/walk.gd" id="11_qfm1y"]
|
||||
[ext_resource type="Script" uid="uid://cq4i0afwesdm3" path="res://scripts/player/states/falling.gd" id="12_fulsm"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxdatd1ilfgmc" path="res://scenes/weapons/bomb.tscn" id="17_fjvrb"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_u8vuu"]
|
||||
resource_local_to_scene = true
|
||||
|
|
@ -151,67 +152,11 @@ compensation_delay = 0.2
|
|||
[node name="molikman_hands" parent="Camera3D" instance=ExtResource("4_dqkch")]
|
||||
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, -1, 0)
|
||||
|
||||
[node name="Skeleton3D" parent="Camera3D/molikman_hands/Hands" index="0"]
|
||||
bones/1/position = Vector3(0.16239367, 0.7620353, -0.22555673)
|
||||
bones/1/rotation = Quaternion(-0.013897974, 0.25458142, 0.93291974, 0.25427514)
|
||||
bones/2/rotation = Quaternion(0.48351443, 0.011421198, -0.101050004, 0.8694092)
|
||||
bones/3/rotation = Quaternion(-0.21969835, 0.9295987, -0.14384198, -0.25862813)
|
||||
bones/4/rotation = Quaternion(-0.228779, -0.029572416, 0.054699976, 0.9714905)
|
||||
bones/5/rotation = Quaternion(-0.0041055745, -0.00432046, 0.08434049, 0.99641925)
|
||||
bones/6/rotation = Quaternion(0.0052072993, 0.00027607038, 0.0044955458, 0.99997634)
|
||||
bones/7/rotation = Quaternion(-0.1004904, -0.0019074425, 0.13231255, 0.98609906)
|
||||
bones/8/rotation = Quaternion(0.024437865, -0.009641473, 0.2161158, 0.97601426)
|
||||
bones/9/rotation = Quaternion(0.026062598, -0.010100163, 0.3215908, 0.94646615)
|
||||
bones/10/rotation = Quaternion(-0.053834017, -0.032078788, 0.06392841, 0.995985)
|
||||
bones/11/rotation = Quaternion(0.04591663, -0.010990316, 0.29229766, 0.9551613)
|
||||
bones/12/rotation = Quaternion(-0.008413597, 0.0025515698, 0.3356365, 0.9419506)
|
||||
bones/13/rotation = Quaternion(-0.035504643, -0.11951073, 0.017020436, 0.99205184)
|
||||
bones/14/rotation = Quaternion(0.07038061, -0.042397514, 0.3243001, 0.9423792)
|
||||
bones/15/rotation = Quaternion(0.010458748, -0.003636818, 0.33499107, 0.9421562)
|
||||
bones/16/rotation = Quaternion(0.023548108, -0.1841245, 0.118893534, 0.9754015)
|
||||
bones/17/rotation = Quaternion(0.07007245, -0.05591666, 0.21599722, 0.9722697)
|
||||
bones/18/rotation = Quaternion(-0.007437984, 0.00025136053, 0.082008004, 0.9966039)
|
||||
bones/19/rotation = Quaternion(-0.228779, -0.029572409, 0.05469998, 0.9714905)
|
||||
bones/20/rotation = Quaternion(-0.10049036, -0.0019074364, 0.13231257, 0.9860992)
|
||||
bones/21/rotation = Quaternion(-0.053834017, -0.032078788, 0.06392841, 0.995985)
|
||||
bones/22/rotation = Quaternion(-0.035504643, -0.11951072, 0.017020464, 0.99205184)
|
||||
bones/23/rotation = Quaternion(0.023548096, -0.18412448, 0.11889355, 0.97540146)
|
||||
bones/24/position = Vector3(-0.35145342, -0.009178132, -0.18038769)
|
||||
bones/25/position = Vector3(0.16239375, 0.7620353, -0.22555672)
|
||||
bones/25/rotation = Quaternion(0.98640305, 0.115810655, 0.1158104, -0.013596949)
|
||||
bones/26/position = Vector3(-0.16605523, 0.503459, 0.34819144)
|
||||
bones/26/rotation = Quaternion(0.80184454, 0.012367124, -0.00014036377, 0.5974047)
|
||||
bones/27/rotation = Quaternion(0.02130827, -0.010780271, 0.9870714, 0.15849292)
|
||||
bones/28/rotation = Quaternion(0.83065116, -0.0069491817, 0.17359851, 0.5289934)
|
||||
bones/29/rotation = Quaternion(0.154159, 0.96413255, -0.21364379, -0.032244705)
|
||||
bones/30/rotation = Quaternion(-0.2385772, -0.09427333, -0.5218142, 0.81357443)
|
||||
bones/31/rotation = Quaternion(0.22222735, 0.37126783, 0.41440633, 0.8006513)
|
||||
bones/32/rotation = Quaternion(-0.21135177, -0.40205637, 0.31771636, 0.83230853)
|
||||
bones/33/rotation = Quaternion(-0.05823014, 0.07767168, -0.03485695, 0.99466646)
|
||||
bones/34/rotation = Quaternion(0.025301827, 0.0070700953, -0.11431894, 0.9930967)
|
||||
bones/35/rotation = Quaternion(0.027933404, -0.0009984301, 0.077792086, 0.9965778)
|
||||
bones/36/rotation = Quaternion(0.06419258, 0.10893227, 0.010188486, 0.9919221)
|
||||
bones/37/rotation = Quaternion(0.04615016, 0.009964154, -0.27093482, 0.9614392)
|
||||
bones/38/rotation = Quaternion(-0.008443102, -0.0024520692, -0.3244902, 0.9458482)
|
||||
bones/39/rotation = Quaternion(0.027152644, 0.0043768333, 0.076968625, 0.9966541)
|
||||
bones/40/rotation = Quaternion(0.06997402, 0.04306513, -0.3332506, 0.9392513)
|
||||
bones/41/rotation = Quaternion(0.009862088, 0.005034929, -0.46087027, 0.88739854)
|
||||
bones/42/rotation = Quaternion(0.14311673, 0.16402356, -0.04056179, 0.9751763)
|
||||
bones/43/rotation = Quaternion(0.07528415, 0.04867352, -0.11827113, 0.9889263)
|
||||
bones/44/rotation = Quaternion(-0.007426173, 0.000489381, 0.017473433, 0.99981964)
|
||||
bones/45/rotation = Quaternion(-0.2385772, -0.09427333, -0.52181435, 0.81357443)
|
||||
bones/46/rotation = Quaternion(-0.058230132, 0.0776717, -0.034856908, 0.9946665)
|
||||
bones/47/rotation = Quaternion(0.06419257, 0.10893226, 0.010188487, 0.9919221)
|
||||
bones/48/rotation = Quaternion(0.027152658, 0.0043768324, 0.07696863, 0.9966541)
|
||||
bones/49/rotation = Quaternion(0.14311673, 0.16402358, -0.040561832, 0.9751763)
|
||||
bones/51/rotation = Quaternion(0.9864031, -0.11581065, -0.115810156, -0.013596978)
|
||||
bones/52/position = Vector3(-0.24780756, 0.5192058, 0.3484822)
|
||||
bones/52/rotation = Quaternion(0.73236954, 0.00991537, -0.022315646, 0.6804694)
|
||||
[node name="GunArm" parent="Camera3D/molikman_hands" index="1"]
|
||||
visible = false
|
||||
|
||||
[node name="Skeleton3D" parent="Camera3D/molikman_hands/GunArm" index="0"]
|
||||
bones/0/position = Vector3(-0.22279283, 0.7100338, -0.19202478)
|
||||
bones/0/rotation = Quaternion(-0.006717509, 0.6971531, 0.71686494, -0.0060944925)
|
||||
bones/1/position = Vector3(5.970651e-08, 0.06469957, 0.06380712)
|
||||
[node name="Armature" parent="Camera3D/molikman_hands" index="2"]
|
||||
visible = false
|
||||
|
||||
[node name="VisibleDisabler" type="Node" parent="Camera3D/molikman_hands"]
|
||||
script = ExtResource("4_smehm")
|
||||
|
|
@ -303,17 +248,22 @@ script = ExtResource("12_fulsm")
|
|||
player = NodePath("../..")
|
||||
SPEED = 5.0
|
||||
|
||||
[node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("default_pistol", "animation_player", "camera")]
|
||||
[node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("default_pistol", "default_knife", "animation_player", "camera")]
|
||||
script = ExtResource("4_qlg0r")
|
||||
default_pistol = NodePath("StartingPistol")
|
||||
default_knife = NodePath("Bomb")
|
||||
animation_player = NodePath("../Camera3D/molikman_hands/AnimationPlayer")
|
||||
camera = NodePath("../Camera3D")
|
||||
|
||||
[node name="StartingPistol" parent="WeaponSystem" instance=ExtResource("7_fjrip")]
|
||||
[node name="StartingPistol" parent="WeaponSystem" node_paths=PackedStringArray("visibility_mesh") instance=ExtResource("7_fjrip")]
|
||||
visibility_mesh = NodePath("../../Camera3D/molikman_hands/GunArm")
|
||||
|
||||
[node name="Shoot" parent="WeaponSystem/StartingPistol" index="1" node_paths=PackedStringArray("raycast")]
|
||||
raycast = NodePath("../../../Camera3D/RayCast3D")
|
||||
|
||||
[node name="Bomb" parent="WeaponSystem" node_paths=PackedStringArray("visibility_mesh") instance=ExtResource("17_fjvrb")]
|
||||
visibility_mesh = NodePath("../../Camera3D/molikman_hands/Armature")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_a8ls1")
|
||||
|
|
|
|||
15
scenes/weapons/bomb.tscn
Normal file
15
scenes/weapons/bomb.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bxdatd1ilfgmc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://scripts/weapon_system/weapon_substate_machine.gd" id="1_krsgt"]
|
||||
[ext_resource type="Script" uid="uid://rx78vdadldm7" path="res://scripts/weapon_system/bomb/bomb_state.gd" id="2_870cc"]
|
||||
|
||||
[node name="Bomb" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||
script = ExtResource("1_krsgt")
|
||||
animation_prefix = &"baked_bomb_"
|
||||
max_ammo = 1
|
||||
can_be_previous = false
|
||||
enter_state = NodePath("Main")
|
||||
metadata/_custom_type_script = "uid://e6lqknfl4ngt"
|
||||
|
||||
[node name="Main" type="Node" parent="."]
|
||||
script = ExtResource("2_870cc")
|
||||
|
|
@ -10,6 +10,7 @@ func _ready() -> void:
|
|||
if child is State:
|
||||
states[child.name] = child
|
||||
child.transition.connect(on_transition_required)
|
||||
|
||||
else:
|
||||
push_warning("Child of state machine is not state")
|
||||
|
||||
|
|
|
|||
17
scripts/weapon_system/bomb/bomb_state.gd
Normal file
17
scripts/weapon_system/bomb/bomb_state.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends WeaponState
|
||||
|
||||
|
||||
func enter():
|
||||
machine.animation_player.play(machine.animation_prefix+"plant")
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
|
||||
func exit():
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
|
||||
func on_animation_finished(animation: StringName):
|
||||
if animation == machine.animation_prefix + "plant":
|
||||
return_to_previous.emit()
|
||||
|
||||
func state_input(event: InputEvent) -> void:
|
||||
if event.is_action_released("plr_bomb"):
|
||||
return_to_previous.emit()
|
||||
1
scripts/weapon_system/bomb/bomb_state.gd.uid
Normal file
1
scripts/weapon_system/bomb/bomb_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://rx78vdadldm7
|
||||
|
|
@ -3,6 +3,8 @@ extends State
|
|||
|
||||
class_name WeaponState
|
||||
|
||||
signal return_to_previous
|
||||
|
||||
var machine: WeaponSubStateMachine
|
||||
|
||||
func use_begin() -> void:
|
||||
|
|
|
|||
|
|
@ -3,10 +3,15 @@ extends SubStateMachine
|
|||
class_name WeaponSubStateMachine
|
||||
|
||||
@export var animation_prefix: StringName
|
||||
@export var visibility_mesh: Node3D
|
||||
|
||||
@export var max_ammo: int
|
||||
@onready var ammo: int = max_ammo
|
||||
|
||||
@export var can_be_previous: bool = true
|
||||
|
||||
signal request_return
|
||||
|
||||
var system: WeaponSystem
|
||||
var animation_player: AnimationPlayer
|
||||
var player_camera: PlayerCamera
|
||||
|
|
@ -17,6 +22,15 @@ func _ready() -> void:
|
|||
states[child.name] = child
|
||||
child.machine = self
|
||||
child.transition.connect(on_transition_required)
|
||||
child.return_to_previous.connect(request_return.emit)
|
||||
|
||||
func enter() -> void:
|
||||
super()
|
||||
visibility_mesh.visible = true
|
||||
|
||||
func exit() -> void:
|
||||
super()
|
||||
visibility_mesh.visible = false
|
||||
|
||||
@rpc("authority","call_local","reliable")
|
||||
func use_begin() -> void:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class_name WeaponSystem
|
|||
@export var camera: PlayerCamera
|
||||
|
||||
var current_state: WeaponSubStateMachine
|
||||
var last_slot: StringName
|
||||
|
||||
var slots: Dictionary[StringName,WeaponSubStateMachine] = {
|
||||
"primary": null,
|
||||
|
|
@ -29,6 +30,7 @@ func _ready() -> void:
|
|||
child.system = self
|
||||
child.animation_player = animation_player
|
||||
child.player_camera = camera
|
||||
child.request_return.connect(return_to_previous)
|
||||
else:
|
||||
push_warning("Child of weapon system is not ability or weapon")
|
||||
|
||||
|
|
@ -56,18 +58,28 @@ func switch(to: StringName):
|
|||
if slots.has(to) == false or slots[to] == null or slots[to] == current_state:
|
||||
return
|
||||
current_state.exit()
|
||||
current_state.in_use = false
|
||||
if current_state.can_be_previous:
|
||||
last_slot = slots.find_key(current_state)
|
||||
else:
|
||||
last_slot = ""
|
||||
current_state = slots[to]
|
||||
current_state.enter()
|
||||
current_state.in_use = true
|
||||
|
||||
switched_to.emit(current_state)
|
||||
|
||||
#update_remotes.rpc(to)
|
||||
update_remotes.rpc(to)
|
||||
|
||||
func return_to_previous():
|
||||
if last_slot != "":
|
||||
switch(last_slot)
|
||||
|
||||
@rpc("authority","call_remote","reliable")
|
||||
func update_remotes(to: StringName):
|
||||
switch(to)
|
||||
current_state.exit()
|
||||
current_state = slots[to]
|
||||
current_state.enter()
|
||||
|
||||
switched_to.emit(current_state)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if current_state == null:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue