ajout du camion #87
* changements des objectifs, donnent juste des graines, sprite moins gros et objectifs plus nombreux * changement de la probabilité de mutation * refactor du code terrain et planet
This commit is contained in:
@@ -30,10 +30,10 @@ func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
return player.planet.is_in_base(zone.get_global_position())
|
||||
return player.planet && player.planet.is_in_base(zone.get_global_position())
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
if machine_type and machine_level:
|
||||
if machine_type and machine_level and player.planet:
|
||||
player.planet.instantiate_machine(machine_type, machine_level, zone.get_global_position())
|
||||
return true
|
||||
return false
|
||||
|
||||
@@ -25,7 +25,7 @@ func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
return true
|
||||
return player.planet != null
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
player.planet.instantiate_entity(scene, zone.get_global_position())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
extends Item
|
||||
class_name Seed
|
||||
|
||||
const MUTATION_PROBABILITY = 0.2
|
||||
const MUTATION_PROBABILITY = 0.3
|
||||
|
||||
const SHOVEL_ICON = preload("res://common/icons/shovel.svg")
|
||||
const GROWING_ICON = preload("res://common/icons/chevrons-up.svg")
|
||||
@@ -39,6 +39,9 @@ func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
if player.planet == null:
|
||||
return false
|
||||
|
||||
var is_there_a_plant_here = false
|
||||
for area in zone.area.get_overlapping_areas() :
|
||||
if area is Plant:
|
||||
@@ -52,6 +55,9 @@ func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
return not is_there_a_plant_here and not is_there_contamination_in_zone
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
if player.planet == null:
|
||||
return false
|
||||
|
||||
player.play_sfx("dig")
|
||||
return player.planet.plant(
|
||||
plant_type,
|
||||
|
||||
Reference in New Issue
Block a user