équilibrages, fix et évolutions
* résolution du bug de disparition des items #94 * améliorations définitives dans le camion via compost #88 * ajout de plus d'aléatoire dans le zone de départ * suppression des récompenses de quota (pour l'instant) * équilibrage du gain en graine * ajout de la clarté dans les actions
This commit is contained in:
@@ -4,6 +4,7 @@ signal inspected_changed(info : Inspector.Info)
|
||||
|
||||
const DEFAULT_ACTION_COLOR = Color.WHITE
|
||||
const ENERGY_ACTION_COLOR = Color("ffff2b")
|
||||
const NO_ENERGY_ACTION_COLOR = Color.RED
|
||||
const ZONE_OPACITY = 0.4
|
||||
const ZONE_ACTIVATED_COLOR = Color.TURQUOISE
|
||||
const ZONE_DEACTIVATED_COLOR = Color.REBECCA_PURPLE
|
||||
@@ -15,6 +16,8 @@ var inspected_info : Inspector.Info = null
|
||||
var player : Player # renseigné par Player
|
||||
var can_interact : bool = false
|
||||
var current_selected_item : Item = null
|
||||
var have_energy_to_use_item : bool = false
|
||||
var could_use_item : bool = false
|
||||
var can_use_item : bool = false
|
||||
|
||||
func _ready():
|
||||
@@ -53,11 +56,18 @@ func _process(_delta):
|
||||
|
||||
current_selected_item = player.inventory.get_item()
|
||||
|
||||
can_use_item = (
|
||||
could_use_item = (
|
||||
current_selected_item
|
||||
and player.preview_can_use_item(current_selected_item)
|
||||
and player.preview_could_use_item(current_selected_item)
|
||||
)
|
||||
|
||||
have_energy_to_use_item = (
|
||||
current_selected_item
|
||||
and player.has_energy_to_use_item(current_selected_item)
|
||||
)
|
||||
|
||||
can_use_item = could_use_item and have_energy_to_use_item
|
||||
|
||||
if current_selected_item:
|
||||
%ActionZone.radius = current_selected_item.usage_zone_radius
|
||||
%ActionZone.color = ZONE_ACTIVATED_COLOR if can_use_item else ZONE_DEACTIVATED_COLOR
|
||||
@@ -89,10 +99,13 @@ func update_inspector():
|
||||
%ActionText.text = inspected.interact_text()
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if inspected.interaction_cost(player) == 0 else ENERGY_ACTION_COLOR
|
||||
%ActionEnergyImage.visible = inspected.interaction_cost(player) != 0
|
||||
elif can_use_item and current_selected_item:
|
||||
elif current_selected_item and current_selected_item.use_text() != "":
|
||||
%Action.visible = true
|
||||
%ActionText.text = current_selected_item.use_text()
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if current_selected_item.energy_usage == 0 else ENERGY_ACTION_COLOR
|
||||
%ActionText.text = current_selected_item.use_text() + (" (no energy left)" if not have_energy_to_use_item else "")
|
||||
if can_use_item:
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if current_selected_item.energy_usage == 0 else ENERGY_ACTION_COLOR
|
||||
else :
|
||||
%Action.modulate = NO_ENERGY_ACTION_COLOR
|
||||
%ActionEnergyImage.visible = current_selected_item.energy_usage != 0
|
||||
else:
|
||||
%Action.visible = false
|
||||
|
||||
Reference in New Issue
Block a user