@@ -1,11 +1,25 @@
|
||||
@tool
|
||||
extends Item
|
||||
class_name SeedItem
|
||||
|
||||
@export var plant_type: PlantType
|
||||
@export var plant_type: PlantType :
|
||||
set(v):
|
||||
plant_type = v
|
||||
if plant_type:
|
||||
name = plant_type.name
|
||||
description = plant_type.description
|
||||
icon = plant_type.seed_texture
|
||||
|
||||
func _init():
|
||||
if plant_type:
|
||||
if plant_type.name:
|
||||
name = plant_type.name
|
||||
if plant_type.seed_texture:
|
||||
icon = plant_type.seed_texture
|
||||
func _init(_plant_type : PlantType = null):
|
||||
plant_type = _plant_type
|
||||
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player) -> bool:
|
||||
return not player.planet.is_there_contamination(player.global_position)
|
||||
|
||||
func use(player : Player) -> bool:
|
||||
if not can_use(player):
|
||||
return false
|
||||
return player.planet.plant(plant_type, player.global_position)
|
||||
|
||||
Reference in New Issue
Block a user