diff --git a/Autoload/Cube.gd b/Autoload/Cube.gd index 1417962a..200946d7 100644 --- a/Autoload/Cube.gd +++ b/Autoload/Cube.gd @@ -38,8 +38,6 @@ const rngCube = { #"EarthPathUnderneath" : [25,26,27,28,29], # This is apparently unnecessary, it'll just flood the column indexes } -const stoneRatio = 0.15 - enum { SIDE_NORTH = 0, SIDE_EAST = 1, diff --git a/Autoload/Settings.gd b/Autoload/Settings.gd index 60b2d93c..da6e8d71 100644 --- a/Autoload/Settings.gd +++ b/Autoload/Settings.gd @@ -74,6 +74,7 @@ var listOfSettings = [ "placing_tutorial", "chance_effect_water", "chance_effect_lava", + "chance_path_stone", "auto_open_map_settings", "fortify", "automatic_torch_slabs", @@ -400,6 +401,10 @@ func game_setting(doWhat,string,value): var oLavaEffectPercent = $'../Main/Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/HBoxContainer2/LavaEffectPercent' if doWhat == SET: oLavaEffectPercent.value = value if doWhat == GET: return oLavaEffectPercent.value + "chance_path_stone": + var oPathStonePercent = $'../Main/Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/HBoxContainer3/PathStonePercent' + if doWhat == SET: oPathStonePercent.value = value + if doWhat == GET: return oPathStonePercent.value "auto_open_map_settings": var oCheckBoxNewMapAutoOpensMapSettings = $'../Main/Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabUI/VBoxContainer/CheckBoxNewMapAutoOpensMapSettings' if doWhat == SET: oCheckBoxNewMapAutoOpensMapSettings.pressed = value diff --git a/Scenes/Main.tscn b/Scenes/Main.tscn index e8eaf1a2..27ea4a14 100644 --- a/Scenes/Main.tscn +++ b/Scenes/Main.tscn @@ -2466,6 +2466,27 @@ value = 2.5 suffix = "%" script = ExtResource( 81 ) +[node name="HBoxContainer3" type="HBoxContainer" parent="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer"] +margin_top = 35.0 +margin_right = 532.0 +margin_bottom = 66.0 + +[node name="Label" type="Label" parent="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/HBoxContainer3"] +margin_top = 5.0 +margin_right = 149.0 +margin_bottom = 26.0 +text = "Place Path stones" + +[node name="PathStonePercent" type="SpinBox" parent="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/HBoxContainer3"] +margin_left = 458.0 +margin_right = 532.0 +margin_bottom = 31.0 +size_flags_horizontal = 10 +step = 0.1 +value = 15.0 +suffix = "%" +script = ExtResource( 81 ) + [node name="BridgesOnlyOnLiquidCheckbox" type="CheckBox" parent="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer"] margin_top = 70.0 margin_right = 532.0 @@ -7057,6 +7078,7 @@ script = SubResource( 20 ) [connection signal="toggled" from="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabFiles/VBoxContainer/CheckBoxAlwaysDecompress" to="Ui/UiSystem/PreferencesWindow" method="_on_CheckBoxAlwaysDecompress_toggled"] [connection signal="value_changed" from="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/HBoxContainer/WaterEffectPercent" to="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements" method="_on_WaterEffectPercent_value_changed"] [connection signal="value_changed" from="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/HBoxContainer2/LavaEffectPercent" to="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements" method="_on_LavaEffectPercent_value_changed"] +[connection signal="value_changed" from="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/HBoxContainer3/PathStonePercent" to="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements" method="_on_PathStonePercent_value_changed"] [connection signal="toggled" from="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/BridgesOnlyOnLiquidCheckbox" to="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements" method="_on_BridgesOnlyOnLiquidCheckbox_toggled"] [connection signal="toggled" from="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/OwnableNaturalTerrain" to="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements" method="_on_OwnableNaturalTerrain_toggled"] [connection signal="toggled" from="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements/MarginContainer/VBoxContainer/EditableBordersCheckbox" to="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabPlacements" method="_on_EditableBordersCheckbox_toggled"] diff --git a/Scenes/SlabPlacement.gd b/Scenes/SlabPlacement.gd index 82d9bd35..99d6ce21 100644 --- a/Scenes/SlabPlacement.gd +++ b/Scenes/SlabPlacement.gd @@ -33,6 +33,7 @@ onready var oRoundGoldNearPath = Nodelist.list["oRoundGoldNearPath"] onready var oRoundGoldNearLiquid = Nodelist.list["oRoundGoldNearLiquid"] onready var oRoundWaterNearLava = Nodelist.list["oRoundWaterNearLava"] onready var oAutomaticTorchSlabsCheckbox = Nodelist.list["oAutomaticTorchSlabsCheckbox"] +onready var oPathStonePercent = Nodelist.list["oPathStonePercent"] enum dir { s = 0 @@ -571,10 +572,24 @@ func place_general(xSlab, ySlab, slabID, ownership, surrID, surrOwner, bitmaskTy if slabID == Slabs.LAVA: # Just hardcode the random FloorTexture for lava. I think it only looks different in the editor. for i in constructedFloor.size(): constructedFloor[i] = Random.choose([546,547]) + elif slabID == Slabs.PATH: + randomize_path_cubes(constructedColumns) + + set_columns(xSlab, ySlab, constructedColumns, constructedFloor) oPlaceThingWithSlab.place_slab_objects(xSlab, ySlab, slabID, ownership, slabsetIndexGroup, bitmask, surrID, bitmaskType) +func randomize_path_cubes(constructedColumns): + var pthClean = Cube.rngCube["PathClean"] + var pthStones = Cube.rngCube["PathWithStones"] + for i in 9: + var cubeID = constructedColumns[i][0] + if cubeID in pthClean or cubeID in pthStones: + if Random.rng.randf_range(0.0, 100.0) < oPathStonePercent.value: + constructedColumns[i][0] = Random.choose(pthStones) + else: + constructedColumns[i][0] = Random.choose(pthClean) func get_constructed_slab_data(columnsetIndexList): var constructedColumns = [] diff --git a/Scenes/SlabSettingsWindow.gd b/Scenes/SlabSettingsWindow.gd index 7df0cc72..c7874418 100644 --- a/Scenes/SlabSettingsWindow.gd +++ b/Scenes/SlabSettingsWindow.gd @@ -54,9 +54,15 @@ func _on_LavaEffectPercent_value_changed(value): func _on_WaterEffectPercent_value_changed(value): Settings.set_setting("chance_effect_water", value) + +func _on_PathStonePercent_value_changed(value): + Settings.set_setting("chance_path_stone", value) + + func _on_PlaceThingsAnywhere_toggled(value): Settings.set_setting("place_things_anywhere", value) func _on_AutomaticTorchSlabsCheckbox_toggled(value): Settings.set_setting("automatic_torch_slabs", value) +