Init commit
This commit is contained in:
33
godot/scenes/characters/character_wrapper.gd
Normal file
33
godot/scenes/characters/character_wrapper.gd
Normal file
@ -0,0 +1,33 @@
|
||||
extends Node
|
||||
class_name CharacterWrapper
|
||||
|
||||
@export var die_script: GDScript = null
|
||||
var owner_placeholder: Node3D = null
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
# Characters should be always controlled by the server and synced accross client
|
||||
# The owner should be responsible for the syncronization, since this node is
|
||||
# just a dummy that is following the controller
|
||||
set_multiplayer_authority(1)
|
||||
|
||||
pass # Replace with function body.
|
||||
|
||||
# Set the owner placeholder, so the characters can send the requests to a node
|
||||
# it depends on
|
||||
func set_owner_placeholder(owner: Node3D):
|
||||
owner_placeholder = owner
|
||||
|
||||
func die():
|
||||
push_warning("TODO: Implement ragdoll kind of dying and respawn character as an object")
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_area_body_part_hit(damage: int) -> void:
|
||||
# The owner node should be aware of how to take damage, so we need to
|
||||
# pass the value.
|
||||
if owner_placeholder:
|
||||
if owner_placeholder.has_method("take_damage"):
|
||||
owner_placeholder.take_damage(damage)
|
||||
else:
|
||||
push_warning("Node doesn't know how to take the damage")
|
13
godot/scenes/characters/hit_detected.gd
Normal file
13
godot/scenes/characters/hit_detected.gd
Normal file
@ -0,0 +1,13 @@
|
||||
extends Area3D
|
||||
|
||||
@export var damage_multiplexer: float = 1.0
|
||||
@export var body_part: String = ""
|
||||
|
||||
signal body_part_hit(damage: int)
|
||||
|
||||
func _ready() -> void:
|
||||
add_to_group("target")
|
||||
|
||||
func hit(base_damage: int):
|
||||
var final_damage = round(base_damage * damage_multiplexer)
|
||||
body_part_hit.emit(final_damage)
|
3031
godot/scenes/characters/y-bot/character.tscn
Normal file
3031
godot/scenes/characters/y-bot/character.tscn
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user