@@ -48,7 +48,7 @@ var pull_out_of_thread = false
4848
4949func _initialize () -> void :
5050 _npc .perception_transition .connect (_handle_perception_info .bind ())
51- _npc .hit_by .connect (func (who ): _aggress (EntityManager .instance .get_entity (who )))
51+ _npc .hit_by .connect (func (who ): _aggress (SKEntityManager .instance .get_entity (who )))
5252
5353
5454func _handle_perception_info (what :StringName , transition :String , fsm :PerceptionFSM_Machine ) -> void :
@@ -73,7 +73,7 @@ func _handle_perception_info(what:StringName, transition:String, fsm:PerceptionF
7373 if below_attack_threshold : # if attack threshold or frenzied
7474 if not _npc .in_combat :
7575 _npc .printe ("start vigilance" )
76- var e = EntityManager .instance .get_entity (what )
76+ var e = SKEntityManager .instance .get_entity (what )
7777
7878 # attack immediately if frenzied
7979 if aggression == 3 :
@@ -103,7 +103,7 @@ func _handle_perception_info(what:StringName, transition:String, fsm:PerceptionF
103103
104104
105105## Will keep watch until the entity is out of range. TODO: Visibility?
106- func _stay_vigilant (e :Entity ) -> void :
106+ func _stay_vigilant (e :SKEntity ) -> void :
107107 # may need to change the order of this, im not sure where to put it yet
108108 if _npc .in_combat : # don't react if already in combat
109109 _add_enemy (e )
@@ -150,7 +150,7 @@ func _stay_vigilant(e:Entity) -> void:
150150 return
151151
152152
153- func _begin_attack (e :Entity ) -> void :
153+ func _begin_attack (e :SKEntity ) -> void :
154154 # figure out response to confrontation
155155 print ("beginning attack" )
156156 match aggression :
@@ -168,7 +168,7 @@ func _begin_attack(e:Entity) -> void:
168168 # This will begin combat, because NPCs have a recurring goal where all enemies must be dead
169169
170170
171- func _add_enemy (e :Entity ) -> void :
171+ func _add_enemy (e :SKEntity ) -> void :
172172 if _npc .goap_memory .has ("enemies" ):
173173 if not _npc .goap_memory ["enemies" ].has (e .name ):
174174 print ("Adding enemy %s " % e .name )
@@ -179,7 +179,7 @@ func _add_enemy(e:Entity) -> void:
179179 _npc ._goap_component .interrupt () # interrupt current task if entering combat
180180
181181
182- func _warn (e :Entity ) -> void :
182+ func _warn (e :SKEntity ) -> void :
183183 # Issue warning to entity
184184 print ("warning!" )
185185 _npc .warning .emit (e .name )
@@ -196,15 +196,15 @@ func _enter_vigilant_stance() -> void:
196196 print ("enter vigilant stance" )
197197
198198
199- func _flee (e :Entity ) -> void :
199+ func _flee (e :SKEntity ) -> void :
200200 # tell GOAP to flee from enemies
201201 print ("flee" )
202202 _npc .add_objective ({"flee_from_enemies" : true }, true , 10 )
203203 _npc .flee .emit (e .name )
204204
205205
206206## Response to being hit.
207- func _aggress (e :Entity ) -> void :
207+ func _aggress (e :SKEntity ) -> void :
208208 # "Coward", "Cautious", "Average", "Brave", "Foolhardy"
209209 # TODO: Friendly fire
210210 var threat = _determine_threat (e )
@@ -244,7 +244,7 @@ func _aggress(e:Entity) -> void:
244244## 1: Stronger [br]
245245## 2: Significantly stronger [br]
246246## See [constant THREAT_LEVEL_WEAKER_INTERVAL], [constant THREAT_LEVEL_GREATER_INTERVAL], [constant THREAT_LEVEL_MUCH_GREATER_INTERVAL]
247- func _determine_threat (e :Entity ) -> int :
247+ func _determine_threat (e :SKEntity ) -> int :
248248 var e_sc = e .get_component ("SkillsComponent" )
249249 # if no skills component associated with the entity, default is 0
250250 if not e_sc .some ():
0 commit comments