40 lines
943 B
GDScript
40 lines
943 B
GDScript
extends Interaction
|
|
|
|
func _ready():
|
|
add_action("Plant", plant, plant_check)
|
|
add_action("Dig Up", dig_up, dig_up_check)
|
|
add_action("Fertilize", fertilize, fertilize_check)
|
|
add_action("Harvest", harvest, harvest_check)
|
|
|
|
func plant():
|
|
get_parent().open_planting_menu()
|
|
|
|
func plant_check():
|
|
if get_parent().currentState == PlantingSpot.PlantState.Empty:
|
|
return true
|
|
return false
|
|
|
|
func dig_up():
|
|
get_parent().dig_up()
|
|
|
|
func dig_up_check():
|
|
if get_parent().currentState == PlantingSpot.PlantState.Planted or get_parent().currentState == PlantingSpot.PlantState.GrownTree:
|
|
return true
|
|
return false
|
|
|
|
func fertilize():
|
|
get_parent().open_fertilization_menu()
|
|
|
|
func fertilize_check():
|
|
if get_parent().currentState == PlantingSpot.PlantState.Planted:
|
|
return true
|
|
return false
|
|
|
|
func harvest():
|
|
get_parent().harvest()
|
|
|
|
func harvest_check():
|
|
if get_parent().currentState == PlantingSpot.PlantState.GrownTree:
|
|
return true
|
|
return false
|