Skip to content

Comments

saving, loading, settings, kitchen sink update (sorry hede wan)#58

Open
a-fan9823 wants to merge 10 commits intoFNADS:newfrom
a-fan9823:new
Open

saving, loading, settings, kitchen sink update (sorry hede wan)#58
a-fan9823 wants to merge 10 commits intoFNADS:newfrom
a-fan9823:new

Conversation

@a-fan9823
Copy link
Member

No description provided.

@a-fan9823 a-fan9823 added the new feature New feature label Nov 1, 2024
now with 20% more fps!

side effects include but are not limited to - rash, swelling, poison, death, Cerber.
emit_signal("on_os_window_mode_changed",DisplayServer.window_get_mode())
_prev_win_mode = DisplayServer.window_get_mode()

func _linear_to_db(value: float) -> float:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function already exists and is exposed in Godot's @globalscope

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

godot function caused a horrible error

extends Node
#array[0] volume
#array[1] display
var settings_array: =[[1,1,1],[0]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Settings need to be a dictionary like in the old system.

Making it an array unnecessarikly hides the meaning of each entry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed this in my new update

var settings_array: =[[1,1,1],[0]]
signal volume_change(Array)
signal window_mode_change(int)
const window_modes = [DisplayServer.WINDOW_MODE_WINDOWED,DisplayServer.WINDOW_MODE_FULLSCREEN,DisplayServer.WINDOW_MODE_MAXIMIZED]#,DisplayServer.WINDOW_FLAG_BORDERLESS]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this array is an unnecessary abstraction that hides the window mode names with "meaningless" numbers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can fix this in a few secs, not too bad

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done and fixed, I had just done it a dumb method

else:
return -45 + (value / 100) * 40

func _on_window_mode_change(inx:int) -> void:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am extremely confused by how you intended the signals and callbacks to work. They don't make much sense how they are right now. (Also, we haven't put _ in front of any callbacks until now. It's better to keep the consistent format)

This function needs to be changed to work with a dictionary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function has been fixed to use the old-new save system

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I have fixed signals(by pretty much removing them)


func _ready() -> void:
_prev_win_mode = DisplayServer.window_get_mode()
connect("volume_change",Callable(self,"_on_volume_change"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Callable is not necessary. You can just use stringnames instead of creating a new callable object.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know this, this is nice to know

ui/files.gd Outdated
label.show()
texture_rect.hide()

var image_resource = load(ProjectSettings.globalize_path(file_path))
Copy link
Member

@HeDeAnTheonlyone HeDeAnTheonlyone Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files exist in the resource folder so making the path absolute is unnessary.

[This next part is just an idea, not a direct change requuest]
We could also think about loading them only once instead of every time we display them. For that you can change the String array to a Texture2D array.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll note this for later

var game_root = get_tree().get_first_node_in_group("Game")
var level = game_root.generator_power
label.text = str(level,'%')
bar.value = bar.max_value * (float(level) / 100)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just set the min/max of the progress bar to the min/max of the power level.
That gets rid of the extra conversion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll need elaboration, I confuse

var level = game_root.generator_power
label.text = str(level,'%')
bar.value = bar.max_value * (float(level) / 100)
game_root.connect("on_power_level_changed",Callable(self,"on_power_change"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script should not connect it's own signal to anything outside of it. If any script needs tpo connect to this signal, they should connect to it inside their own script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh? its connecting to game root for when the power changes

ui/generator.gd Outdated
func on_power_change(level:int) -> void:
if level == 0:
label.text = str("OUT OF POWER!")
bar.value = bar.size.x * (float(0) / 100)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 / 100 is still 0. Always. Making 0 a float also doesn't change that. Even if you multiply it by the x size of the bar, The result will be 0 in the end.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swear I changed that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh...

global_settings.connect("on_os_window_mode_changed",Callable(self,"_update_dropdown"))

func _on_slider_changed(value: float, id: int) -> void:
global_settings.emit_signal("volume_change",[id, value])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not emmit signals of other scripts. This is a big nono.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, time to rework literally everything in my settings 👍

now comes with 90% less confusing signals when you order now!

and if you order within this window(null)
you can get a FREE, 90% less signals
(loading description.....)
@a-fan9823 a-fan9823 changed the title I hope I fixed all the issues with my last version, I've also added the window mode setting saving, loading, settings, kitchen sink update (sorry hede wan) Nov 2, 2024
probably needs a rework, added loading screen for peetza caching
var settings: Dictionary = init_default_settings();

const default_fps:= 60
signal on_os_window_mode_changed(int)
Copy link
Member

@HeDeAnTheonlyone HeDeAnTheonlyone Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a-fan9823
I still don't quite get this. What would this signal be needed for?

@HeDeAnTheonlyone
Copy link
Member

I already have the save manager with the changes we decided in the last meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants