2017-07-01 19:59:37 +02:00
|
|
|
extends Area2D
|
|
|
|
|
|
|
|
var in_area = []
|
2018-01-13 20:28:57 +01:00
|
|
|
var from_player
|
2017-07-01 19:59:37 +02:00
|
|
|
|
|
|
|
# Called from the animation
|
|
|
|
func explode():
|
2018-03-14 05:52:41 +01:00
|
|
|
if not is_network_master():
|
2017-07-01 19:59:37 +02:00
|
|
|
# But will call explosion only on master
|
|
|
|
return
|
|
|
|
for p in in_area:
|
2018-03-14 05:52:41 +01:00
|
|
|
if p.has_method("exploded"):
|
2018-01-13 20:28:57 +01:00
|
|
|
p.rpc("exploded", from_player) # Exploded has a master keyword, so it will only be received by the master
|
2017-07-01 19:59:37 +02:00
|
|
|
|
|
|
|
func done():
|
|
|
|
queue_free()
|
|
|
|
|
|
|
|
func _on_bomb_body_enter(body):
|
2018-03-14 05:52:41 +01:00
|
|
|
if not body in in_area:
|
2017-07-01 19:59:37 +02:00
|
|
|
in_area.append(body)
|
|
|
|
|
|
|
|
func _on_bomb_body_exit(body):
|
|
|
|
in_area.erase(body)
|