#44 changement de la méthode d'interaction et d'utilisation du joueur pour une plus grande liberté de la souris
This commit is contained in:
@@ -11,8 +11,14 @@ func is_one_time_use():
|
||||
func can_use(_player : Player) -> bool:
|
||||
return false
|
||||
|
||||
func use_text(_player) -> String:
|
||||
return ""
|
||||
|
||||
func use_requirement_text() -> String:
|
||||
return ""
|
||||
|
||||
func use(_player : Player):
|
||||
return false
|
||||
return false
|
||||
|
||||
func generate_action_area(_player) -> ActionArea:
|
||||
return null
|
||||
|
||||
@@ -13,14 +13,23 @@ class_name Seed
|
||||
func _init(_plant_type : PlantType = null):
|
||||
plant_type = _plant_type
|
||||
|
||||
func generate_action_area(player : Player) -> ActionArea:
|
||||
return ActionArea.new(
|
||||
player,
|
||||
10
|
||||
)
|
||||
|
||||
func use_text(_player) -> String:
|
||||
return "Plant " + plant_type.name
|
||||
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player) -> bool:
|
||||
return not player.planet.is_there_contamination(player.global_position)
|
||||
return not player.planet.is_there_contamination(player.action_area.global_position)
|
||||
|
||||
func use(player : Player) -> bool:
|
||||
if not can_use(player):
|
||||
return false
|
||||
player.play_sfx("dig")
|
||||
return player.planet.plant(plant_type, player.global_position)
|
||||
return player.planet.plant(plant_type, player.action_area.global_position)
|
||||
|
||||
@@ -3,6 +3,9 @@ class_name Shovel
|
||||
|
||||
const USE_INTERVAL = 0.15
|
||||
|
||||
func use_text(_player) -> String:
|
||||
return "Dig"
|
||||
|
||||
func can_use(player : Player) -> bool:
|
||||
var areas = player.action_area.get_overlapping_areas()
|
||||
for area in areas :
|
||||
|
||||
@@ -2,10 +2,9 @@ extends Item
|
||||
class_name ToolItem
|
||||
|
||||
@export var area_width: float = 50
|
||||
@export var area_distance: float = 50
|
||||
|
||||
func generate_action_area():
|
||||
func generate_action_area(player : Player) -> ActionArea:
|
||||
return ActionArea.new(
|
||||
area_width,
|
||||
area_distance
|
||||
player,
|
||||
area_width
|
||||
)
|
||||
Reference in New Issue
Block a user