|
|
|
|
@@ -1,36 +1,36 @@
|
|
|
|
|
class_name Hack extends Area3D
|
|
|
|
|
|
|
|
|
|
enum Type{
|
|
|
|
|
BOMB,
|
|
|
|
|
MINE,
|
|
|
|
|
GAS,
|
|
|
|
|
FORCE_PANEL,
|
|
|
|
|
SWITCH,
|
|
|
|
|
PITFALL
|
|
|
|
|
DESTROY,
|
|
|
|
|
PURGE,
|
|
|
|
|
INFECT,
|
|
|
|
|
REDIRECT,
|
|
|
|
|
TRIGGER,
|
|
|
|
|
CONTAIN
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const range_shapes : Dictionary = {
|
|
|
|
|
Hack.Type.BOMB : Vector3(4.25,3,4.25),
|
|
|
|
|
Hack.Type.GAS : Vector3(1,1,1),
|
|
|
|
|
Hack.Type.PITFALL : Vector3(1,1,1),
|
|
|
|
|
Hack.Type.FORCE_PANEL : Vector3(1,1,1),
|
|
|
|
|
Hack.Type.SWITCH : Vector3(3,1,3),
|
|
|
|
|
Hack.Type.MINE : Vector3(4.25,3,4.25),
|
|
|
|
|
Hack.Type.DESTROY : Vector3(4.25,3,4.25),
|
|
|
|
|
Hack.Type.INFECT : Vector3(1,1,1),
|
|
|
|
|
Hack.Type.CONTAIN : Vector3(1,1,1),
|
|
|
|
|
Hack.Type.REDIRECT : Vector3(1,1,1),
|
|
|
|
|
Hack.Type.TRIGGER : Vector3(3,1,3),
|
|
|
|
|
Hack.Type.PURGE : Vector3(4.25,3,4.25),
|
|
|
|
|
}
|
|
|
|
|
const hack_icons : Dictionary = {
|
|
|
|
|
Hack.Type.BOMB : preload("res://visuals/images/icons/t-bomb.png"),
|
|
|
|
|
Hack.Type.GAS : preload("res://visuals/images/icons/t-gas.png"),
|
|
|
|
|
Hack.Type.PITFALL : preload("res://visuals/images/icons/t-pitfall.png"),
|
|
|
|
|
Hack.Type.FORCE_PANEL : preload("res://visuals/images/icons/t-force_panel.png"),
|
|
|
|
|
Hack.Type.SWITCH : preload("res://visuals/images/icons/t-switch.png"),
|
|
|
|
|
Hack.Type.MINE : preload("res://visuals/images/icons/t-mine.png"),
|
|
|
|
|
Hack.Type.DESTROY : preload("res://external/destroy-icon.png"),
|
|
|
|
|
Hack.Type.INFECT : preload("res://external/infect-icon.png"),
|
|
|
|
|
Hack.Type.CONTAIN : preload("res://external/contain-icon.png"),
|
|
|
|
|
Hack.Type.REDIRECT : preload("res://external/redirect-icon.png"),
|
|
|
|
|
Hack.Type.TRIGGER : preload("res://external/trigger-icon.png"),
|
|
|
|
|
Hack.Type.PURGE : preload("res://external/purge-icon.png"),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bomb_explosion_template = preload("res://templates/explosion.tscn")
|
|
|
|
|
const mine_explosion_template = preload("res://templates/explosion.tscn")
|
|
|
|
|
const pitfall_template = preload("res://templates/pitfall.tscn")
|
|
|
|
|
const switch_explosion_template = preload("res://templates/explosion.tscn")
|
|
|
|
|
const gas_emitter_template = preload("res://templates/gas_emitter.tscn")
|
|
|
|
|
const destroy_explosion_template = preload("res://templates/explosion.tscn")
|
|
|
|
|
const purge_explosion_template = preload("res://templates/explosion.tscn")
|
|
|
|
|
const contain_template = preload("res://templates/pitfall.tscn")
|
|
|
|
|
const trigger_explosion_template = preload("res://templates/explosion.tscn")
|
|
|
|
|
const infect_emitter_template = preload("res://templates/gas_emitter.tscn")
|
|
|
|
|
const force_activate_sound = preload("res://audio/sounds/TomWinandySFX_UI_ScifiTech_Start_06.wav")
|
|
|
|
|
|
|
|
|
|
@onready var range_area : Area3D = %RangeArea
|
|
|
|
|
@@ -72,7 +72,7 @@ func _exit_tree() -> void:
|
|
|
|
|
func setup(type : Type, direction : Vector3, hack_owner : int) -> void:
|
|
|
|
|
self.type = type
|
|
|
|
|
self.hack_owner = hack_owner
|
|
|
|
|
if type == Type.FORCE_PANEL:
|
|
|
|
|
if type == Type.REDIRECT:
|
|
|
|
|
var r : float = atan2(direction.z, direction.x)
|
|
|
|
|
var cardinal : float = roundi(r * 2 / PI) * PI / 2
|
|
|
|
|
self.direction = Vector3(cos(cardinal), 0, sin(cardinal))
|
|
|
|
|
@@ -115,15 +115,15 @@ func _ready() -> void:
|
|
|
|
|
icon.visible = owns_hack
|
|
|
|
|
range_shape.size = range_shapes[type]
|
|
|
|
|
match(type):
|
|
|
|
|
Type.BOMB:
|
|
|
|
|
Type.DESTROY:
|
|
|
|
|
damage = 15
|
|
|
|
|
Type.MINE:
|
|
|
|
|
Type.PURGE:
|
|
|
|
|
damage = 10
|
|
|
|
|
Type.SWITCH:
|
|
|
|
|
Type.TRIGGER:
|
|
|
|
|
damage = 5
|
|
|
|
|
Type.GAS:
|
|
|
|
|
Type.INFECT:
|
|
|
|
|
activation_timer.start()
|
|
|
|
|
Type.FORCE_PANEL:
|
|
|
|
|
Type.REDIRECT:
|
|
|
|
|
var r : float = atan2(direction.z, -direction.x) + PI/2
|
|
|
|
|
force_strip.rotate_y(r)
|
|
|
|
|
force_strip.visible = owns_hack
|
|
|
|
|
@@ -140,29 +140,29 @@ func activate() -> void:
|
|
|
|
|
return
|
|
|
|
|
var explode : bool = false
|
|
|
|
|
match(type):
|
|
|
|
|
Type.PITFALL:
|
|
|
|
|
generate_pitfall(square)
|
|
|
|
|
Type.CONTAIN:
|
|
|
|
|
generate_contain(square)
|
|
|
|
|
for body in get_overlapping_bodies():
|
|
|
|
|
body.start_pitfall(square, 6.0)
|
|
|
|
|
#Generate the circle here
|
|
|
|
|
Type.FORCE_PANEL:
|
|
|
|
|
Type.REDIRECT:
|
|
|
|
|
Game.oneshot(force_activate_sound)
|
|
|
|
|
for body in get_overlapping_bodies():
|
|
|
|
|
body.fling(direction, 5.0)
|
|
|
|
|
Type.MINE:
|
|
|
|
|
var exp = mine_explosion_template.instantiate()
|
|
|
|
|
Type.PURGE:
|
|
|
|
|
var exp = purge_explosion_template.instantiate()
|
|
|
|
|
Game.level.add_vfx(exp, square)
|
|
|
|
|
explode = true
|
|
|
|
|
Type.SWITCH:
|
|
|
|
|
var exp = switch_explosion_template.instantiate()
|
|
|
|
|
Type.TRIGGER:
|
|
|
|
|
var exp = trigger_explosion_template.instantiate()
|
|
|
|
|
Game.level.add_vfx(exp, square)
|
|
|
|
|
explode = true
|
|
|
|
|
Type.BOMB:
|
|
|
|
|
var exp = bomb_explosion_template.instantiate()
|
|
|
|
|
Type.DESTROY:
|
|
|
|
|
var exp = destroy_explosion_template.instantiate()
|
|
|
|
|
Game.level.add_vfx(exp, square)
|
|
|
|
|
explode = true
|
|
|
|
|
Type.GAS:
|
|
|
|
|
var emitter = gas_emitter_template.instantiate()
|
|
|
|
|
Type.INFECT:
|
|
|
|
|
var emitter = infect_emitter_template.instantiate()
|
|
|
|
|
emitter.hack_owner = hack_owner
|
|
|
|
|
emitter.square = square
|
|
|
|
|
emitter.damage = 4
|
|
|
|
|
@@ -179,13 +179,13 @@ func activate() -> void:
|
|
|
|
|
|
|
|
|
|
func trigger_adjacent_bombs() -> void:
|
|
|
|
|
for hack : Hack in range_area.get_overlapping_areas():
|
|
|
|
|
if hack.type == Type.BOMB and hack != self:
|
|
|
|
|
if hack.type == Type.DESTROY and hack != self:
|
|
|
|
|
hack.delay_trigger()
|
|
|
|
|
|
|
|
|
|
func generate_pitfall(suqare : Vector3i) -> void:
|
|
|
|
|
var pitfall = pitfall_template.instantiate()
|
|
|
|
|
pitfall.duration = 6.0
|
|
|
|
|
Game.level.add_vfx(pitfall, square)
|
|
|
|
|
func generate_contain(square : Vector3i) -> void:
|
|
|
|
|
var contain = contain_template.instantiate()
|
|
|
|
|
contain.duration = 6.0
|
|
|
|
|
Game.level.add_vfx(contain, square)
|
|
|
|
|
|
|
|
|
|
func blast_players() -> void:
|
|
|
|
|
for body in range_area.get_overlapping_bodies():
|
|
|
|
|
@@ -200,7 +200,7 @@ func delay_trigger() -> void:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_body_entered(body: Node3D) -> void:
|
|
|
|
|
if type == Type.GAS or type == Type.BOMB:
|
|
|
|
|
if type == Type.INFECT or type == Type.DESTROY:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if body.id == hack_owner:
|
|
|
|
|
|