* ajout des mutations #86 * changement de l'objectif #85 * refonte de l'inspecteur #71 * changement léger de la plantation * les plantes ne donnent que des graines de leurs espèces * refonte partielle du code, refacto
49 lines
1.1 KiB
GDScript
49 lines
1.1 KiB
GDScript
extends InspectableEntity
|
|
class_name Objective
|
|
|
|
const RANDOM_MAX_OBJECTIVE_INTERVAL = 1.
|
|
const DECONTAMINATION_ICON = preload("res://common/icons/skull.svg")
|
|
|
|
var completed : bool = false
|
|
var planet : Planet
|
|
@export var reward : ObjectiveReward = null :
|
|
set(r):
|
|
reward = r
|
|
update_reward_info(r)
|
|
|
|
func _ready():
|
|
update_reward_info(reward)
|
|
|
|
func pointer_text():
|
|
return "Contamination Objective"
|
|
|
|
func inspector_info() -> Inspector.Info:
|
|
var info : Inspector.Info = Inspector.Info.new(
|
|
pointer_text(),
|
|
"This dead log can hide a treasure of life."
|
|
)
|
|
|
|
info.framed_infos.append(
|
|
Inspector.FramedInfo.new(
|
|
"When decontamined",
|
|
reward.get_description(),
|
|
DECONTAMINATION_ICON
|
|
)
|
|
)
|
|
|
|
return info
|
|
|
|
func _end_pass_day():
|
|
if planet and not completed:
|
|
if not planet.is_there_contamination(global_position):
|
|
reward.reward(self)
|
|
%AnimationPlayer.play("activate")
|
|
%RewardInfo.visible = false
|
|
completed = true
|
|
|
|
func update_reward_info(r : ObjectiveReward):
|
|
if r:
|
|
%RewardText.text = r.get_text()
|
|
%RewardIcon.texture = r.get_icon()
|
|
%RewardInfo.visible = r != null
|