You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			64 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			GDScript
		
	
		
		
			
		
	
	
			64 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			GDScript
		
	
| 
											2 years ago
										 | extends Node3D | ||
|  | class_name Core | ||
|  | 
 | ||
| 
											2 years ago
										 | @onready var character: Character = (get_owner() as Character) | ||
|  | @onready var status: Status = (%Status as Status) | ||
|  | @onready var skill: Skill = (%Skill as Skill) | ||
|  | @onready var move: Move = (%Move as Move) | ||
|  | 
 | ||
|  | var active_core_action_list: Array[String] = ["free_attack_heavy", "free_attack_light", "free_jump", "free_interact", "lock_attack_heavy", "lock_attack_light", "lock_jump", "lock_interact"] | ||
| 
											2 years ago
										 | 
 | ||
|  | 
 | ||
|  | func _ready(): | ||
| 
											1 year ago
										 |     for i in range(8): | ||
|  |         status.core_active_list.append(null) | ||
| 
											2 years ago
										 | 
 | ||
| 
											2 years ago
										 | 
 | ||
|  | func _process(delta): | ||
| 
											1 year ago
										 |     pass | ||
| 
											2 years ago
										 | 
 | ||
| 
											2 years ago
										 | 
 | ||
|  | func set_active_core(index: int, core: CoreCfg) -> void: | ||
| 
											1 year ago
										 |     match core.type: | ||
|  |         Enum.ECoreType.Passive: return | ||
|  |         _: pass | ||
|  |     if (index < 0) or (index >= 8): | ||
|  |         return | ||
|  |     var core_pre = status.core_active_list[index] | ||
|  |     if core_pre: | ||
|  |         on_remove_active_core(index, core_pre) | ||
|  |     status.core_active_list[index] = core | ||
|  |     on_add_active_core(index, core) | ||
|  |     status.emit_status("core_active_list") | ||
|  |     return | ||
| 
											2 years ago
										 | 
 | ||
|  | 
 | ||
|  | func on_add_active_core(index: int, core: CoreCfg): | ||
| 
											1 year ago
										 |     var skill_cfg: SkillCfg = core.get_skill_cfg(0) | ||
|  |     var action: String      = active_core_action_list[index] | ||
|  |     skill.add_skill(action, skill_cfg) | ||
| 
											2 years ago
										 | 
 | ||
|  | 
 | ||
|  | func on_remove_active_core(index: int, core: CoreCfg): | ||
| 
											1 year ago
										 |     var skill_cfg: SkillCfg = core.get_skill_cfg(0) | ||
|  |     var action: String      = active_core_action_list[index] | ||
|  |     skill.remove_skill(action, skill_cfg) | ||
| 
											2 years ago
										 | 
 | ||
|  | 
 | ||
|  | func add_passive_core(core: CoreCfg) -> void: | ||
| 
											1 year ago
										 |     match core.type: | ||
| 
											1 year ago
										 |         Enum.ECoreType.Active: return | ||
| 
											1 year ago
										 |         _: pass | ||
|  |     status.core_passive_list.append(core) | ||
|  |     status.emit_status("core_passive_list") | ||
|  |     return | ||
| 
											2 years ago
										 | 
 | ||
| 
											2 years ago
										 | 
 | ||
| 
											2 years ago
										 | func remove_passive_core(core: CoreCfg) -> void: | ||
| 
											1 year ago
										 |     match core.type: | ||
| 
											1 year ago
										 |         Enum.ECoreType.Active: return | ||
| 
											1 year ago
										 |         _: pass | ||
|  |     status.core_passive_list.filter(func(c): return c!=core) | ||
|  |     status.emit_status("core_passive_list") | ||
|  |     return |