Merge branch 'master' of github.com:unfa/liblast

remotes/1699310152913738325/tmp_refs/heads/legacy
unfa 2021-04-21 23:22:31 +02:00
commit d914bc2999
4 changed files with 16 additions and 8 deletions

View File

@ -1,7 +1,7 @@
extends Spatial
var first = true
var velocity = 200
var velocity = 350
const bullet_hit = preload("res://Assets/Effects/BulletHit.tscn")

View File

@ -140,7 +140,7 @@ sync func play():
player.pitch_scale = PitchScale + rand_range(-RandomizePitch /2, RandomizePitch/2)
else:
player.pitch_scale = PitchScale
player.play()
ready = false

View File

@ -299,23 +299,31 @@ func fall(delta):
was_on_floor = is_on_floor()
sync func on_damage_dealt(damage, target, is_kill):
if is_kill:
player_stats.score += 1
game.get_node("PlayerListContainer").update_player_list()
master func on_hit(damage, location):
set_health(health - 30)
master func on_hit(damage, location, source):
set_health(health - damage)
rpc("blood_splatter", location)
var source_player = get_parent().get_node(source)
if health <= 0:
rpc("kill")
kill()
source_player.rpc("on_damage_dealt", damage, self.name, true)
else:
$Sounds/Pain.rpc("play")
source_player.rpc("on_damage_dealt", damage, self.name, false)
sync func blood_splatter(location):
var effect = bodyHitEffect.instance()
get_tree().root.add_child(effect)
effect.global_transform.origin = location
master func kill():
func kill():
if is_dead:
return

View File

@ -65,7 +65,7 @@ func shoot(camera):
var hit = result.collider
if hit.has_method("on_hit"):
hit.rpc("on_hit", 30, result.position)
hit.rpc("on_hit", 30, result.position, player.name)
if hit is Player:
var kill = true if hit.health <= 0 else false