add fast mode chance to config
This commit is contained in:
parent
8efe7f7bac
commit
55ff74065d
3 changed files with 12 additions and 1 deletions
|
@ -12,6 +12,7 @@ func _ready() -> void:
|
|||
|
||||
config.set_value("general", "remove_cars_timeout", 15)
|
||||
config.set_value("general", "automatic_map_change_after", 2)
|
||||
config.set_value("general", "fast_mode_chance", 0.0)
|
||||
|
||||
config.save(SETTINGS_FILE_PATH)
|
||||
else:
|
||||
|
|
|
@ -25,6 +25,14 @@ var automatic_map_change_in=automatic_map_change_after #change map when this rea
|
|||
|
||||
var colorwheelstep:float=0.3
|
||||
|
||||
var fast_mode_chance:float=0
|
||||
|
||||
func setFastModeChance(v:float):
|
||||
fast_mode_chance=max(min(v,1.0),0.0)
|
||||
|
||||
func getFastModeChance():
|
||||
return fast_mode_chance
|
||||
|
||||
func getRounds():
|
||||
return rounds
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ func _ready():
|
|||
Gamestate.setRemoveCarsTimeout(ConfigFileHandler.get_general_setting("remove_cars_timeout"))
|
||||
Gamestate.setAutomaticMapChangeAfter(ConfigFileHandler.get_general_setting("automatic_map_change_after"))
|
||||
|
||||
Gamestate.setFastModeChance(ConfigFileHandler.get_general_setting("fast_mode_chance"))
|
||||
|
||||
keywhitelist=ConfigFileHandler.get_keywhitelist_setting() #empty list if disabled
|
||||
btn_save_whitelist.disabled=keywhitelist.size()>0 #whitelist enabled, then disable save whitelist button
|
||||
btn_save_whitelist.visible=!keywhitelist.size()>0
|
||||
|
@ -72,7 +74,7 @@ func _unhandled_key_input(event: InputEvent) -> void:
|
|||
|
||||
func _on_timer_timeout() -> void: #Start Game
|
||||
print("Game starting")
|
||||
if (randi() % 3 == 0):
|
||||
if (randi() % 100 <= Gamestate.getFastModeChance()*100):
|
||||
Gamestate.setCarPreset("fast")
|
||||
else:
|
||||
Gamestate.setCarPreset("normal")
|
||||
|
|
Loading…
Add table
Reference in a new issue