├── addons └── omnikit │ ├── plugin.gd.uid │ ├── src │ ├── logger │ │ ├── logger.gd.uid │ │ └── logger.gd │ ├── helpers │ │ ├── files │ │ │ ├── csv_reader.gd.uid │ │ │ ├── file_helper.gd.uid │ │ │ ├── json_reader.gd.uid │ │ │ ├── json_reader.gd │ │ │ ├── csv_reader.gd │ │ │ └── file_helper.gd │ │ ├── math │ │ │ ├── bit_stream.gd.uid │ │ │ ├── math_helper.gd.uid │ │ │ ├── tor_curve.gd.uid │ │ │ ├── bezier_curve.gd.uid │ │ │ ├── tor_curve.gd │ │ │ ├── bit_stream.gd │ │ │ └── bezier_curve.gd │ │ ├── structures │ │ │ ├── jobs.gd.uid │ │ │ ├── uuid.gd.uid │ │ │ ├── hashset.gd.uid │ │ │ ├── array_helper.gd.uid │ │ │ ├── enum_helper.gd.uid │ │ │ ├── shuffle_bag.gd.uid │ │ │ ├── vector_helper.gd.uid │ │ │ ├── dictionary_helper.gd.uid │ │ │ ├── semantic_version.gd.uid │ │ │ ├── markov_chain_text_generator.gd.uid │ │ │ ├── enum_helper.gd │ │ │ ├── shuffle_bag.gd │ │ │ ├── jobs.gd │ │ │ ├── dictionary_helper.gd │ │ │ ├── semantic_version.gd │ │ │ ├── hashset.gd │ │ │ ├── uuid.gd │ │ │ ├── markov_chain_text_generator.gd │ │ │ └── array_helper.gd │ │ ├── text │ │ │ ├── censorer.gd.uid │ │ │ ├── label_helper.gd.uid │ │ │ ├── string_helper.gd.uid │ │ │ ├── label_helper.gd │ │ │ └── censorer.gd │ │ ├── time │ │ │ ├── time_helper.gd.uid │ │ │ └── time_helper.gd │ │ ├── color │ │ │ ├── color_gradient.gd.uid │ │ │ ├── color_helper.gd.uid │ │ │ ├── color_palette.gd.uid │ │ │ ├── color_gradient.gd │ │ │ ├── color_palette.gd │ │ │ ├── palettes │ │ │ │ ├── yellow_grass.tres │ │ │ │ ├── green_grass.tres │ │ │ │ ├── coffee.tres │ │ │ │ ├── slso8.tres │ │ │ │ ├── pollen8.tres │ │ │ │ ├── nyx8.tres │ │ │ │ ├── ammo8.tres │ │ │ │ ├── funkyfutures.tres │ │ │ │ ├── oil6.tres │ │ │ │ ├── borkfest.tres │ │ │ │ ├── rust_gold8.tres │ │ │ │ ├── dreamscapes.tres │ │ │ │ ├── winter_wonderland.tres │ │ │ │ ├── submerged_chimera.tres │ │ │ │ └── goosebumps_gold.tres │ │ │ ├── gradients │ │ │ │ ├── coffee.tres │ │ │ │ ├── slso8.tres │ │ │ │ ├── pollen8.tres │ │ │ │ ├── ammo8.tres │ │ │ │ ├── funkyfutures.tres │ │ │ │ ├── nyx8.tres │ │ │ │ ├── oil6.tres │ │ │ │ ├── borkfest.tres │ │ │ │ ├── dreamscapes.tres │ │ │ │ ├── rust_gold8.tres │ │ │ │ ├── winter_wonderland.tres │ │ │ │ ├── goosebumps_gold.tres │ │ │ │ └── submerged_chimera.tres │ │ │ └── color_helper.gd │ │ ├── input │ │ │ ├── input_helper.gd.uid │ │ │ └── motion_input.gd.uid │ │ ├── nodes │ │ │ ├── node_remover.gd.uid │ │ │ ├── node_traversal.gd.uid │ │ │ ├── node_positioner.gd.uid │ │ │ ├── node_remover.gd │ │ │ └── node_traversal.gd │ │ ├── geometry │ │ │ └── geometry_helper.gd.uid │ │ ├── localization │ │ │ └── localization.gd.uid │ │ ├── motion │ │ │ ├── velocity_helper.gd.uid │ │ │ └── velocity_helper.gd │ │ ├── viewport │ │ │ ├── camera_2d_helper.gd.uid │ │ │ ├── camera_3d_helper.gd.uid │ │ │ ├── raycast_result.gd.uid │ │ │ ├── texture_helper.gd.uid │ │ │ ├── raycast_result.gd │ │ │ ├── camera_2d_helper.gd │ │ │ ├── camera_3d_helper.gd │ │ │ └── texture_helper.gd │ │ ├── collisions │ │ │ ├── collision_helper.gd.uid │ │ │ └── collision_helper.gd │ │ ├── content │ │ │ └── names │ │ │ │ ├── name_generator.gd.uid │ │ │ │ ├── name_repository.gd.uid │ │ │ │ ├── name_repository.gd │ │ │ │ ├── name_generator.gd │ │ │ │ └── repositories │ │ │ │ ├── real_life │ │ │ │ ├── male_human_en.tres │ │ │ │ ├── female_human_en.tres │ │ │ │ └── male_human_es.tres │ │ │ │ └── fantasy │ │ │ │ ├── female_orc.tres │ │ │ │ ├── male_orc.tres │ │ │ │ ├── male_dwarf.tres │ │ │ │ ├── male_elf.tres │ │ │ │ ├── female_dwarf.tres │ │ │ │ └── female_elf.tres │ │ └── hardware │ │ │ ├── hardware_detector.gd.uid │ │ │ ├── hardware_requirements.gd.uid │ │ │ └── hardware_detector.gd │ └── autoloads │ │ ├── signals │ │ ├── event_bus.gd.uid │ │ └── event_bus.gd │ │ ├── network │ │ └── network_handler.gd.uid │ │ ├── viewport │ │ └── window_manager.gd.uid │ │ └── gamepad │ │ ├── gamepad_controller_manager.gd.uid │ │ └── gamepad_controller_manager.gd │ ├── settings │ └── plugin_settings.gd.uid │ └── plugin.cfg ├── .gitattributes ├── images ├── orbit.png ├── swing.png ├── follow.png ├── rotator.png ├── gradients │ ├── ammo8.png │ ├── nyx8.png │ ├── oil6.png │ ├── slso8.png │ ├── borkfest.png │ ├── coffee.png │ ├── pollen8.png │ ├── rust_gold.png │ ├── dreamscapes.png │ ├── funkyfutures.png │ ├── goosebumps_gold.png │ ├── submerged_chimera.png │ ├── winter_wonderland.png │ ├── nyx8.png.import │ ├── oil6.png.import │ ├── ammo8.png.import │ ├── coffee.png.import │ ├── slso8.png.import │ ├── pollen8.png.import │ ├── borkfest.png.import │ ├── rust_gold.png.import │ ├── dreamscapes.png.import │ ├── funkyfutures.png.import │ ├── goosebumps_gold.png.import │ ├── submerged_chimera.png.import │ └── winter_wonderland.png.import ├── follow.png.import ├── orbit.png.import ├── swing.png.import └── rotator.png.import ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── SECURITY.md ├── event_bus.tscn ├── LICENSE ├── icon.svg.import ├── project.godot ├── CONTRIBUTING.md ├── icon.svg └── CODE_OF_CONDUCT.md /addons/omnikit/plugin.gd.uid: -------------------------------------------------------------------------------- 1 | uid://b0020lexr1c4o 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/logger/logger.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bmqysuo2va7yb 2 | -------------------------------------------------------------------------------- /addons/omnikit/settings/plugin_settings.gd.uid: -------------------------------------------------------------------------------- 1 | uid://epj4b2elqgjn 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/files/csv_reader.gd.uid: -------------------------------------------------------------------------------- 1 | uid://0qt406jb3nj6 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/math/bit_stream.gd.uid: -------------------------------------------------------------------------------- 1 | uid://dnltnfibo0xxu 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/math/math_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://4cp6ws8qbi6j 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/math/tor_curve.gd.uid: -------------------------------------------------------------------------------- 1 | uid://dlvwi74fwxd2 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/jobs.gd.uid: -------------------------------------------------------------------------------- 1 | uid://cc80fbllvyjkq 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/uuid.gd.uid: -------------------------------------------------------------------------------- 1 | uid://dp538ut3n2rmu 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/text/censorer.gd.uid: -------------------------------------------------------------------------------- 1 | uid://be405iyj5qqdp 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/time/time_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://u565dfayqspl 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/autoloads/signals/event_bus.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bkr7j5nn8sfsh 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/color_gradient.gd.uid: -------------------------------------------------------------------------------- 1 | uid://cc78widvv0nox 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/color_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://c8hoqxlaf4ryh 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/color_palette.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bdgfoc5auy1wg 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/files/file_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://0sm8jtm5ywry 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/files/json_reader.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bw1rvwkd54evp 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/input/input_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bs33vmwc4f4ta 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/input/motion_input.gd.uid: -------------------------------------------------------------------------------- 1 | uid://c7xdyx8l14avu 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/math/bezier_curve.gd.uid: -------------------------------------------------------------------------------- 1 | uid://tr30hnega7db 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/nodes/node_remover.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bxvpqo6cekeec 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/nodes/node_traversal.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bdyrhe4vk43wr 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/hashset.gd.uid: -------------------------------------------------------------------------------- 1 | uid://coda6of8jn5cx 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/text/label_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://b7lep6od0t2d2 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/text/string_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://dmg60l8nf4d7q 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/autoloads/network/network_handler.gd.uid: -------------------------------------------------------------------------------- 1 | uid://c4u82u2tcol30 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/autoloads/viewport/window_manager.gd.uid: -------------------------------------------------------------------------------- 1 | uid://da7eswtcbmxi0 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/geometry/geometry_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://p7ewr2pp0ssk 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/localization/localization.gd.uid: -------------------------------------------------------------------------------- 1 | uid://b4hs1ait2tyvt 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/motion/velocity_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://b2uwqc72g6p60 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/nodes/node_positioner.gd.uid: -------------------------------------------------------------------------------- 1 | uid://d0cp3wbjavawn 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/array_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://yf21oi6nv3ja 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/enum_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://b3i0s5v66750r 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/shuffle_bag.gd.uid: -------------------------------------------------------------------------------- 1 | uid://by6uv3w1e11mj 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/vector_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://c4au08f3nkpnt 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/viewport/camera_2d_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://d3t7xahhkw8hv 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/viewport/camera_3d_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://cckkqu6avwup3 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/viewport/raycast_result.gd.uid: -------------------------------------------------------------------------------- 1 | uid://ukkjlact7ru8 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/viewport/texture_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://db7io7unk8nf3 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/collisions/collision_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://ctjs5wb0kfae8 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/name_generator.gd.uid: -------------------------------------------------------------------------------- 1 | uid://tc1wm1bj4p87 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/name_repository.gd.uid: -------------------------------------------------------------------------------- 1 | uid://cejilr31xj65q 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/hardware/hardware_detector.gd.uid: -------------------------------------------------------------------------------- 1 | uid://cllinnfsdf5b6 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/hardware/hardware_requirements.gd.uid: -------------------------------------------------------------------------------- 1 | uid://daebapcdqbtfe 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/dictionary_helper.gd.uid: -------------------------------------------------------------------------------- 1 | uid://mxqfeuy2530f 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/semantic_version.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bic0p612mjll3 2 | -------------------------------------------------------------------------------- /addons/omnikit/src/autoloads/gamepad/gamepad_controller_manager.gd.uid: -------------------------------------------------------------------------------- 1 | uid://7xfpq4t0wvte 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Normalize EOL for all files that Git considers text files. 2 | * text=auto eol=lf -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/markov_chain_text_generator.gd.uid: -------------------------------------------------------------------------------- 1 | uid://bd1srjqo40x73 2 | -------------------------------------------------------------------------------- /images/orbit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/orbit.png -------------------------------------------------------------------------------- /images/swing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/swing.png -------------------------------------------------------------------------------- /images/follow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/follow.png -------------------------------------------------------------------------------- /images/rotator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/rotator.png -------------------------------------------------------------------------------- /images/gradients/ammo8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/ammo8.png -------------------------------------------------------------------------------- /images/gradients/nyx8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/nyx8.png -------------------------------------------------------------------------------- /images/gradients/oil6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/oil6.png -------------------------------------------------------------------------------- /images/gradients/slso8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/slso8.png -------------------------------------------------------------------------------- /images/gradients/borkfest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/borkfest.png -------------------------------------------------------------------------------- /images/gradients/coffee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/coffee.png -------------------------------------------------------------------------------- /images/gradients/pollen8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/pollen8.png -------------------------------------------------------------------------------- /images/gradients/rust_gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/rust_gold.png -------------------------------------------------------------------------------- /images/gradients/dreamscapes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/dreamscapes.png -------------------------------------------------------------------------------- /images/gradients/funkyfutures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/funkyfutures.png -------------------------------------------------------------------------------- /images/gradients/goosebumps_gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/goosebumps_gold.png -------------------------------------------------------------------------------- /images/gradients/submerged_chimera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/submerged_chimera.png -------------------------------------------------------------------------------- /images/gradients/winter_wonderland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninetailsrabbit/indie-blueprint-toolbox/HEAD/images/gradients/winter_wonderland.png -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/color_gradient.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitColorGradient extends Resource 2 | 3 | @export var id: StringName 4 | @export var name: StringName 5 | @export var gradient: GradientTexture1D 6 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/color_palette.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitColorPalette extends Resource 2 | 3 | @export var id: StringName 4 | @export var name: StringName 5 | @export var colors: PackedColorArray = [] 6 | -------------------------------------------------------------------------------- /addons/omnikit/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="Omnikit" 4 | description="General utilities that does not belongs to a particular place and are sed as static classes that can be accessed at any time even if they are not in the scene tree." 5 | author="sempitern0" 6 | version="1.2.5" 7 | script="plugin.gd" 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | Add your description here, especially why you made these changes and what problem you tried to solve. 4 | 5 | ## Addressed issues 6 | 7 | - List issues here, reference them via # 8 | 9 | ## Screenshots (Optional) 10 | 11 | Show your changes with screenshots 12 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/text/label_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitLabelHelper 2 | 3 | 4 | static func adjust_text(label: Label, max_size: int = 200) -> void: 5 | label.custom_minimum_size.x = min(label.size.x, max_size) 6 | 7 | if label.size.x > max_size: 8 | label.autowrap_mode = TextServer.AUTOWRAP_WORD 9 | label.custom_minimum_size.y = label.size.y 10 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Godot Version | Branch | Supported | 6 | | ------- | ------------- | ----------- | ------------------ | 7 | | 1.x | 4.x | `godot-4.x` | :white_check_mark: | 8 | 9 | ## Reporting a Vulnerability 10 | 11 | Please [raise an issue](https://github.com/sempitern0/omnikit/issues) in case you find a security issue. 12 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/name_repository.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitNameRepository extends Resource 2 | 3 | enum Category { 4 | Male, 5 | Female, 6 | NoGender, 7 | } 8 | 9 | 10 | @export var id: StringName 11 | @export var use_shuffle_bag: bool = true 12 | @export var region: StringName = &"en" 13 | @export var gender: Category = Category.NoGender 14 | @export var names: Array[String] = [] 15 | @export var surnames: Array[String] = [] 16 | -------------------------------------------------------------------------------- /event_bus.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://dqd6fc5qtim7d"] 2 | 3 | [ext_resource type="Script" uid="uid://c22a1w56amswj" path="res://event_bus.gd" id="1_dw24f"] 4 | [ext_resource type="Script" uid="uid://c7d81wivf54vc" path="res://score.gd" id="2_ql4vm"] 5 | 6 | [node name="EventBus" type="Node2D"] 7 | script = ExtResource("1_dw24f") 8 | 9 | [node name="ScoreHandler" type="Node" parent="."] 10 | script = ExtResource("2_ql4vm") 11 | metadata/_custom_type_script = "uid://c7d81wivf54vc" 12 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/yellow_grass.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorPalette" load_steps=2 format=3 uid="uid://bb7f3juodbp6q"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_tsmtu"] 4 | 5 | [resource] 6 | script = ExtResource("1_tsmtu") 7 | id = &"yellow_grass" 8 | name = &"Yellow grass" 9 | colors = [Color(0.7882353, 0.7058824, 0.34509805, 1), Color(0.83137256, 0.6627451, 0.3019608, 1), Color(0.7254902, 0.5921569, 0.24313726, 1), Color(0.6431373, 0.47843137, 0.17254902, 1)] 10 | metadata/_custom_type_script = "uid://bdgfoc5auy1wg" 11 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/green_grass.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorPalette" load_steps=2 format=3 uid="uid://jr7tuu5p0bxe"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_jwbio"] 4 | 5 | [resource] 6 | script = ExtResource("1_jwbio") 7 | id = &"green_grass" 8 | name = &"Green grass" 9 | colors = [Color(0.29803923, 0.6039216, 0.16470589, 1), Color(0.24705882, 0.49411765, 0.14509805, 1), Color(0.42745098, 0.76862746, 0.23529412, 1), Color(0.18039216, 0.36862746, 0.101960786, 1)] 10 | metadata/_custom_type_script = "uid://bdgfoc5auy1wg" 11 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/enum_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitEnumHelper 2 | 3 | 4 | static func random_value(_enum: Variant) -> Variant: 5 | return _enum.keys()[randi() % _enum.size()] 6 | 7 | 8 | static func random_value_as_str(_enum: Variant) -> StringName: 9 | return value_to_str(_enum, randi() % _enum.size()) 10 | 11 | 12 | static func value_to_str(_enum: Variant, value: int) -> StringName: 13 | return StringName(_enum.keys()[value]) 14 | 15 | 16 | static func values_to_str(_enum: Variant) -> Array[StringName]: 17 | var values: Array[StringName] = [] 18 | 19 | for index: int in _enum.keys().size(): 20 | values.append(value_to_str(_enum, index)) 21 | 22 | return values 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "" 5 | labels: "⭐ feature" 6 | assignees: "" 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/coffee.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorPalette" load_steps=2 format=3 uid="uid://cpwttsrbyyvub"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_bq3f1"] 4 | 5 | [resource] 6 | script = ExtResource("1_bq3f1") 7 | id = &"coffee" 8 | name = &"Coffee" 9 | colors = [Color(0, 0, 0, 1), null, Color(0.0392157, 0.0392157, 0.0392157, 1), Color(0.0980392, 0.0980392, 0.0980392, 1), Color(0.32549, 0.243137, 0.176471, 1), Color(0.635294, 0.439216, 0.207843, 1), Color(0.721569, 0.545098, 0.290196, 1), Color(0.866667, 0.792157, 0.490196, 1), Color(0.984314, 0.976471, 0.937255, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/slso8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="ColorPalette" load_steps=2 format=3 uid="uid://b3haf5geiy1f5"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_ef4rh"] 4 | 5 | [resource] 6 | script = ExtResource("1_ef4rh") 7 | id = &"slso8" 8 | name = &"Slso8" 9 | colors = [Color(0, 0.0901961, 0.168627, 1), Color(0.0509804, 0.168627, 0.270588, 1), Color(0.12549, 0.235294, 0.337255, 1), Color(0.329412, 0.305882, 0.407843, 1), Color(0.552941, 0.411765, 0.478431, 1), Color(0.815686, 0.505882, 0.34902, 1), Color(1, 0.666667, 0.368627, 1), Color(1, 0.831373, 0.639216, 1), Color(1, 0.92549, 0.839216, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/pollen8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="ColorPalette" load_steps=2 format=3 uid="uid://6ujiko3ersq"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_brjsj"] 4 | 5 | [resource] 6 | script = ExtResource("1_brjsj") 7 | id = &"pollen8" 8 | name = &"Pollen8" 9 | colors = [Color(0.180392, 0.141176, 0.164706, 1), Color(0.45098, 0.27451, 0.298039, 1), Color(0.670588, 0.337255, 0.458824, 1), Color(0.933333, 0.415686, 0.486275, 1), Color(1, 0.654902, 0.647059, 1), Color(0.203922, 0.67451, 0.729412, 1), Color(0.447059, 0.862745, 0.733333, 1), Color(1, 0.878431, 0.494118, 1), Color(1, 0.905882, 0.839216, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/nyx8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="ColorPalette" load_steps=2 format=3 uid="uid://d20l6hm88h112"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_gkcsd"] 4 | 5 | [resource] 6 | script = ExtResource("1_gkcsd") 7 | id = &"nyx8" 8 | name = &"Nyx8" 9 | colors = [Color(0, 0.0392157, 0.0117647, 1), Color(0.0313726, 0.0784314, 0.117647, 1), Color(0.0588235, 0.164706, 0.247059, 1), Color(0.12549, 0.223529, 0.309804, 1), Color(0.305882, 0.286275, 0.372549, 1), Color(0.505882, 0.384314, 0.443137, 1), Color(0.6, 0.458824, 0.466667, 1), Color(0.764706, 0.639216, 0.541176, 1), Color(0.964706, 0.839216, 0.741176, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/ammo8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorPalette" load_steps=2 format=3 uid="uid://bn8gvswphpdvs"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_ks1ir"] 4 | 5 | [resource] 6 | script = ExtResource("1_ks1ir") 7 | id = &"ammo8" 8 | name = &"Ammo-8" 9 | colors = [Color(0, 0.0392157, 0.0117647, 1), Color(0.0156863, 0.0470588, 0.0235294, 1), Color(0.0666667, 0.137255, 0.0941176, 1), Color(0.117647, 0.227451, 0.160784, 1), Color(0.188235, 0.364706, 0.258824, 1), Color(0.301961, 0.501961, 0.380392, 1), Color(0.537255, 0.635294, 0.341176, 1), Color(0.745098, 0.862745, 0.498039, 1), Color(0.933333, 1, 0.8, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/funkyfutures.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorPalette" load_steps=2 format=3 uid="uid://dbugyqpbdcfkk"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_m20sv"] 4 | 5 | [resource] 6 | script = ExtResource("1_m20sv") 7 | id = &"funkyfutures" 8 | name = &"Funkyfutures" 9 | colors = [Color(0.0705882, 0.0313726, 0.14902, 1), Color(0.670588, 0.121569, 0.396078, 1), Color(1, 0.309804, 0.411765, 1), Color(1, 0.505882, 0.258824, 1), Color(1, 0.854902, 0.270588, 1), Color(0.2, 0.407843, 0.862745, 1), Color(0.286275, 0.905882, 0.92549, 1), Color(1, 0.968627, 0.972549, 1), Color(0.168627, 0.0588235, 0.329412, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/oil6.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="ColorPalette" load_steps=2 format=3 uid="uid://ci31vt88yrxaj"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_mg54p"] 4 | 5 | [resource] 6 | script = ExtResource("1_mg54p") 7 | id = &"oil6" 8 | name = &"Oil6" 9 | colors = [Color(0.0235294, 0.0235294, 0.0392157, 1), Color(0.0666667, 0.0666667, 0.121569, 1), Color(0.113725, 0.113725, 0.2, 1), Color(0.152941, 0.152941, 0.266667, 1), Color(0.286275, 0.301961, 0.494118, 1), Color(0.545098, 0.427451, 0.611765, 1), Color(0.776471, 0.623529, 0.647059, 1), Color(0.94902, 0.827451, 0.670588, 1), Color(0.984314, 0.960784, 0.937255, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/shuffle_bag.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitShuffleBag extends RefCounted 2 | 3 | var initial: Array[Variant] = [] 4 | var bag: Array[Variant] = [] 5 | 6 | 7 | func _init(array: Array[Variant]) -> void: 8 | populate(array) 9 | 10 | 11 | func populate(array: Array[Variant]) -> void: 12 | initial = array 13 | reshuffle() 14 | 15 | 16 | func reshuffle() -> void: 17 | bag = initial.duplicate() 18 | bag.shuffle() 19 | 20 | 21 | func pick_random() -> Variant: 22 | if bag.is_empty(): 23 | reshuffle() 24 | 25 | return bag.pop_front() 26 | 27 | 28 | func pick_randoms(amount: int) -> Variant: 29 | var result: Array[Variant] = [] 30 | 31 | for i in amount: 32 | result.append(pick_random()) 33 | 34 | return result -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/borkfest.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorPalette" load_steps=2 format=3 uid="uid://bof4aa2ppyeut"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_ks1ir"] 4 | 5 | [resource] 6 | script = ExtResource("1_ks1ir") 7 | id = &"borkfest" 8 | name = &"Borkfest" 9 | colors = [Color(0.0901961, 0.0901961, 0.0666667, 1), Color(0.792157, 0.352941, 0.180392, 1), Color(1, 0.470588, 0.192157, 1), Color(0.952941, 0.6, 0.286275, 1), Color(0.921569, 0.760784, 0.458824, 1), Color(0.87451, 0.843137, 0.521569, 1), Color(0.12549, 0.133333, 0.0823529, 1), Color(0.588235, 0.235294, 0.235294, 1), Color(0.227451, 0.156863, 0.00784314, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/rust_gold8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="ColorPalette" load_steps=2 format=3 uid="uid://ol5me4tvp4rl"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_bnjg5"] 4 | 5 | [resource] 6 | script = ExtResource("1_bnjg5") 7 | id = &"rust_gold8" 8 | name = &"Rust Gold-8" 9 | colors = [Color(0.0313726, 0.0784314, 0.117647, 1), Color(0.12549, 0.12549, 0.12549, 1), Color(0.223529, 0.223529, 0.223529, 1), Color(0.447059, 0.34902, 0.337255, 1), Color(0.733333, 0.498039, 0.341176, 1), Color(0.2, 0.109804, 0.0901961, 1), Color(0.337255, 0.196078, 0.14902, 1), Color(0.67451, 0.419608, 0.14902, 1), Color(0.964706, 0.803922, 0.14902, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/dreamscapes.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorPalette" load_steps=2 format=3 uid="uid://fakd5kmyjr68"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_lhnds"] 4 | 5 | [resource] 6 | script = ExtResource("1_lhnds") 7 | id = &"dreamscapes" 8 | name = &"Dreamscapes" 9 | colors = [Color(0.129412, 0.0980392, 0.129412, 1), Color(0.329412, 0.2, 0.266667, 1), Color(0.545098, 0.25098, 0.286275, 1), Color(0.682353, 0.415686, 0.278431, 1), Color(0.792157, 0.627451, 0.352941, 1), Color(0.317647, 0.321569, 0.384314, 1), Color(0.388235, 0.470588, 0.490196, 1), Color(0.556863, 0.627451, 0.568627, 1), Color(0.788235, 0.8, 0.631373, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/winter_wonderland.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="ColorPalette" load_steps=2 format=3 uid="uid://bdbgepqtir36m"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_gw75i"] 4 | 5 | [resource] 6 | script = ExtResource("1_gw75i") 7 | id = &"winter_wonderland" 8 | name = &"Winter Wonderland" 9 | colors = [Color(0.0666667, 0.0941176, 0.215686, 1), Color(0.12549, 0.156863, 0.305882, 1), Color(0.172549, 0.290196, 0.470588, 1), Color(0.219608, 0.458824, 0.631373, 1), Color(0.545098, 0.792157, 0.866667, 1), Color(0.45098, 0.552941, 0.615686, 1), Color(0.654902, 0.737255, 0.788235, 1), Color(0.839216, 0.882353, 0.913725, 1), Color(1, 1, 1, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/submerged_chimera.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="ColorPalette" load_steps=2 format=3 uid="uid://0lwrg4orhopg"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_8l30y"] 4 | 5 | [resource] 6 | script = ExtResource("1_8l30y") 7 | id = &"submerged_chimera" 8 | name = &"Submerged Chimera" 9 | colors = [Color(0.0196078, 0.00784314, 0.0980392, 1), Color(0.0705882, 0.0588235, 0.156863, 1), Color(0.180392, 0.117647, 0.360784, 1), Color(0.427451, 0.258824, 0.6, 1), Color(0.52549, 0.137255, 0.682353, 1), Color(0.870588, 0.223529, 0.913725, 1), Color(0.968627, 0.572549, 0.894118, 1), Color(1, 0.823529, 0.870588, 1), Color(0.968627, 0.980392, 0.917647, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/palettes/goosebumps_gold.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="ColorPalette" load_steps=2 format=3 uid="uid://b5815hmhe0gxm"] 2 | 3 | [ext_resource type="Script" uid="uid://bdgfoc5auy1wg" path="res://addons/omnikit/src/helpers/color/color_palette.gd" id="1_cnkm5"] 4 | 5 | [resource] 6 | script = ExtResource("1_cnkm5") 7 | id = &"goosegumps_gold" 8 | name = &"Goosegumps Gold" 9 | colors = [Color(0, 0.00784314, 0.0156863, 1), Color(0.129412, 0.0980392, 0.109804, 1), Color(0.215686, 0.137255, 0.396078, 1), Color(0.25098, 0.294118, 0.466667, 1), Color(0.352941, 0.521569, 0.643137, 1), Color(0.580392, 0.0784314, 0.203922, 1), Color(0.784314, 0.129412, 0.0313726, 1), Color(0.890196, 0.364706, 0.0313726, 1), Color(0.819608, 0.623529, 0.133333, 1)] 10 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/jobs.gd: -------------------------------------------------------------------------------- 1 | ## Wait for multiple callables to finish 2 | ## EXAMPLE: 3 | ## var jobs = OmniKitJobs.new() 4 | ## jobs.add(func(): ## do stuff): 5 | ## jobs.add(func(): ## do secondary stuff): 6 | ## await jobs.completed 7 | class_name OmniKitJobs extends RefCounted 8 | 9 | signal completed 10 | 11 | var started: int = 0 12 | var finished: int = 0 13 | 14 | 15 | func add(new_job: Callable): 16 | if new_job.is_valid(): 17 | started += 1 18 | _run_job(new_job) 19 | 20 | 21 | func reset() -> void: 22 | started = 0 23 | finished = 0 24 | 25 | 26 | func _run_job(job: Callable) -> void: 27 | await job.call() 28 | finished += 1 29 | 30 | if started == finished: 31 | reset() 32 | await Engine.get_main_loop().process_frame 33 | completed.emit() 34 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/collisions/collision_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitCollisionHelper 2 | 3 | 4 | @warning_ignore("narrowing_conversion") 5 | static func layer_to_value(layer: int) -> int: 6 | if layer > 32: 7 | push_error("OmniKitCollisionHelper->layer_to_value: The specified collision layer (%d) is invalid. Please ensure the layer value is between 1 and 32" % layer) 8 | 9 | return pow(2, clampi(layer, 1, 32) - 1) 10 | 11 | @warning_ignore("narrowing_conversion") 12 | static func value_to_layer(value: int) -> int: 13 | if value == 1: 14 | return value 15 | 16 | ## This bitwise operation check if the value is a valid base 2 17 | if value > 0 and (value & (value - 1)) == 0: 18 | return (log(value) / log(2)) + 1 19 | 20 | push_error("OmniKitCollisionHelper->value_to_layer: The specified value %d) is invalid. Please ensure the value is a power of 2" % value) 21 | 22 | return 0 23 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/coffee.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://crdtfarlju6do"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_k14w7"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_ckk8g"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0, 0, 0, 1, 0.0392157, 0.0392157, 0.0392157, 1, 0.0980392, 0.0980392, 0.0980392, 1, 0.32549, 0.243137, 0.176471, 1, 0.635294, 0.439216, 0.207843, 1, 0.721569, 0.545098, 0.290196, 1, 0.866667, 0.792157, 0.490196, 1, 0.984314, 0.976471, 0.937255, 1, 0, 0, 0, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_gbm30"] 10 | gradient = SubResource("Gradient_ckk8g") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_k14w7") 15 | id = &"coffee" 16 | name = &"Coffee" 17 | gradient = SubResource("GradientTexture1D_gbm30") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/slso8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://d1ns282iw6peh"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_dtu3o"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_0l8os"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0, 0.0901961, 0.168627, 1, 0.12549, 0.235294, 0.337255, 1, 0.329412, 0.305882, 0.407843, 1, 0.552941, 0.411765, 0.478431, 1, 0.815686, 0.505882, 0.34902, 1, 1, 0.666667, 0.368627, 1, 1, 0.831373, 0.639216, 1, 1, 0.92549, 0.839216, 1, 0.0509804, 0.168627, 0.270588, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_ka5bu"] 10 | gradient = SubResource("Gradient_0l8os") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_dtu3o") 15 | id = &"slso8" 16 | name = &"Slso8" 17 | gradient = SubResource("GradientTexture1D_ka5bu") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/pollen8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://cm3iy6pqbmmb7"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_vokey"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_fecuy"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.180392, 0.141176, 0.164706, 1, 0.670588, 0.337255, 0.458824, 1, 0.933333, 0.415686, 0.486275, 1, 1, 0.654902, 0.647059, 1, 0.203922, 0.67451, 0.729412, 1, 0.447059, 0.862745, 0.733333, 1, 1, 0.878431, 0.494118, 1, 1, 0.905882, 0.839216, 1, 0.45098, 0.27451, 0.298039, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_dfxr1"] 10 | gradient = SubResource("Gradient_fecuy") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_vokey") 15 | id = &"pollen8" 16 | name = &"Pollen8" 17 | gradient = SubResource("GradientTexture1D_dfxr1") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/ammo8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://c3j6dsmmkr73k"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_2clwu"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_mnht0"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.0666667, 0.137255, 0.0941176, 1, 0.117647, 0.227451, 0.160784, 1, 0.188235, 0.364706, 0.258824, 1, 0.301961, 0.501961, 0.380392, 1, 0.537255, 0.635294, 0.341176, 1, 0.745098, 0.862745, 0.498039, 1, 0.933333, 1, 0.8, 1, 0, 0.0392157, 0.0117647, 1, 0.0156863, 0.0470588, 0.0235294, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_cxn4s"] 10 | gradient = SubResource("Gradient_mnht0") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_2clwu") 15 | id = &"ammo8" 16 | name = &"Ammo-8" 17 | gradient = SubResource("GradientTexture1D_cxn4s") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/funkyfutures.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://bw62jq02r0aj2"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_8ieva"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_nal8l"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.0705882, 0.0313726, 0.14902, 1, 0.670588, 0.121569, 0.396078, 1, 1, 0.309804, 0.411765, 1, 1, 0.505882, 0.258824, 1, 1, 0.854902, 0.270588, 1, 0.2, 0.407843, 0.862745, 1, 0.286275, 0.905882, 0.92549, 1, 1, 0.968627, 0.972549, 1, 0.168627, 0.0588235, 0.329412, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_r6mvn"] 10 | gradient = SubResource("Gradient_nal8l") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_8ieva") 15 | id = &"funkyfutures" 16 | name = &"Funkyfutures" 17 | gradient = SubResource("GradientTexture1D_r6mvn") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/nyx8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://cpgyxlmfa1ict"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_0aeiv"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_yecbm"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0, 0.0392157, 0.0117647, 1, 0.0588235, 0.164706, 0.247059, 1, 0.12549, 0.223529, 0.309804, 1, 0.305882, 0.286275, 0.372549, 1, 0.505882, 0.384314, 0.443137, 1, 0.6, 0.458824, 0.466667, 1, 0.764706, 0.639216, 0.541176, 1, 0.964706, 0.839216, 0.741176, 1, 0.0313726, 0.0784314, 0.117647, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_qc7uq"] 10 | gradient = SubResource("Gradient_yecbm") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_0aeiv") 15 | id = &"nyx8" 16 | name = &"Nyx8" 17 | gradient = SubResource("GradientTexture1D_qc7uq") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/oil6.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://clqijpdiw7s36"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_ki43n"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_byv5s"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.0235294, 0.0235294, 0.0392157, 1, 0.113725, 0.113725, 0.2, 1, 0.152941, 0.152941, 0.266667, 1, 0.286275, 0.301961, 0.494118, 1, 0.545098, 0.427451, 0.611765, 1, 0.776471, 0.623529, 0.647059, 1, 0.94902, 0.827451, 0.670588, 1, 0.984314, 0.960784, 0.937255, 1, 0.0666667, 0.0666667, 0.121569, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_3nwqa"] 10 | gradient = SubResource("Gradient_byv5s") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_ki43n") 15 | id = &"oil6" 16 | name = &"Oil6" 17 | gradient = SubResource("GradientTexture1D_3nwqa") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/borkfest.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://4rhk7lae0ada"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_km77l"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_rehaq"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.0901961, 0.0901961, 0.0666667, 1, 0.792157, 0.352941, 0.180392, 1, 1, 0.470588, 0.192157, 1, 0.952941, 0.6, 0.286275, 1, 0.921569, 0.760784, 0.458824, 1, 0.87451, 0.843137, 0.521569, 1, 0.12549, 0.133333, 0.0823529, 1, 0.588235, 0.235294, 0.235294, 1, 0.227451, 0.156863, 0.00784314, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_pcfe8"] 10 | gradient = SubResource("Gradient_rehaq") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_km77l") 15 | id = &"borkfest" 16 | name = &"Borkfest" 17 | gradient = SubResource("GradientTexture1D_pcfe8") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/dreamscapes.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://cqarsfqemj3qi"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_k14w8"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_ckk8g"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.129412, 0.0980392, 0.129412, 1, 0.329412, 0.2, 0.266667, 1, 0.545098, 0.25098, 0.286275, 1, 0.682353, 0.415686, 0.278431, 1, 0.792157, 0.627451, 0.352941, 1, 0.317647, 0.321569, 0.384314, 1, 0.388235, 0.470588, 0.490196, 1, 0.556863, 0.627451, 0.568627, 1, 0.788235, 0.8, 0.631373, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_gbm31"] 10 | gradient = SubResource("Gradient_ckk8g") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_k14w8") 15 | id = &"dreamscapes" 16 | name = &"Dreamscapes" 17 | gradient = SubResource("GradientTexture1D_gbm31") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/rust_gold8.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://bg5br1eq4sbge"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_lksrj"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_np2bm"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.0313726, 0.0784314, 0.117647, 1, 0.223529, 0.223529, 0.223529, 1, 0.447059, 0.34902, 0.337255, 1, 0.733333, 0.498039, 0.341176, 1, 0.2, 0.109804, 0.0901961, 1, 0.337255, 0.196078, 0.14902, 1, 0.67451, 0.419608, 0.14902, 1, 0.964706, 0.803922, 0.14902, 1, 0.12549, 0.12549, 0.12549, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_k6r6g"] 10 | gradient = SubResource("Gradient_np2bm") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_lksrj") 15 | id = &"rust_gold8" 16 | name = &"Rust Gold-8" 17 | gradient = SubResource("GradientTexture1D_k6r6g") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/math/tor_curve.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitTorCurve 2 | 3 | 4 | static func pinch(v): 5 | return pow(v, 2) * (-1 if v < 0.5 else 1) 6 | 7 | 8 | static func run(x: float, a: float = 0.0, b: float = 0.5, c: float = 0.0) -> float: 9 | c = pinch(c) 10 | x = max(0, min(1, x)) 11 | 12 | var epsilon = 0.00001 13 | var s = exp(a) 14 | var s2 = 1.0 / (s + epsilon) 15 | var t = max(0, min(1, b)) 16 | var u = c 17 | var result = 0 18 | var c1 = 0 19 | var c2 = 0 20 | var c3 = 0 21 | 22 | if(x < t): 23 | c1 = (t * x) / ( x + s * (t - x) + epsilon) 24 | c2 = t - pow(1 / (t + epsilon), s2 - 1) * pow(abs(x - t), s2) 25 | 26 | c3 = pow(1 / (t + epsilon), s - 1) * pow(x, s) 27 | else: 28 | c1 = (1 - t)*(x - 1) / (1 - x - s * (t - x) + epsilon) + 1 29 | c2 = pow(1 / ( (1 - t) + epsilon), s2 - 1) * pow(abs(x - t), s2) + t 30 | c3 = 1 - pow(1 / ( (1 - t) + epsilon), s - 1) * pow(1 - x, s) 31 | 32 | if(u <= 0): 33 | result = (-u) * c2 + (1 + u) * c1 34 | else: 35 | result = (u) * c3 + (1 - u) * c1 36 | 37 | return result 38 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/winter_wonderland.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://c6yftr3v5wri5"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_ex3ev"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_0t5fp"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.0666667, 0.0941176, 0.215686, 1, 0.172549, 0.290196, 0.470588, 1, 0.219608, 0.458824, 0.631373, 1, 0.545098, 0.792157, 0.866667, 1, 0.45098, 0.552941, 0.615686, 1, 0.654902, 0.737255, 0.788235, 1, 0.839216, 0.882353, 0.913725, 1, 1, 1, 1, 1, 0.12549, 0.156863, 0.305882, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_7rapr"] 10 | gradient = SubResource("Gradient_0t5fp") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_ex3ev") 15 | id = &"winter_wonderland" 16 | name = &"Winter Wonderland" 17 | gradient = SubResource("GradientTexture1D_7rapr") 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "" 5 | labels: "\U0001F41B bug" 6 | assignees: "" 7 | --- 8 | 9 | Godot version: x.x.x 10 | 11 | **Describe the bug** 12 | A clear and concise description of what the bug is. 13 | 14 | **To Reproduce** 15 | Steps to reproduce the behavior: 16 | 17 | 1. Go to '...' 18 | 2. Click on '....' 19 | 3. Scroll down to '....' 20 | 4. See error 21 | 22 | **Expected behavior** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Screenshots** 26 | If applicable, add screenshots to help explain your problem. 27 | 28 | **Desktop (please complete the following information):** 29 | 30 | - OS: [e.g. iOS] 31 | - Browser [e.g. chrome, safari] 32 | - Version [e.g. 22] 33 | 34 | **Smartphone (please complete the following information):** 35 | 36 | - Device: [e.g. iPhone6] 37 | - OS: [e.g. iOS8.1] 38 | - Browser [e.g. stock browser, safari] 39 | - Version [e.g. 22] 40 | 41 | **Additional context** 42 | Add any other context about the problem here. 43 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/goosebumps_gold.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://dk3sjxy2l6f7u"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_oi1c7"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_pnkvq"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0, 0.00784314, 0.0156863, 1, 0.215686, 0.137255, 0.396078, 1, 0.25098, 0.294118, 0.466667, 1, 0.352941, 0.521569, 0.643137, 1, 0.580392, 0.0784314, 0.203922, 1, 0.784314, 0.129412, 0.0313726, 1, 0.890196, 0.364706, 0.0313726, 1, 0.819608, 0.623529, 0.133333, 1, 0.129412, 0.0980392, 0.109804, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_cpvhw"] 10 | gradient = SubResource("Gradient_pnkvq") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_oi1c7") 15 | id = &"goosebumps_gold" 16 | name = &"Goosebumps Gold" 17 | gradient = SubResource("GradientTexture1D_cpvhw") 18 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/gradients/submerged_chimera.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitColorGradient" load_steps=4 format=3 uid="uid://mlbiw12lmbm8"] 2 | 3 | [ext_resource type="Script" uid="uid://cc78widvv0nox" path="res://addons/omnikit/src/helpers/color/color_gradient.gd" id="1_d10y8"] 4 | 5 | [sub_resource type="Gradient" id="Gradient_umcuk"] 6 | offsets = PackedFloat32Array(0, 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1) 7 | colors = PackedColorArray(0.0196078, 0.00784314, 0.0980392, 1, 0.180392, 0.117647, 0.360784, 1, 0.427451, 0.258824, 0.6, 1, 0.52549, 0.137255, 0.682353, 1, 0.870588, 0.223529, 0.913725, 1, 0.968627, 0.572549, 0.894118, 1, 1, 0.823529, 0.870588, 1, 0.968627, 0.980392, 0.917647, 1, 0.0705882, 0.0588235, 0.156863, 1) 8 | 9 | [sub_resource type="GradientTexture1D" id="GradientTexture1D_i3jyk"] 10 | gradient = SubResource("Gradient_umcuk") 11 | width = 2048 12 | 13 | [resource] 14 | script = ExtResource("1_d10y8") 15 | id = &"submerged_chimera" 16 | name = &"Submerged Chimera" 17 | gradient = SubResource("GradientTexture1D_i3jyk") 18 | -------------------------------------------------------------------------------- /images/follow.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://bgvx3ufbaiob" 6 | path="res://.godot/imported/follow.png-912f434435d3c348a90a93a54158e7c2.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/follow.png" 14 | dest_files=["res://.godot/imported/follow.png-912f434435d3c348a90a93a54158e7c2.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/orbit.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://co6s527cvivb6" 6 | path="res://.godot/imported/orbit.png-1721a1f8a200bab78950ebb3188341c7.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/orbit.png" 14 | dest_files=["res://.godot/imported/orbit.png-1721a1f8a200bab78950ebb3188341c7.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/swing.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://civ88xgosakg1" 6 | path="res://.godot/imported/swing.png-d145f9b3ce5fc2881fad0963988147a8.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/swing.png" 14 | dest_files=["res://.godot/imported/swing.png-d145f9b3ce5fc2881fad0963988147a8.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/rotator.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://n3f24epvfv6d" 6 | path="res://.godot/imported/rotator.png-586f178b6a3fb1bd505da547f27044bd.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/rotator.png" 14 | dest_files=["res://.godot/imported/rotator.png-586f178b6a3fb1bd505da547f27044bd.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/nyx8.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://1ie8qcr22f1a" 6 | path="res://.godot/imported/nyx8.png-7aadfd578be204ef21506a571e43d2fa.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/nyx8.png" 14 | dest_files=["res://.godot/imported/nyx8.png-7aadfd578be204ef21506a571e43d2fa.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/oil6.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://h6wtnnhhblm6" 6 | path="res://.godot/imported/oil6.png-acaca07b1a44cab0cd21112667c594ba.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/oil6.png" 14 | dest_files=["res://.godot/imported/oil6.png-acaca07b1a44cab0cd21112667c594ba.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/ammo8.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://jn1q18phkyiw" 6 | path="res://.godot/imported/ammo8.png-776f939154e3601d63ee0c42f426aeca.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/ammo8.png" 14 | dest_files=["res://.godot/imported/ammo8.png-776f939154e3601d63ee0c42f426aeca.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/coffee.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://5lddxkbaqk8l" 6 | path="res://.godot/imported/coffee.png-edfd31f97f99d91d3769efd03c317d81.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/coffee.png" 14 | dest_files=["res://.godot/imported/coffee.png-edfd31f97f99d91d3769efd03c317d81.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/slso8.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://dvjnr8ueurk10" 6 | path="res://.godot/imported/slso8.png-dc00786fdcba3ad68cca76f452424de0.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/slso8.png" 14 | dest_files=["res://.godot/imported/slso8.png-dc00786fdcba3ad68cca76f452424de0.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/pollen8.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://betipsv6g0hlg" 6 | path="res://.godot/imported/pollen8.png-f94307f1723d8d7103915e72371f630c.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/pollen8.png" 14 | dest_files=["res://.godot/imported/pollen8.png-f94307f1723d8d7103915e72371f630c.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 sempitern0 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/gradients/borkfest.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://ce3yciw43aone" 6 | path="res://.godot/imported/borkfest.png-7c90862ca9bc6dda59550186451f9f91.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/borkfest.png" 14 | dest_files=["res://.godot/imported/borkfest.png-7c90862ca9bc6dda59550186451f9f91.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/viewport/raycast_result.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitRaycastResult extends RefCounted 2 | 3 | var collider: Node 4 | var collider_id: int 5 | var normal: Vector3 6 | var position: Vector3 7 | var face_index: int 8 | var shape: int 9 | var rid: RID 10 | 11 | var property_keys: Array[String] = [ 12 | "collider", 13 | "collider_id", 14 | "normal", 15 | "position", 16 | "face_index", 17 | "shape", 18 | "rid" 19 | ] 20 | 21 | func _init(result: Dictionary) -> void: 22 | for key: String in property_keys: 23 | if result.has(key): 24 | self[key] = result[key] 25 | 26 | 27 | func collided() -> bool: 28 | return collider != null 29 | 30 | 31 | func projection(origin: Vector3, to: Vector3 = position, distance: float = 100.0) -> Vector3: 32 | if normal.is_zero_approx(): 33 | return origin.direction_to(to) * distance 34 | 35 | return origin * normal * distance 36 | 37 | 38 | func as_dict() -> Dictionary: 39 | return { 40 | "collider": collider, 41 | "collider_id": collider_id, 42 | "normal": normal, 43 | "position": position, 44 | "face_index": face_index, 45 | "shape": shape, 46 | "rid": rid, 47 | } 48 | -------------------------------------------------------------------------------- /images/gradients/rust_gold.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://cg3buy81i4r7q" 6 | path="res://.godot/imported/rust_gold.png-22566de84e91045d4f2071a321ff437f.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/rust_gold.png" 14 | dest_files=["res://.godot/imported/rust_gold.png-22566de84e91045d4f2071a321ff437f.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/dreamscapes.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://tvsvc4fxend2" 6 | path="res://.godot/imported/dreamscapes.png-7bdbd42faa4a113df77cbd942389acb6.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/dreamscapes.png" 14 | dest_files=["res://.godot/imported/dreamscapes.png-7bdbd42faa4a113df77cbd942389acb6.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/funkyfutures.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://dx5rbc0brbcm" 6 | path="res://.godot/imported/funkyfutures.png-d9d5854dc8f5188be4738bbc45a38391.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/funkyfutures.png" 14 | dest_files=["res://.godot/imported/funkyfutures.png-d9d5854dc8f5188be4738bbc45a38391.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/goosebumps_gold.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://bcffvmiennq7m" 6 | path="res://.godot/imported/goosebumps_gold.png-80683d82e585e86969319c2bf20f4618.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/goosebumps_gold.png" 14 | dest_files=["res://.godot/imported/goosebumps_gold.png-80683d82e585e86969319c2bf20f4618.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/submerged_chimera.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://b8bnyx5ku76aj" 6 | path="res://.godot/imported/submerged_chimera.png-63c8525369272d473e7a60f58d2f1c1d.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/submerged_chimera.png" 14 | dest_files=["res://.godot/imported/submerged_chimera.png-63c8525369272d473e7a60f58d2f1c1d.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /images/gradients/winter_wonderland.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://ke80b0mmancc" 6 | path="res://.godot/imported/winter_wonderland.png-91cc1e772320ed7e2e5ef4f6b27fe04e.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://images/gradients/winter_wonderland.png" 14 | dest_files=["res://.godot/imported/winter_wonderland.png-91cc1e772320ed7e2e5ef4f6b27fe04e.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | -------------------------------------------------------------------------------- /icon.svg.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://jln0u7ian26u" 6 | path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://icon.svg" 14 | dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/uastc_level=0 22 | compress/rdo_quality_loss=0.0 23 | compress/hdr_compression=1 24 | compress/normal_map=0 25 | compress/channel_pack=0 26 | mipmaps/generate=false 27 | mipmaps/limit=-1 28 | roughness/mode=0 29 | roughness/src_normal="" 30 | process/channel_remap/red=0 31 | process/channel_remap/green=1 32 | process/channel_remap/blue=2 33 | process/channel_remap/alpha=3 34 | process/fix_alpha_border=true 35 | process/premult_alpha=false 36 | process/normal_map_invert_y=false 37 | process/hdr_as_srgb=false 38 | process/hdr_clamp_exposure=false 39 | process/size_limit=0 40 | detect_3d/compress_to=1 41 | svg/scale=1.0 42 | editor/scale_with_editor_scale=false 43 | editor/convert_colors_with_editor_theme=false 44 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=5 10 | 11 | [application] 12 | 13 | config/name="OmniKit" 14 | config/description="General utilities that does not belongs to a particular place and are sed as static classes that can be accessed at any time even if they are not in the scene tree." 15 | config/version="1.2.5" 16 | config/features=PackedStringArray("4.5", "GL Compatibility") 17 | config/icon="uid://ceeyh135twaqe" 18 | 19 | [autoload] 20 | 21 | OmniKitWindowManager="*res://addons/omnikit/src/autoloads/viewport/window_manager.gd" 22 | OmniKitNetworkHandler="*res://addons/omnikit/src/autoloads/network/network_handler.gd" 23 | OmniKitGamepadControllerManager="*res://addons/omnikit/src/autoloads/gamepad/gamepad_controller_manager.gd" 24 | OmniKitEventBus="*res://addons/omnikit/src/autoloads/signals/event_bus.gd" 25 | 26 | [editor_plugins] 27 | 28 | enabled=PackedStringArray("res://addons/omnikit/plugin.cfg") 29 | 30 | [rendering] 31 | 32 | renderer/rendering_method="gl_compatibility" 33 | renderer/rendering_method.mobile="gl_compatibility" 34 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/files/json_reader.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitJSONHelper 2 | 3 | 4 | static func parse(path: String, encrypted_key: String = "") -> Variant: 5 | if not path.get_extension() == "json": 6 | push_error("OmniKitJSONHelper->parse: The file path %s provided does not have a valid JSON extension" % path) 7 | return {} 8 | 9 | var file: FileAccess 10 | 11 | if encrypted_key.is_empty(): 12 | file = FileAccess.open(path, FileAccess.READ) 13 | else: 14 | file = FileAccess.open_encrypted_with_pass(path, FileAccess.READ, encrypted_key) 15 | 16 | var open_error: Error = FileAccess.get_open_error() 17 | 18 | if open_error != OK: 19 | push_error("OmniKitJSONHelper: An error happened opening json file %s, Error %d-%s" % [path, open_error, error_string(open_error)]) 20 | return {} 21 | 22 | var json: JSON = JSON.new() 23 | var json_string_data: String = file.get_as_text() 24 | var json_error: Error = json.parse(json_string_data) 25 | 26 | if json_error == OK: 27 | assert(json.data is Array or json.data is Dictionary, "OmniKitJSONHelper->parse: Invalid data type, only JSON dictionary or arrays are supported") 28 | else: 29 | push_error("OmniKitJSONHelper->parse: JSON Parse Error: ", json.get_error_message(), " in ", json_string_data, " at line ", json.get_error_line()) 30 | 31 | return json.data 32 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/viewport/camera_2d_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitCamera2DHelper 2 | 3 | 4 | func get_panning_camera_position(camera: Camera2D) -> Vector2: 5 | var viewport: Viewport = camera.get_viewport() 6 | 7 | var current_mouse_screen_position: Vector2 = viewport.get_mouse_position() 8 | var original_mouse_global_position: Vector2 = (viewport.get_screen_transform() * viewport.get_canvas_transform()).affine_inverse() * viewport.get_mouse_position() 9 | var final_mouse_global_position: Vector2 = (viewport.get_screen_transform() * viewport.get_canvas_transform()).affine_inverse() * current_mouse_screen_position 10 | var mouse_global_diff: Vector2 = original_mouse_global_position - final_mouse_global_position 11 | var new_camera_position: Vector2 = camera.global_position + mouse_global_diff 12 | 13 | if new_camera_position != camera.global_position: 14 | return new_camera_position 15 | 16 | return Vector2.ZERO 17 | 18 | 19 | func get_camera2d_frame(viewport: Viewport, selected_camera: Camera2D = null) -> Rect2: 20 | var camera_frame: Rect2 = viewport.get_visible_rect() 21 | var camera: Camera2D = viewport.get_camera_2d() if selected_camera == null else selected_camera 22 | 23 | if camera: 24 | camera_frame.position = camera.get_screen_center_position() - camera_frame.size / 2.0 25 | 26 | return camera_frame 27 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/dictionary_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitDictionaryHelper 2 | 3 | 4 | static func contain_all_keys(target: Dictionary, keys: Array[String]) -> bool: 5 | return keys.all(func(key: String): return key in target.keys()) 6 | 7 | 8 | static func contain_any_key(target: Dictionary, keys: Array[String]) -> bool: 9 | return keys.any(func(key: String): return key in target.keys()) 10 | 11 | 12 | static func reverse_key_value(source_dict: Dictionary) -> Dictionary: 13 | var reversed: Dictionary = {} 14 | 15 | for key in source_dict.keys(): 16 | reversed[source_dict[key]] = key 17 | 18 | return reversed 19 | 20 | ## Transform the object used as dictionary key with the selected property, for example the object id 21 | static func transform_dictionary_key(source_dict: Dictionary, property: String) -> Dictionary: 22 | var new_dict: Dictionary = {} 23 | 24 | if source_dict.is_empty(): 25 | return source_dict 26 | 27 | for key: Object in source_dict: 28 | if key.has_method("get_property_list"): 29 | new_dict[key[property]] = source_dict[key] 30 | 31 | return new_dict 32 | 33 | 34 | static func merge_recursive(dest: Dictionary, source: Dictionary) -> void: 35 | for key in source: 36 | if source[key] is Dictionary: 37 | 38 | if not dest.has(key): 39 | dest[key] = {} 40 | 41 | merge_recursive(dest[key], source[key]) 42 | else: 43 | dest[key] = source[key] 44 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/name_generator.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitNameGenerator extends RefCounted 2 | 3 | var repository: OmniKitNameRepository 4 | var names_bag: OmniKitShuffleBag 5 | var surnames_bag: OmniKitShuffleBag 6 | 7 | 8 | func _init(_repository: OmniKitNameRepository) -> void: 9 | repository = _repository 10 | 11 | if repository.use_shuffle_bag: 12 | names_bag = OmniKitShuffleBag.new(repository.names) 13 | surnames_bag = OmniKitShuffleBag.new(repository.surnames) 14 | 15 | 16 | func generate(include_surname: bool = true) -> String: 17 | var result: String = "" 18 | 19 | if repository.names.size(): 20 | result += generate_name() 21 | 22 | if include_surname and repository.surnames.size(): 23 | result += " %s" % generate_surname() 24 | 25 | return result 26 | 27 | 28 | func generate_name() -> String: 29 | if repository.names.size(): 30 | return names_bag.random() if repository.use_shuffle_bag else repository.names.pick_random() 31 | 32 | return "" 33 | 34 | 35 | func generate_surname() -> String: 36 | if repository.surnames.size(): 37 | return surnames_bag.random() if repository.use_shuffle_bag else repository.surnames.pick_random() 38 | 39 | return "" 40 | 41 | 42 | func change_repository(new_repository: OmniKitNameRepository) -> OmniKitNameGenerator: 43 | repository = new_repository 44 | names_bag = OmniKitShuffleBag.new(repository.names) 45 | surnames_bag = OmniKitShuffleBag.new(repository.surnames) 46 | 47 | return self -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/semantic_version.gd: -------------------------------------------------------------------------------- 1 | ## https://semver.org/ 2 | class_name OmniKitSemanticVersion extends RefCounted 3 | 4 | var major: int 5 | var minor: int 6 | var patch: int 7 | 8 | ## Here can goes the definition after the number like "-rc.1" or "-alpha.2" 9 | ## Examples: 1.0.0-rc.1 or 1.0.2-alpha.2 10 | var state: String = "" 11 | 12 | func _init(_major: int, _minor: int, _patch: int, _state: String = "") -> void: 13 | major = _major 14 | minor = _minor 15 | patch = _patch 16 | state = _state 17 | 18 | 19 | static func parse(value: String) -> OmniKitSemanticVersion: 20 | var regex: RegEx = RegEx.new() 21 | regex.compile("[a-zA-Z:,-]+") 22 | 23 | var cleaned: String = regex.sub(value, "", true) 24 | var parts: PackedStringArray = cleaned.split(".") 25 | var major: int = parts[0].to_int() 26 | var minor: int = parts[1].to_int() 27 | var patch: int = parts[2].to_int() if parts.size() > 2 else 0 28 | 29 | return OmniKitSemanticVersion.new(major, minor, patch) 30 | 31 | 32 | func equals(other: OmniKitSemanticVersion) -> bool: 33 | return major == other.major and minor == other.minor and patch == other.patch 34 | 35 | 36 | func is_greater(other: OmniKitSemanticVersion) -> bool: 37 | if major > other.major: 38 | return true 39 | 40 | if major == other.major and minor > other.minor: 41 | return true 42 | 43 | return major == other.major and minor == other.minor and patch > other.patch 44 | 45 | 46 | func _to_string() -> String: 47 | return "v%d.%d.%d%s" % [major, minor, patch, state] 48 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution 2 | 3 | Existing issues marked with a [help wanted tag](https://github.com/sempitern0/omnikit/labels/help%20wanted) are the best candidates for contributions. Issues with that tag are either not prioritised, or are in need of help with someone with more expertise within a certain area 4 | 5 | ## Reporting bugs 6 | 7 | 1. **[Follow the template for bug reports.](https://github.com/sempitern0/omnikit/issues/new?assignees=sempitern0&labels=%F0%9F%90%9B+bug&projects=&template=bug_report.md&title)** 8 | 2. **Golden rule** Open _one_ ussie for _one_ bug . 9 | 3. [Search for existing reports first.](https://github.com/sempitern0/omnikit/issues) If you found a similar issue in the tracker - better share your problem in the existing thread. 10 | 4. Besides the platform, specify as many specifics as you can _(if relevant)_. CPU/GPU, input methods _(controller, mouse)_ and so on. 11 | 5. A simple reproduction project helps more than any reproduction steps. Include it whenever you can. Examining the problem first-hand is the easiest way to solve it. 12 | 13 | ## Proposing features 14 | 15 | 1. **[Follow the template for feature requests.](https://github.com/sempitern0/omnikit/issues/new?assignees=sempitern0&labels=%E2%AD%90+feature&projects=&template=feature_request.md&title)** 16 | 2. [Search for existing proposals first.](https://github.com/sempitern0/omnikit/issues) 17 | 3. Request something with a real-world use-case. Abstract features may not be considered. 18 | 4. If you are capable of implementing said feature, include some code that demonstrates the finer details/nuances of said feature. 19 | 20 | ## Thanks you for contributing mindfully! 21 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/nodes/node_remover.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitNodeRemover 2 | 3 | 4 | static func is_node_valid(node: Node) -> bool: 5 | return node != null and is_instance_valid(node) and not node.is_queued_for_deletion() 6 | 7 | 8 | static func remove(node: Node) -> void: 9 | if is_node_valid(node): 10 | if node.is_inside_tree(): 11 | node.queue_free() 12 | else: 13 | node.call_deferred("free") 14 | 15 | ## Exceptions are passed as [Area3D.new().get_class) 16 | static func remove_and_queue_free_children(node: Node, except: Array = []) -> void: 17 | if node.get_child_count() == 0: 18 | return 19 | 20 | var childrens = node.get_children().filter(func(child): return not child.get_class() in except) 21 | childrens.reverse() 22 | 23 | for child in childrens.filter(func(_node: Node): return is_node_valid(_node)): 24 | node.remove_child(child) 25 | remove(child) 26 | 27 | ## Exceptions are passed as [Area3D.new().get_class) 28 | static func queue_free_children(node: Node, except: Array = []) -> void: 29 | if node.get_child_count() == 0: 30 | return 31 | 32 | var childrens = node.get_children().filter(func(child): return not child.get_class() in except) 33 | childrens.reverse() 34 | 35 | for child in childrens.filter(func(_node: Node): return is_node_valid(_node)): 36 | remove(child) 37 | 38 | except.clear() 39 | 40 | 41 | ## Exceptions are passed as [Area3D.new().get_class) 42 | static func free_children(node: Node, except: Array = []) -> void: 43 | if node.get_child_count() == 0: 44 | return 45 | 46 | var childrens = node.get_children().filter(func(child): return not child.get_class() in except) 47 | childrens.reverse() 48 | 49 | for child in childrens.filter(func(_node: Node): return is_node_valid(_node)): 50 | child.free() 51 | 52 | except.clear() 53 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/hashset.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitHashSet extends RefCounted 2 | 3 | var hashset: Dictionary[Variant, bool] = {} 4 | 5 | func _init(init_values: Array[Variant] = []) -> void: 6 | merge(init_values) 7 | 8 | 9 | func merge(new_values: Array[Variant] = []) -> void: 10 | for value: Variant in new_values: 11 | add(value) 12 | 13 | 14 | func add(value: Variant) -> bool: 15 | if hashset.has(value): 16 | return false 17 | 18 | hashset[value] = true 19 | return true 20 | 21 | 22 | func duplicate() -> OmniKitHashSet: 23 | return OmniKitHashSet.new(hashset.keys().duplicate()) 24 | 25 | 26 | func remove(value: Variant) -> bool: 27 | return hashset.erase(value) 28 | 29 | 30 | func has(value: Variant) -> bool: 31 | return hashset.has(value) 32 | 33 | 34 | func size() -> int: 35 | return hashset.size() 36 | 37 | 38 | func is_empty() -> bool: 39 | return hashset.is_empty() 40 | 41 | 42 | func equals(other: OmniKitHashSet) -> bool: 43 | if hashset.size() != other.size(): 44 | return false 45 | 46 | var result: bool = true 47 | 48 | for value: Variant in hashset.keys(): 49 | if not other.has(value): 50 | result = false 51 | break 52 | 53 | return result 54 | 55 | 56 | func to_array() -> Array[Variant]: 57 | return hashset.keys() 58 | 59 | 60 | func front() -> Variant: 61 | if hashset.is_empty(): 62 | return null 63 | 64 | return hashset.keys().front() 65 | 66 | 67 | func back() -> Variant: 68 | if hashset.is_empty(): 69 | return null 70 | 71 | return hashset.keys().back() 72 | 73 | 74 | func pop_back() -> Variant: 75 | var value: Variant = back() 76 | hashset.erase(value) 77 | 78 | return value 79 | 80 | 81 | func pop_front() -> Variant: 82 | var value: Variant = front() 83 | hashset.erase(value) 84 | 85 | return value 86 | 87 | 88 | func clear() -> void: 89 | hashset.clear() 90 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/motion/velocity_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitVelocityHelper 2 | 3 | enum SpeedUnit { 4 | KilometersPerHour, 5 | MilesPerHour, 6 | } 7 | 8 | 9 | static func current_speed_on(speed_unit: SpeedUnit, velocity: Variant) -> float: 10 | match speed_unit: 11 | SpeedUnit.KilometersPerHour: 12 | return current_speed_on_kilometers_per_hour(velocity) 13 | SpeedUnit.MilesPerHour: 14 | return current_speed_on_miles_per_hour(velocity) 15 | _: 16 | return 0.0 17 | 18 | 19 | static func current_speed_on_miles_per_hour(velocity: Variant) -> float: 20 | if velocity is Vector2 or velocity is Vector2i: 21 | return roundf(velocity.length() * OmniKitMathHelper.MetersPerSecondToMilePerHourFactor) 22 | 23 | elif velocity is Vector3: 24 | return roundf(Vector3(velocity.x, 0, velocity.z).length() * OmniKitMathHelper.MetersPerSecondToMilePerHourFactor) 25 | 26 | elif velocity is Vector3i: 27 | return roundf(Vector3i(velocity.x, 0, velocity.z).length() * OmniKitMathHelper.MetersPerSecondToMilePerHourFactor) 28 | 29 | elif velocity is float: ## We assume we received the velocity length 30 | return roundf(velocity * OmniKitMathHelper.MetersPerSecondToMilePerHourFactor) 31 | else: 32 | return 0.0 33 | 34 | 35 | static func current_speed_on_kilometers_per_hour(velocity: Variant) -> float: 36 | if velocity is Vector2 or velocity is Vector2i: 37 | return roundf(velocity.length() * OmniKitMathHelper.MetersPerSecondToKilometersPerHourFactor) 38 | 39 | elif velocity is Vector3: 40 | return roundf(Vector3(velocity.x, 0, velocity.z).length() * OmniKitMathHelper.MetersPerSecondToKilometersPerHourFactor) 41 | 42 | elif velocity is Vector3i: 43 | return roundf(Vector3i(velocity.x, 0, velocity.z).length() * OmniKitMathHelper.MetersPerSecondToKilometersPerHourFactor) 44 | 45 | elif velocity is float: ## We assume we received the velocity length 46 | return roundf(velocity * OmniKitMathHelper.MetersPerSecondToKilometersPerHourFactor) 47 | else: 48 | return 0.0 -------------------------------------------------------------------------------- /icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/uuid.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitUUID 2 | 3 | const BYTE_MASK: int = 0b11111111 4 | 5 | var _uuid: Array 6 | 7 | func _init(rng := RandomNumberGenerator.new()) -> void: 8 | _uuid = uuidbinrng(rng) 9 | 10 | 11 | static func uuidbin(): 12 | randomize() 13 | # 16 random bytes with the bytes on index 6 and 8 modified 14 | return [ 15 | randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, 16 | randi() & BYTE_MASK, randi() & BYTE_MASK, ((randi() & BYTE_MASK) & 0x0f) | 0x40, randi() & BYTE_MASK, 17 | ((randi() & BYTE_MASK) & 0x3f) | 0x80, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, 18 | randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, 19 | ] 20 | 21 | static func uuidbinrng(rng: RandomNumberGenerator): 22 | rng.randomize() 23 | return [ 24 | rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, 25 | rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, ((rng.randi() & BYTE_MASK) & 0x0f) | 0x40, rng.randi() & BYTE_MASK, 26 | ((rng.randi() & BYTE_MASK) & 0x3f) | 0x80, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, 27 | rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, 28 | ] 29 | 30 | static func v4() -> String: 31 | # 16 random bytes with the bytes on index 6 and 8 modified 32 | var b = uuidbin() 33 | 34 | return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [ 35 | # low 36 | b[0], b[1], b[2], b[3], 37 | 38 | # mid 39 | b[4], b[5], 40 | 41 | # hi 42 | b[6], b[7], 43 | 44 | # clock 45 | b[8], b[9], 46 | 47 | # clock 48 | b[10], b[11], b[12], b[13], b[14], b[15] 49 | ] 50 | 51 | static func v4_rng(rng: RandomNumberGenerator) -> String: 52 | # 16 random bytes with the bytes on index 6 and 8 modified 53 | var b = uuidbinrng(rng) 54 | 55 | return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [ 56 | # low 57 | b[0], b[1], b[2], b[3], 58 | 59 | # mid 60 | b[4], b[5], 61 | 62 | # hi 63 | b[6], b[7], 64 | 65 | # clock 66 | b[8], b[9], 67 | 68 | # clock 69 | b[10], b[11], b[12], b[13], b[14], b[15] 70 | ] 71 | 72 | 73 | func as_array() -> Array: 74 | return _uuid.duplicate() 75 | 76 | 77 | func as_string() -> String: 78 | return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [ 79 | # low 80 | _uuid[0], _uuid[1], _uuid[2], _uuid[3], 81 | 82 | # mid 83 | _uuid[4], _uuid[5], 84 | 85 | # hi 86 | _uuid[6], _uuid[7], 87 | 88 | # clock 89 | _uuid[8], _uuid[9], 90 | 91 | # node 92 | _uuid[10], _uuid[11], _uuid[12], _uuid[13], _uuid[14], _uuid[15] 93 | ] 94 | 95 | func is_equal(other) -> bool: 96 | return _uuid == other._uuid 97 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/files/csv_reader.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitCSVReader 2 | 3 | 4 | ### CSV & TSV related ### 5 | static func read(path: String, as_dictionary: bool = true) -> Variant: 6 | var file_exists: bool = FileAccess.file_exists(path) 7 | 8 | if not _filepath_is_valid(path) or not file_exists: 9 | push_error("OmniKitCSVReader: Failed to load CSV because file doesn't exist or is corrupted. Path: %s", path) 10 | return ERR_PARSE_ERROR 11 | 12 | var delimiter: String = _detect_limiter_from_file(path) 13 | var lines: Array[Variant] = [] 14 | 15 | var file: FileAccess = FileAccess.open(path, FileAccess.READ) 16 | var open_error: Error = FileAccess.get_open_error() 17 | 18 | if open_error != Error.OK: 19 | push_error("OmniKitCSVReader: ERROR_CODE[%s] Error opening file %s" % [error_string(open_error), path]) 20 | return ERR_PARSE_ERROR 21 | 22 | while not file.eof_reached(): 23 | var csv_line: PackedStringArray = file.get_csv_line(delimiter) 24 | var is_last_line: bool = csv_line.size() == 0 || (csv_line.size() == 1 && csv_line[0].is_empty()) 25 | 26 | if is_last_line: 27 | continue 28 | 29 | var parsed_line: Array[Variant] = [] 30 | 31 | for field: String in csv_line: 32 | if field.is_valid_int(): 33 | parsed_line.append(int(field)) 34 | elif field.is_valid_float(): 35 | parsed_line.append(float(field)) 36 | else: 37 | parsed_line.append(field) 38 | 39 | lines.append(parsed_line) 40 | 41 | file.close() 42 | 43 | # Remove trailing empty line 44 | if not lines.is_empty() and lines.back().size() == 1 and lines.back()[0] == "": 45 | lines.pop_back() 46 | 47 | if as_dictionary and lines.size() > 1: 48 | var result_as_array_of_dictionaries: Array[Dictionary] = [] 49 | var column_headers = lines[0] 50 | 51 | for i in range(1, lines.size()): 52 | var current_dict: Dictionary = {} 53 | var current_fields = lines[i] 54 | 55 | if current_fields.size() > column_headers.size(): 56 | push_error("OmniKitCSVReader: Reading the file %s it was detected a line that has more fields than column headers [] < []" % [path, column_headers.join(","), current_fields.join(",")]) 57 | return ERR_PARSE_ERROR 58 | 59 | for header_index in column_headers.size(): 60 | current_dict[column_headers[header_index]] = current_fields[header_index] if header_index < current_fields.size() else null 61 | 62 | result_as_array_of_dictionaries.append(current_dict) 63 | 64 | return result_as_array_of_dictionaries 65 | 66 | return lines 67 | 68 | 69 | static func _filepath_is_valid(path: String) -> bool: 70 | return not path.is_empty() and path.is_absolute_path() and ResourceLoader.exists(path) 71 | 72 | 73 | static func _detect_limiter_from_file(filename: String) -> String: 74 | match filename.get_extension().strip_edges().to_lower(): 75 | "csv": 76 | return "," 77 | "tsv": 78 | return "\t" 79 | 80 | return "," 81 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/math/bit_stream.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitBitStream extends RefCounted 2 | 3 | var bits: Array 4 | var current_bit = 0 5 | 6 | 7 | func bits_left(): 8 | return bits.size() - current_bit 9 | 10 | 11 | func push(value: int, range_max: int): 12 | var num_bits = ceil(log2(range_max)) 13 | 14 | for digit in range(num_bits - 1, - 1, - 1): 15 | var bit = value & (1 << digit) 16 | push_bit(bit > 0) 17 | 18 | 19 | func push_bit(bit: bool): 20 | bits.push_back(bit) 21 | 22 | 23 | func pull(range_max:int)->int: 24 | var num_bits = ceil(log2(range_max)) 25 | var value = 0 26 | 27 | for digit in range(num_bits - 1, - 1, - 1): 28 | var bit_state = int(bits[current_bit]) 29 | current_bit += 1 30 | 31 | value += bit_state << digit 32 | 33 | return value 34 | 35 | 36 | func to_godot_string()-> String: 37 | var string = "" 38 | var byteArray = to_byte_array() 39 | 40 | for byte in byteArray: 41 | string += char(byte + 65) 42 | 43 | return string 44 | 45 | func from_godot_string(string: String): 46 | var byteArray = PackedByteArray() 47 | 48 | for c in string: 49 | byteArray.push_back(c.unicode_at(0) - 65) 50 | 51 | from_byte_array(byteArray) 52 | 53 | 54 | func pprint(): 55 | var string = "" 56 | 57 | for bit in bits: 58 | if bit: 59 | string += "1" 60 | else : 61 | string += "0" 62 | 63 | return string 64 | 65 | 66 | func to_byte_array() -> PackedByteArray: 67 | var byte_array = PackedByteArray() 68 | var digit_count = 0 69 | var value = 0 70 | 71 | for bit in bits: 72 | digit_count += 1 73 | value = (value << 1) + int(bit) 74 | 75 | if digit_count == 8: 76 | digit_count = 0 77 | byte_array.append(value) 78 | value = 0 79 | 80 | if digit_count > 0: 81 | byte_array.append(value << (8 - digit_count)) 82 | 83 | return byte_array 84 | 85 | 86 | func from_byte_array(byte_array: PackedByteArray) -> OmniKitBitStream: 87 | bits.clear() 88 | 89 | for byte in byte_array: 90 | for digit in range(7, - 1, - 1): 91 | push_bit(byte & (1 << digit)) 92 | 93 | return self 94 | 95 | 96 | func to_utf8() -> String: 97 | var byte_array = to_byte_array() 98 | 99 | var file = FileAccess.open(OS.get_user_data_dir() + "/bitstream.dat", FileAccess.WRITE_READ) 100 | file.store_buffer(byte_array) 101 | 102 | var utf8_string = file.get_as_text(false) 103 | file.close() 104 | 105 | return utf8_string 106 | 107 | 108 | func from_utf8(utf8_string: String) -> OmniKitBitStream: 109 | return from_byte_array(utf8_string.to_utf8_buffer()) 110 | 111 | 112 | func to_ascii_string()-> String: 113 | return to_byte_array().get_string_from_ascii() 114 | 115 | 116 | func from_ascii_string(string: String): 117 | return from_byte_array(string.to_ascii_buffer()) 118 | 119 | 120 | func from_string(string: String): 121 | bits.clear() 122 | 123 | for s in string: 124 | if s == "1": 125 | push_bit(1) 126 | else : 127 | push_bit(0) 128 | 129 | 130 | func log2(number): 131 | return log(number) / log(2) 132 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/time/time_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitTimeHelper 2 | 3 | enum TimeUnit { 4 | Seconds, 5 | Milliseconds, 6 | Microseconds 7 | } 8 | 9 | 10 | static var conversions_to_seconds: Dictionary = { 11 | TimeUnit.Seconds: 1.0, 12 | TimeUnit.Milliseconds: 1_000.0, 13 | TimeUnit.Microseconds: 1_000_000.0, 14 | } 15 | 16 | """ 17 | Formats a time value into a string representation of minutes, seconds, and optionally milliseconds. 18 | 19 | Args: 20 | time (float): The time value to format, in seconds. 21 | use_milliseconds (bool, optional): Whether to include milliseconds in the formatted string. Defaults to false. 22 | 23 | Returns: 24 | str: A string representation of the formatted time in the format "MM:SS" or "MM:SS:mm", depending on the value of use_milliseconds. 25 | 26 | Example: 27 | # Format 123.456 seconds without milliseconds 28 | var formatted_time = format_seconds(123.456) 29 | # Result: "02:03" 30 | 31 | # Format 123.456 seconds with milliseconds 32 | var formatted_time_with_ms = format_seconds(123.456, true) 33 | # Result: "02:03:45" 34 | """ 35 | @warning_ignore("narrowing_conversion") 36 | static func format_seconds(time: float, use_milliseconds: bool = false) -> String: 37 | var minutes: int = floori(time / 60) 38 | var seconds: int = fmod(time, 60) 39 | var milliseconds: int = fmod(time, 1) * 100 40 | 41 | var result: String = "%02d:%02d" % [minutes, seconds] 42 | 43 | if(use_milliseconds): 44 | result += ":%02d" % milliseconds 45 | 46 | return result 47 | 48 | # Returns the amount of time passed since the engine started 49 | static func get_ticks(time_unit: TimeUnit = TimeUnit.Seconds) -> float: 50 | match time_unit: 51 | TimeUnit.Microseconds: 52 | return Time.get_ticks_usec() 53 | TimeUnit.Milliseconds: 54 | return Time.get_ticks_msec() 55 | TimeUnit.Seconds: 56 | return get_ticks_seconds() 57 | _: 58 | return get_ticks_seconds() 59 | 60 | 61 | ## Returns the conversion of [method Time.get_ticks_usec] to seconds. 62 | static func get_ticks_seconds() -> float: 63 | return Time.get_ticks_usec() / conversions_to_seconds[TimeUnit.Microseconds] 64 | 65 | 66 | static func convert_to_seconds(time: float, origin_unit: TimeUnit) -> float: 67 | return time / conversions_to_seconds[origin_unit] 68 | 69 | 70 | static func convert_to(time: float, origin_unit: TimeUnit, target_unit: TimeUnit) -> float: 71 | return convert_to_seconds(time, origin_unit) * conversions_to_seconds[target_unit] 72 | 73 | 74 | static func create_idle_timer(wait_time: float = 1.0, autostart: bool = false, one_shot: bool = false) -> Timer: 75 | var timer = Timer.new() 76 | timer.wait_time = wait_time 77 | timer.process_callback = Timer.TIMER_PROCESS_IDLE 78 | timer.autostart = autostart 79 | timer.one_shot = one_shot 80 | 81 | return timer 82 | 83 | 84 | static func create_physics_timer(wait_time: float = 1.0, autostart: bool = false, one_shot: bool = false) -> Timer: 85 | var timer = Timer.new() 86 | timer.wait_time = wait_time 87 | timer.process_callback = Timer.TIMER_PROCESS_PHYSICS 88 | timer.autostart = autostart 89 | timer.one_shot = one_shot 90 | 91 | return timer 92 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/hardware/hardware_detector.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitHardwareDetector 2 | 3 | static var engine_version: String = "Godot %s" % Engine.get_version_info().string 4 | static var device: String = OS.get_model_name() 5 | static var platform: String = OS.get_name() 6 | static var distribution_name: String = OS.get_distribution_name() 7 | static var video_adapter_name: String = RenderingServer.get_video_adapter_name() 8 | static var processor_name: String = OS.get_processor_name() 9 | static var processor_count: int = OS.get_processor_count() 10 | static var usable_threads: int = processor_count * 2 # I assume that each core has 2 threads 11 | static var computer_screen_size: Vector2i = DisplayServer.screen_get_size() 12 | 13 | 14 | static func renderer() -> String: 15 | return str(ProjectSettings.get_setting_with_override("rendering/renderer/rendering_method")) 16 | 17 | 18 | static func renderer_driver() -> String: 19 | match renderer(): 20 | "forward_plus", "mobile": 21 | return ProjectSettings.get_setting_with_override("rendering/rendering_device/driver") 22 | "gl_compatibility": 23 | return ProjectSettings.get_setting_with_override("rendering/gl_compatibility/driver") 24 | 25 | return "" 26 | 27 | 28 | static func is_multithreading_enabled() -> bool: 29 | return ProjectSettings.get_setting("rendering/driver/threads/thread_model") == 2 30 | 31 | 32 | static func is_exported_release() -> bool: 33 | return OS.has_feature("template") 34 | 35 | 36 | static func renderer_is_forward() -> bool: 37 | return renderer().nocasecmp_to("forward_plus") == 0 38 | 39 | 40 | static func render_is_compatibility() -> bool: 41 | return renderer().nocasecmp_to("gl_compatibility") == 0 42 | 43 | 44 | static func renderer_is_mobile() -> bool: 45 | return renderer().nocasecmp_to("mobile") == 0 46 | 47 | 48 | static func has_fsr() -> bool: 49 | return OS.has_feature("fsr") 50 | 51 | 52 | static func is_steam_deck() -> bool: 53 | return OmniKitStringHelper.equals_ignore_case(distribution_name, "SteamOS") \ 54 | or video_adapter_name.containsn("radv vangogh") \ 55 | or OS.get_processor_name().containsn("amd custom apu 0405") 56 | 57 | 58 | static func is_web() -> bool: 59 | return OS.has_feature("Web") 60 | 61 | 62 | static func is_android() -> bool: 63 | return OS.get_name() == "Android" 64 | 65 | 66 | static func is_ios() -> bool: 67 | return OS.get_name() == "iOS" 68 | 69 | 70 | static func is_mobile() -> bool: 71 | if not OS.has_feature("web"): 72 | return false 73 | 74 | return is_android() or is_ios() \ 75 | or (is_web() and OS.has_feature("web_android")) or (is_web() and OS.has_feature("web_ios")) \ 76 | or JavaScriptBridge.eval("/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)", true) 77 | 78 | 79 | static func is_desktop() -> bool: 80 | return is_windows() or is_linux() or is_mac() 81 | 82 | 83 | static func is_windows() -> bool: 84 | return OS.get_name() in ["Windows", "UWP"] 85 | 86 | 87 | static func is_linux() -> bool: 88 | return OS.get_name() in ["Linux", "FreeBSD", "NetBSD", "OpenBSD", "BSD"] 89 | 90 | 91 | static func is_mac() -> bool: 92 | return OS.get_name() == "macOS" 93 | 94 | 95 | static func is_windows_web() -> bool: 96 | return is_web() and OS.has_feature("web_windows") 97 | 98 | 99 | static func is_linux_web() -> bool: 100 | return is_web() and OS.has_feature("web_linuxbsd") 101 | 102 | 103 | static func is_mac_web() -> bool: 104 | return is_web() and OS.has_feature("web_macos") 105 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/real_life/male_human_en.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitNameRepository" load_steps=2 format=3 uid="uid://ttgdn4g6rndy"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_0n51f"] 4 | 5 | [resource] 6 | script = ExtResource("1_0n51f") 7 | id = &"male_human" 8 | gender = 0 9 | names = Array[String](["Liam", "Noah", "Oliver", "Elijah", "William", "James", "Benjamin", "Lucas", "Henry", "Alexander", "Mason", "Ethan", "Daniel", "Jacob", "Michael", "Matthew", "Joseph", "Samuel", "David", "John", "Ryan", "Owen", "Caleb", "Jackson", "Andrew", "Joshua", "Gabriel", "Isaac", "Lincoln", "Adrian", "Jeremiah", "Cameron", "Adam", "Wesley", "Nathan", "Dominic", "Xavier", "Raymond", "Easton", "Anthony", "Ezra", "Charles", "Josiah", "Christopher", "Sebastian", "Asher", "Miles", "Leo", "Marcus", "Timothy", "Joel", "Julian", "Angelo", "Vincent", "Maxwell", "Kevin", "Jeffrey", "Tyler", "Brandon", "Connor", "Carlos", "Bryan", "Jordan", "Dennis", "Ronnie", "Philip", "Aaron", "Nicholas", "Patrick", "Sean", "Wayne", "Billy", "Keith", "Paul", "Roy", "Victor", "Bruce", "Kyle", "Harold", "Bobby", "Bradley", "Roger", "Gerald", "Stephen", "Jesse", "Donald", "Shawn", "Arthur", "Clarence", "Tony", "Ralph", "Albert", "Frederick", "Earl", "Eugene", "Leroy", "Carl", "Reginald", "Vincent", "Curtis", "Barry", "Jay", "Bernard", "Franklin", "Clifford", "Harvey", "Neal", "Russell", "Kirk", "Glen", "Lester", "Marvin", "Stanley", "Ward", "Ben", "Kent", "Brett", "Dale", "Drew", "Grant", "Jed", "Kurt", "Lloyd", "Ross", "Todd", "Warren", "Chad", "Derek", "Eric", "Greg", "Kent", "Lance", "Mark", "Perry", "Scott", "Shane", "Travis", "Troy", "Blake", "Cody", "Dustin", "Garrett", "Justin", "Spencer", "Wyatt", "Zachary", "Chase", "Clayton", "Devon", "Jared", "Trevor", "Wesley", "Caleb", "Colton", "Dalton", "Keegan", "Preston", "Trenton", "Tristan", "Ashton", "Brendan", "Bryce", "Declan", "Hayden", "Jasper", "Kaden", "Landon", "Micah", "Ronan", "Silas"]) 10 | surnames = Array[String](["Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis", "Rodriguez", "Martinez", "Hernandez", "Lopez", "Gonzalez", "Wilson", "Anderson", "Thomas", "Taylor", "Moore", "Jackson", "Martin", "Lee", "Perez", "Thompson", "White", "Harris", "Sanchez", "Clark", "Ramirez", "Lewis", "Robinson", "Walker", "Young", "Allen", "King", "Wright", "Scott", "Torres", "Green", "Adams", "Baker", "Nelson", "Rivera", "Hill", "Campbell", "Mitchell", "Roberts", "Gomez", "Phillips", "Evans", "Turner", "Diaz", "Parker", "Cruz", "Edwards", "Morris", "Collins", "Flores", "Morales", "Coleman", "Rogers", "Gutierrez", "Ortiz", "Ross", "Myers", "Powell", "Sullivan", "Kennedy", "Bell", "Chavez", "Hayes", "Chapman", "Webb", "Ellis", "Ruiz", "Bishop", "Sanders", "Gray", "Little", "Vargas", "Price", "McCarthy", "Medina", "Navarro", "Carroll", "Reed", "Stone", "Ryan", "Fernandez", "Arnold", "Spencer", "Peters", "Hawkins", "Grant", "Lawson", "Bailey", "Dunn", "Vega", "Cook", "Romero", "Griffin", "Garza", "Hayes", "Wheeler", "Jenkins", "Parks", "Lambert", "Fletcher", "Watts", "Andrews", "Burns", "Bishop", "Simmons", "Todd", "Crawford", "Porter", "Reynolds", "Villa", "Oneal", "Berry", "Blackwell", "Hendrix", "Walls", "Salazar", "Nixon", "Davenport", "Waters", "Nichols", "Bridges", "Summers", "West", "Frye", "Hardy", "Marshall", "Singleton", "Townsend", "Wiley", "Kent", "Preston", "Lane", "Nicholson", "Underwood", "Douglas", "Harrison", "Rhodes", "Justice", "Sheppard", "Booker", "Washington", "Jefferson", "Madison", "Monroe", "Adams", "Lincoln", "Grant", "Wilson", "Roosevelt", "Kennedy"]) 11 | metadata/_custom_type_script = "uid://cejilr31xj65q" 12 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/viewport/camera_3d_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitCamera3DHelper 2 | 3 | 4 | static func center_by_ray_origin(camera: Camera3D) -> Vector3: 5 | return camera.project_ray_origin(Vector2.ZERO) 6 | 7 | 8 | static func center_by_origin(camera: Camera3D) -> Vector3: 9 | return camera.global_transform.origin 10 | 11 | 12 | static func forward_direction(camera: Camera3D) -> Vector3: 13 | return Vector3.FORWARD.z * camera.global_transform.basis.z.normalized() 14 | 15 | 16 | static func is_facing_camera(camera: Camera3D, node: Node) -> bool: 17 | return camera.global_position.dot(node.basis.z) < 0 18 | 19 | 20 | static func world_to_screen_position(world_position: Vector3, camera: Camera3D) -> Vector2: 21 | return camera.unproject_position(world_position) 22 | 23 | 24 | static func world_position_to_ui(ui_element: Control, world_position: Vector3, camera: Camera3D) -> void: 25 | ui_element.visible = not camera.is_position_behind(world_position) 26 | ui_element.position = world_to_screen_position(world_position, camera) 27 | 28 | 29 | static func project_raycast( 30 | viewport: Viewport, 31 | from: Vector3, 32 | to: Vector3, 33 | collide_with_bodies: bool = true, 34 | collide_with_areas: bool = false, 35 | collision_mask: int = 1 36 | ) -> OmniKitRaycastResult: 37 | 38 | var ray_query: PhysicsRayQueryParameters3D = PhysicsRayQueryParameters3D.create( 39 | from, 40 | to, 41 | collision_mask 42 | ) 43 | 44 | ray_query.collide_with_bodies = collide_with_bodies 45 | ray_query.collide_with_areas = collide_with_areas 46 | 47 | var result: Dictionary = (viewport.get_camera_3d().get_world_3d() if viewport is SubViewport else viewport.get_world_3d()).direct_space_state.intersect_ray(ray_query) 48 | 49 | return OmniKitRaycastResult.new(result) 50 | 51 | 52 | static func project_raycast_from_camera_center( 53 | camera: Camera3D, 54 | distance: float = 1000.0, 55 | collide_with_bodies: bool = true, 56 | collide_with_areas: bool = false, 57 | collision_mask: int = 1 58 | ) -> OmniKitRaycastResult: 59 | 60 | var viewport: Viewport = camera.get_viewport() 61 | var screen_center: Vector2i = viewport.get_visible_rect().size / 2 62 | var origin = camera.project_ray_origin(screen_center) 63 | var to: Vector3 = origin + camera.project_ray_normal(screen_center) * distance 64 | 65 | return project_raycast(viewport, origin, to, collide_with_bodies, collide_with_areas, collision_mask) 66 | 67 | 68 | static func project_raycast_to_mouse( 69 | camera: Camera3D, 70 | distance: float = 1000.0, 71 | collide_with_bodies: bool = true, 72 | collide_with_areas: bool = false, 73 | collision_mask: int = 1 74 | ) -> OmniKitRaycastResult: 75 | 76 | var viewport: Viewport = camera.get_viewport() 77 | var mouse_position: Vector2 = viewport.get_mouse_position() 78 | 79 | var world_space: PhysicsDirectSpaceState3D = (camera.get_world_3d() if viewport is SubViewport else viewport.get_world_3d()).direct_space_state 80 | var from: Vector3 = camera.project_ray_origin(mouse_position) 81 | var to: Vector3 = camera.project_position(mouse_position, distance) 82 | 83 | return project_raycast(viewport, from, to, collide_with_bodies, collide_with_areas, collision_mask) 84 | 85 | 86 | static func camera_snap_to_grid(camera: Camera3D, target: Node3D, grid_size: float, ground_y_level: float = 0.0) -> Vector3: 87 | assert(grid_size > 0, "OmniKitCamera3DHelper->camera_snap_to_grid: The grid size is zero or below, make sure the size is greater than 0") 88 | 89 | var raycast: OmniKitRaycastResult = OmniKitCamera3DHelper.project_raycast_to_mouse(camera) 90 | var grid: Vector3 = (raycast.position / grid_size).floor() 91 | 92 | var snap_position: Vector3 = Vector3(grid.x, 0.0, grid.z) * grid_size 93 | snap_position.y = ground_y_level 94 | 95 | return snap_position 96 | -------------------------------------------------------------------------------- /addons/omnikit/src/autoloads/signals/event_bus.gd: -------------------------------------------------------------------------------- 1 | ## This EventBus does not replace the built-in signal system from Godot but provides a way 2 | ## to connect events on scripts that do not need to be in the SceneTree 3 | ## ---------------------------------------------------------------------- 4 | ## It's recommended to create a separate script Events.gd to save your signal names as constants 5 | ## So OmniKitEventBus.subscribe(&"event_name", ...args) becomes OmniKitEventBus.subscribe(Events.score, ...args) 6 | ## This gives the advantage of only having to change the names of events in one place. 7 | extends Node 8 | 9 | class EventListener: 10 | var id: int 11 | var method: Callable 12 | var priority: int = 0 13 | var flag: ConnectFlags = ConnectFlags.CONNECT_PERSIST 14 | 15 | 16 | func _init(_method: Callable, _priority: int = 0, _flag: ConnectFlags = CONNECT_PERSIST) -> void: 17 | id = _method.get_object_id() 18 | method = _method 19 | priority = _priority 20 | flag = _flag 21 | 22 | func call_method(payload: Array[Variant]) -> void: 23 | method.callv(payload) 24 | 25 | class EventRecord: 26 | var event: StringName 27 | var listener: EventListener 28 | var timestamp: float 29 | var datetime: String 30 | 31 | func _init(_event: StringName, _listener: EventListener) -> void: 32 | event = _event 33 | listener = _listener 34 | timestamp = Time.get_unix_time_from_system() 35 | datetime = Time.get_datetime_string_from_unix_time(timestamp) 36 | 37 | 38 | ## Array[EventListener] 39 | var events: Dictionary[StringName, Array] = {} 40 | var event_history: Array[EventRecord] = [] 41 | var max_event_history_length: int = 50: 42 | set(value): 43 | max_event_history_length = maxi(0, value) 44 | 45 | 46 | func subscribe(event: StringName, method: Callable, priority: int = 0, flag: ConnectFlags = CONNECT_PERSIST) -> void: 47 | if method.is_valid(): 48 | var listener: EventListener = EventListener.new(method, priority, flag) 49 | 50 | if events.has(event): 51 | if not _event_has_method(event, method): 52 | events[event].append(listener) 53 | else: 54 | events[event] = [listener] 55 | 56 | events[event].sort_custom(_sort_listeners_by_priority) 57 | 58 | 59 | func subscribe_once(event: StringName, method: Callable, priority: int = 0) -> void: 60 | subscribe(event, method, priority, CONNECT_ONE_SHOT) 61 | 62 | 63 | func unsubscribe(event: StringName, method: Callable) -> void: 64 | if events.has(event): 65 | events[event] = events[event]\ 66 | .filter(func(listener: EventListener): return listener.id != method.get_object_id()) 67 | 68 | 69 | func publish(event: StringName, ...payload) -> void: 70 | if events.has(event): 71 | for subscriber: EventListener in events[event]: 72 | match subscriber.flag: 73 | CONNECT_ONE_SHOT: 74 | subscriber.call_method(payload) 75 | unsubscribe(event, subscriber.method) 76 | CONNECT_DEFERRED: 77 | subscriber.call_deferred("call_method", payload) 78 | _: 79 | subscriber.call_method(payload) 80 | 81 | record_event(event, subscriber) 82 | 83 | 84 | func record_event(event: StringName, subscriber: EventListener) -> void: 85 | if max_event_history_length > 0: 86 | if event_history.size() + 1 > max_event_history_length: 87 | event_history.pop_front() 88 | 89 | event_history.append(EventRecord.new(event, subscriber)) 90 | 91 | 92 | func flush_event_history() -> void: 93 | event_history.clear() 94 | 95 | 96 | func _event_has_method(event: StringName, method: Callable) -> bool: 97 | return method.get_object_id() in events[event].map(func(listener: EventListener): return listener.id) 98 | 99 | 100 | func _sort_listeners_by_priority(a: EventListener, b: EventListener) -> bool: 101 | return a.id < b.id 102 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/color/color_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitColorHelper 2 | 3 | const ColorPalettesPath: String = "res://addons/omnikit/src/helpers/color/palettes" 4 | const GradientsPath: String = "res://addons/omnikit/src/helpers/color/gradients" 5 | 6 | enum ColorGenerationMethod { 7 | RandomRGB, 8 | GoldenRatioHSV 9 | } 10 | 11 | 12 | static func get_palette(id: StringName) -> OmniKitColorPalette: 13 | var regex = RegEx.new() 14 | regex.compile(".tres$") 15 | 16 | for color_palette_path: String in OmniKitFileHelper.get_files_recursive(ColorPalettesPath, regex): 17 | var color_palette: OmniKitColorPalette = ResourceLoader.load(color_palette_path, "", ResourceLoader.CACHE_MODE_REUSE) 18 | 19 | if color_palette.id == id: 20 | return color_palette 21 | 22 | return null 23 | 24 | 25 | static func get_gradient(id: StringName) -> OmniKitColorGradient: 26 | var regex = RegEx.new() 27 | regex.compile(".tres$") 28 | 29 | for gradient_path: String in OmniKitFileHelper.get_files_recursive(GradientsPath, regex): 30 | var gradient: OmniKitColorGradient = ResourceLoader.load(gradient_path, "", ResourceLoader.CACHE_MODE_REUSE) 31 | 32 | if gradient.id == id: 33 | return gradient 34 | 35 | return null 36 | 37 | 38 | static func generate_random_colors(method: ColorGenerationMethod, number_of_colors: int = 12, saturation: float = 0.5, value: float = 0.95) -> PackedColorArray: 39 | var colors: PackedColorArray = PackedColorArray() 40 | 41 | match method: 42 | ColorGenerationMethod.RandomRGB: 43 | return generate_random_rgb_colors(number_of_colors) 44 | ColorGenerationMethod.GoldenRatioHSV: 45 | return generate_random_hsv_colors(number_of_colors, saturation, value) 46 | 47 | return colors 48 | 49 | # Using ideas from https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ 50 | static func generate_random_hsv_colors(number_of_colors: int = 12, saturation: float = 0.5, value: float = 0.95) -> PackedColorArray: 51 | var colors: PackedColorArray = PackedColorArray() 52 | 53 | for i: int in number_of_colors: 54 | var h = randf() 55 | h += OmniKitMathHelper.GoldenRatioConjugate 56 | h = fmod(h, 1.0) 57 | 58 | colors.append(Color.from_hsv(h, saturation, value)) 59 | 60 | return colors 61 | 62 | # Using ideas from https://www.iquilezles.org/www/articles/palettes/palettes.htm 63 | static func generate_random_rgb_colors(number_of_colors: int = 12, darkened_value: float = 0.2) -> PackedColorArray: 64 | var a = Vector3(randf_range(0.0, 0.5), randf_range(0.0, 0.5), randf_range(0.0, 0.5)) 65 | var b = Vector3(randf_range(0.1, 0.6), randf_range(0.1, 0.6), randf_range(0.1, 0.6)) 66 | var c = Vector3(randf_range(0.15, 0.8), randf_range(0.15, 0.8), randf_range(0.15, 0.8)) 67 | var d = Vector3(randf_range(0.4, 0.6), randf_range(0.4, 0.6), randf_range(0.4, 0.6)) 68 | 69 | var colors: PackedColorArray = PackedColorArray() 70 | var n: float = float(number_of_colors - 1.0) 71 | 72 | for i: int in number_of_colors: 73 | var vec3 = Vector3( 74 | (a.x + b.x * cos(TAU * (c.x * float(i / n) + d.x))) + (i / n), 75 | (a.y + b.y * cos(TAU * (c.y * float(i / n) + d.y))) + (i / n), 76 | (a.z + b.z * cos(TAU * (c.z * float(i / n) + d.z))) + (i / n) 77 | ) 78 | 79 | colors.append(Color(vec3.x, vec3.y, vec3.z).darkened(darkened_value)) 80 | 81 | return colors 82 | 83 | 84 | ## Consider exploring alternative color difference metrics like Delta-E or CIELAB if precise color matching is crucial 85 | static func colors_are_similar(color_a: Color, color_b: Color, tolerance: float = 100.0) -> bool: 86 | var v1: Vector4 = Vector4(color_a.r, color_a.g, color_a.b, color_a.a) 87 | var v2: Vector4 = Vector4(color_b.r, color_b.g, color_b.b, color_b.a) 88 | 89 | return v2.distance_to(v1) <= (tolerance / 255.0) 90 | 91 | 92 | static func color_from_vector(vec) -> Color: 93 | if vec is Vector3: 94 | return Color(vec.x, vec.y, vec.z) 95 | elif vec is Vector4: 96 | return Color(vec.x, vec.y, vec.z, vec.w) 97 | else: 98 | return Color.WHITE 99 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/real_life/female_human_en.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="NameRepository" load_steps=2 format=3 uid="uid://b0b3ljthp0ntg"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_u8g7u"] 4 | 5 | [resource] 6 | script = ExtResource("1_u8g7u") 7 | id = &"female_human" 8 | use_shuffle_bag = true 9 | region = &"en" 10 | gender = 1 11 | names = Array[String](["Olivia", "Emma", "Amelia", "Sophia", "Isabella", "Ava", "Mia", "Charlotte", "Harper", "Evelyn", "Abigail", "Emily", "Elizabeth", "Mila", "Ella", "Scarlett", "Eleanor", "Madison", "Lily", "Aurora", "Hazel", "Nora", "Chloe", "Violet", "Willow", "Stella", "Luna", "Grace", "Victoria", "Riley", "Zoey", "Penelope", "Layla", "Naomi", "Lucy", "Bella", "Natalie", "Daisy", "Everly", "Paisley", "Ivy", "Sarah", "Autumn", "Ruby", "Sadie", "Alice", "Clara", "Audrey", "Samantha", "June", "Skylar", "Elsie", "Adeline", "Piper", "Leah", "Josephine", "Emery", "Anna", "Quinn", "Maya", "Cornelia", "Brynn", "Sawyer", "Olive", "Rosie", "Freya", "Adalyn", "Aubrey", "Isla", "Summer", "Cecilia", "Eloise", "Jade", "Asher", "Adeline", "Thea", "Eleanor", "Nova", "Hazel", "Iris", "Athena", "Hadley", "Juniper", "Winter", "Wren", "Ophelia", "Rosemary", "Vivian", "Josephine", "Genevieve", "Callie", "Blair", "Briar", "Magnolia", "Marlowe", "Beatrice", "Theodora", "Rowan", "Sylvie", "Esther", "Juliet", "Eliza", "Adelaide", "Harriet", "Imogen", "Phoebe", "Annabelle", "Isabelle", "Josephine", "Eleanor", "Frances", "Louisa", "Caroline", "Margaret", "Beatrice", "Eleanor", "Florence", "Hazel", "Ivy", "Juniper", "Lavender", "Olive", "Poppy", "Rose", "Violet", "Willow", "Daisy", "Lily", "Magnolia", "Rosemary", "Summer", "Winter", "Autumn", "Skye", "River", "Ocean", "Luna", "Stella", "Aurora", "Nova", "Lyra", "Celeste", "Astrid", "Freya", "Ingrid", "Signe", "Solveig", "Thora", "Elara", "Anya", "Sasha", "Vera", "Nadia", "Olga", "Irina", "Zoya", "Mara", "Nina", "Vera", "Ada", "Clara", "Elsa", "Greta", "Hilda", "Ida", "Ingrid", "Liselotte", "Marta", "Sigrid", "Astrid", "Solveig", "Vendela", "Ebba", "Liv", "Saga", "Tove", "Ylva", "Alma", "Astrid", "Idun", "Linnea", "Maja", "Nora", "Siri", "Tuva", "Wilma", "Ada", "Alice", "Beatrice", "Clara", "Eleanor", "Florence", "Grace", "Harriet", "Imogen", "Josephine", "Louisa", "Margaret", "Phoebe", "Rosemary", "Theodora", "Vivian", "Adeline", "Audrey", "Cecilia", "Eloise", "Genevieve", "Juliet", "Lydia", "Penelope", "Scarlett", "Victoria", "Annabelle", "Isabelle", "Natalie", "Samantha", "Valerie", "Beatrice", "Eleanor", "Frances", "Hazel", "Ivy", "Juniper", "Lavender", "Olive", "Poppy", "Rose", "Violet", "Willow"]) 12 | surnames = Array[String](["Smith", "Johnson", "Williams", "Brown", "Jones", "Miller", "Davis", "Wilson", "Anderson", "Thomas", "Taylor", "Moore", "Jackson", "Martin", "Lee", "White", "Harris", "Clark", "Lewis", "Robinson", "Walker", "Young", "Allen", "King", "Wright", "Scott", "Green", "Adams", "Baker", "Nelson", "Hill", "Campbell", "Mitchell", "Roberts", "Phillips", "Evans", "Turner", "Parker", "Edwards", "Morris", "Collins", "Rogers", "Ross", "Myers", "Powell", "Sullivan", "Kennedy", "Bell", "Hayes", "Chapman", "Webb", "Ellis", "Bishop", "Sanders", "Gray", "Little", "Price", "McCarthy", "Carroll", "Reed", "Stone", "Arnold", "Spencer", "Peters", "Hawkins", "Grant", "Lawson", "Bailey", "Dunn", "Cook", "Griffin", "Wheeler", "Jenkins", "Parks", "Lambert", "Fletcher", "Watts", "Andrews", "Burns", "Bishop", "Simmons", "Todd", "Crawford", "Porter", "Reynolds", "Oneal", "Berry", "Blackwell", "Hendrix", "Walls", "Nixon", "Davenport", "Waters", "Nichols", "Bridges", "Summers", "West", "Frye", "Hardy", "Marshall", "Singleton", "Townsend", "Wiley", "Kent", "Preston", "Lane", "Nicholson", "Underwood", "Douglas", "Harrison", "Rhodes", "Justice", "Sheppard", "Booker", "Washington", "Jefferson", "Madison", "Monroe", "Lincoln", "Grant", "Roosevelt", "Kennedy", "Carter", "Ford", "Reagan", "Bush", "Clinton", "Obama"]) 13 | metadata/_custom_type_script = "uid://cejilr31xj65q" 14 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/math/bezier_curve.gd: -------------------------------------------------------------------------------- 1 | class OmniKitBezierCurve: 2 | 3 | static var maximum_control_points: int = 18 4 | static var factorial: Array[float] = OmniKitMathHelper.factorials_from(maximum_control_points) 5 | 6 | static func change_maximum_control_points(points: int) -> void: 7 | maximum_control_points = max(3, points) 8 | 9 | ## This function shall return the interpolated point where t must be between 0 and 1 both inclusive 10 | static func point_3(t: float, control_points: Array[Vector3] = []) -> Vector3: 11 | t = clamp(t, 0.0, 1.0) 12 | 13 | var n: int = control_points.size() - 1 14 | 15 | if n > maximum_control_points: 16 | push_warning("OmniKitBezierCurve: There more than %d control points (%d) in this bezier curve calculation, these points will be ignored" % [maximum_control_points, n]) 17 | control_points = control_points.slice(0 , maximum_control_points + 1) 18 | 19 | if t <= 0: 20 | return control_points.front() 21 | 22 | if t >= 0: 23 | return control_points.back() 24 | 25 | var point := Vector3() 26 | 27 | for i in range(control_points.size()): 28 | point += Vector3.ONE * (bernstein(n, i, t) * control_points[i]) 29 | 30 | return point 31 | 32 | ## Calculate all the points for the entire curve 33 | ## from t = 0 to t = 1 with and increment by default of 0.01 34 | static func point_list_3(control_points: Array[float], interval: float = 0.01) -> Array[Vector3]: 35 | var n: int = control_points.size() - 1 36 | 37 | if n > maximum_control_points: 38 | push_warning("OmniKitBezierCurve: There more than %d control points (%d) in this bezier curve calculation, these points will be ignored" % [maximum_control_points, n]) 39 | control_points = control_points.slice(0 , maximum_control_points + 1) 40 | 41 | var points: Array[Vector3] = [] 42 | var t := 0.0 43 | 44 | while t <= 1.0 + interval - 0.0001: 45 | var point := Vector3() 46 | 47 | for i in range(control_points.size()): 48 | point += Vector3.ONE * (bernstein(n, i, t) * control_points[i]) 49 | 50 | 51 | points.append(point) 52 | t += interval 53 | 54 | return points 55 | 56 | 57 | static func point_2(t: float, control_points: Array[Vector2] = []) -> Vector2: 58 | t = clamp(t, 0.0, 1.0) 59 | 60 | var n: int = control_points.size() - 1 61 | 62 | if n > maximum_control_points: 63 | push_warning("OmniKitBezierCurve: There more than %d control points (%d) in this bezier curve calculation, these points will be ignored" % [maximum_control_points, n]) 64 | control_points = control_points.slice(0 , maximum_control_points + 1) 65 | 66 | if t <= 0: 67 | return control_points.front() 68 | 69 | if t >= 0: 70 | return control_points.back() 71 | 72 | var point := Vector2() 73 | 74 | for i in range(control_points.size()): 75 | point += Vector2.ONE * (bernstein(n, i, t) * control_points[i]) 76 | 77 | return point 78 | 79 | ## Calculate all the points for the entire curve 80 | ## from t = 0 to t = 1 with and increment by default of 0.01 81 | static func point_list_2(control_points: Array[float], interval: float = 0.01) -> Array[Vector2]: 82 | var n: int = control_points.size() - 1 83 | 84 | if n > maximum_control_points: 85 | push_warning("OmniKitBezierCurve: There more than %d control points (%d) in this bezier curve calculation, these points will be ignored" % [maximum_control_points, n]) 86 | control_points = control_points.slice(0 , maximum_control_points + 1) 87 | 88 | var points: Array[Vector2] = [] 89 | var t := 0.0 90 | 91 | while t <= 1.0 + interval - 0.0001: 92 | var point := Vector2() 93 | 94 | for i in range(control_points.size()): 95 | point += Vector2.ONE * (bernstein(n, i, t) * control_points[i]) 96 | 97 | 98 | points.append(point) 99 | t += interval 100 | 101 | return points 102 | 103 | 104 | ## Berstein basic points 105 | static func bernstein(n: int, i: int, t: float) -> float: 106 | var t_i: float = pow(t, i) 107 | var t_n_minus_i = pow((1 - t), (n - i)) 108 | var basis: float = binomial(n, i) * t_i * t_n_minus_i 109 | 110 | return basis 111 | 112 | 113 | static func binomial(n: int, i: int) -> float: 114 | var a1: float = factorial[n] 115 | var a2: float = factorial[i] 116 | var a3: float = factorial[n - i] 117 | 118 | var ni: float = a1 / (a2 * a3) 119 | 120 | return ni 121 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/fantasy/female_orc.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="NameRepository" load_steps=2 format=3 uid="uid://dgabd6yqr3dst"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_smvh8"] 4 | 5 | [resource] 6 | script = ExtResource("1_smvh8") 7 | id = &"female_orc" 8 | use_shuffle_bag = true 9 | region = &"en" 10 | gender = 1 11 | names = Array[String](["Grizelda", "Thagra", "Snaga", "Gnasha", "Gorga", "Moga", "Ruka", "Borga", "Skraga", "Zuga", "Ooga", "Grima", "Fraza", "Kruga", "Zoga", "Murga", "Ragga", "Bluga", "Snarla", "Thokka", "Ugluka", "Gruma", "Skarra", "Moka", "Roga", "Buga", "Stuga", "Zaga", "Gronka", "Tharga", "Snorta", "Gnarla", "Gorga", "Mogka", "Rukka", "Borka", "Skruga", "Zuga", "Ooga", "Grima", "Fraza", "Kruga", "Zoga", "Murga", "Ragga", "Bluga", "Snarla", "Thokka", "Ugluka", "Gruma", "Skarra", "Moka", "Roga", "Buga", "Stuga", "Zaga", "Gronka", "Tharga", "Snorta", "Gnarla", "Gorga", "Mogka", "Rukka", "Borka", "Skruga", "Zuga", "Ooga", "Grima", "Fraza", "Kruga", "Zoga", "Murga", "Ragga", "Bluga", "Snarla", "Thokka", "Ugluka", "Gruma", "Skarra", "Moka", "Roga", "Buga", "Stuga", "Zaga", "Gronka", "Tharga", "Snorta", "Gnarla", "Gorga", "Mogka", "Rukka", "Borka", "Skruga", "Zuga", "Ooga", "Grima", "Fraza", "Kruga", "Zoga", "Murga", "Ragga", "Bluga", "Snarla", "Thokka", "Ugluka", "Gruma", "Skarra", "Moka", "Roga", "Buga", "Stuga", "Zaga", "Gronka", "Tharga", "Snorta", "Gnarla", "Gorga", "Mogka", "Rukka", "Borka", "Skruga", "Zuga", "Ooga", "Grima", "Fraza", "Kruga", "Zoga", "Murga", "Ragga", "Bluga", "Snarla", "Thokka", "Ugluka", "Gruma", "Skarra", "Moka", "Roga", "Buga", "Stuga", "Zaga", "Gronka", "Tharga", "Snorta", "Gnarla", "Gorga", "Mogka", "Rukka", "Borka", "Skruga", "Zuga", "Ooga", "Grima", "Fraza", "Kruga", "Zoga", "Murga", "Ragga", "Bluga", "Snarla", "Thokka", "Ugluka", "Gruma", "Skarra", "Moka", "Roga", "Buga", "Stuga", "Zaga", "Gronka", "Tharga", "Snorta", "Gnarla", "Gorga", "Mogka", "Rukka", "Borka", "Skruga", "Zuga", "Ooga", "Grima", "Fraza", "Kruga", "Zoga", "Murga", "Ragga", "Bluga", "Snarla", "Thokka", "Ugluka", "Gruma", "Skarra", "Moka", "Roga", "Buga", "Stuga", "Zaga", "Gronka", "Tharga", "Snorta", "Gnarla"]) 12 | surnames = Array[String](["Skullcleaver", "Ironfist", "Bloodreaper", "Stonehide", "Warjaw", "Grimclaw", "Bonecrusher", "Axefist", "Ragehammer", "Doomfang", "Gutrender", "Fleshgouger", "Skullgouger", "Ironwill", "Bloodtooth", "Stonejaw", "Warclaw", "Grimhide", "Bonefist", "Axeclaw", "Ragejaw", "Doomhide", "Gutcleaver", "Fleshrender", "Skullbreaker", "Ironrage", "Bloodaxe", "Stoneclaw", "Warfist", "Grimjaw", "Bonehammer", "Axewarrior", "Ragehide", "Doomfist", "Gutripper", "Flesheater", "Skullfang", "Ironhammer", "Bloodclaw", "Stoneaxe", "Warhammer", "Grimfist", "Bonejaw", "Axeblood", "Ragefang", "Doomclaw", "Gutrender", "Fleshwound", "Skullhide", "Ironheart", "Bloodrage", "Stonefury", "Waraxe", "Grimhowl", "Boneaxe", "Axegrim", "Ragefist", "Doomshriek", "Gutgouger", "Flesheater", "Skullclaw", "Ironmaiden", "Bloodforged", "Stonebreaker", "Warbringer", "Grimtide", "Bonecarver", "Axewielder", "Ragebinder", "Doomseer", "Gutspiller", "Fleshcrafter", "Skullshatter", "Ironclad", "Bloodcaller", "Stoneguard", "Warshaper", "Grimwalker", "Boneknitter", "Axethrower", "Ragefueled", "Doomwhisper", "Gutstripper", "Fleshrender", "Skullbinder", "Ironbrand", "Bloodletter", "Stonehewn", "Warforged", "Grimstalker", "Bonegrinder", "Axesmiter", "Ragehowler", "Doomweaver", "Gutburster", "Fleshpeeler", "Skullcarver", "Ironscale", "Blooddrinker", "Stonefist", "Warcaller", "Grimwielder", "Bonecleaver", "Axebinder", "Rageforged", "Doomguard", "Gutripper", "Fleshbinder", "Skullrender", "Ironshaper", "Bloodhowler", "Stonecarver", "Warstalker", "Grimsmiter", "Bonehew", "Axecaller", "Rageguard", "Doomforged", "Gutshredder", "Fleshstripper", "Skullstalker", "Ironweaver", "Bloodwielder", "Stonebinder", "Warcleaver", "Grimbinder", "Boneforged", "Axeguard", "Ragecleaver", "Doomcaller", "Gutcarver", "Fleshguard", "Skullwielder", "Ironcaller", "Bloodguard", "Stonecleaver", "Warbinder", "Grimguard", "Bonebinder", "Axeweaver", "Ragecarver", "Doomwielder", "Gutguard", "Fleshcleaver", "Skullguard", "Ironbinder", "Bloodcarver", "Stoneguard", "Warweaver", "Grimcarver", "Boneguard", "Axecarver", "Rageguard", "Doomcarver", "Gutweaver", "Fleshweaver", "Skullweaver", "Ironcarver", "Bloodweaver", "Stoneweaver", "Warcarver", "Grimweaver", "Boneweaver", "Axeweaver", "Rageweaver", "Doomweaver", "Gutweaver", "Fleshcarver", "Skullcarver", "Ironweaver", "Bloodcarver", "Stonecarver", "Warweaver", "Grimcarver"]) 13 | metadata/_custom_type_script = "uid://cejilr31xj65q" 14 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/fantasy/male_orc.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="NameRepository" load_steps=2 format=3 uid="uid://djueywo0glvue"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_3108j"] 4 | 5 | [resource] 6 | script = ExtResource("1_3108j") 7 | id = &"male_orc" 8 | use_shuffle_bag = true 9 | region = &"en" 10 | gender = 0 11 | names = Array[String](["Grog", "Thrak", "Snag", "Gnash", "Gorz", "Mog", "Ruk", "Borg", "Skrag", "Zug", "Oog", "Grim", "Fraz", "Krug", "Zog", "Murg", "Ragg", "Blug", "Snarl", "Thokk", "Ugluk", "Grum", "Skarr", "Mok", "Rog", "Bug", "Stug", "Zagg", "Gronk", "Tharg", "Snort", "Gnarl", "Gorg", "Mogk", "Rukk", "Bork", "Skrug", "Zugg", "Oogg", "Grimg", "Frazz", "Krugg", "Zogg", "Murgg", "Ragg", "Blugg", "Snarll", "Thokkk", "Uglukk", "Grumm", "Skarrg", "Mokk", "Rogg", "Bugg", "Stugg", "Zagg", "Gronkk", "Thargg", "Snortt", "Gnarll", "Gorgg", "Mogkk", "Rukkk", "Borkk", "Skrugg", "Zuggg", "Ooggg", "Grimgg", "Frazzz", "Kruggg", "Zoggg", "Murggg", "Ragg", "Bluggg", "Snarlll", "Thokkkk", "Uglukkk", "Grummm", "Skarrgg", "Mokkk", "Rogg", "Buggg", "Stuggg", "Zagg", "Gronkkk", "Tharggg", "Snorttt", "Gnarlll", "Gorggg", "Mogkkk", "Rukkkk", "Borkkk", "Skruggg", "Zugggg", "Oogggg", "Grimggg", "Frazzzz", "Krugggg", "Zogggg", "Murgggg", "Raggk", "Blugggg", "Snarllll", "Thokkkkk", "Uglukkkk", "Grummmm", "Skarrggg", "Mokkkk", "Roggk", "Bugggg", "Stugggg", "Zaggk", "Gronkkkk", "Thargggg", "Snortttt", "Gnarllll", "Gorgggg", "Mogkkkk", "Rukkkkk", "Borkkkk", "Skrugggk", "Zugggggk", "Oogggggk", "Grimggggk", "Frazzzzk", "Kruggggk", "Zogggggk", "Murggggk", "Raggkk", "Blugggggk", "Snarlllllk", "Thokkkkkk", "Uglukkkkk", "Grummmmk", "Skarrggggk", "Mokkkkkk", "Roggkkk", "Bugggggk", "Stugggggk", "Zaggkkk", "Gronkkkkk", "Thargggggk", "Snorttttk", "Gnarllllk", "Gorggggk", "Mogkkkkk", "Rukkkkkk", "Borkkkkk", "Skrugggkk", "Zugggggkk", "Oogggggkk", "Grimggggkk", "Frazzzzk", "Kruggggkk", "Zogggggkk", "Murggggkk", "Raggkkk", "Blugggggkk", "Snarllllkk", "Thokkkkkkk", "Uglukkkkkk", "Grummmmkk", "Skarrggggkk", "Mokkkkkkk", "Roggkkkk", "Bugggggkk", "Stugggggkk", "Zaggkkkk", "Gronkkkkkk", "Thargggggkk", "Snortttttkk", "Gnarllllkk", "Gorggggkk", "Mogkkkkkk", "Rukkkkkkk", "Borkkkkkk", "Skrugggkkk", "Zugggggkkk", "Oogggggkkk", "Grimggggkkk"]) 12 | surnames = Array[String](["Skullcleaver", "Ironfist", "Bloodreaper", "Stonehide", "Warjaw", "Grimclaw", "Bonecrusher", "Axefist", "Ragehammer", "Doomfang", "Gutrender", "Fleshgouger", "Skullgouger", "Ironwill", "Bloodtooth", "Stonejaw", "Warclaw", "Grimhide", "Bonefist", "Axeclaw", "Ragejaw", "Doomhide", "Gutcleaver", "Fleshrender", "Skullbreaker", "Ironrage", "Bloodaxe", "Stoneclaw", "Warfist", "Grimjaw", "Bonehammer", "Axewarrior", "Ragehide", "Doomfist", "Gutripper", "Flesheater", "Skullfang", "Ironhammer", "Bloodclaw", "Stoneaxe", "Warhammer", "Grimfist", "Bonejaw", "Axeblood", "Ragefang", "Doomclaw", "Gutrender", "Fleshwound", "Skullhide", "Ironheart", "Bloodrage", "Stonefury", "Waraxe", "Grimhowl", "Boneaxe", "Axegrim", "Ragefist", "Doomshriek", "Gutgouger", "Flesheater", "Skullclaw", "Ironmaiden", "Bloodforged", "Stonebreaker", "Warbringer", "Grimtide", "Bonecarver", "Axewielder", "Ragebinder", "Doomseer", "Gutspiller", "Fleshcrafter", "Skullshatter", "Ironclad", "Bloodcaller", "Stoneguard", "Warshaper", "Grimwalker", "Boneknitter", "Axethrower", "Ragefueled", "Doomwhisper", "Gutstripper", "Fleshrender", "Skullbinder", "Ironbrand", "Bloodletter", "Stonehewn", "Warforged", "Grimstalker", "Bonegrinder", "Axesmiter", "Ragehowler", "Doomweaver", "Gutburster", "Fleshpeeler", "Skullcarver", "Ironscale", "Blooddrinker", "Stonefist", "Warcaller", "Grimwielder", "Bonecleaver", "Axebinder", "Rageforged", "Doomguard", "Gutripper", "Fleshbinder", "Skullrender", "Ironshaper", "Bloodhowler", "Stonecarver", "Warstalker", "Grimsmiter", "Bonehew", "Axecaller", "Rageguard", "Doomforged", "Gutshredder", "Fleshstripper", "Skullstalker", "Ironweaver", "Bloodwielder", "Stonebinder", "Warcleaver", "Grimbinder", "Boneforged", "Axeguard", "Ragecleaver", "Doomcaller", "Gutcarver", "Fleshguard", "Skullwielder", "Ironcaller", "Bloodguard", "Stonecleaver", "Warbinder", "Grimguard", "Bonebinder", "Axeweaver", "Ragecarver", "Doomwielder", "Gutguard", "Fleshcleaver", "Skullguard", "Ironbinder", "Bloodcarver", "Stoneguard", "Warweaver", "Grimcarver", "Boneguard", "Axecarver", "Rageguard", "Doomcarver", "Gutweaver", "Fleshweaver", "Skullweaver", "Ironcarver", "Bloodweaver", "Stoneweaver", "Warcarver", "Grimweaver", "Boneweaver", "Axeweaver", "Rageweaver", "Doomweaver", "Gutweaver", "Fleshcarver", "Skullcarver", "Ironweaver", "Bloodcarver", "Stonecarver", "Warweaver", "Grimcarver"]) 13 | metadata/_custom_type_script = "uid://cejilr31xj65q" 14 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/viewport/texture_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitTextureHelper 2 | 3 | static var ImageFormatSignatures: Dictionary[String, Array] = { 4 | "png": [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A], 5 | "jpg": [0xFF, 0xD8, 0xFF], 6 | "jpeg": [0xFF, 0xD8, 0xFF], 7 | "webp": [0x52, 0x49, 0x46, 0x46, null, null, null, null, 0x57, 0x45, 0x42, 0x50], ## Ignore byte size with null 8 | "bmp": [0x42, 0x4D], 9 | "tga": [0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], 10 | "svg": [0x3C, 0x73, 0x76, 0x67], ## String: 15 | if data.size() < 12: 16 | return "" 17 | 18 | for format: String in ImageFormatSignatures: 19 | var signature = ImageFormatSignatures[format] 20 | var is_match = true 21 | 22 | for index: int in signature.size(): 23 | if signature[index] == null: 24 | continue 25 | 26 | if index >= data.size() or data[index] != signature[index]: 27 | is_match = false 28 | break 29 | 30 | if is_match: 31 | 32 | if format.begins_with("svg"): 33 | return "svg" 34 | 35 | return format 36 | 37 | return "" 38 | 39 | 40 | static func load_image_from_buffer(data: PackedByteArray) -> Image: 41 | var image: Image = Image.new() 42 | var format: String = detect_image_format_from_bytes(data) 43 | 44 | match format: 45 | "png": 46 | image.load_png_from_buffer(data) 47 | "jpg", "jpeg": 48 | image.load_jpg_from_buffer(data) 49 | "bmp": 50 | image.load_bmp_from_buffer(data) 51 | "webp": 52 | image.load_webp_from_buffer(data) 53 | "tga": 54 | image.load_tga_from_buffer(data) 55 | "svg": 56 | image.load_svg_from_buffer(data) 57 | 58 | return image 59 | 60 | 61 | static func center_texture_rect_pivot(texture_rect: TextureRect) -> TextureRect: 62 | if texture_rect.texture: 63 | texture_rect.pivot_offset = (texture_rect.texture.get_size() / 2).ceil() 64 | else: 65 | push_warning("OmniKitTextureHelper::center_texture_rect_pivot -> The texture rect %s does not have a texture" % texture_rect.name) 66 | return texture_rect 67 | 68 | 69 | static func get_texture_dimensions(texture: Texture2D) -> Rect2i: 70 | return texture.get_image().get_used_rect() 71 | 72 | 73 | static func get_texture_rect_dimensions(texture_rect: TextureRect) -> Vector2: 74 | var texture: Texture2D = texture_rect.texture 75 | var used_rect: Rect2i = get_texture_dimensions(texture) 76 | var texture_dimensions: Vector2 = Vector2(used_rect.size) * texture_rect.scale 77 | 78 | return texture_dimensions 79 | 80 | 81 | static func get_sprite_dimensions(sprite: Sprite2D) -> Vector2: 82 | var texture: Texture2D = sprite.texture 83 | var used_rect: Rect2i = get_texture_dimensions(texture) 84 | var sprite_dimensions: Vector2 = Vector2(used_rect.size) * sprite.scale 85 | 86 | return sprite_dimensions 87 | 88 | 89 | static func get_png_rect_from_texture(texture: Texture2D) -> Rect2i: 90 | var image: Image = texture.get_image() 91 | 92 | assert(image != null and image is Image, "OmniKitTextureHelper::get_png_rect_from_texture -> The image from the texture is null, the texture it's invalid") 93 | 94 | var top_position: int = image.get_height() 95 | var bottom_position: int = 0 96 | 97 | var right_position: int = image.get_width() 98 | var left_position: int = 0 99 | 100 | for x in image.get_width(): 101 | for y in image.get_height(): 102 | var pixel_color: Color = image.get_pixel(x, y) 103 | 104 | if pixel_color.a: 105 | if top_position > y: 106 | top_position = y 107 | 108 | if bottom_position < y: 109 | bottom_position = y 110 | 111 | if right_position > x: 112 | right_position = x 113 | 114 | if left_position < x: 115 | left_position = x 116 | 117 | var position: Vector2i = Vector2i(left_position - right_position, bottom_position - top_position) 118 | var size: Vector2i = Vector2i(right_position + roundi(position.x / 2.0), top_position + roundi(position.y / 2.0)) 119 | 120 | return Rect2i(position, size) 121 | 122 | 123 | func get_colors_from_image(image: Image) -> PackedColorArray: 124 | var colors: OmniKitHashSet = OmniKitHashSet.new() 125 | 126 | for x in image.get_width(): 127 | for y in image.get_height(): 128 | var pixel_color: Color = image.get_pixel(x, y) 129 | colors.add(Color(pixel_color.to_html())) 130 | 131 | return PackedColorArray(colors.values) 132 | 133 | 134 | func get_colors_from_texture(texture: Texture2D) -> PackedColorArray: 135 | return get_colors_from_image(texture.get_image()) 136 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/fantasy/male_dwarf.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="NameRepository" load_steps=2 format=3 uid="uid://ban24po2o7i8"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_ver5d"] 4 | 5 | [resource] 6 | script = ExtResource("1_ver5d") 7 | id = &"male_dwarf" 8 | use_shuffle_bag = true 9 | region = &"en" 10 | gender = 0 11 | names = Array[String](["Borin", "Balin", "Dwalin", "Thorin", "Farin", "Gimli", "Oin", "Gloin", "Dori", "Nori", "Ori", "Fili", "Kili", "Bifur", "Bofur", "Bombur", "Durin", "Thrain", "Thror", "Bard", "Bain", "Brand", "Dain", "Frerin", "Fundin", "Groin", "Halin", "Harin", "Imli", "Kazin", "Loni", "Mani", "Nali", "Oni", "Pali", "Regin", "Rori", "Snorri", "Talin", "Tori", "Ulf", "Vali", "Ymir", "Zorin", "Alaric", "Angus", "Barnaby", "Cedric", "Clarence", "Dirk", "Eamon", "Eldred", "Fenris", "Fergus", "Garrett", "Hamish", "Ingvar", "Jasper", "Kaelan", "Laird", "Magnus", "Neville", "Oswald", "Percival", "Quentin", "Ragnar", "Seamus", "Stellan", "Torvin", "Ulrich", "Vance", "Wallace", "Xerxes", "York", "Angrim", "Bram", "Cormac", "Dougal", "Einar", "Faelan", "Gunnar", "Hakon", "Ivar", "Jorn", "Kieran", "Lars", "Marek", "Nils", "Olaf", "Piers", "Roric", "Sven", "Titus", "Vidar", "Wulfric", "Yorick", "Astrid", "Bjorn", "Casimir", "Dagfinn", "Egil", "Frode", "Grimm", "Halvard", "Isak", "Jari", "Knut", "Leif", "Matti", "Oddvar", "Pal", "Reidar", "Sigurd", "Stian", "Trygve", "Ulfur", "Viggo", "Waldemar", "Yngvar", "Aki", "Bardi", "Cai", "Didrik", "Ebbe", "Finn", "Geir", "Hallstein", "Jens", "Kolbein", "Lukas", "Morten", "Orvar", "Poul", "Roar", "Stein", "Terje", "Vegard", "Wilhelm", "Aindreas", "Baird", "Calum", "Ewan", "Fraser", "Hamish", "Iain", "Jock", "Kenna", "Lachlan", "Murdoch", "Nairn", "Ranald", "Ruaraidh", "Torquil", "Uisdean", "Vaughan", "Alpin", "Blair", "Clyde", "Dougal", "Findlay", "Gavin", "Hamish", "Innes", "Kerr", "Lennox", "Ross", "Struan", "Tavish", "Urquhart"]) 12 | surnames = Array[String](["Stonebeard", "Ironhand", "Battlehammer", "Rockfist", "Goldfinder", "Alebrewer", "Deepdelver", "Mountainheart", "Axebeard", "Steelbrow", "Hammerfall", "Stonehewer", "Ironforge", "Battleaxe", "Rockbeard", "Goldbeard", "Alechugger", "Deepminer", "Mountainlord", "Steelhammer", "Anvilfist", "Stonefoot", "Ironhelm", "Battlefist", "Rockheart", "Goldhammer", "Aleson", "Deepstone", "Mountainshield", "Steelaxe", "Granitebeard", "Stonegrip", "Ironshield", "Battlebrow", "Rockhammer", "Goldfist", "Alewarden", "Deepforge", "Mountainking", "Steelheart", "Boulderfist", "Stonehelm", "Ironstrike", "Battleheart", "Rockbrow", "Goldbrow", "Alegut", "Deepgrip", "Mountainminer", "Steelgrip", "Cliffbeard", "Stoneaxe", "Ironbeard", "Battlefist", "Rockgrip", "Goldgrip", "Alewright", "Deephewer", "Mountainforger", "Steelfoot", "Gravelbeard", "Stonebrow", "Ironfist", "Battleaxe", "Rocklord", "Goldlord", "Aleheart", "Deepstrike", "Mountainhewer", "Steelshield", "Hillbeard", "Stoneheart", "Ironhammer", "Battlebeard", "Rockshield", "Goldshield", "Alemaster", "Deepwarden", "Mountainstrike", "Steelstrike", "Peakbeard", "Stonefist", "Ironbrow", "Battlehelm", "Rockstrike", "Goldstrike", "Alesmith", "Deepking", "Mountainfist", "Steelbeard", "Ridgebeard", "Stonehammer", "Ironheart", "Battlelord", "Rockking", "Goldking", "Alewarden", "Deepbrow", "Mountainlord", "Steelbrow", "Valleybeard", "Stoneaxe", "Ironshield", "Battleking", "Rockstrike", "Goldstrike", "Alewright", "Deepheart", "Mountainstrike", "Steelheart", "Cragbeard", "Stonehelm", "Ironstrike", "Battleheart", "Rockfist", "Goldfist", "Alegut", "Deepgrip", "Mountainminer", "Steelgrip", "Moorbeard", "Stonegrip", "Ironbeard", "Battlebrow", "Rockhammer", "Goldhammer", "Alewarden", "Deepforge", "Mountainking", "Steelaxe", "Glenbeard", "Stonebrow", "Ironfist", "Battlefist", "Rockheart", "Goldbeard", "Aleson", "Deepstone", "Mountainshield", "Steelhammer", "Dalebeard", "Stoneheart", "Ironhelm", "Battleaxe", "Rockbeard", "Goldbeard", "Alechugger", "Deepminer", "Mountainlord", "Steelbrow", "Fellbeard", "Stonefist", "Ironforge", "Battlefist", "Rockbeard", "Goldbeard", "Alebrewer", "Deepdelver", "Mountainheart", "Axebeard", "Braebeard", "Stonehewer", "Ironhand", "Battlehammer", "Rockfist", "Goldfinder", "Alebrewer", "Deepdelver", "Mountainheart", "Axebeard", "Strathbeard", "Stonebeard", "Ironhand", "Battlehammer", "Rockfist", "Goldfinder", "Alebrewer", "Deepdelver", "Mountainheart", "Axebeard", "Lochness", "Ironfoot", "Stonefist", "Goldheart", "Hammerstone", "Axehand", "Steelheart", "Deepaxe", "Mountainbrow", "Rockgrip", "Glenmore", "Stonebrow", "Ironheart", "Goldhand", "Hammerfist", "Axebrow", "Steelgrip", "Deephelm", "Mountainfist", "Rockhammer"]) 13 | metadata/_custom_type_script = "uid://cejilr31xj65q" 14 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/fantasy/male_elf.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="NameRepository" load_steps=2 format=3 uid="uid://dr61v8dvsyrsv"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_38dwj"] 4 | 5 | [resource] 6 | script = ExtResource("1_38dwj") 7 | id = &"male_elf" 8 | use_shuffle_bag = true 9 | region = &"en" 10 | gender = 0 11 | names = Array[String](["Aeliana", "Aerion", "Alatar", "Alavara", "Alderon", "Aleria", "Althaea", "Amastacia", "Amriel", "Anarion", "Andriel", "Anya", "Aranel", "Aredhel", "Ariana", "Ariel", "Arion", "Arwen", "Astara", "Astel", "Avariel", "Ayla", "Ayden", "Belen", "Beren", "Caelen", "Calen", "Celedon", "Celebrian", "Celeborn", "Celestia", "Cerin", "Cian", "Corellon", "Cygnus", "Daenys", "Dara", "Darian", "Delwyn", "Dior", "Eldarion", "Elenwe", "Elrond", "Elros", "Elowen", "Elyssa", "Enya", "Eolande", "Erevan", "Eryn", "Faenor", "Faelar", "Faelen", "Faelina", "Faeriel", "Finarfin", "Finduilas", "Finrod", "Galadriel", "Galin", "Haldir", "Hania", "Helerion", "Idril", "Ilara", "Ilian", "Imladris", "Ingwe", "Iolanthe", "Isildur", "Isolde", "Ithilwen", "Jareth", "Jessa", "Kael", "Kaia", "Kalen", "Kella", "Kira", "Kyra", "Laelon", "Laenya", "Larael", "Lathien", "Lenore", "Liran", "Liriel", "Lirion", "Livia", "Loran", "Lucien", "Lyra", "Lysandra", "Maeve", "Maelen", "Maelora", "Maia", "Maire", "Maldor", "Mareth", "Mariel", "Marius", "Mellon", "Meryl", "Miriel", "Morwen", "Nayana", "Nayanael", "Nessa", "Nienna", "Noldor", "Nuala", "Oakhaven", "Oriel", "Orion", "Osse", "Pella", "Perrin", "Quenya", "Quillon", "Rael", "Raelen", "Raina", "Rainier", "Renna", "Riannon", "Rielle", "Riona", "Rowan", "Rylen", "Sael", "Saelan", "Sariel", "Sauron", "Sephina", "Seraphina", "Silvanus", "Sinya", "Sorrel", "Sylvan", "Taelon", "Talia", "Tameron", "Tauriel", "Telperion", "Thalion", "Thranduil", "Tinuviel", "Tirian", "Tylwyth", "Ulaire", "Una", "Uriel", "Valen", "Valinor", "Vanya", "Varian", "Vashanti", "Vilya", "Vivienne", "Wynafael", "Xandriel", "Xylia", "Ylandra", "Yvaine", "Yvain", "Zaltar", "Zelia", "Zethus", "Zylos"]) 12 | surnames = Array[String](["Moonwhisper", "Sunstrider", "Starfall", "Shadowbrook", "Silverleaf", "Windrunner", "Nightshade", "Dawnflower", "Emberglow", "Frostmoon", "Riverwood", "Skywatcher", "Whisperwind", "Stonehaven", "Greenwood", "Brightstar", "Darkwood", "Sunpetal", "Snowdrift", "Stormblade", "Oakhaven", "Mistwalker", "Swiftarrow", "Ironwood", "Goldleaf", "Silversong", "Shadowmere", "Duskwalker", "Fireheart", "Icewind", "Brookwood", "Stargazer", "Windchaser", "Rockwood", "Emeraldleaf", "Moonglow", "Nightstalker", "Sunwhisper", "Snowflower", "Thunderbow", "Willowbrook", "Skywing", "Whisperstream", "Stonebridge", "Forestsong", "Brightmoon", "Darkshade", "Sunshadow", "Snowfall", "Lightningstrike", "Ashwood", "Mistral", "Swiftfoot", "Ironleaf", "Goldenleaf", "Silverstream", "Shadowfen", "Duskflower", "Flameheart", "Frostflower", "Creekwood", "Starwhisper", "Windrider", "Stonecliff", "Grovewood", "Moonshadow", "Nightwing", "Sunbloom", "Snowdrift", "Stormbringer", "Pinehaven", "Mistveil", "Swiftwing", "Ironbark", "Goldstream", "Silvershadow", "Shadowbrook", "Dawnwhisper", "Firefly", "Iceheart", "Lakeview", "Skyfire", "Whisperwood", "Stonefist", "Greenleaf", "Brightflower", "Darkstream", "Sunrider", "Snowflake", "Thunderstrike", "Birchwood", "Mistflower", "Swiftstream", "Ironbranch", "Goldenwing", "Silverbrook", "Shadowfell", "Duskwing", "Firestorm", "Icewalker", "Hillcrest", "Starstream", "Windwalker", "Stonegrove", "Forestwalker", "Moonrider", "Nightflower", "Sunwalker", "Snowstream", "Lightningarrow", "Rowanwood", "Mistshadow", "Swiftshadow", "Ironstream", "Goldenshadow", "Silverwing", "Shadowvine", "Duskstream", "Flamekissed", "Frostwalker", "Valeview", "Skywhisper", "Whisperwing", "Stonearrow", "Greenbrook", "Brightwing", "Darkrider", "Sunwing", "Snowdrift", "Stormchaser", "Elmwood", "Mistwing", "Swiftwalker", "Ironwing", "Goldwalker", "Silverleaf", "Shadowwalker", "Duskrider", "Firewalker", "Icewing", "Meadowbrook", "Starwalker", "Windshadow", "Stoneleaf", "Forestwing", "Moonwalker", "Nightrider", "Sunshadow", "Snowwalker", "Lightningwing", "Oakwood", "Mistrider", "Swiftwind", "Ironwood", "Goldleaf", "Silverstream", "Shadowstream", "Dawnwalker", "Firewing", "Icechaser", "Riverbend", "Skywalker", "Whisperrider", "Stonebrook", "Greenwalker", "Brightrider", "Darkwing", "Sunstream", "Snowrider", "Thunderwing", "Willowwood", "Mistwalker", "Swiftwing", "Ironleaf", "Goldwing", "Silverwalker", "Shadowrider", "Duskwalker", "Firewalker", "Icewalker", "Ashbrook", "Starwing", "Windwalker", "Stonegrove", "Forestrider", "Moonwalker", "Nightstream", "Sunwalker", "Snowwing", "Lightningrider", "Pinebrook", "Mistrider", "Swiftshadow", "Ironwalker", "Goldwalker", "Silverstream", "Shadowwing", "Duskstream", "Firestream", "Icewing"]) 13 | metadata/_custom_type_script = "uid://cejilr31xj65q" 14 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/markov_chain_text_generator.gd: -------------------------------------------------------------------------------- 1 | ## A class for generating new text (like words or names) based on patterns 2 | ## learned from a provided training dataset. It uses a Markov chain model to predict 3 | ## the next character in a sequence, creating plausible-sounding outputs. 4 | class_name OmniKitMarkovChainTextGenerator extends RefCounted 5 | 6 | 7 | const CHARACTERS: Array[String] = [ 8 | "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 9 | "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", 10 | "u", "v", "w", "x", "y", "z", "â", "à", "é", "è", 11 | "ê", "ë", "î", "ï", "ô", "ö", "ù", "û", "ç", " ", 12 | "-", ".", "0", "1", "2", "3", "4", "5", "6", "7", 13 | "8", "9", "á", "é", "í", "ó", "ú", "ñ", "ü", "ø", 14 | "æ", "œ", "ß", "'", "_", "&", "#", "@", "!", "?" 15 | ] 16 | 17 | var trigram_frequencies: Dictionary 18 | var total_trigram_count: int 19 | var training_data: Array 20 | var start_pattern_counts : Dictionary[String, int] 21 | var end_pattern_counts: Dictionary[String, int] 22 | 23 | 24 | func _init(training_items: Array, chain_depth: int = 2): ## chain_depth is not being used as this would need a good refactor 25 | trigram_frequencies = {} 26 | 27 | for c1 in CHARACTERS: 28 | var d2 = {} 29 | 30 | for c2 in CHARACTERS: 31 | var d3 = {} 32 | 33 | for c3 in CHARACTERS: 34 | d3[c3] = 0.0 35 | d2[c2] = d3 36 | 37 | trigram_frequencies[c1] = d2 38 | 39 | total_trigram_count = 0 40 | start_pattern_counts = {} 41 | end_pattern_counts = {} 42 | 43 | for item: String in training_items: 44 | var processed_item: String = item.strip_edges().to_lower() 45 | training_data.append(item) 46 | 47 | for c in range(processed_item.length() - 2): 48 | if c == 0: 49 | var start_segment = processed_item.substr(0, min(3, processed_item.length())) 50 | 51 | if start_segment in start_pattern_counts: 52 | start_pattern_counts[start_segment] += 1 53 | else: 54 | start_pattern_counts[start_segment] = 1 55 | 56 | if c == processed_item.length() - 3: 57 | var end_segment = processed_item.substr(c) 58 | 59 | if end_segment .length() > 0: 60 | if end_segment in end_pattern_counts: 61 | end_pattern_counts[end_segment ] += 1 62 | else: 63 | end_pattern_counts[end_segment ] = 1 64 | 65 | var char_a = processed_item[c] 66 | var char_b = processed_item[c + 1] 67 | var char_c = processed_item[c + 2] 68 | 69 | if (not (char_a in trigram_frequencies) or \ 70 | not (char_b in trigram_frequencies[char_a]) or \ 71 | not (char_c in trigram_frequencies[char_a][char_b])): 72 | continue 73 | 74 | trigram_frequencies[processed_item[c]][char_b][char_c] += 1 75 | total_trigram_count += 1 76 | 77 | 78 | func generate(must_be_new: bool = true, max_output_length: int = 10, end_probability_threshold: float = 0.75, generation_attempt: int = 0) -> String: 79 | var result = get_weighted_random_item(start_pattern_counts ).pick_random() 80 | 81 | var current_index: int = 3 82 | var pattern: String 83 | var possible_next_chars: Array 84 | var next_char: String 85 | 86 | while result.length() < max_output_length: 87 | if (not result[current_index - 2] in trigram_frequencies or \ 88 | not result[current_index - 1] in trigram_frequencies[result[current_index - 2]]): 89 | break 90 | 91 | possible_next_chars = get_weighted_random_item(trigram_frequencies[result[current_index - 2]][result[current_index - 1]]) 92 | 93 | if possible_next_chars.is_empty(): 94 | break 95 | 96 | next_char = possible_next_chars.pick_random() 97 | result += next_char 98 | pattern = result.substr(result.length() - 3) 99 | 100 | if pattern in end_pattern_counts: 101 | if end_pattern_counts[pattern] > 0.001: 102 | if randf() < end_probability_threshold: break 103 | 104 | current_index += 1 105 | 106 | 107 | if not ["a", "e", "i", "o", "u", "y"].any(func(vowel: String): return vowel in result): 108 | result = generate(must_be_new, max_output_length, end_probability_threshold, generation_attempt + 1) 109 | 110 | if generation_attempt < 100: 111 | 112 | if result.length() > 3: 113 | while (not result.substr(max(0, result.length() - 3)) in end_pattern_counts): 114 | result = result.substr(0, result.length() - 1) 115 | 116 | if result.is_empty(): 117 | result = generate(must_be_new, max_output_length, end_probability_threshold, generation_attempt + 1) 118 | 119 | var cleaned_parts: Array = (result.split(" ") as Array).filter(func(p): return p.length() > 1) 120 | result = " ".join(cleaned_parts) 121 | 122 | if must_be_new and result in training_data: 123 | result = generate(must_be_new, max_output_length, end_probability_threshold, generation_attempt + 1) 124 | 125 | return result.capitalize() 126 | 127 | 128 | func get_weighted_random_item(data: Dictionary): 129 | var items = [] 130 | 131 | for key in data: 132 | for i in range(data[key]): 133 | items.append(key) 134 | 135 | return items 136 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/real_life/male_human_es.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="NameRepository" load_steps=2 format=3 uid="uid://cskwu5flqrcef"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_p0f4i"] 4 | 5 | [resource] 6 | script = ExtResource("1_p0f4i") 7 | id = &"male_human" 8 | use_shuffle_bag = true 9 | region = &"es" 10 | gender = 0 11 | names = Array[String](["Abel", "Adolfo", "Agustín", "Amador", "Amancio", "Anselmo", "Arnaldo", "Arturo", "Augusto", "Baldomero", "Baltasar", "Bartolomé", "Basilio", "Beltrán", "Bienvenido", "Borja", "Braulio", "Bruno", "Cayetano", "Celestino", "Cirilo", "Claudio", "Cornelio", "Cosme", "Cristian", "Cristóbal", "Custodio", "Daniel", "Desiderio", "Dimas", "Donato", "Edgar", "Edmundo", "Efrén", "Elías", "Eliseo", "Eloy", "Emilio", "Epifanio", "Esteban", "Eugenio", "Eusebio", "Evaristo", "Exiquio", "Feliciano", "Félix", "Florencio", "Fortunato", "Froilán", "Fulgencio", "Gelasio", "Gerardo", "Germán", "Gervasio", "Gil", "Gregorio", "Guillermo", "Gustavo", "Heraclio", "Hermenegildo", "Horacio", "Hortensio", "Huberto", "Íñigo", "Isidoro", "Israel", "Jacinto", "Jaime", "Jeremías", "Jerónimo", "Joaquín", "Jonás", "Jorge", "Josué", "Judas", "Julio", "Justino", "Juvenal", "Laureano", "Laurentino", "Leandro", "Leoncio", "Liberio", "Lino", "Lisandro", "Lorenzo", "Lotario", "Luciano", "Lucrecio", "Macario", "Magín", "Malcom", "Marc", "Marcial", "Mariano", "Marino", "Mario", "Máximo", "Melchor", "Micael", "Narciso", "Natalio", "Nazario", "Néstor", "Noé", "Norberto", "Octavio", "Odón", "Olegario", "Oliver", "Onésimo", "Orestes", "Oriol", "Orfeo", "Osvaldo", "Oto", "Paloma", "Pancracio", "Patricio", "Paulino", "Plácido", "Poncio", "Porfirio", "Prisciliano", "Prospero", "Quentin", "Quirino", "Raimundo", "Ramiro", "Raúl", "Reinaldo", "Remigio", "Renato", "Restituto", "Reynaldo", "Rigoberto", "Rogelio", "Rolando", "Romualdo", "Roque", "Rosendo", "Rufino", "Salomón", "Salvador", "Silas", "Silvestre", "Silverio", "Sixto", "Sócrates", "Sofronio", "Telmo", "Teo", "Teobaldo", "Teodoro", "Teófanes", "Timoteo", "Tito", "Toribio", "Tristán", "Ubaldo", "Urbano", "Valentín", "Valeriano", "Venancio", "Ventura", "Vergilio", "Vicente", "Virgilio", "Vladimiro", "Walter", "Wilfredo", "Wenceslao", "Yeray", "Yago", "Zacarías", "Zenón", "Alfonso", "Alberto", "Andrés", "Antonio", "Alejandro", "Carlos", "Diego", "Eduardo", "Enrique", "Fernando", "Francisco", "Gabriel", "Gonzalo", "Hugo", "Ignacio", "Javier", "José", "Juan", "Leonardo", "Luis", "Manuel", "Marcelo", "Mateo", "Miguel", "Nicolás", "Oscar", "Pablo", "Pedro", "Rafael", "Ricardo", "Roberto", "Rubén", "Samuel", "Santiago", "Sebastián", "Sergio", "Simeón", "Tomás", "Víctor", "Xavier", "Aarón", "Adrián", "Aitor", "Álvaro", "Armando", "Benito", "Blas", "Camilo", "César", "Clemente", "Dámaso", "Damián", "Daniel", "Darío", "David", "Demetrio", "Domínguez", "Dioni", "Domingo", "Eduardo", "Enrico", "Ernesto", "Ezequiel", "Fabián", "Facundo", "Federico", "Felipe", "Fernández", "Ferrán", "Flores", "Francisco", "Gámir", "Gómez", "González", "Hidalgo", "Herrera", "Ignacio", "Isla", "Iván", "Jaramillo", "Jesús", "José", "Juanes", "Julián", "Julián", "Laguna", "Lamadrid", "Larraínzar", "Lázaro", "Leal", "Lebrija", "León", "Leopoldo", "Liñán", "Llorente", "López", "Lope", "Lucio", "Mármol"]) 12 | surnames = Array[String](["Alcalá", "Álvarez", "Andrés", "Aranda", "Arenas", "Arranz", "Arostegui", "Ayerbe", "Barajas", "Barbería", "Barbier", "Bárbara", "Bergés", "Bernabé", "Bertrán", "Bolaños", "Borbón", "Bosco", "Bosquí", "Brazo", "Brioso", "Bueno", "Burgo", "Cabrera", "Caceres", "Cadenas", "Cagigal", "Cajal", "Calatrava", "Calleja", "Canga", "Cano", "Cantabria", "Cardona", "Cardoso", "Cariño", "Carracedo", "Carrera", "Carreño", "Carrocera", "Carrillo", "Carrión", "Casado", "Casas", "Cascales", "Castellanos", "Castelló", "Castellote", "Castillo", "Castro", "Cavallero", "Ceballos", "Cebrián", "Cerezo", "Cernadas", "Cervantes", "Cervillo", "Cesáreo", "Cetina", "Chacón", "Chapela", "Charco", "Chastre", "Chavero", "Checa", "Chué", "Cimadevilla", "Cobos", "Colmenares", "Colomer", "Colón", "Conde", "Contreras", "Correa", "Cortés", "Cortizo", "Crespo", "Cruz", "Cuadrado", "Cuesta", "Cuevas", "Díaz", "Domínguez", "Dorado", "Duque", "Echeverría", "Egea", "Elías", "Enríquez", "Escobar", "Escribano", "Espinosa", "Esteban", "Estévez", "Fernández", "Figueroa", "Fidalgo", "Flores", "Fonseca", "Fraga", "Franco", "Fresno", "Fuentes", "Gálvez", "García", "Lara", "Lázaro", "Leal", "León", "Linares", "Lisboa", "Lobo", "Lomana", "López", "Lozano", "Lucas", "Luque", "Macías", "Madrid", "Madroñal", "Malo", "Manzano", "Marín", "Márquez", "Martín", "Martínez", "Mateo", "Medina", "Mejías", "Mena", "Méndez", "Millán", "Miranda", "Molina", "Montero", "Montes", "Mora", "Morales", "Moreno", "Moya", "Muñoz", "Navarro", "Nieto", "Núñez", "Olmo", "Oliva", "Ordóñez", "Ortega", "Ortiz", "Palma", "Pardo", "Pascual", "Pastor", "Paz", "Peña", "Quijada", "Quirós", "Ramírez", "Ramos", "Real", "Reina", "Ribera", "Rico", "Rincón", "Ríos", "Robles", "Roca", "Rodas", "Rodrigo", "Rodríguez", "Rojo", "Román", "Romero", "Rubio", "Ruiz", "Saavedra", "Sáez", "Salamanca", "Salas", "Salvador", "Sánchez", "Sancho", "Santana", "Santiago", "Santos", "Sanz", "Segura", "Serrano", "Sierra", "Silva", "Soler", "Soria", "Soto", "Suárez", "Toledo", "Torres", "Vaca", "Valdés", "Valdivieso", "Valero", "Valle", "Vargas", "Vázquez", "Vega", "Velasco", "Vera", "Vergara", "Vicente", "Vidal", "Villa", "Villalba", "Villanueva", "Villar", "Vivas", "Vizcaíno", "Yáñez", "Zamora", "Zurdo", "Zaragoza", "Zúñiga"]) 13 | metadata/_custom_type_script = "uid://cejilr31xj65q" 14 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | - Demonstrating empathy and kindness toward other people 21 | - Being respectful of differing opinions, viewpoints, and experiences 22 | - Giving and gracefully accepting constructive feedback 23 | - Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | - Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | - The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | - Trolling, insulting or derogatory comments, and personal or political attacks 33 | - Public or private harassment 34 | - Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | - Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/structures/array_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitArrayHelper 2 | 3 | 4 | static func only_has_numbers(array: Array[Variant]) -> bool: 5 | if array.is_empty(): 6 | return false 7 | 8 | return array.all(_is_number) 9 | 10 | 11 | static func remove_numbers(array: Array[Variant]) -> Array: 12 | return array.filter(func(value: Variant): return not _is_number(value)) 13 | 14 | 15 | static func sum(values: Array[int]) -> int: 16 | var result: int = 0 17 | 18 | for value in values: 19 | result += value 20 | 21 | return result 22 | 23 | 24 | static func sum_floats(values: Array[float]) -> float: 25 | var result: float = 0.0 26 | 27 | for value in values: 28 | result += value 29 | 30 | return result 31 | 32 | 33 | static func repeat(element: Variant, times: int) -> Array[Variant]: 34 | var result: Array[Variant] = [] 35 | 36 | for _time: int in times: 37 | result.append(element.duplicate()) 38 | 39 | return result 40 | 41 | ## Flatten any array with n dimensions recursively 42 | static func flatten(array: Array[Variant]): 43 | var result: Array[Variant] = [] 44 | 45 | for i in array.size(): 46 | if typeof(array[i]) >= TYPE_ARRAY: 47 | result.append_array(flatten(array[i])) 48 | else: 49 | result.append(array[i]) 50 | 51 | return result 52 | 53 | 54 | static func pick_random_values(array: Array[Variant], items_to_pick: int = 1, duplicates: bool = true) -> Array[Variant]: 55 | var result: Array[Variant] = [] 56 | var target = flatten(array.duplicate()) 57 | target.shuffle() 58 | 59 | items_to_pick = mini(target.size(), items_to_pick) 60 | 61 | for i in range(items_to_pick): 62 | var item = target.pick_random() 63 | result.append(item) 64 | 65 | if not duplicates: 66 | target.erase(item) 67 | 68 | return result 69 | 70 | 71 | static func remove_duplicates(array: Array[Variant]) -> Array[Variant]: 72 | var cleaned_array: Array[Variant] = [] 73 | 74 | for element in array: 75 | if not cleaned_array.has(element): 76 | cleaned_array.append(element) 77 | 78 | return cleaned_array 79 | 80 | 81 | static func remove_falsy_values(array: Array[Variant]) -> Array[Variant]: 82 | var cleaned_array: Array[Variant] = [] 83 | 84 | for element in array: 85 | if element: 86 | cleaned_array.append(element) 87 | 88 | return cleaned_array 89 | 90 | 91 | static func middle_element(array: Array[Variant]): 92 | if array.size() > 2: 93 | return array[floor(array.size() / 2.0)] 94 | 95 | return null 96 | 97 | 98 | ## This method works in a circular way, this means that is the value is the last, it returns the first one in the array 99 | static func next_element_from_value(array: Array[Variant], value: Variant) -> Variant: 100 | if array.is_empty() or not array.has(value): 101 | return null 102 | 103 | elif array.size() > 1 and array.has(value): 104 | var from_value_index = array.find(value) 105 | 106 | if from_value_index != -1 and from_value_index + 1 < array.size(): 107 | return array[from_value_index + 1] 108 | else: 109 | return array.front() 110 | 111 | return null 112 | 113 | ## This method works in a circular way, this means that is the value is the first, it returns the last one in the array 114 | static func previous_element_from_value(array: Array[Variant], value: Variant) -> Variant: 115 | if array.is_empty() or not array.has(value): 116 | return null 117 | 118 | elif array.size() > 1 and array.has(value): 119 | var from_value_index = array.find(value) 120 | 121 | if from_value_index != -1 and (from_value_index - 1) > -1: 122 | return array[from_value_index - 1] 123 | else: 124 | return array.back() 125 | 126 | return null 127 | 128 | ## Return a dictionary with the array value as key and the frequency count as value 129 | static func frequency(array: Array[Variant]) -> Dictionary: 130 | var result: Dictionary = {} 131 | 132 | for element: Variant in array: 133 | result[element] = result.get(element, 0) + 1 134 | 135 | return result 136 | 137 | 138 | ## To detect if a contains elements of b 139 | static func intersects(a: Array[Variant], b: Array[Variant]) -> bool: 140 | for e: Variant in a: 141 | if b.has(e): 142 | return true 143 | 144 | return false 145 | 146 | 147 | static func intersected_elements(a: Array[Variant], b: Array[Variant]) -> Array[Variant]: 148 | if intersects(a, b): 149 | return a.filter(func(element): return element in b) 150 | 151 | return [] 152 | 153 | 154 | static func merge_unique(first: Array[Variant], second: Array[Variant]) -> Array[Variant]: 155 | var merged_array: Array[Variant] = remove_duplicates(first) 156 | 157 | for element in remove_duplicates(second): 158 | if not merged_array.has(element): 159 | merged_array.append(element) 160 | 161 | return merged_array 162 | 163 | ##Separates an Array into smaller array: 164 | ## argument 1: array that is going to be converted 165 | ## argument 2: size of these smaller arrays 166 | ## argument 3: writes smaller arrays even if they aren't full 167 | ## Example: 168 | ## ArrayHelper.chunk[[1,2,3,4,5,6,7,8,9], 3] 169 | ## [1,2,3,4,5,6,7,8,9] -> [[1,2,3], [4,5,6], [7,8,9]] 170 | ## Example 2: 171 | ## ArrayHelper.chunk([1,2,3,4,5,6,7,8,9], 4) 172 | ## [1,2,3,4,5,6,7,8,9] -> [[1, 2, 3, 4], [5, 6, 7, 8], [9]] 173 | static func chunk(array: Array[Variant], size: int, only_chunks_with_same_size: bool = false): 174 | var result = [] 175 | var i = 0 176 | var j = -1 177 | 178 | if only_chunks_with_same_size: 179 | @warning_ignore("integer_division") 180 | array = array.slice(0, floor(array.size() / size) * size) 181 | 182 | for element in array: 183 | if i % size == 0: 184 | result.push_back([]) 185 | j += 1 186 | 187 | result[j].push_back(element) 188 | i += 1 189 | 190 | return result 191 | 192 | 193 | static func _is_number(value: Variant) -> bool: 194 | if typeof(value) in [TYPE_STRING, TYPE_STRING_NAME]: 195 | return value.is_valid_int() or value.is_valid_float() 196 | 197 | return typeof(value) in [TYPE_INT, TYPE_FLOAT] 198 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/fantasy/female_dwarf.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitNameRepository" load_steps=2 format=3 uid="uid://dxa3wqfcc5p3t"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_5jx5o"] 4 | 5 | [resource] 6 | script = ExtResource("1_5jx5o") 7 | id = &"female_dwarf" 8 | gender = 0 9 | names = Array[String](["Borwyn", "Balina", "Dwalna", "Thorwyn", "Farina", "Gimla", "Oina", "Gloina", "Dora", "Nora", "Ora", "Fila", "Kila", "Bifura", "Bofura", "Bombura", "Durina", "Thraina", "Throra", "Barda", "Baina", "Branda", "Daina", "Frerina", "Fundina", "Groina", "Halina", "Harina", "Imla", "Kaza", "Lona", "Mana", "Nala", "Ona", "Pala", "Regina", "Rora", "Snorra", "Talina", "Tora", "Ulfa", "Vala", "Ymira", "Zora", "Alara", "Angusina", "Barnabyne", "Cedrica", "Clarencea", "Dirka", "Eamona", "Eldreda", "Fenrisia", "Fergusa", "Garretta", "Hamisha", "Ingvara", "Jaspera", "Kaelana", "Lairda", "Magnusa", "Nevilla", "Oswalda", "Percivala", "Quentina", "Ragnara", "Seamusa", "Stellana", "Torvina", "Ulrica", "Vanca", "Wallaca", "Xerxa", "Yorka", "Angrima", "Brama", "Cormaca", "Dougala", "Einara", "Faelana", "Gunnara", "Hakona", "Ivara", "Jorna", "Kierana", "Larsa", "Mareka", "Nilsa", "Olafa", "Piersa", "Rorica", "Svena", "Tita", "Vidara", "Wulfrica", "Yoricka", "Astrida", "Bjorna", "Casimira", "Dagfinna", "Egila", "Froda", "Grimma", "Halvarda", "Isaka", "Jara", "Knuta", "Leifa", "Mattia", "Oddvara", "Pala", "Reidara", "Sigurda", "Stiana", "Trygva", "Ulfura", "Vigga", "Waldemara", "Yngvara", "Aka", "Barda", "Cai", "Didrika", "Ebba", "Finna", "Geira", "Hallsteina", "Jensa", "Kolbeina", "Lukasa", "Mortena", "Orvara", "Paula", "Roara", "Steina", "Terja", "Vegarda", "Wilhelma", "Aindrea", "Bairda", "Caluma", "Ewana", "Frasera", "Hamisha", "Iaina", "Jocka", "Kenna", "Lachlana", "Murdoca", "Nairna", "Ranalda", "Ruaraidha", "Torquila", "Uisdeana", "Vaughana", "Alpina", "Blaira", "Clyda", "Dougala", "Findlaya", "Gavina", "Hamisha", "Innesa", "Kerra", "Lennoxa", "Rossa", "Struana", "Tavisha", "Urquharta"]) 10 | surnames = Array[String](["Stonebeard", "Ironhand", "Battlehammer", "Rockfist", "Goldfinder", "Alebrewer", "Deepdelver", "Mountainheart", "Axebeard", "Steelbrow", "Hammerfall", "Stonehewer", "Ironforge", "Battleaxe", "Rockbeard", "Goldbeard", "Alechugger", "Deepminer", "Mountainlord", "Steelhammer", "Anvilfist", "Stonefoot", "Ironhelm", "Battlefist", "Rockheart", "Goldhammer", "Aleson", "Deepstone", "Mountainshield", "Steelaxe", "Granitebeard", "Stonegrip", "Ironshield", "Battlebrow", "Rockhammer", "Goldfist", "Alewarden", "Deepforge", "Mountainking", "Steelheart", "Boulderfist", "Stonehelm", "Ironstrike", "Battleheart", "Rockbrow", "Goldbrow", "Alegut", "Deepgrip", "Mountainminer", "Steelgrip", "Cliffbeard", "Stoneaxe", "Ironbeard", "Battlefist", "Rockgrip", "Goldgrip", "Alewright", "Deephewer", "Mountainforger", "Steelfoot", "Gravelbeard", "Stonebrow", "Ironfist", "Battleaxe", "Rocklord", "Goldlord", "Aleheart", "Deepstrike", "Mountainhewer", "Steelshield", "Hillbeard", "Stoneheart", "Ironhammer", "Battlebeard", "Rockshield", "Goldshield", "Alemaster", "Deepwarden", "Mountainstrike", "Steelstrike", "Peakbeard", "Stonefist", "Ironbrow", "Battlehelm", "Rockstrike", "Goldstrike", "Alesmith", "Deepking", "Mountainfist", "Steelbeard", "Ridgebeard", "Stonehammer", "Ironheart", "Battlelord", "Rockking", "Goldking", "Alewarden", "Deepbrow", "Mountainlord", "Steelbrow", "Valleybeard", "Stoneaxe", "Ironshield", "Battleking", "Rockstrike", "Goldstrike", "Alewright", "Deepheart", "Mountainstrike", "Steelheart", "Cragbeard", "Stonehelm", "Ironstrike", "Battleheart", "Rockfist", "Goldfist", "Alegut", "Deepgrip", "Mountainminer", "Steelgrip", "Moorbeard", "Stonegrip", "Ironbeard", "Battlebrow", "Rockhammer", "Goldhammer", "Alewarden", "Deepforge", "Mountainking", "Steelaxe", "Glenbeard", "Stonebrow", "Ironfist", "Battlefist", "Rockheart", "Goldbeard", "Aleson", "Deepstone", "Mountainshield", "Steelhammer", "Dalebeard", "Stoneheart", "Ironhelm", "Battleaxe", "Rockbeard", "Goldbeard", "Alechugger", "Deepminer", "Mountainlord", "Steelbrow", "Fellbeard", "Stonefist", "Ironforge", "Battlefist", "Rockbeard", "Goldbeard", "Alebrewer", "Deepdelver", "Mountainheart", "Axebeard", "Braebeard", "Stonehewer", "Ironhand", "Battlehammer", "Rockfist", "Goldfinder", "Alebrewer", "Deepdelver", "Mountainheart", "Axebeard", "Strathbeard", "Stonebeard", "Ironhand", "Battlehammer", "Rockfist", "Goldfinder", "Alebrewer", "Deepdelver", "Mountainheart", "Axebeard", "Lochness", "Ironfoot", "Stonefist", "Goldheart", "Hammerstone", "Axehand", "Steelheart", "Deepaxe", "Mountainbrow", "Rockgrip", "Glenmore", "Stonebrow", "Ironheart", "Goldhand", "Hammerfist", "Axebrow", "Steelgrip", "Deephelm", "Mountainfist", "Rockhammer", "Boulderbrow", "Ironbrow", "Battlebrow", "Rockbrow", "Goldbrow", "Alebrow", "Deepbrow", "Mountainbrow", "Steelbrow", "Granitebrow", "Cliffbrow", "Gravelbrow", "Hillbrow", "Peakbrow", "Ridgebrow", "Valleybrow", "Cragbrow", "Moorbrow", "Glenbrow", "Dalebrow", "Fellbrow", "Braebrow", "Strathbrow", "Lochbrow", "Glenmorebrow", "Boulderhelm", "Ironhelm", "Battlehelm", "Rockhelm", "Goldhelm", "Alehelm", "Deephelm", "Mountainhelm", "Steelhelm", "Granitehelm", "Cliffhelm", "Gravelhelm", "Hillhelm", "Peakhelm", "Ridgehelm", "Valleyhelm", "Craghelm", "Moorhelm", "Glenhelm", "Dalehelm", "Fellhelm", "Braehelm", "Strathhelm", "Lochhelm", "Glenmorehelm", "Boulderheart", "Ironheart", "Battleheart", "Rockheart", "Goldheart", "Aleheart", "Deepheart", "Mountainheart", "Steelheart", "Graniteheart", "Cliffheart", "Gravelheart", "Hillheart", "Peakheart", "Ridgeheart", "Valleyheart", "Cragheart", "Moorheart", "Glenheart", "Daleheart", "Fellheart", "Braeheart", "Strathheart", "Lochheart", "Glenmoreheart", "Boulderhand", "Ironhand", "Battlehand", "Rockhand", "Goldhand", "Alehand", "Deephand", "Mountainhand", "Steelhand", "Granitehand", "Cliffhand", "Gravelhand", "Hillhand", "Peakhand", "Ridgehand", "Valleyhand", "Craghand", "Moorhand", "Glenhand", "Dalehand", "Fellhand", "Braehand", "Strathhand", "Lochhand", "Glenmorehand"]) 11 | metadata/_custom_type_script = "uid://cejilr31xj65q" 12 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/nodes/node_traversal.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitNodeTraversal 2 | 3 | 4 | static func set_owner_to_edited_scene_root(node: Node) -> void: 5 | if Engine.is_editor_hint() and node.get_tree(): 6 | node.owner = node.get_tree().edited_scene_root 7 | 8 | 9 | static func get_all_children(from_node: Node) -> Array: 10 | var nodes := [] 11 | 12 | for child: Node in from_node.get_children(): 13 | if child.get_child_count() > 0: 14 | nodes.append(child) 15 | nodes.append_array(get_all_children(child)) 16 | else: 17 | nodes.append(child) 18 | 19 | return nodes 20 | 21 | 22 | static func get_all_ancestors(from_node: Node) -> Array: 23 | if from_node.get_parent() == null: 24 | return [] 25 | 26 | var ancestors := [] 27 | var node := from_node.get_parent() 28 | 29 | while(node.get_parent() != null): 30 | ancestors.append(node) 31 | node = node.get_parent() 32 | 33 | return ancestors 34 | 35 | 36 | ## Only works for native custom class not for GDScriptNativeClass 37 | ## Example NodePositioner.find_nodes_of_custom_class(self, MachineState) 38 | static func find_nodes_of_custom_class(node: Node, class_to_find: Variant) -> Array: 39 | var result := [] 40 | 41 | var childrens = node.get_children(true) 42 | 43 | for child: Node in childrens: 44 | if child.get_script() == class_to_find: 45 | result.append(child) 46 | else: 47 | result.append_array(find_nodes_of_custom_class(child, class_to_find)) 48 | 49 | return result 50 | 51 | ## Only works for native nodes like Area2D, Camera2D, etc. 52 | ## Example NodePositioner.find_nodes_of_type(self, Control.new()) 53 | static func find_nodes_of_type(node: Node, type_to_find: Node) -> Array: 54 | var result := [] 55 | 56 | var childrens = node.get_children(true) 57 | 58 | for child: Node in childrens: 59 | if child.is_class(type_to_find.get_class()): 60 | result.append(child) 61 | else: 62 | result.append_array(find_nodes_of_type(child, type_to_find)) 63 | 64 | return result 65 | 66 | 67 | ## Only works for native Godot Classes like Area3D, Camera2D, etc. 68 | ## Example NodeTraversal.first_node_of_type(self, Control.new()) 69 | static func first_node_of_type(node: Node, type_to_find: Node): 70 | if node.get_child_count() == 0: 71 | return null 72 | 73 | for child: Node in node.get_children(): 74 | if child.is_class(type_to_find.get_class()): 75 | type_to_find.free() 76 | return child 77 | 78 | type_to_find.free() 79 | 80 | return null 81 | 82 | ## Only works for native custom class not for GDScriptNativeClass 83 | ## Example NodeTraversal.first_node_of_custom_class(self, MachineState) 84 | static func first_node_of_custom_class(node: Node, class_to_find: GDScript): 85 | if node.get_child_count() == 0: 86 | return null 87 | 88 | for child: Node in node.get_children(): 89 | if child.get_script() == class_to_find: 90 | return child 91 | 92 | return null 93 | 94 | 95 | static func get_first_child(node: Node): 96 | var node_count := node.get_child_count() 97 | 98 | if node_count == 0: 99 | return null 100 | 101 | return node.get_child(0) 102 | 103 | 104 | static func get_last_child(node: Node): 105 | var node_count := node.get_child_count() 106 | 107 | if node_count == 0: 108 | return null 109 | 110 | return node.get_child(node_count - 1) 111 | 112 | 113 | static func first_child_node_in_group(node: Node, group: String): 114 | if node.get_child_count() == 0 || group.is_empty(): 115 | return null 116 | 117 | for child: Node in node.get_children(true): 118 | if child.is_in_group(group): 119 | return child 120 | 121 | return null 122 | 123 | 124 | static func hide_nodes(nodes: Array[Node] = []) -> void: 125 | for node: Node in nodes: 126 | if node.has_method("hide"): 127 | node.hide() 128 | 129 | 130 | static func show_nodes(nodes: Array[Node] = []) -> void: 131 | for node: Node in nodes: 132 | if node.has_method("show"): 133 | node.show() 134 | 135 | 136 | static func add_all_childrens_to_group(node: Node, group: String, filter: Array[Node] = []) -> void: 137 | for child: Node in get_all_children(node).filter(func(_node: Node): return not filter.has(_node)): 138 | child.add_to_group(group) 139 | 140 | 141 | static func remove_all_childrens_from_group(node: Node, group: String, filter: Array[Node] = []) -> void: 142 | for child: Node in get_all_children(node).filter(func(_node: Node): return not filter.has(_node) and _node.is_in_group(group)): 143 | child.remove_from_group(group) 144 | 145 | 146 | static func add_meta_to_all_children(node: Node, meta: String, value: Variant, filter: Array[Node] = []) -> void: 147 | for child: Node in get_all_children(node).filter(func(_node: Node): return not filter.has(_node)): 148 | child.set_meta(meta, value) 149 | 150 | 151 | static func remove_meta_from_all_children(node: Node, meta: String) -> void: 152 | for child: Node in get_all_children(node).filter(func(_node: Node): return _node.has_meta(meta)): 153 | child.remove_meta(meta) 154 | 155 | 156 | static func get_tree_depth(node: Node) -> int: 157 | var depth := 0 158 | 159 | while(node.get_parent() != null): 160 | depth += 1 161 | node = node.get_parent() 162 | 163 | return depth 164 | 165 | 166 | static func get_absolute_z_index(node: Node2D) -> int: 167 | var z: int = 0 168 | 169 | while node is Node2D: 170 | z += node.z_index 171 | 172 | if not node.z_as_relative: 173 | break 174 | 175 | node = node.get_parent() 176 | 177 | return z 178 | 179 | 180 | static func create_scene_from(root_node: Node) -> PackedScene: 181 | if is_instance_valid(root_node) and root_node.is_inside_tree(): 182 | var scene: PackedScene = PackedScene.new() 183 | 184 | for child: Node in get_all_children(root_node): 185 | child.owner = root_node 186 | 187 | scene.pack(root_node) 188 | 189 | return scene 190 | 191 | push_error("OmniKitNodeTraversal->create_scene_from: The root_node %s is not a valid instance or not is inside the scene tree, aborting..." % str(root_node)) 192 | 193 | return null 194 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/text/censorer.gd: -------------------------------------------------------------------------------- 1 | # This static class can filter the texts and remove most of the bad words 2 | class_name OmniKitCensorer 3 | 4 | 5 | const Rules: Array[String] = [ 6 | "n+([ehiy]+|ay|ey|io|[il]+)[bgq$]+h?(a+|aer|a+h+|a+r+|e+|ea|eoa|e+r+|ie|ier|let|lit|o|or|r+|u|uh|uhr|u+r+|ward|y+)s*", 7 | "f[ae]y?g+[oeiu]+t+s?", 8 | "даунская", 9 | "пидорасы", 10 | "ching\\W*chongs?", 11 | "n󠀡󠀡iggers", 12 | "re+t+a?r[dt]+s?", 13 | "towel\\W*heads?", 14 | "пидорка", 15 | "pac?k(i|ie|y)", 16 | "ting\\W*tongs?", 17 | "trann(ie|y)s?", 18 | "white\\W*trash", 19 | "ni:gg\\w*:\\w*", 20 | "chin(c|k)s?", 21 | "n+i+[gq]+s?", 22 | "yam\\W*yams?", 23 | "\\w*niggas?", 24 | "chinamans?", 25 | "polacke?s?", 26 | "neekeris?", 27 | "nigfhers?", 28 | "redskins?", 29 | "beaners?", 30 | "coolies?", 31 | "f+a+g+s*", 32 | "fenians?", 33 | "gringos?", 34 | "newfags?", 35 | "ni gg er", 36 | "nigga\\w*", 37 | "niggles?", 38 | "nignogs?", 39 | "rus+kis?", 40 | "wiggers?", 41 | "Ϝaggоt", 42 | "gypsies", 43 | "injuns?", 44 | "jiggas?", 45 | "nikkas?", 46 | "wiggas?", 47 | "\\w*fag", 48 | "coons?", 49 | "dykes?", 50 | "fa66ot", 51 | "fagts?", 52 | "gooks?", 53 | "gypos?", 54 | "homos?", 55 | "kikes?", 56 | "spics?", 57 | "abos?", 58 | "fgts?", 59 | "fаgs", 60 | "gypsy", 61 | "japs?", 62 | "wops?", 63 | "fagz", 64 | "fаg", 65 | "f@g", 66 | "\\w*N󠀡󠀡IGGE󠀡󠀡R\\w*", 67 | "\\w*ɴɪɢɢᴇʀ\\w*", 68 | "\\w*nіggеr\\w*", 69 | "\\w*NÍGGER\\w*", 70 | "\\w*n\\\\\\|gger\\w*", 71 | "\\w*niggеr\\w*", 72 | "\\w*F4GG0T\\w*", 73 | "\\w*N1GG3R\\w*", 74 | "\\w*nigger\\w*", 75 | "\\w*nigg4\\w*", 76 | "\\w*niggz\\w*", 77 | 78 | 79 | "fak(ed|ers?|ing)", 80 | "kompetenzteam", 81 | "派送员", 82 | "pinegrove", 83 | "n\\.e\\.ig\\.e\\.", 84 | "fukushima", 85 | "nie gee", 86 | "fuchsia", 87 | "fuchian", 88 | "cock\\.li", 89 | "fuxius", 90 | "fucuro", 91 | "niego", 92 | "niebo", 93 | "neige", 94 | "neggy", 95 | "nebby", 96 | "fuxis", 97 | "cwfag", 98 | "pubg", 99 | "niby", 100 | "nebo", 101 | "fuku", 102 | "fuki", 103 | "fakt", 104 | 105 | "(ape|bat|bull?|butt|dip|dog|dumb|ebo|holy|horse|jack|pedo|pig|ubi)\\W*sh(it|ti)s?", 106 | "d[il]+(ck|kc)\\W*(ass|bag|breath|eat|face|flip|head|hole|less|suck|weed)\\w*", 107 | "f[chj]?(a|au|aw|e|o+|u|uy)[ch]*k(e?d|e?rs?|[ei]?n+g?|t)", 108 | "m[aou](d+|t+|th|ht|z)(a|e|er|ir|ur)(c|f)c?[aou]c?k\\w*", 109 | "m[ou]th(a|er)(f|ph)[vue]+c?[gkqx]+(e?d|e?r|[ei]?n+g?)", 110 | "\\w*f[vu]+h*c+[hjvk]*(e?d|e?r|[ei]?n+g?|t)", 111 | "b+i+a*t+c+h+(e+d|e*r?[sz]+|[ei]?n+g?|y)", 112 | "\\w*f[vu]+c?[xkq]+(e?d|e?r|[ei]?n+g?|t)", 113 | "p(oo+|u+)s+(a+y+|e+|eh|ey|i+|ie|y+)s*", 114 | "m[ou]th(a|er)(f|ph)[vue]+c?[gkqx]+", 115 | "\\w*f[vu]+h*q(e?d|e?r|[ei]?n+g?|t)", 116 | "f[chj]?(a|au|aw|e|o+|u|uy)[ch]*k", 117 | "f[ck]+(e?d|e?r|[ei]?n+g?|t)", 118 | "fu󠀡󠀡cki󠀡󠀡ng", 119 | "dumb(f|ph)[vu]+c?[xkq]", 120 | "c(oc?|aw)k\\W*suc?k\\w*", 121 | "d[il]+(ck|kc)(ed|ing)", 122 | "ph[vu]+h*c+[hjvk]*\\w*", 123 | "son\\W*of\\W*a\\W*bitch", 124 | "долбоебизм", 125 | "c(o|ah|aw)c?k(s|ed)", 126 | "s+h+[ily]+t+[ersy]*", 127 | "a+ss+\\W*w?hole?\\w*", 128 | "ph[vu]+c?[xkq]+\\w*", 129 | "говноедов", 130 | "долбаебов", 131 | "ебланская", 132 | "ебланский", 133 | "заебёшься", 134 | "захуячили", 135 | "съебаться", 136 | "пидарский", 137 | "уебанский", 138 | "уебищьное", 139 | "f[vu]+c?[xkq]+\\w*", 140 | "bull+sh+[ily]+t+", 141 | "god\\W*damn?\\W*it", 142 | "ахуенная", 143 | "ахуенную", 144 | "ахуенный", 145 | "выебаное", 146 | "ебанному", 147 | "ебанутые", 148 | "ебланами", 149 | "пидарасы", 150 | "уёбищная", 151 | "уёбищный", 152 | "god\\W*damn?\\w*", 153 | "въебали", 154 | "въебать", 155 | "ебанная", 156 | "ебанное", 157 | "ебанных", 158 | "ебаного", 159 | "ебаньки", 160 | "ебонное", 161 | "заебала", 162 | "заебало", 163 | "поебень", 164 | "хуёвого", 165 | "a+ss+\\W*fu\\w*", 166 | "c(o|ah|aw)c?k", 167 | "d[il]+(ck|kc)", 168 | "b+i+a*t+c+h+", 169 | "butt\\W*fu\\w*", 170 | "cumm(er|ing)", 171 | "f[vu]+h*c\\w*", 172 | "f[vu]+h*q\\w*", 173 | "sh+i+[ae]+t+", 174 | "ахуели", 175 | "ебаная", 176 | "ебаное", 177 | "ебаной", 178 | "ебаную", 179 | "ебаные", 180 | "ебаный", 181 | "ебаным", 182 | "ебаных", 183 | "ебучий", 184 | "пиздеж", 185 | "пиздец", 186 | "сраная", 187 | "уёбища", 188 | "уёбище", 189 | "хуесос", 190 | "хуетой", 191 | "хуйнёй", 192 | "хуёвая", 193 | "хуёвый", 194 | "c+u+n+t+\\w*", 195 | "d+i+c+k+s*", 196 | "fucking", 197 | "блядь", 198 | "блять", 199 | "дохуя", 200 | "дрочи", 201 | "ебало", 202 | "ебать", 203 | "н4еб4л", 204 | "нахуй", 205 | "нахуя", 206 | "нехуй", 207 | "нихуя", 208 | "пизде", 209 | "пизду", 210 | "похуй", 211 | "уебёт", 212 | "хуета", 213 | "хуету", 214 | "хуйни", 215 | "хуйню", 216 | "хуйня", 217 | "ёбаны", 218 | "a+sholes?", 219 | "sh+e+i+t+", 220 | "ахуе", 221 | "ебал", 222 | "ебут", 223 | "сука", 224 | "хуям", 225 | "шлюх", 226 | "F\\.U\\.C\\.K", 227 | "chodes?", 228 | "cumshot", 229 | "fucking", 230 | "fuck", 231 | "shit\\w*", 232 | "shtpost", 233 | "who+re?", 234 | "cumbag", 235 | "jebane", 236 | "sluts?", 237 | "slutty", 238 | "twats?", 239 | "бля", 240 | "ебу", 241 | "хуи", 242 | "хуй", 243 | "хуя", 244 | "cums?", 245 | "dafuq", 246 | "diсk", 247 | "sh it", 248 | "coq+", 249 | "hore", 250 | "kock", 251 | "shat", 252 | "dik", 253 | "fck", 254 | "\\w*f+u+c+k+\\w*", 255 | "\\w*fцск\\w*", 256 | "\\w*shіtty\\w*", 257 | "\\w*f_uc_k\\w*", 258 | "^[a@][s\\$][s\\$]$", 259 | "[a@][s\\$][s\\$]h[o0][l1][e3][s\\$]?", 260 | ] 261 | 262 | 263 | static func filter_list(texts: Array[String] = [], censor_character: String = "*") -> Array[String]: 264 | var censored_texts: Array[String] = [] 265 | 266 | for text in texts: 267 | censored_texts.append(filter(text, censor_character)) 268 | 269 | return censored_texts 270 | 271 | 272 | static func filter(text: String, censor_character: String = "*") -> String: 273 | var new_text: String = text 274 | var regex = RegEx.new() 275 | 276 | for rule in Rules: 277 | regex.compile(rule) 278 | 279 | var result: RegExMatch = regex.search(new_text) 280 | 281 | if is_instance_valid(result): 282 | for profanity in result.strings: 283 | var censored_string: String = "" 284 | 285 | for _i in profanity.length(): 286 | censored_string += censor_character 287 | 288 | new_text = new_text.replace(profanity, censored_string) 289 | 290 | return new_text 291 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/content/names/repositories/fantasy/female_elf.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="OmniKitNameRepository" load_steps=2 format=3 uid="uid://dxiim7q7wrv27"] 2 | 3 | [ext_resource type="Script" uid="uid://cejilr31xj65q" path="res://addons/omnikit/src/helpers/content/names/name_repository.gd" id="1_nkesw"] 4 | 5 | [resource] 6 | script = ExtResource("1_nkesw") 7 | id = &"female_elf" 8 | use_shuffle_bag = true 9 | region = &"en" 10 | gender = 1 11 | names = Array[String](["Aeliana", "Aeriel", "Alavara", "Aleria", "Althaea", "Amastacia", "Amriel", "Anariel", "Andriel", "Anya", "Aranel", "Aredhel", "Ariana", "Ariel", "Arwen", "Astara", "Astel", "Avariel", "Ayla", "Belen", "Celebrian", "Celestia", "Cerin", "Daenys", "Dara", "Delwyn", "Elenwe", "Elowen", "Elyssa", "Enya", "Eolande", "Faelar", "Faelen", "Faelina", "Faeriel", "Finduilas", "Galadriel", "Hania", "Ilara", "Ilian", "Iolanthe", "Isolde", "Ithilwen", "Jessa", "Kaia", "Kella", "Kira", "Kyra", "Laelon", "Laenya", "Larael", "Lathien", "Lenore", "Liran", "Liriel", "Livia", "Lyra", "Lysandra", "Maeve", "Maelora", "Maia", "Maire", "Mariel", "Meryl", "Miriel", "Morwen", "Nayana", "Nessa", "Nienna", "Nuala", "Oriel", "Pella", "Rael", "Raelen", "Raina", "Renna", "Riannon", "Rielle", "Riona", "Rowan", "Sael", "Saelan", "Sariel", "Sephina", "Seraphina", "Sinya", "Sorrel", "Talia", "Tauriel", "Tinuviel", "Una", "Valen", "Vanya", "Vashanti", "Vilya", "Vivienne", "Wynafael", "Xylia", "Ylandra", "Yvaine", "Zelia", "Aelinor", "Aelwyn", "Alassë", "Almiel", "Amaraia", "Ancalimë", "Arinya", "Avalon", "Aylin", "Bregil", "Calaelen", "Calessë", "Carmiel", "Celebríaneth", "Ciriel", "Díriel", "Eärwen", "Eirien", "Elenna", "Elentári", "Ellinor", "Emerië", "Enfiel", "Erina", "Eruviel", "Fánaiel", "Fëanoriel", "Fíriel", "Gaelen", "Gwendolyn", "Hiril", "Írissë", "Íviel", "Laire", "Lalwendë", "Líniel", "Lómiel", "Lôsiel", "Lucieneth", "Lúthienel", "Mírielë", "Naimë", "Naliel", "Nessamelda", "Nienniel", "Olwen", "Palantírwen", "Quendië", "Ráma", "Ríniel", "Róis", "Saelindë", "Símael", "Síliel", "Talaniel", "Telchariel", "Tinwelindel", "Úmarth", "Vairë", "Valanya", "Vána", "Vardiel", "Yavániel", "Zirakíriel", "Adanel", "Aldalómë", "Amandil", "Anfauglith", "Arweniel", "Calacirië", "Celebrindal", "Elwingiel", "Eryniel", "Falasiel", "Fëanturi", "Glóriel", "Hadhodrond", "Ithilienwen", "Laurelinwen", "Lindiriel", "Lothlórienel", "Melianiel", "Nimlothiel", "Ossiriandel", "Silmarien", "Taurielwen", "Telperienel", "Undómiel", "Vanyariel", "Yavannaiel", "Zirakzigilwen", "Ailinel", "Alatariel", "Amandilwen", "Anfauglithiel", "Arwenundómiel", "Calaciryawen", "Celebrindaleth", "Elwingiel", "Erynlasgalen", "Falaselviel", "Fëanturiel", "Glórielwen", "Hadhodrondiel", "Ithilieneth", "Laurelineth", "Lindireth", "Lothlórieneth", "Melianeth", "Nimlothel", "Ossiriandeth", "Silmarieneth", "Taurielithil", "Telperieneth", "Undómielwen", "Vanyalindë", "Yavannalómë", "Zirakzigileth", "Ailinelda", "Alatarielda", "Amandilda", "Anfauglithda", "Arwenundómielda", "Calaciryawenda", "Celebrindalethda", "Elwingielda", "Erynlasgalenda", "Falaselvielda", "Fëanturielda", "Glórielwenda", "Hadhodrondda", "Ithilienethda", "Laurelinethda", "Lindirethda", "Lothlórienethda", "Melianethda", "Nimlothelda", "Ossiriandethda", "Silmarienethda", "Taurielithilda", "Telperienethda", "Undómielwenda", "Vanyalindëda", "Yavannalómëda", "Zirakzigilethda", "Ailineth", "Alatarieth", "Amandith", "Anfauglithth", "Arwenundómielth", "Calaciryawenth", "Celebrindalethth", "Elwingielth", "Erynlasgalenth", "Falaselvielth", "Fëanturielth", "Glórielwent", "Hadhodrondth", "Ithilienethth", "Laurelinethth", "Lindirethth", "Lothlórienethth", "Melianethth", "Nimlothelth", "Ossiriandethth", "Silmarienethth", "Taurielithilth", "Telperienethth", "Undómielwent", "Vanyalindëth", "Yavannalómëth", "Zirakzigilethth"]) 12 | surnames = Array[String](["Moonwhisper", "Sunstrider", "Starfall", "Shadowbrook", "Silverleaf", "Windrunner", "Nightshade", "Dawnflower", "Emberglow", "Frostmoon", "Riverwood", "Skywatcher", "Whisperwind", "Stonehaven", "Greenwood", "Brightstar", "Darkwood", "Sunpetal", "Snowdrift", "Stormblade", "Oakhaven", "Mistwalker", "Swiftarrow", "Ironwood", "Goldleaf", "Silversong", "Shadowmere", "Duskwalker", "Fireheart", "Icewind", "Brookwood", "Stargazer", "Windchaser", "Rockwood", "Emeraldleaf", "Moonglow", "Nightstalker", "Sunwhisper", "Snowflower", "Thunderbow", "Willowbrook", "Skywing", "Whisperstream", "Stonebridge", "Forestsong", "Brightmoon", "Darkshade", "Sunshadow", "Snowfall", "Lightningstrike", "Ashwood", "Mistral", "Swiftfoot", "Ironleaf", "Goldenleaf", "Silverstream", "Shadowfen", "Duskflower", "Flameheart", "Frostflower", "Creekwood", "Starwhisper", "Windrider", "Stonecliff", "Grovewood", "Moonshadow", "Nightwing", "Sunbloom", "Snowdrift", "Stormbringer", "Pinehaven", "Mistveil", "Swiftwing", "Ironbark", "Goldstream", "Silvershadow", "Shadowbrook", "Dawnwhisper", "Firefly", "Iceheart", "Lakeview", "Skyfire", "Whisperwood", "Stonefist", "Greenleaf", "Brightflower", "Darkstream", "Sunrider", "Snowflake", "Thunderstrike", "Birchwood", "Mistflower", "Swiftstream", "Ironbranch", "Goldenwing", "Silverbrook", "Shadowfell", "Duskwing", "Firestorm", "Icewalker", "Hillcrest", "Starstream", "Windwalker", "Stonegrove", "Forestwalker", "Moonrider", "Nightflower", "Sunwalker", "Snowstream", "Lightningarrow", "Rowanwood", "Mistshadow", "Swiftshadow", "Ironstream", "Goldenshadow", "Silverwing", "Shadowvine", "Duskstream", "Flamekissed", "Frostwalker", "Valeview", "Skywhisper", "Whisperwing", "Stonearrow", "Greenbrook", "Brightwing", "Darkrider", "Sunwing", "Snowdrift", "Stormchaser", "Elmwood", "Mistwing", "Swiftwalker", "Ironwing", "Goldwalker", "Silverleaf", "Shadowwalker", "Duskrider", "Firewalker", "Icewing", "Meadowbrook", "Starwalker", "Windshadow", "Stoneleaf", "Forestwing", "Moonwalker", "Nightrider", "Sunshadow", "Snowwalker", "Lightningwing", "Oakwood", "Mistrider", "Swiftwind", "Ironwood", "Goldleaf", "Silverstream", "Shadowstream", "Dawnwalker", "Firewing", "Icechaser", "Riverbend", "Skywalker", "Whisperrider", "Stonebrook", "Greenwalker", "Brightrider", "Darkwing", "Sunstream", "Snowrider", "Thunderwing", "Willowwood", "Mistwalker", "Swiftwing", "Ironleaf", "Goldwing", "Silverwalker", "Shadowrider", "Duskwalker", "Firewalker", "Icewalker", "Ashbrook", "Starwing", "Windwalker", "Stonegrove", "Forestrider", "Moonwalker", "Nightstream", "Sunwalker", "Snowwing", "Lightningrider", "Pinebrook", "Mistrider", "Swiftshadow", "Ironwalker", "Goldwalker", "Silverstream", "Shadowwing", "Duskstream", "Firestream", "Icewing"]) 13 | metadata/_custom_type_script = "uid://cejilr31xj65q" 14 | -------------------------------------------------------------------------------- /addons/omnikit/src/helpers/files/file_helper.gd: -------------------------------------------------------------------------------- 1 | class_name OmniKitFileHelper 2 | 3 | 4 | static func filepath_is_valid(path: String) -> bool: 5 | return not path.is_empty() and path.is_absolute_path() and ResourceLoader.exists(path) 6 | 7 | 8 | static func dirpath_is_valid(path: String) -> bool: 9 | return not path.is_empty() and path.is_absolute_path() and DirAccess.dir_exists_absolute(path) 10 | 11 | 12 | static func directory_exist_on_executable_path(directory_path: String) -> bool: 13 | var real_path: String = OS.get_executable_path().get_base_dir().path_join(directory_path) 14 | var directory: DirAccess = DirAccess.open(real_path) 15 | var open_error: Error = DirAccess.get_open_error() 16 | 17 | if open_error != OK: 18 | push_error("OmniKitFileHelper>directory_exist_on_executable_path: An error (%d | %s) while opening directory path '%s'" % [open_error, error_string(open_error), real_path]) 19 | return false 20 | 21 | return true 22 | 23 | 24 | ## Supports RegEx expressions 25 | static func get_files_recursive(path: String, regex: RegEx = null) -> Array[String]: 26 | if path.is_empty() or not DirAccess.dir_exists_absolute(path): 27 | push_error("OmniKitFileHelper>get_files_recursive: directory not found '%s'" % path) 28 | 29 | return [] 30 | 31 | var files: Array[String] = [] 32 | var directory: DirAccess = DirAccess.open(path) 33 | var error: Error = DirAccess.get_open_error() 34 | 35 | if error != OK: 36 | push_error("OmniKitFileHelper->get_files_recursive: An error %d %s happened when loading files from directory %s" % [error, error_string(error), path]) 37 | return [] 38 | 39 | if directory: 40 | directory.list_dir_begin() 41 | var file := directory.get_next() 42 | 43 | while file != "": 44 | if directory.current_is_dir(): 45 | files += get_files_recursive(directory.get_current_dir().path_join(file), regex) 46 | else: 47 | var file_path = directory.get_current_dir().path_join(file) 48 | 49 | if regex != null: 50 | if regex.search(file_path): 51 | files.append(file_path) 52 | else: 53 | files.append(file_path) 54 | 55 | file = directory.get_next() 56 | 57 | return files 58 | else: 59 | push_error("OmniKitFileHelper->get_files_recursive: An error %s occured when trying to open directory: %s" % [DirAccess.get_open_error(), path]) 60 | return [] 61 | 62 | 63 | static func copy_directory_recursive(from_dir :String, to_dir :String) -> Error: 64 | if not DirAccess.dir_exists_absolute(from_dir): 65 | push_error("OmniKitFileHelper->copy_directory_recursive: directory not found '%s'" % from_dir) 66 | return ERR_DOES_NOT_EXIST 67 | 68 | if not DirAccess.dir_exists_absolute(to_dir): 69 | var err: Error = DirAccess.make_dir_recursive_absolute(to_dir) 70 | if err != OK: 71 | push_error("OmniKitFileHelper->copy_directory_recursive: Can't create directory '%s'. Error: %s" % [to_dir, error_string(err)]) 72 | return err 73 | 74 | var source_dir: DirAccess = DirAccess.open(from_dir) 75 | var dest_dir: DirAccess = DirAccess.open(to_dir) 76 | 77 | if source_dir != null: 78 | source_dir.list_dir_begin() 79 | var next: String = "." 80 | 81 | while next != "": 82 | next = source_dir.get_next() 83 | if next == "" or next == "." or next == "..": 84 | continue 85 | var source := source_dir.get_current_dir() + "/" + next 86 | var dest := dest_dir.get_current_dir() + "/" + next 87 | 88 | if source_dir.current_is_dir(): 89 | copy_directory_recursive(source + "/", dest) 90 | continue 91 | 92 | var err: Error = source_dir.copy(source, dest) 93 | 94 | if err != OK: 95 | push_error("OmniKitFileHelper->copy_directory_recursive: Error checked copy file '%s' to '%s'" % [source, dest]) 96 | return err 97 | 98 | return OK 99 | else: 100 | push_error("OmniKitFileHelper->copy_directory_recursive: Directory not found: " + from_dir) 101 | return ERR_DOES_NOT_EXIST 102 | 103 | 104 | static func remove_files_recursive(path: String, regex: RegEx = null) -> Error: 105 | var directory: DirAccess = DirAccess.open(path) 106 | 107 | if DirAccess.get_open_error() == OK: 108 | directory.list_dir_begin() 109 | 110 | var file_name = directory.get_next() 111 | 112 | while file_name != "": 113 | if directory.current_is_dir(): 114 | remove_files_recursive(directory.get_current_dir().path_join(file_name), regex) 115 | else: 116 | if regex != null: 117 | if regex.search(file_name): 118 | directory.remove(file_name) 119 | else: 120 | directory.remove(file_name) 121 | 122 | file_name = directory.get_next() 123 | 124 | directory.remove(path) 125 | 126 | return OK 127 | else: 128 | var error: Error = DirAccess.get_open_error() 129 | push_error("OmniKitFileHelper->remove_recursive: An error %s happened open directory: %s " % [error_string(error), path]) 130 | 131 | return error 132 | 133 | 134 | static func get_pck_files(path: String) -> Array: 135 | var regex = RegEx.new() 136 | regex.compile(".pck$") 137 | 138 | return get_files_recursive(path, regex) 139 | 140 | 141 | static func get_resource_files(path: String) -> Array: 142 | var regex = RegEx.new() 143 | regex.compile(".res$") 144 | 145 | return get_files_recursive(path, regex) 146 | 147 | 148 | static func get_scene_files(path: String) -> Array: 149 | var regex = RegEx.new() 150 | regex.compile(".tscn$") 151 | 152 | return get_files_recursive(path, regex) 153 | 154 | 155 | static func get_script_files(path: String) -> Array: 156 | var regex = RegEx.new() 157 | regex.compile(".gd$") 158 | 159 | return get_files_recursive(path, regex) 160 | 161 | 162 | static func get_shader_files(path: String) -> Array: 163 | var regex = RegEx.new() 164 | regex.compile(".gdshader$") 165 | 166 | return get_files_recursive(path, regex) 167 | 168 | 169 | static func uid_to_file(uid: String) -> String: 170 | if uid.begins_with("uid:"): 171 | var id: int = ResourceUID.text_to_id(uid) 172 | 173 | if ResourceUID.has_id(id): 174 | return ResourceUID.get_id_path(id) 175 | 176 | return "" 177 | 178 | 179 | static func desktop_dir() -> String: 180 | return OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP) 181 | 182 | 183 | static func documents_dir() -> String: 184 | return OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS) 185 | 186 | 187 | static func pictures_dir() -> String: 188 | return OS.get_system_dir(OS.SYSTEM_DIR_PICTURES) 189 | 190 | 191 | static func downloads_dir() -> String: 192 | return OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS) 193 | -------------------------------------------------------------------------------- /addons/omnikit/src/logger/logger.gd: -------------------------------------------------------------------------------- 1 | ## Referenced from https://forum.godotengine.org/t/how-to-use-the-new-logger-class-in-godot-4-5/127006 2 | class_name OmnikitLogger extends Logger 3 | 4 | const MaxQueueSize: int = 20 5 | const FileExtension: String = ".log" 6 | 7 | const EventColors: Dictionary[Event, String] = { 8 | Event.Info: "lime_green", 9 | Event.Warning: "gold", 10 | Event.SystemError: "tomato", 11 | Event.Critical: "crimson", 12 | } 13 | 14 | enum Event { 15 | Info, 16 | Warning, 17 | SystemError, 18 | Critical, 19 | Flush 20 | } 21 | 22 | static var DefaultFilePath: String = OS.get_user_data_dir() + "/logs" 23 | static var _mutex: Mutex = Mutex.new() 24 | static var _event_strings: PackedStringArray = Event.keys() 25 | static var _message_queue: PackedStringArray 26 | static var _queue_size: int: 27 | set(value): 28 | _queue_size = clampi(value, 0, MaxQueueSize) 29 | 30 | static var _log_path: String 31 | static var _is_valid: bool = false 32 | static var current_logger: OmnikitLogger 33 | 34 | 35 | static func _static_init() -> void: 36 | enable() 37 | 38 | 39 | static func enable() -> void: 40 | _log_path = _create_log_file() 41 | _message_queue.resize(MaxQueueSize) 42 | _is_valid = not _log_path.is_empty() and _message_queue.size() == MaxQueueSize 43 | current_logger = OmnikitLogger.new() 44 | OS.add_logger(current_logger) 45 | 46 | 47 | static func disable() -> bool: 48 | if current_logger: 49 | OS.remove_logger(current_logger) 50 | return true 51 | 52 | return false 53 | 54 | 55 | static func _create_log_file() -> String: 56 | var file_name: String = Time.get_date_string_from_system() + FileExtension 57 | var file_path: String = DefaultFilePath + "/%s" % file_name 58 | var file: FileAccess = FileAccess.open(file_path, FileAccess.WRITE) 59 | 60 | return file_path if file else "" 61 | 62 | 63 | ## Tracking player progression, state changes, or routine successful actions. 64 | static func info(message: String) -> void: 65 | if not _is_valid: 66 | return 67 | 68 | var event: Event = Event.Info 69 | message = _format_log_message(message, event) 70 | 71 | _add_message_to_queue(message, event) 72 | _print_event(message, event) 73 | 74 | 75 | ## Notifying of non-critical issues (e.g., missing resource files, deprecated calls) that don't halt execution. 76 | static func warn(message: String) -> void: 77 | if not _is_valid: 78 | return 79 | 80 | var event: Event = Event.Warning 81 | message = _format_log_message(message, event) 82 | 83 | _add_message_to_queue(message, event) 84 | _print_event(message, event) 85 | 86 | 87 | ## Logging application errors, failed API calls, or issues that prevent intended functionality. Includes a script backtrace. 88 | static func error(message: String) -> void: 89 | if not _is_valid: 90 | return 91 | 92 | var event: Event = Event.SystemError 93 | message = _format_log_message(message, event) 94 | 95 | var script_backtraces: Array[ScriptBacktrace] = Engine.capture_script_backtraces() 96 | 97 | if not script_backtraces.is_empty(): 98 | message += '\n' + str(script_backtraces.front()) 99 | 100 | _add_message_to_queue(message, event) 101 | _print_event(message, event) 102 | 103 | ## Logging failures that may lead to instability or immediate crashes. Includes a script backtrace. 104 | static func critical(message: String) -> void: 105 | if not _is_valid: 106 | return 107 | 108 | var event: Event = Event.Critical 109 | message = _format_log_message(message, event) 110 | 111 | var script_backtraces: Array[ScriptBacktrace] = Engine.capture_script_backtraces() 112 | 113 | if not script_backtraces.is_empty(): 114 | message += '\n' + str(script_backtraces.front()) 115 | 116 | _add_message_to_queue(message, event) 117 | _print_event(message, event) 118 | 119 | 120 | static func force_flush() -> void: 121 | _add_message_to_queue("", Event.Flush) 122 | 123 | 124 | func _log_error(function: String, file: String, line: int, code: String, rationale: String, editor_notify: bool, error_type: int, script_backtraces: Array[ScriptBacktrace]) -> void: 125 | if not _is_valid: 126 | return 127 | 128 | var event: Event = Event.Warning if error_type == ERROR_TYPE_WARNING else Event.SystemError 129 | var message: String = "[{time}] {event}: {rationale}\n{code}\n{file}:{line} @ {function}()".format({ 130 | "time": Time.get_time_string_from_system(), 131 | "event": _event_strings[event], 132 | "rationale": rationale, 133 | "code": code, 134 | "file": file, 135 | "line": line, 136 | "function": function, 137 | }) 138 | 139 | _add_message_to_queue(message, event) 140 | 141 | 142 | func _log_message(message: String, is_error: bool) -> void: 143 | if not _is_valid: 144 | return 145 | 146 | var event: Event = Event.SystemError if is_error else Event.Info 147 | message = _format_log_message(message.trim_suffix('\n'), event) 148 | 149 | if is_error: 150 | var script_backtraces: Array[ScriptBacktrace] = Engine.capture_script_backtraces() 151 | 152 | if not script_backtraces.is_empty(): 153 | message += '\n' + str(script_backtraces.front()) 154 | 155 | _add_message_to_queue(message, event) 156 | 157 | 158 | static func _format_log_message(message: String, event: Event) -> String: 159 | return "[{time}] {event}: {message}".format({ 160 | "time": Time.get_datetime_string_from_system(), 161 | "event": _event_strings[event], 162 | "message": message, 163 | }) 164 | 165 | 166 | static func _add_message_to_queue(message: String, event: Event) -> void: 167 | _mutex.lock() 168 | 169 | if not _is_valid: 170 | _mutex.unlock() 171 | return 172 | 173 | if not message.is_empty(): 174 | _message_queue[_queue_size] = message 175 | _queue_size += 1 176 | 177 | if _queue_size >= MaxQueueSize or event == Event.Flush: 178 | _is_valid = _flush() 179 | _queue_size = 0 180 | 181 | _mutex.unlock() 182 | 183 | 184 | static func _flush() -> bool: 185 | var file: FileAccess = FileAccess.open(_log_path, FileAccess.READ_WRITE) 186 | 187 | if file == null: 188 | return false 189 | 190 | file.seek_end() 191 | 192 | for message: int in range(_queue_size): 193 | if not file.store_line(_message_queue[message]): 194 | return false 195 | 196 | return true 197 | 198 | 199 | static func _print_event(message: String, event: Event) -> void: 200 | var message_lines: PackedStringArray = message.split('\n') 201 | 202 | message_lines[0] = "[b][color=%s]%s[/color][/b]" % [EventColors[event], message_lines[0]] 203 | print_rich.call_deferred("[lang=tlh]%s[/lang]" % '\n'.join(message_lines)) 204 | -------------------------------------------------------------------------------- /addons/omnikit/src/autoloads/gamepad/gamepad_controller_manager.gd: -------------------------------------------------------------------------------- 1 | # Nintendo switch pro controllers does not work yet https://github.com/godotengine/godot/issues/81191 2 | extends Node 3 | 4 | signal controller_connected(device_id, controller_name: String) 5 | signal controller_disconnected(device_id, previous_controller_name: String, controller_name: String) 6 | 7 | const DeviceGeneric: StringName = &"generic" 8 | const DeviceKeyboard: StringName = &"keyboard" 9 | const DeviceXboxController: StringName = &"xbox" 10 | const DeviceSwitchController: StringName = &"switch" 11 | const DeviceSwitchJoyconLeftController: StringName = &"switch_left_joycon" 12 | const DeviceSwitchJoyconRightController: StringName = &"switch_right_joycon" 13 | const DevicePlaystationController: StringName = &"playstation" 14 | const DeviceLunaController: StringName = &"luna" 15 | const DeviceSteamDeckController: StringName = &"steam" 16 | 17 | const XboxButtonLabels: Array[String] = ["A", "B", "X", "Y", "Back", "Home", "Menu", "Left Stick", "Right Stick", "Left Shoulder", "Right Shoulder", "Up", "Down", "Left", "Right", "Share"] 18 | const SwitchButtonLabels: Array[String] = ["B", "A", "Y", "X", "-", "", "+", "Left Stick", "Right Stick", "Left Shoulder", "Right Shoulder", "Up", "Down", "Left", "Right", "Capture"] 19 | const PlaystationButtonLabels: Array[String] = ["Cross", "Circle", "Square", "Triangle", "Select", "PS", "Options", "L3", "R3", "L1", "R1", "Up", "Down", "Left", "Right", "Microphone"] 20 | const SteamdeckButtonLabels: Array[String] = ["A", "B", "X", "Y", "View", "", "Options", "Left Stick Press", "Right Stick Press", "Left Shoulder", "Right Shoulder", "Up", "Down", "Left", "Right"] 21 | 22 | const DefaultVibrationStrength: float = 0.5 23 | const DefaultVibrationDuration: float = 0.65 24 | 25 | var current_controller_guid 26 | var current_controller_device := DeviceKeyboard 27 | var current_controller_name: String = "Keyboard" 28 | var current_device_id: int = 0 29 | var connected: bool = false 30 | 31 | 32 | func _notification(what: int) -> void: 33 | if what in [NOTIFICATION_PREDELETE, NOTIFICATION_EXIT_TREE]: 34 | Input.stop_joy_vibration(current_device_id) 35 | 36 | 37 | func _enter_tree() -> void: 38 | process_thread_group = PROCESS_THREAD_GROUP_SUB_THREAD 39 | process_thread_messages = FLAG_PROCESS_THREAD_MESSAGES 40 | 41 | Input.joy_connection_changed.connect(on_joy_connection_changed) 42 | 43 | 44 | func _ready() -> void: 45 | for joypad in joypads(): 46 | print_rich("Found joypad #%d: [b]%s[/b] - %s" % [joypad, Input.get_joy_name(joypad), Input.get_joy_guid(joypad)]) 47 | 48 | 49 | func has_joypad() -> bool: 50 | return joypads().size() > 0 51 | 52 | ## Array of device ids 53 | func joypads() -> Array[int]: 54 | return Input.get_connected_joypads() 55 | 56 | 57 | func start_controller_vibration(weak_strength = DefaultVibrationStrength, strong_strength = DefaultVibrationStrength, duration = DefaultVibrationDuration): 58 | if not current_controller_is_keyboard() and has_joypad(): 59 | Input.start_joy_vibration(current_device_id, weak_strength, strong_strength, duration) 60 | 61 | 62 | func stop_controller_vibration(): 63 | if not current_controller_is_keyboard() and has_joypad(): 64 | Input.stop_joy_vibration(current_device_id) 65 | 66 | 67 | func update_current_controller(device: int, controller_name: String) -> void: 68 | ##https://github.com/mdqinc/SDL_GameControllerDB 69 | current_controller_guid = Input.get_joy_guid(device) 70 | current_device_id = device 71 | current_controller_name = controller_name 72 | 73 | match controller_name: 74 | "Steam", "SteamOS": 75 | current_controller_device = DeviceSteamDeckController 76 | "Luna Controller": 77 | current_controller_device = DeviceLunaController 78 | "XInput", "XInput Gamepad", "Xbox One For Windows", "Xbox Series Controller", "Xbox 360 Controller", \ 79 | "Xbox One Controller": 80 | current_controller_device = DeviceXboxController 81 | "Sony DualSense","Nacon Revolution Unlimited Pro Controller",\ 82 | "PS3 Controller", "PS4 Controller", "PS5 Controller": 83 | current_controller_device = DevicePlaystationController 84 | "Steam Virtual Gamepad": 85 | current_controller_device = DeviceGeneric 86 | "Switch","Switch Controller","Nintendo Switch Pro Controller",\ 87 | "Faceoff Deluxe Wired Pro Controller for Nintendo Switch": 88 | current_controller_device = DeviceSwitchController 89 | "Joy-Con (L)": 90 | current_controller_device = DeviceSwitchJoyconLeftController 91 | "Joy-Con (R)": 92 | current_controller_device = DeviceSwitchJoyconRightController 93 | _: 94 | current_controller_device = DeviceKeyboard 95 | current_controller_name = "Keyboard" 96 | 97 | 98 | #region Controller detectors 99 | func current_controller_is_generic() -> bool: 100 | return current_controller_device == DeviceGeneric 101 | 102 | 103 | func current_controller_is_steam_deck() -> bool: 104 | return current_controller_device == DeviceSteamDeckController 105 | 106 | func current_controller_is_luna() -> bool: 107 | return current_controller_device == DeviceLunaController 108 | 109 | 110 | func current_controller_is_keyboard() -> bool: 111 | return current_controller_device == DeviceKeyboard 112 | 113 | 114 | func current_controller_is_playstation() -> bool: 115 | return current_controller_device == DevicePlaystationController 116 | 117 | 118 | func current_controller_is_xbox() -> bool: 119 | return current_controller_device == DeviceXboxController 120 | 121 | 122 | func current_controller_is_switch() -> bool: 123 | return current_controller_device == DeviceSwitchController 124 | 125 | 126 | func current_controller_is_switch_joycon() -> bool: 127 | return current_controller_device in [DeviceSwitchJoyconLeftController, DeviceSwitchJoyconRightController] 128 | 129 | 130 | func current_controller_is_switch_joycon_right() -> bool: 131 | return current_controller_device == DeviceSwitchJoyconRightController 132 | 133 | 134 | func current_controller_is_switch_joycon_left() -> bool: 135 | return current_controller_device == DeviceSwitchJoyconLeftController 136 | #endregion 137 | 138 | 139 | func on_joy_connection_changed(device_id: int, joy_connected: bool): 140 | var previous_controller_name: String = current_controller_name 141 | update_current_controller(device_id, Input.get_joy_name(device_id) if joy_connected else "") 142 | 143 | if joy_connected: 144 | controller_connected.emit(device_id, current_controller_name) 145 | print_rich("[color=green]Found newly connected joypad #%d: [b]%s[/b] - %s[/color]" % [device_id, Input.get_joy_name(device_id), Input.get_joy_guid(device_id)]) 146 | else: 147 | controller_disconnected.emit(device_id, previous_controller_name, current_controller_name) 148 | print_rich("[color=red]Disconnected joypad [b]%s[/b] with id #%d[/color]" % [previous_controller_name, device_id]) 149 | --------------------------------------------------------------------------------