Extensive work on animations and partially functional level keys, new UI gears but needs rounding error correction. Particle preloader added.
This commit is contained in:
@@ -52,9 +52,9 @@ var poison_strength : int = 0
|
||||
var poison_time_remaining : float = 0
|
||||
var poison_pulse_timer : float
|
||||
|
||||
var melee_range : float = 3.0
|
||||
var melee_range : float = 1.25
|
||||
var can_melee : bool = false
|
||||
var ranged_range : float = 6
|
||||
var ranged_range : float = 7
|
||||
var attack_timer : float = 0
|
||||
var melee_recovery_time : float = .75
|
||||
var ranged_recovery_time : float = 0.25
|
||||
@@ -348,14 +348,16 @@ func check_attack_target() -> void:
|
||||
var ranged_sq = ranged_range * ranged_range
|
||||
var melee_sq = melee_range * melee_range
|
||||
var space_state = get_world_3d().direct_space_state
|
||||
var list = get_tree().get_nodes_in_group("combat")
|
||||
|
||||
combat_target = null
|
||||
# use global coordinates, not local to node
|
||||
for target : Node3D in get_tree().get_nodes_in_group("combat"):
|
||||
if target == self:
|
||||
continue
|
||||
#Check to see if they're within the correct direction
|
||||
var angle = abs(facing.angle_to(target.global_position - global_position))
|
||||
var xz_diff = (target.global_position - global_position).normalized()
|
||||
xz_diff.y = 0
|
||||
var angle = abs(facing.angle_to(xz_diff))
|
||||
if angle > PI / 4.0:
|
||||
continue
|
||||
#Determine if they're within shot range
|
||||
@@ -364,8 +366,8 @@ func check_attack_target() -> void:
|
||||
continue
|
||||
|
||||
#Raycast to see if they're a valid target
|
||||
var start = global_position + Vector3(0,1,0)
|
||||
var end = target.global_position + Vector3(0,1,0)
|
||||
var start = global_position + Vector3(0,.5,0)
|
||||
var end = target.global_position + Vector3(0,.5,0)
|
||||
var query = PhysicsRayQueryParameters3D.create(start, end, 1|2, [self])
|
||||
var result = space_state.intersect_ray(query)
|
||||
if !result or (result.collider is not PawnController and result.collider is not CombatTarget):
|
||||
@@ -384,6 +386,8 @@ func check_attack_target() -> void:
|
||||
can_melee = false
|
||||
if ranged_closest != null:
|
||||
combat_target = ranged_closest
|
||||
else:
|
||||
combat_target = null
|
||||
combat_target_changed.emit(melee_closest != null)
|
||||
|
||||
func try_install_hack() -> void:
|
||||
@@ -629,6 +633,9 @@ func detonate() -> void:
|
||||
for hack : Hack in switch_list:
|
||||
hack.activate()
|
||||
|
||||
func can_poison() -> bool:
|
||||
return true
|
||||
|
||||
func is_poisoned() -> bool:
|
||||
return poison_time_remaining > 0
|
||||
|
||||
@@ -699,7 +706,8 @@ func _on_melee_hit(_body : Node3D) -> void:
|
||||
#TODO: WRITE THE MELEE DAMAGE CODE
|
||||
pass
|
||||
|
||||
|
||||
func is_flung() -> bool:
|
||||
return state == State.FLUNG
|
||||
func is_attacking() -> bool:
|
||||
return state == State.RANGED_ATTACKING or state == State.MELEE_ATTACKING
|
||||
|
||||
@@ -742,30 +750,34 @@ func add_hack(type : Hack.Type) -> void:
|
||||
hack_list_changed.emit(data.hacks, data.active_hack)
|
||||
|
||||
func add_random_hack(advanced : bool) -> void:
|
||||
#Get their current hack list
|
||||
var choices : Dictionary = {
|
||||
Hack.Type.DESTROY: true,
|
||||
Hack.Type.PURGE: true,
|
||||
Hack.Type.INFECT: true,
|
||||
Hack.Type.REDIRECT: true,
|
||||
Hack.Type.TRIGGER: true,
|
||||
Hack.Type.CONTAIN: true
|
||||
}
|
||||
for hd : PawnLevelData.HackData in data.hacks:
|
||||
if hd.max_quantity == 9:
|
||||
choices.erase(hd.type)
|
||||
|
||||
var choice = choices.keys().pick_random()
|
||||
add_hack.rpc(choice)
|
||||
if !advanced:
|
||||
#Get their current hack list
|
||||
var choices : Dictionary = {
|
||||
Hack.Type.DESTROY: true,
|
||||
Hack.Type.PURGE: true,
|
||||
Hack.Type.INFECT: true,
|
||||
Hack.Type.REDIRECT: true,
|
||||
Hack.Type.TRIGGER: true,
|
||||
Hack.Type.CONTAIN: true
|
||||
}
|
||||
for hd : PawnLevelData.HackData in data.hacks:
|
||||
if hd.max_quantity == 9:
|
||||
choices.erase(hd.type)
|
||||
|
||||
var choice = choices.keys().pick_random()
|
||||
add_hack.rpc(choice)
|
||||
#Create a list of possible hacks, omitting any that they have the max in already
|
||||
#Randomly pick one
|
||||
#RPC Add hack to them
|
||||
#TODO: Add random hack spawning using RPCs
|
||||
pass
|
||||
|
||||
func collect_data_key() -> void:
|
||||
Game.level.award_data_key.rpc(id)
|
||||
|
||||
func pickup(type : Pickup.Type) -> void:
|
||||
func collect(type : Collectable.Type) -> void:
|
||||
if id != Multiplayer.id:
|
||||
return
|
||||
match(type):
|
||||
Pickup.Type.DATABLOCK: print("Datablock picked up!")
|
||||
Pickup.Type.BASIC_HACK: add_random_hack(false)
|
||||
Collectable.Type.DATAKEY: collect_data_key()
|
||||
Collectable.Type.BASIC_HACK: add_random_hack(false)
|
||||
|
||||
Reference in New Issue
Block a user