From 0ddbcf77447adcd14623f76908003ad4e6d78e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Balogh=20Kriszti=C3=A1n?= Date: Wed, 29 Jul 2026 00:05:40 +0200 Subject: [PATCH] major refactor + concept - refactored the main player controller script into smaller components for readability - refactored the file structure and added folder coloring - added lore and concept for future reference --- concept/breadwinner/.obsidian/app.json | 3 + concept/breadwinner/.obsidian/appearance.json | 4 + .../breadwinner/.obsidian/core-plugins.json | 33 + concept/breadwinner/.obsidian/graph.json | 22 + .../themes/Obsidianite/manifest.json | 7 + .../.obsidian/themes/Obsidianite/theme.css | 1481 +++++++++++++++++ concept/breadwinner/.obsidian/workspace.json | 245 +++ concept/breadwinner/TLDR/MVP Assets.md | 10 + concept/breadwinner/TLDR/MVP Functionality.md | 8 + concept/breadwinner/TLDR/MVP.md | 2 + .../concepts and lore/Base gameplay.md | 11 + .../concepts and lore/Multiplayer.md | 5 + .../concepts and lore/Singleplayer.md | 1 + concept/breadwinner/entities/IT.md | 12 + concept/breadwinner/entities/PlayerEntity.md | 3 + concept/breadwinner/entities/Serbreads.md | 6 + .../breadwinner/game mechanics/Clipboard.md | 5 + .../breadwinner/game mechanics/Day cycle.md | 15 + .../breadwinner/game mechanics/Smartwatch.md | 3 + .../game mechanics/THE NARRATOR.md | 10 + .../game mechanics/The PSA system.md | 9 + .../game mechanics/The pawn shop.md | 73 + .../game mechanics/The safe zone computer.md | 14 + .../game mechanics/The safe zone.md | 15 + .../breadwinner/thing groups/!Group rules.md | 11 + concept/breadwinner/thing groups/Entity.md | 0 .../breadwinner/thing groups/Equippable.md | 24 + concept/breadwinner/thing groups/Grabbable.md | 13 + concept/breadwinner/thing groups/Player.md | 44 + maps/dev_map.tscn | 2 +- player/player_manager.gd | 419 ----- project.godot | 12 + {player => scenes/player}/grab_prompt.tscn | 2 +- {player => scenes/player}/in_game_menu.tscn | 6 +- .../player}/in_game_menu_manager.gd | 0 .../player}/in_game_menu_manager.gd.uid | 0 scenes/player/input_controller_component.gd | 95 ++ .../player/input_controller_component.gd.uid | 1 + scenes/player/movement_component.gd | 100 ++ scenes/player/movement_component.gd.uid | 1 + {player => scenes/player}/player.tscn | 72 +- scenes/player/player_manager.gd | 109 ++ .../player}/player_manager.gd.uid | 0 scenes/player/player_properties.gd | 22 + scenes/player/player_properties.gd.uid | 1 + {player => scenes/player}/player_ui.tscn | 4 +- .../player}/player_ui_manager.gd | 0 .../player}/player_ui_manager.gd.uid | 0 .../procedural_camera_mover_component.gd | 96 ++ .../procedural_camera_mover_component.gd.uid | 1 + scenes/player/sound_controller_component.gd | 69 + .../player/sound_controller_component.gd.uid | 1 + scenes/player/state_handler_component.gd | 30 + scenes/player/state_handler_component.gd.uid | 1 + scenes/player/ui_handler_component.gd | 72 + scenes/player/ui_handler_component.gd.uid | 1 + {player => shaders}/blur_shader.gdshader | 0 {player => shaders}/blur_shader.gdshader.uid | 0 58 files changed, 2773 insertions(+), 433 deletions(-) create mode 100644 concept/breadwinner/.obsidian/app.json create mode 100644 concept/breadwinner/.obsidian/appearance.json create mode 100644 concept/breadwinner/.obsidian/core-plugins.json create mode 100644 concept/breadwinner/.obsidian/graph.json create mode 100644 concept/breadwinner/.obsidian/themes/Obsidianite/manifest.json create mode 100644 concept/breadwinner/.obsidian/themes/Obsidianite/theme.css create mode 100644 concept/breadwinner/.obsidian/workspace.json create mode 100644 concept/breadwinner/TLDR/MVP Assets.md create mode 100644 concept/breadwinner/TLDR/MVP Functionality.md create mode 100644 concept/breadwinner/TLDR/MVP.md create mode 100644 concept/breadwinner/concepts and lore/Base gameplay.md create mode 100644 concept/breadwinner/concepts and lore/Multiplayer.md create mode 100644 concept/breadwinner/concepts and lore/Singleplayer.md create mode 100644 concept/breadwinner/entities/IT.md create mode 100644 concept/breadwinner/entities/PlayerEntity.md create mode 100644 concept/breadwinner/entities/Serbreads.md create mode 100644 concept/breadwinner/game mechanics/Clipboard.md create mode 100644 concept/breadwinner/game mechanics/Day cycle.md create mode 100644 concept/breadwinner/game mechanics/Smartwatch.md create mode 100644 concept/breadwinner/game mechanics/THE NARRATOR.md create mode 100644 concept/breadwinner/game mechanics/The PSA system.md create mode 100644 concept/breadwinner/game mechanics/The pawn shop.md create mode 100644 concept/breadwinner/game mechanics/The safe zone computer.md create mode 100644 concept/breadwinner/game mechanics/The safe zone.md create mode 100644 concept/breadwinner/thing groups/!Group rules.md create mode 100644 concept/breadwinner/thing groups/Entity.md create mode 100644 concept/breadwinner/thing groups/Equippable.md create mode 100644 concept/breadwinner/thing groups/Grabbable.md create mode 100644 concept/breadwinner/thing groups/Player.md delete mode 100644 player/player_manager.gd rename {player => scenes/player}/grab_prompt.tscn (95%) rename {player => scenes/player}/in_game_menu.tscn (91%) rename {player => scenes/player}/in_game_menu_manager.gd (100%) rename {player => scenes/player}/in_game_menu_manager.gd.uid (100%) create mode 100644 scenes/player/input_controller_component.gd create mode 100644 scenes/player/input_controller_component.gd.uid create mode 100644 scenes/player/movement_component.gd create mode 100644 scenes/player/movement_component.gd.uid rename {player => scenes/player}/player.tscn (77%) create mode 100644 scenes/player/player_manager.gd rename {player => scenes/player}/player_manager.gd.uid (100%) create mode 100644 scenes/player/player_properties.gd create mode 100644 scenes/player/player_properties.gd.uid rename {player => scenes/player}/player_ui.tscn (96%) rename {player => scenes/player}/player_ui_manager.gd (100%) rename {player => scenes/player}/player_ui_manager.gd.uid (100%) create mode 100644 scenes/player/procedural_camera_mover_component.gd create mode 100644 scenes/player/procedural_camera_mover_component.gd.uid create mode 100644 scenes/player/sound_controller_component.gd create mode 100644 scenes/player/sound_controller_component.gd.uid create mode 100644 scenes/player/state_handler_component.gd create mode 100644 scenes/player/state_handler_component.gd.uid create mode 100644 scenes/player/ui_handler_component.gd create mode 100644 scenes/player/ui_handler_component.gd.uid rename {player => shaders}/blur_shader.gdshader (100%) rename {player => shaders}/blur_shader.gdshader.uid (100%) diff --git a/concept/breadwinner/.obsidian/app.json b/concept/breadwinner/.obsidian/app.json new file mode 100644 index 0000000..6abe4c1 --- /dev/null +++ b/concept/breadwinner/.obsidian/app.json @@ -0,0 +1,3 @@ +{ + "alwaysUpdateLinks": true +} \ No newline at end of file diff --git a/concept/breadwinner/.obsidian/appearance.json b/concept/breadwinner/.obsidian/appearance.json new file mode 100644 index 0000000..aecdda0 --- /dev/null +++ b/concept/breadwinner/.obsidian/appearance.json @@ -0,0 +1,4 @@ +{ + "cssTheme": "Obsidianite", + "theme": "obsidian" +} \ No newline at end of file diff --git a/concept/breadwinner/.obsidian/core-plugins.json b/concept/breadwinner/.obsidian/core-plugins.json new file mode 100644 index 0000000..639b90d --- /dev/null +++ b/concept/breadwinner/.obsidian/core-plugins.json @@ -0,0 +1,33 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "footnotes": false, + "properties": true, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": true, + "bases": true, + "webviewer": false +} \ No newline at end of file diff --git a/concept/breadwinner/.obsidian/graph.json b/concept/breadwinner/.obsidian/graph.json new file mode 100644 index 0000000..0ddc945 --- /dev/null +++ b/concept/breadwinner/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 0.7132754626224407, + "close": true +} \ No newline at end of file diff --git a/concept/breadwinner/.obsidian/themes/Obsidianite/manifest.json b/concept/breadwinner/.obsidian/themes/Obsidianite/manifest.json new file mode 100644 index 0000000..e090605 --- /dev/null +++ b/concept/breadwinner/.obsidian/themes/Obsidianite/manifest.json @@ -0,0 +1,7 @@ +{ + "name": "Obsidianite", + "version": "2.0.2", + "minAppVersion": "1.1.0", + "author": "@bennyxguo", + "authorUrl": "https://github.com/bennyxguo" +} diff --git a/concept/breadwinner/.obsidian/themes/Obsidianite/theme.css b/concept/breadwinner/.obsidian/themes/Obsidianite/theme.css new file mode 100644 index 0000000..867a5a9 --- /dev/null +++ b/concept/breadwinner/.obsidian/themes/Obsidianite/theme.css @@ -0,0 +1,1481 @@ +/** --------------------------------------------------------------- +** ██████╗ ██████╗ ███████╗██╗██████╗ ██╗ █████╗ ███╗ ██╗██╗████████╗███████╗ +** ██╔═══██╗██╔══██╗██╔════╝██║██╔══██╗██║██╔══██╗████╗ ██║██║╚══██╔══╝██╔════╝ +** ██║ ██║██████╔╝███████╗██║██║ ██║██║███████║██╔██╗ ██║██║ ██║ █████╗ +** ██║ ██║██╔══██╗╚════██║██║██║ ██║██║██╔══██║██║╚██╗██║██║ ██║ ██╔══╝ +** ╚██████╔╝██████╔╝███████║██║██████╔╝██║██║ ██║██║ ╚████║██║ ██║ ███████╗ +** ╚═════╝ ╚═════╝ ╚══════╝╚═╝╚═════╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚══════╝ +** —— Version 2.1.0 +** —— Made with 💎 by Benny Guo +** Changes Log @see: https://github.com/bennyxguo/Obsidian-Obsidianite/blob/main/CHANGELOG.md +** --------------------------------------------------------------- */ + +/****************************************** + Currently only comes in dark theme, + Light theme is still working in progress, + but it wil come soon or later. +******************************************/ + +/* .theme-light { + --background-primary: #fbfbfb; + --background-primary-alt: #fbfbfb; + --background-secondary: #fbfbfb; + --background-secondary-alt: #2e3236; + --text-normal: #333; + --text-faint: #b2b2b2; + --text-title-h1: #333; + --text-title-h2: #333; + --text-title-h3: #333; + --text-title-h4: #333; + --text-title-h5: #333; + --text-link: #b4b4b4; + --text-a: #db4d52; + --text-a-hover: #db4d52; + --text-mark: #d3ffa4; + --pre-code: #ffffff; + --interactive-accent: #92a1a1; + --interactive-before: #5e6565; + --background-modifier-border: #92a1a17a; + --blockquote-border: #d6555f; + --tag-background: rgba(14, 210, 247, 0.15); + --interactive-accent-rgb: 61, 215, 251; + --font-family-editor: Avenir, 'Avenir Next'; + --font-family-preview: Avenir, 'Avenir Next'; +} */ + +.theme-dark { + --background-primary: #100e17; + --background-primary-alt: #0d0b12; + --background-secondary: #191621; + --background-secondary-alt: #0d0b12; + --text-normal: #bebebe; + --text-accent: #0fb6d6; + --text-sub-accent: #f4569d; + --text-dim: #45aaff; + --text-faint: #7aa2f7; + --text-title-h1: var(--text-accent); + --text-title-h2: #cbdbe5; + --text-title-h3: #cbdbe5; + --text-title-h4: #cbdbe5; + --text-title-h5: #cbdbe5; + --text-link: #b4b4b4; + --text-a: #6bcafb; + --text-a-hover: #6bcafb; + --text-mark: #263d92; + --code-background: var(--background-secondary); + --interactive-accent: rgba(14, 210, 247, 0.5); + --interactive-accent-hover: rgba(14, 210, 247, 0.8); + --interactive-before: #5e6565; + --blockquote-border: #4aa8fb; + --tag-background: rgba(14, 210, 247, 0.15); + --interactive-accent-rgb: #3dd7fb; + --font-family-editor: 'Rubik'; + --font-family-preview: 'Rubik'; + --bg-sub-accent-55: rgba(244, 86, 157, 0.55); + --bg-accent-55: rgba(14, 210, 247, 0.55); + --bg-accent-25: rgba(14, 210, 247, 0.25); + --text-highlight-bg: rgba(244, 86, 157, 0.25); + --background-modifier-border: rgba(14, 210, 247, 0.05); + --table-border-color: rgb(14, 210, 247, 0.15); + --test-color: rgb(122, 162, 247); + --editor-border-color: #101014; +} + +/****************************************** +** ██████╗██╗ ██╗███████╗████████╗ ██████╗ ███╗ ███╗██╗███████╗███████╗ +** ██╔════╝██║ ██║██╔════╝╚══██╔══╝██╔═══██╗████╗ ████║██║╚══███╔╝██╔════╝ +** ██║ ██║ ██║███████╗ ██║ ██║ ██║██╔████╔██║██║ ███╔╝ █████╗ +** ██║ ██║ ██║╚════██║ ██║ ██║ ██║██║╚██╔╝██║██║ ███╔╝ ██╔══╝ +** ╚██████╗╚██████╔╝███████║ ██║ ╚██████╔╝██║ ╚═╝ ██║██║███████╗███████╗ +** ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚══════╝╚══════╝ +** —— You can customized the theme using the variables below +******************************************/ + +:root { + /***************************************/ + /* FONTS RELATED */ + /***************************************/ + + /** Font Customization **/ + --default-font: 'Rubik', 'Glow Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, + Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; + + --default-font-size: 18px; + + /** Main text font weight **/ + --body-font-weight: 450; + + /** Font family for hash-tags **/ + --tag-font-family: 'OperatorMonoSSmLig-Book', 'Glow Sans SC', '华文细黑', 'STXihei', 'PingFang TC', + '微软雅黑体', 'Microsoft YaHei New', '微软雅黑', 'Microsoft Yahei', '宋体', 'SimSun', + 'Helvetica Neue', 'Helvetica', Arial, sans-serif !important; + + /** Font specially for codes **/ + --code-mono-font: 'OperatorMonoSSmLig-Book'; +} + +/**-------------------** +| CUSTOMIZED TAG COLOURS +**--------------------**/ + +/* For preview mode */ +a.tag[href*='#todo'], +a.tag[href*='#待完成'] { + background-color: #be2e5e; + color: #fff; +} +/* For Editor Mode */ +.cm-s-obsidian .CodeMirror-line span.cm-tag-todo:not(.cm-formatting-hashtag) { + color: #ee6a96; +} + +a.tag[href*='#working-draft'], +a.tag[href*='#进行中'] { + background-color: #4d3ca6; + color: #fff; +} + +.cm-s-obsidian .CodeMirror-line span.cm-tag-working-draft:not(.cm-formatting-hashtag) { + color: #a897ff; +} + +a.tag[href*='#notes'], +a.tag[href*='#笔记'] { + background-color: #17b978; + color: #fff; +} + +.cm-s-obsidian .CodeMirror-line span.cm-tag-notes:not(.cm-formatting-hashtag) { + color: #45e0a2; +} + +a.tag[href*='#knowledge'], +a.tag[href*='#知识'] { + background-color: #005792; + color: #fff; +} + +.cm-s-obsidian .CodeMirror-line span.cm-tag-knowledge:not(.cm-formatting-hashtag) { + color: #6cbdf3; +} + +a.tag[href*='#writing'], +a.tag[href*='#文章'] { + background-color: #f95959; + color: #fff; +} + +.cm-s-obsidian .CodeMirror-line span.cm-tag-writing:not(.cm-formatting-hashtag) { + color: #ff7a7a; +} + +a.tag[href*='#ideas'], +a.tag[href*='#想法'] { + background-color: #ffc93c; + color: #000; +} + +.cm-s-obsidian .CodeMirror-line span.cm-tag-ideas:not(.cm-formatting-hashtag) { + color: #ffdc82; +} + +/************************************** +| GENERAL STYLES +| ------------------------------------- +| Obsidian main controls related. +/**************************************/ + +::-webkit-scrollbar { + opacity: 1; + width: 0.6rem; +} + +::-webkit-scrollbar-thumb { + background-color: var(--background-modifier-border); + border-radius: 999px; +} + +::-webkit-scrollbar-track, +::-webkit-scrollbar-track-piece { + background: var(--background-secondary); +} + +.markdown-preview-view .internal-link.is-unresolved { + opacity: 0.7; +} + +.titlebar { + background-color: var(--background-primary-alt); +} + +.status-bar { + background-color: var(--background-primary-alt); + border-color: #101014; + color: var(--text-faint); + position: absolute; + margin: auto; + right: 0; + bottom: 0; + display: flex; + align-items: center; + border-top-left-radius: 8px; + padding: 8px 6px 6px 10px; + max-height: unset; + + opacity: 0.4; + transition: 0.5s; +} + +.status-bar:hover { + opacity: 1; + transition: 0.2s; +} + +.titlebar-text { + color: var(--text-accent); +} + +.theme-dark .notice { + background-color: var(--background-primary-alt); + color: var(--text-accent); +} + +/** NAVIGATION / SIDE-DOCK **/ +.nav-file-title, +.nav-folder-title { + border: 1px solid transparent; +} + +.nav-folder-collapse-indicator { + color: var(--text-accent); +} +.nav-file.is-active > .nav-file-title, +.nav-file.is-active > .nav-folder-title, +.nav-file.is-active > .nav-folder-collapse-indicator, +.nav-folder.is-active > .nav-file-title, +.nav-folder.is-active > .nav-folder-title, +.nav-folder.is-active > .nav-folder-collapse-indicator { + color: var(--text-accent); +} + +/** Side-dock icons **/ +.side-dock-ribbon-tab, +.side-dock-ribbon-action, +.workspace-ribbon-collapse-btn, +.workspace-tab-header { + transition: all 350ms ease-in-out; + opacity: 0.5; + cursor: pointer; +} +.side-dock-ribbon-tab:hover, +.side-dock-ribbon-action:hover, +.workspace-ribbon-collapse-btn:hover, +.workspace-tab-header:hover { + opacity: 1; + color: var(--text-accent); +} + +/** Left side menu -- collapsed **/ +.workspace-ribbon.is-collapsed { + background-color: var(--background-primary-alt); +} +/** Left side menu border **/ +.workspace-ribbon.mod-left.is-collapsed, +.workspace-ribbon.mod-right.is-collapsed { + border-color: var(--editor-border-color); +} + +/** Navigation tabs **/ +.is-focused .workspace-tab-header.is-active { + opacity: 1; +} + +.is-focused .mod-active .workspace-tab-header.is-active .workspace-tab-header-inner-icon, +.is-focused .mod-active .workspace-tab-header.is-active .workspace-tab-header-inner-title { + background: var(--background-modifier-border); + color: var(--text-accent); +} + +.nav-file-title.is-active, +.nav-folder-title.is-active { + background: var(--background-secondary); + border: 1px solid var(--bg-accent-25); + color: var(--text-accent); +} + +body:not(.is-grabbing) .nav-file-title:hover, +body:not(.is-grabbing) .nav-folder-title:hover { + background: var(--background-modifier-border); + border: 1px solid var(--interactive-accent-hover); +} + +/** Folder Lists **/ +body:not(.is-grabbing) .nav-file-title:hover, +body:not(.is-grabbing) .nav-folder-title:hover { + color: var(--text-accent); +} +/** Folder list active arrow **/ +body:not(.is-grabbing) .nav-file-title:hover .nav-folder-collapse-indicator, +body:not(.is-grabbing) .nav-folder-title:hover .nav-folder-collapse-indicator { + color: var(--text-accent); +} +/** Folder List main title **/ +.nav-folder.mod-root > .nav-file-title, +.nav-folder.mod-root > .nav-folder-title { + color: var(--text-accent); +} + +/** View Header title **/ +.workspace-leaf.mod-active .view-header-title { + color: var(--text-accent); +} + +/** Little tag styles (at links) **/ +.pane-list-item:hover .pane-list-item-ending-flair { + background-color: var(--background-secondary); + color: var(--text-accent); +} + +/** SETTINGS STYLES **/ +.checkbox-container.is-enabled { + background-color: rgba(14, 210, 247, 0.7); +} + +.workspace-drop-overlay { + background-color: var(--background-primary-alt); +} + +/* except list markers */ +span.cm-formatting-list, +/*code block backticks */ span.cm-formatting-code-block.cm-hmd-codeblock, +/* optionally header hashes */ span.cm-formatting-header { + display: inline !important; +} + +/***************************************/ +/* EDITOR GENERAL STYLES */ +/***************************************/ + +.markdown-source-view.mod-cm6 .task-list-label { + position: relative; + top: -2px; + padding-top: 0; +} + +/* OBSIDIANITE CHECKBOXES */ + +.contains-task-list .task-list-item .contains-task-list { + padding-inline-start: 5px; +} + +.contains-task-list .task-list-item ul.contains-task-list::before { + left: -46px !important; + border-width: 2px; +} + +.contains-task-list .task-list-item { + position: relative; + vertical-align: middle; + box-sizing: border-box; + padding-left: 30px; +} + +.markdown-preview-view ul > li.task-list-item { + text-indent: -3em; +} + +.contains-task-list .task-list-item input[type='checkbox'] { + position: relative; + top: 2px; + left: -8px; + width: 20px; + height: 20px; + margin: 0; + opacity: 0; + z-index: 10; +} + +.markdown-preview-view .list-collapse-indicator { + margin-left: -80px !important; + box-sizing: border-box; +} + +.contains-task-list .task-list-item::before { + content: ''; + position: absolute; + top: 2px; + left: -25px; + width: 20px; + height: 20px; + display: inline-flex; + justify-content: center; + border: 2px solid #9e9e9e; + margin-right: 15px; + border-radius: 3px; + transition: all 0.3s; + box-sizing: border-box; + z-index: 1; +} + +.contains-task-list .is-checked.task-list-item::before { + border: 10px solid var(--text-accent); + animation: bounce 300ms; +} + +.contains-task-list .is-checked.task-list-item::after { + content: ''; + position: absolute; + top: 8px; + left: -21px; + border-right: 3px solid transparent; + border-bottom: 3px solid transparent; + transform: rotate(45deg); + transform-origin: 0% 100%; + animation: checked-box 125ms 250ms forwards; + z-index: 5; +} + +.markdown-preview-view ul > li.task-list-item.is-checked { + text-decoration: line-through !important; + color: var(--interactive-accent) !important; +} + +.markdown-preview-view ul > li.task-list-item.is-checked ul > li:not(.is-checked) { + text-decoration: none !important; + color: var(--text-normal) !important; +} + +@keyframes checked-box { + 0% { + width: 0; + height: 0; + border-color: #212121; + transform: translate(0, 0) rotate(45deg); + } + 33% { + width: 4px; + height: 0; + border-color: #212121; + transform: translate(0, 0) rotate(45deg); + } + 100% { + width: 4px; + height: 8px; + border-color: #212121; + transform: translate(0, -8px) rotate(45deg); + } +} + +@keyframes bounce { + 0% { + border-width: 2px; + /* transform: scale(1); */ + } + 33% { + border-width: 4px; + /* transform: scale(0.7); */ + } + 100% { + border-width: 10px; + /* transform: scale(1); */ + } +} + +/************************************** +| MAIN EDITOR / PREVIEW MODE +| ------------------------------------- +| Write in the same section to keep them +| relatively sync with css. +/**************************************/ + +/**-------------------** +| HEADING STYLES +**--------------------**/ +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: var(--default-font); + font-weight: 600; +} + +.HyperMD-header.HyperMD-header-2, +.HyperMD-header.HyperMD-header-3, +.HyperMD-header.HyperMD-header-4, +.HyperMD-header.HyperMD-header-5, +.HyperMD-header.HyperMD-header-6 { + border-bottom: 1px solid; + border-width: 1px; + border-image-slice: 1; + border-image-source: linear-gradient(to right, var(--text-sub-accent), #100e17, #100e17, #100e17); +} + +.HyperMD-header { + padding: 20px; +} + +.markdown-preview-section h1, +.cm-header-1 { + font-size: 34px; + color: var(--text-title-h1); +} + +.markdown-preview-section h2, +.cm-header-2 { + font-size: 26px; + color: var(--text-title-h2); +} + +.markdown-preview-section h3, +.cm-header-3 { + font-size: 22px; + color: var(--text-title-h3); +} + +.markdown-preview-section h4, +.cm-header-4 { + font-size: 18px; + color: var(--text-title-h4); +} + +.markdown-preview-section h5, +.cm-header-5 { + font-size: 18px; + color: var(--text-title-h5); +} + +.markdown-preview-section h6, +.cm-header-6 { + font-size: 18px; + color: var(--text-title-h5); +} + +/** headings */ +.markdown-preview-view h2, +.markdown-preview-view h3, +.markdown-preview-view h4, +.markdown-preview-view h5, +.markdown-preview-view h6 { + /* padding-top: 1.25rem; */ + margin: 45px 0 20px 0; + position: relative; + padding-bottom: 10px; + border-bottom: 1px solid; + border-width: 35%; + border-image-slice: 1; + border-image-source: linear-gradient(to right, var(--text-sub-accent), #100e17, #100e17, #100e17); +} + +.view-header-icon { + color: var(--text-accent); +} + +/** Adding different # colors **/ + +.cm-formatting.cm-formatting-header.cm-header { + color: var(--text-accent); + opacity: 0.45; +} + +/**-------------------** +| HR STYLES +**--------------------**/ + +/** hr styles -- PREVIEW MODE */ +.cm-line hr, +.markdown-preview-view hr { + margin-block-start: 4em; + margin-block-end: 4em; + border: none; + height: 0; + border-bottom: 1px solid; + border-image-slice: 1; + border-width: 1px; + border-image-source: linear-gradient(to right, transparent, var(--text-accent), transparent); +} + +.cm-line hr::after, +.markdown-preview-view hr::after { + content: '§'; + display: inline-block; + position: absolute; + left: 50%; + transform: translate(-50%, -50%) rotate(60deg); + transform-origin: 50% 50%; + padding: 0.5rem; + color: var(--text-sub-accent); + background-color: var(--background-primary); +} + +/**-------------------** +| STRONG/BOLD STYLES +**--------------------**/ + +.cm-strong, +strong { + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + padding: 0; + color: #7aa2f7; + background-color: #7aa2f7; + background-image: linear-gradient(62deg, #87c2fd 0%, #dcb9fc 100%) !important; +} + +strong .math.math-inline .MathJax { + position: inherit !important; +} + +.cm-strong .cm-selection, +strong::selection { + -webkit-text-fill-color: var(--text-faint); +} + +/**-------------------** +| STYLING +**--------------------**/ + +.cm-strong kbd, +strong kbd { + -webkit-text-fill-color: initial; +} + +/**-------------------** +| ITALIC STYLES +**--------------------**/ + +.cm-em, +em { + color: #bb9af7 !important; + font-family: OperatorMonoSSmLig-Book, Rubik, var(--default-font) !important; +} + +.cm-em.cm-formatting-em { + display: inline-flex; + width: 0.45rem; + font-size: 0.6rem; + vertical-align: text-top; +} + +/**-------------------** +| LISTING STYLES (ul, li, ol) +**--------------------**/ + +.cm-s-obsidian span.cm-formatting-list { + color: var(--text-accent); +} + +.markdown-source-view.mod-cm6 .cm-indent::before { + border-width: 2px; + border-color: var(--text-accent); + margin-left: -1px; + opacity: 0.35; + transition: opacity 500ms linear ease-in-out; +} + +.markdown-source-view.mod-cm6 .cm-active-indent::before { + opacity: 0.8; +} + +/**-------------------** +| LINKS STYLING +**--------------------**/ + +/** editor mode **/ +.cm-s-obsidian span.cm-link:not(.cm-formatting-link) .cm-underline, +.cm-s-obsidian span.cm-hmd-internal-link .cm-underline { + color: var(--text-normal); + -webkit-text-fill-color: var(--text-normal); + background-position: 0 100%; + background-repeat: repeat-x; + background-size: 5px 5px; + text-decoration: none; +} + +cm-s-obsidian span.cm-link:not(.cm-formatting-link) .cm-underline { + background-image: linear-gradient( + to bottom, + var(--bg-sub-accent-55) 0%, + var(--bg-sub-accent-55) 100% + ); +} + +.cm-s-obsidian span.cm-formatting-link { + color: var(--text-faint) !important; + opacity: 0.25; +} + +/** preview mode **/ +.external-link { + padding: 0; +} + +.internal-link, +.external-link { + color: var(--text-normal); + background-position: 0 100%; + background-repeat: repeat-x; + background-size: 5px 5px; + text-decoration: none; + transition: background 350ms ease-in-out; +} + +.cm-s-obsidian span.cm-link:not(.cm-formatting-link) .cm-underline, +.external-link { + background-image: linear-gradient( + to bottom, + var(--bg-sub-accent-55) 0%, + var(--bg-sub-accent-55) 100% + ); + transition: background 350ms ease-in-out; +} + +.cm-s-obsidian span.cm-hmd-internal-link .cm-underline, +.internal-link { + background-image: linear-gradient(to bottom, var(--bg-accent-55) 0%, var(--bg-accent-55) 100%); + transition: background 350ms ease-in-out; +} + +.internal-link:hover, +.cm-s-obsidian span.cm-hmd-internal-link .cm-underline:hover { + -webkit-text-fill-color: #fff; + color: #fff; + background-size: 4px 50px; + text-decoration-line: none !important; +} + +.cm-s-obsidian span.cm-link:not(.cm-formatting-link) .cm-underline:hover, +.external-link:hover { + -webkit-text-fill-color: #fff; + color: #fff; + background-size: 4px 50px; + text-decoration-line: none !important; +} + +/* link */ +a, +.internal-link, +.cm-hmd-internal-link, +.cm-link { + text-decoration: none !important; + color: var(--text-normal); + position: relative; + z-index: 1; +} + +.cm-url { + color: var(--text-faint) !important; + opacity: 0.4; + font-weight: normal; +} + +.cm-formatting-image { + color: var(--text-accent) !important; + opacity: 0.7; +} + +/* link hover color */ +a:hover, +.internal-link:hover { + text-decoration: none !important; + color: var(--text-accent); +} + +/**-------------------** +| TAG STYLING +**--------------------**/ + +.cm-s-obsidian span.cm-hashtag { + position: relative; + color: var(--text-accent); + opacity: 1; + font-family: var(--tag-font-family); + font-style: italic; + text-decoration: none; + font-size: 0.86rem; + font-weight: 500; +} + +.cm-s-obsidian span.cm-hashtag:hover { + text-decoration-line: underline; + text-decoration-color: var(--text-accent); +} + +.cm-s-obsidian span.cm-formatting-hashtag { + color: var(--text-faint); +} + +/** tags */ +a.tag { + background-color: var(--tag-background); + color: var(--text-accent); + white-space: nowrap; + border-radius: var(--tag-radius); + padding: var(--tag-padding-y) var(--tag-padding-x); + font-family: var(--tag-font-family); + text-decoration: none; + font-style: italic; + font-size: 0.86rem; + font-weight: 500; +} + +a.tag:hover { + border-color: var(--text-accent); + opacity: 1; + background-color: var(--tag-background) !important; + text-decoration: underline !important; + text-decoration-color: var(--text-accent); +} + +h1 a.tag, +h2 a.tag, +h3 a.tag, +h4 a.tag, +h5 a.tag, +h6 a.tag { + font-size: inherit !important; +} + +/**-------------------** +| INLINE CODE STYLING +**--------------------**/ + +.CodeMirror-activeline + span.cm-inline-code:not(.cm-formatting):not(.cm-hmd-indented-code):not( + .obsidian-search-match-highlight + ) { + padding: 0 !important; + margin: 0 !important; +} + +.cm-s-obsidian span.cm-inline-code { + color: rgba(14, 210, 247, 0.9) !important; +} + +.cm-s-obsidian span.cm-inline-code.cm-formatting-code { + display: inline-flex; + min-width: 0.55rem; +} + +/**-------------------** +| HIGHLIGHTING STYLES +**--------------------**/ + +.cm-s-obsidian span.cm-formatting-highlight, +.cm-s-obsidian span.cm-highlight { + background-image: none !important; + background-color: var(--text-highlight-bg); + color: #fff; + -webkit-text-fill-color: #fff; + -webkit-background-clip: initial; +} + +/**-------------------** +| CODE FENCE STYLING +**--------------------**/ + +.cm-s-obsidian span.code-block-flair:not(:empty) { + color: var(--text-accent); + font-weight: 600; + text-transform: uppercase; + font-size: 0.6rem; + background: rgba(16, 14, 23, 0.86); + border-radius: 8px; + padding: 0.1em 0.8em; + margin-top: 0.3rem; + margin-right: 0.3rem; +} + +.cm-s-obsidian pre.HyperMD-codeblock { + color: var(--text-sub-accent); +} + +.cm-s-obsidian div.HyperMD-codeblock-bg { + background-color: #191621; +} + +.cm-s-obsidian div.HyperMD-codeblock-begin-bg { + border-top-left-radius: 0.3em; + border-top-right-radius: 0.3em; + border: none; +} + +.cm-s-obsidian div.HyperMD-codeblock-begin-bg:before { + position: absolute; + content: ''; + top: -5%; + left: 0; + width: 100%; + height: 60%; + margin-top: 1.5em; + border-top-left-radius: 0.3em; + border-top-right-radius: 0.3em; + background-color: #191621; +} + +.cm-s-obsidian div.HyperMD-codeblock-end-bg { + border-bottom-left-radius: 0.3em; + border-bottom-right-radius: 0.3em; + border: none; +} + +pre { + position: relative; +} + +pre[class*='language-']:before { + font-family: Rubik, Lato, Lucida Grande, Lucida Sans Unicode, Tahoma, Sans-Serif; + font-style: normal; + font-weight: 700; + font-size: 0.6rem; + color: #fff; + position: absolute; + top: 0.3rem; + right: 0.3rem; + padding: 0; + color: var(--text-accent) !important; + content: ''; + text-transform: uppercase; + background: rgba(16, 14, 23, 0.86); + border-radius: 8px; + padding: 0.1em 0.8em; + z-index: 10; +} + +pre[class$='javascript']:before, +pre[class$='js']:before { + content: 'JavaScript'; +} + +pre[class$='typescript']:before, +pre[class$='ts']:before { + content: 'typescript'; +} + +pre[class$='html']:before { + content: 'html'; +} + +pre[class$='css']:before { + content: 'css'; +} + +pre[class$='ejs']:before { + content: 'ejs'; +} + +pre[class$='vue']:before { + content: 'vue'; +} + +pre[class$='react']:before { + content: 'react'; +} + +pre[class$='shell']:before { + content: 'Shell'; +} + +pre[class$='powershell']:before { + content: 'PowerShell'; +} + +pre[class$='json']:before { + content: 'Json'; +} + +pre[class$='python']:before { + content: 'python'; +} + +/**-------------------** +| BLOCKQUOTE STYLING +**--------------------**/ + +/* Remove blockquote left margin */ +blockquote { + margin-inline-start: 0; +} + +/* blockquote style overwrite */ + +.markdown-source-view.mod-cm6.is-live-preview .HyperMD-quote, +.markdown-preview-view blockquote { + position: relative; + padding: 1rem 2rem 1rem 3rem; + color: #bdbdbd; + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; + margin-bottom: 2em; + margin-right: 0 !important; + border-left: 3px rgba(14, 210, 247, 0.5) solid; + border-top: transparent; + border-bottom: transparent; + border-right: transparent; + background: linear-gradient(135deg, rgba(32, 28, 41, 0.45), #100e17); +} + +.markdown-source-view.mod-cm6.is-live-preview .HyperMD-quote::before, +.markdown-preview-view blockquote::before { + content: ''; + position: absolute; + top: 0; + left: 0px; + height: 2px; + width: 60%; + background: linear-gradient(90deg, rgba(13, 185, 215, 0.5), #13111a); +} + +.markdown-source-view.mod-cm6.is-live-preview .HyperMD-quote + .HyperMD-quote::before { + display: none; +} + +.HyperMD-quote::after, +.markdown-preview-view blockquote::after { + content: ''; + position: absolute; + bottom: 0; + left: 0px; + height: 2px; + width: 25%; + background: linear-gradient(90deg, rgba(13, 185, 215, 0.5), #15131c); +} + +.HyperMD-quote.HyperMD-quote-2::before, +.HyperMD-quote.HyperMD-quote-3::before, +.HyperMD-quote.HyperMD-quote-4::before, +.HyperMD-quote.HyperMD-quote-5::before { + height: 0; +} + +.markdown-preview-view blockquote p { + position: relative; +} + +.markdown-preview-view blockquote p:first-of-type::before { + content: '!!'; + font-style: italic; + font-weight: 700; + font-size: 18px; + color: var(--text-accent); + position: absolute; + top: 0.1rem; + left: -1.8rem; +} + +/**-------------------** +| FRONT-META STYLING +**--------------------**/ + +.cm-s-obsidian span.cm-def, +.cm-s-obsidian span.cm-atom { + color: var(--text-faint); +} +.cm-s-obsidian span.cm-meta { + color: var(--text-accent); +} + +.cm-s-obsidian span.cm-string { + color: var(--text-sub-accent); +} + +/**-------------------** +| CODE STYLING +**--------------------**/ + +/** inline code */ +.cm-s-obsidian + span.cm-inline-code:not(.cm-formatting):not(.cm-hmd-indented-code):not( + .obsidian-search-match-highlight + ), +.markdown-preview-view code { + overflow-wrap: break-word; + background-color: rgba(14, 210, 247, 0.05); + word-wrap: break-word; + padding: 0 5px; + border-radius: 0.3rem; + color: rgba(14, 210, 247, 0.9) !important; +} + +.theme-dark :not(pre) > code[class*='language-'], +.theme-dark pre[class*='language-'] { + background-color: var(--background-secondary); +} + +.markdown-preview-view img { + border-radius: 8px; +} + +/** code syntax theme **/ + +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-comment { + color: #6272a4; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-string, +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-string-2 { + color: #f1fa8c; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-number { + color: #bd93f9; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-variable { + color: #50fa7b; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-variable-2 { + color: white; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-def { + color: #50fa7b; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-operator { + color: #ff79c6; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-keyword { + color: #ff79c6; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-atom { + color: #bd93f9; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-meta { + color: #f8f8f2; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-tag { + color: #ff79c6; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-attribute { + color: #50fa7b; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-qualifier { + color: #50fa7b; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-property { + color: #66d9ef; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-builtin { + color: #50fa7b; +} +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-variable-3, +.theme-dark .cm-s-obsidian pre.HyperMD-codeblock span.cm-type { + color: #ffb86c; +} + +/** prism.js dracular theme **/ + +/* +* Dracula Theme for Prism.JS +* +* @author Gustavo Costa +* e-mail: gusbemacbe@gmail.com +* +* @contributor Jon Leopard +* e-mail: jonlprd@gmail.com +* +* @license MIT 2016-2018 +*/ + +pre::-webkit-scrollbar { + width: 14px; +} + +code[class*='language-'], +pre[class*='language-'] { + color: #ccc; + background: rgb(40, 41, 54); + text-shadow: none; + font-family: 'OperatorMonoSSmLig-Book', PT Mono, Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', + monospace !important; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*='language-']::-moz-selection, +pre[class*='language-'] ::-moz-selection, +code[class*='language-']::-moz-selection, +code[class*='language-'] ::-moz-selection { + text-shadow: none; + background-color: #5a5f80; +} + +pre[class*='language-']::selection, +pre[class*='language-'] ::selection, +code[class*='language-']::selection, +code[class*='language-'] ::selection { + text-shadow: none; + background-color: #5a5f80; +} + +@media print { + code[class*='language-'], + pre[class*='language-'] { + text-shadow: none; + } +} + +/* Code blocks */ +:not(pre) > code[class*='language-'], +pre[class*='language-'] { + background: rgba(40, 41, 54, 1); +} + +/* Inline code */ +:not(pre) > code[class*='language-'] { + padding: 4px 7px; + border-radius: 0.3em; + white-space: normal; +} + +.limit-300 { + height: 300px !important; +} + +.limit-400 { + height: 400px !important; +} + +.limit-500 { + height: 500px !important; +} + +.limit-600 { + height: 600px !important; +} + +.limit-700 { + height: 700px !important; +} + +.limit-800 { + height: 800px !important; +} + +.theme-dark .token.comment { + color: rgba(98, 114, 164, 1); +} + +.theme-dark .token.prolog { + color: rgba(207, 207, 194, 1); +} + +.theme-dark .token.tag { + color: rgba(220, 104, 170, 1); +} + +.theme-dark .token.entity { + color: rgba(139, 233, 253, 1); +} + +.theme-dark .token.atrule { + color: rgba(98, 239, 117, 1); +} + +.theme-dark .token.url { + color: rgba(102, 217, 239, 1); +} + +.theme-dark .token.selector { + color: rgba(207, 207, 194, 1); +} + +.theme-dark .token.string { + color: rgba(241, 250, 140, 1); +} + +.theme-dark .token.property { + color: rgba(255, 184, 108, 1); +} + +.theme-dark .token.important { + color: rgba(255, 121, 198, 1); + font-weight: bold; +} + +.theme-dark .token.punctuation { + color: white; +} + +.theme-dark .token.number { + color: rgba(189, 147, 249, 1); +} + +.theme-dark .token.function { + color: rgba(80, 250, 123, 1); +} + +.theme-dark .token.class-name { + color: rgba(255, 184, 108, 1); +} + +.theme-dark .token.keyword { + color: rgba(255, 121, 198, 1); +} + +.theme-dark .token.boolean { + color: rgba(255, 184, 108, 1); +} + +.theme-dark .token.operator { + color: rgba(139, 233, 253, 1); +} + +.theme-dark .token.char { + color: rgba(255, 135, 157, 1); +} + +.theme-dark .token.regex { + color: rgba(80, 250, 123, 1); +} + +.theme-dark .token.variable { + color: rgba(80, 250, 123, 1); +} + +.theme-dark .token.constant { + color: rgba(255, 184, 108, 1); +} + +.theme-dark .token.symbol { + color: rgba(255, 184, 108, 1); +} + +.theme-dark .token.builtin { + color: rgba(255, 121, 198, 1); +} + +.theme-dark .token.attr-value { + color: #7ec699; +} + +.theme-dark .token.deleted { + color: #e2777a; +} + +.theme-dark .token.namespace { + color: #e2777a; +} + +.theme-dark .token.bold { + font-weight: bold; +} + +.theme-dark .token.italic { + font-style: italic; +} + +.theme-dark .token { + color: #ff79c6; +} + +.language-cpp .theme-dark .token.string { + color: #8be9fd; +} + +.language-c .theme-dark .token.string { + color: #8be9fd; +} + +.theme-dark .language-css .token.selector { + color: rgba(80, 250, 123, 1); +} + +.theme-dark .language-css .token.property { + color: rgba(255, 184, 108, 1); +} + +.language-java span.theme-dark .token.class-name { + color: #8be9fd; +} + +.language-java .theme-dark .token.class-name { + color: #8be9fd; +} + +.language-markup .theme-dark .token.attr-value { + color: rgba(102, 217, 239, 1); +} + +.language-markup .theme-dark .token.tag { + color: rgba(80, 250, 123, 1); +} + +.language-objectivec .theme-dark .token.property { + color: #66d9ef; +} + +.language-objectivec .theme-dark .token.string { + color: #50fa7b; +} + +.language-php .theme-dark .token.boolean { + color: #8be9fd; +} + +.language-php .theme-dark .token.function { + color: #ff79c6; +} + +.language-php .theme-dark .token.keyword { + color: #66d9ef; +} + +.language-ruby .theme-dark .token.symbol { + color: #8be9fd; +} + +.language-ruby .theme-dark .token.class-name { + color: #cfcfc2; +} + +pre.line-numbers { + position: relative; + padding-left: 3.8em; + counter-reset: linenumber; +} + +pre.line-numbers > code { + position: relative; + white-space: inherit; +} + +.line-numbers .line-numbers-rows { + position: absolute; + pointer-events: none; + top: 0; + font-size: 100%; + left: -3.8em; + width: 3em; /* works for line-numbers below 1000 lines */ + letter-spacing: -1px; + border-right: 1px solid #999; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.line-numbers-rows > span { + pointer-events: none; + display: block; + counter-increment: linenumber; +} + +.line-numbers-rows > span:before { + content: counter(linenumber); + color: #999; + display: block; + padding-right: 0.8em; + text-align: right; +} diff --git a/concept/breadwinner/.obsidian/workspace.json b/concept/breadwinner/.obsidian/workspace.json new file mode 100644 index 0000000..9cc5eda --- /dev/null +++ b/concept/breadwinner/.obsidian/workspace.json @@ -0,0 +1,245 @@ +{ + "main": { + "id": "28323c9c9c8f824d", + "type": "split", + "children": [ + { + "id": "e3c159822b57aede", + "type": "tabs", + "children": [ + { + "id": "dcb7106dcf4a60dd", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "thing groups/Equippable.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Equippable" + } + }, + { + "id": "cc30646b046d3148", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "game mechanics/Clipboard.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Clipboard" + } + } + ], + "currentTab": 1 + } + ], + "direction": "vertical" + }, + "left": { + "id": "c47a4dd12a181305", + "type": "split", + "children": [ + { + "id": "1d732e949ecb7ff5", + "type": "tabs", + "children": [ + { + "id": "787ccec16a03f34e", + "type": "leaf", + "state": { + "type": "file-explorer", + "state": { + "sortOrder": "alphabetical", + "autoReveal": false + }, + "icon": "lucide-folder-closed", + "title": "Files" + } + }, + { + "id": "396e6407e7d74ce7", + "type": "leaf", + "state": { + "type": "search", + "state": { + "query": "", + "matchingCase": false, + "explainSearch": false, + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical" + }, + "icon": "lucide-search", + "title": "Keresés" + } + }, + { + "id": "60eb4e500151af49", + "type": "leaf", + "state": { + "type": "bookmarks", + "state": {}, + "icon": "lucide-bookmark", + "title": "Könyvjelzők" + } + } + ] + } + ], + "direction": "horizontal", + "width": 300 + }, + "right": { + "id": "6c3b63c92687c92c", + "type": "split", + "children": [ + { + "id": "62c8ce916c27f5de", + "type": "tabs", + "children": [ + { + "id": "03f01b1cdcd651ea", + "type": "leaf", + "state": { + "type": "backlink", + "state": { + "file": "game mechanics/Clipboard.md", + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-coming-in", + "title": "Backlinks for Clipboard" + } + }, + { + "id": "300e9e61ca856913", + "type": "leaf", + "state": { + "type": "outgoing-link", + "state": { + "file": "entities/Player.md", + "linksCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-going-out", + "title": "Kimenő kapcsolatok a(z) Player jegyzetből" + } + }, + { + "id": "48329abeac44dabd", + "type": "leaf", + "state": { + "type": "tag", + "state": { + "sortOrder": "frequency", + "useHierarchy": true, + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-tags", + "title": "Címkék" + } + }, + { + "id": "99cf439ab830cb0a", + "type": "leaf", + "state": { + "type": "all-properties", + "state": { + "sortOrder": "frequency", + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-archive", + "title": "Minden tulajdonság" + } + }, + { + "id": "418af86fa0164a7a", + "type": "leaf", + "state": { + "type": "graph", + "state": {}, + "icon": "lucide-git-fork", + "title": "Graph view" + } + }, + { + "id": "6f0ac6a92e460aab", + "type": "leaf", + "state": { + "type": "outline", + "state": { + "file": "entities/Player.md", + "followCursor": false, + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-list", + "title": "Player vázlata" + } + } + ], + "currentTab": 4 + } + ], + "direction": "horizontal", + "width": 647.5, + "collapsed": true + }, + "left-ribbon": { + "hiddenItems": { + "switcher:Open quick switcher": false, + "graph:Open graph view": false, + "canvas:Create new canvas": false, + "daily-notes:Open today's daily note": false, + "templates:Insert template": false, + "command-palette:Open command palette": false, + "bases:Create new base": false + } + }, + "active": "cc30646b046d3148", + "lastOpenFiles": [ + "game mechanics/Day cycle.md", + "game mechanics/Smartwatch.md", + "game mechanics/THE NARRATOR.md", + "concepts and lore/Base gameplay.md", + "concepts and lore/Multiplayer.md", + "concepts and lore/Singleplayer.md", + "entities/Serbreads.md", + "entities/IT.md", + "entities/PlayerEntity.md", + "TLDR/MVP Functionality.md", + "TLDR/MVP Assets.md", + "TLDR/MVP.md", + "TLDR", + "concepts and lore/Lore.md", + "thing groups/Player.md", + "game mechanics/Clipboard.md", + "game mechanics/The pawn shop.md", + "game mechanics/The safe zone computer.md", + "game mechanics/The safe zone.md", + "game mechanics/The PSA system.md", + "thing groups/Equippable.md", + "thing groups/Grabbable.md", + "thing groups/!Group rules.md", + "thing groups/Entity.md", + "Pasted image 20260728145533.png", + "game mechanics", + "concepts and lore/Multiplayer (bredren).md", + "thing groups", + "concepts and lore", + "entities" + ] +} \ No newline at end of file diff --git a/concept/breadwinner/TLDR/MVP Assets.md b/concept/breadwinner/TLDR/MVP Assets.md new file mode 100644 index 0000000..8b6bbe5 --- /dev/null +++ b/concept/breadwinner/TLDR/MVP Assets.md @@ -0,0 +1,10 @@ +The list goes from most important to least important in descending order + +- [[The safe zone]] +- [[The safe zone computer]] +- layout pieces for procedural generation of levels +- procedural level generation +- Player character +- IT model +- serbreads model +- textures for everything \ No newline at end of file diff --git a/concept/breadwinner/TLDR/MVP Functionality.md b/concept/breadwinner/TLDR/MVP Functionality.md new file mode 100644 index 0000000..f202555 --- /dev/null +++ b/concept/breadwinner/TLDR/MVP Functionality.md @@ -0,0 +1,8 @@ +Descending in order of importance +- Movement fluidity +- Procedural camera and ui movement fluidity +- Audio + - breathing + - jumping, landing + - ambiance +- Multiplayer base \ No newline at end of file diff --git a/concept/breadwinner/TLDR/MVP.md b/concept/breadwinner/TLDR/MVP.md new file mode 100644 index 0000000..90300af --- /dev/null +++ b/concept/breadwinner/TLDR/MVP.md @@ -0,0 +1,2 @@ +- [[MVP Assets]] +- [[MVP Functionality]] diff --git a/concept/breadwinner/concepts and lore/Base gameplay.md b/concept/breadwinner/concepts and lore/Base gameplay.md new file mode 100644 index 0000000..7745ac7 --- /dev/null +++ b/concept/breadwinner/concepts and lore/Base gameplay.md @@ -0,0 +1,11 @@ +You start in the *"safe zone"*. There is an old *computer* with a *printer* attached. You can hear a silly, high-passed song playing from somewhere in the safe zone. There is also a *bed*, where you can sleep once you have finished for the day. + +You must go out into the *"infinite bread warehouse"* to gather bread for delivery next to the *safe zone*. This warehouse is randomly generated each time you are dropped in the game from warehouse components to give it a liminal feel. + +You must use small *"bread moving trays"* to be able to move a bigger number of bread. + +You have a base quota that gets printed out or written on the screen at the *safe zone* every day. Once the quota is fulfilled, you can hear an approval sound emanating from the computer that can be found in the *safe zone*. Once you check, you can see that there are additional quotas you can complete for additional *cash*. + +With cash you can buy *upgrades*, such as **increased inventory space**, **exosuits** for increased speed or power (can lift heavier objects aka bring more bread on the tray), **lures** for the entities, **facility upgrades** (more or better battery for longer day-times (important for later game because the quotas are so big)) + +The *day ends* after x minutes, when all the lights go out, and everything gets pitch black. You can still deliver more bread, but because of the dark, there are more *entities* roaming about, making it much more treacherous. BUT yielding high in rewards if you do, since you can find treasures lurking in the darkness. Treasures are [[Equippable]]s, which have a higher sell value. \ No newline at end of file diff --git a/concept/breadwinner/concepts and lore/Multiplayer.md b/concept/breadwinner/concepts and lore/Multiplayer.md new file mode 100644 index 0000000..feb4a9b --- /dev/null +++ b/concept/breadwinner/concepts and lore/Multiplayer.md @@ -0,0 +1,5 @@ +4 player CO-OP, where the difficulty scales in accordance of player count. + +Name of the mode is **bredren**, coming from brethren. + +https://youtu.be/frNKdfPQfxA diff --git a/concept/breadwinner/concepts and lore/Singleplayer.md b/concept/breadwinner/concepts and lore/Singleplayer.md new file mode 100644 index 0000000..3cf3898 --- /dev/null +++ b/concept/breadwinner/concepts and lore/Singleplayer.md @@ -0,0 +1 @@ +The original experience. Check [[Base gameplay]]. diff --git a/concept/breadwinner/entities/IT.md b/concept/breadwinner/entities/IT.md new file mode 100644 index 0000000..13d4082 --- /dev/null +++ b/concept/breadwinner/entities/IT.md @@ -0,0 +1,12 @@ +IT is the main "*monsert*" of the game. + +IT looks like a gigantic centipede, which has a body made of bread???? + +Each day it grows **longer**. Yes. It consumes more bread, since its basically (no really) infinite. + +It can crawl on the walls, and basically follows the curvature of the wall and sticks to it, because uh **IT CAN**. + +In game, it should be drawn towards sounds --> making use of [[The PSA system]] and items is key for conquering this entity. + +Of course, bread is not the only source of its meal -- its also you as well. It will eat you, yummy ummyy muym ym yummy + diff --git a/concept/breadwinner/entities/PlayerEntity.md b/concept/breadwinner/entities/PlayerEntity.md new file mode 100644 index 0000000..d1c76a3 --- /dev/null +++ b/concept/breadwinner/entities/PlayerEntity.md @@ -0,0 +1,3 @@ +This is the node, that the player will be in control of during game runtime +it is in the group [[Player]] + diff --git a/concept/breadwinner/entities/Serbreads.md b/concept/breadwinner/entities/Serbreads.md new file mode 100644 index 0000000..d6b46e2 --- /dev/null +++ b/concept/breadwinner/entities/Serbreads.md @@ -0,0 +1,6 @@ +Servants but bread. + +They are **anthropomorphic bread**. They walk towards you, and are *photo-phobic* (aka afraid of light), because of reasons. Therefore they do not come out in the day, but in the **night** they do. They are easily deferred with a **flashlight**, or some other light source, if bright enough. + +They are sneaky, but do give a **small sound** when approaching. Their pitter-patter is not perfect. When threatened or shot with light, they *scream* and run away from its source. Anti-moth like. + diff --git a/concept/breadwinner/game mechanics/Clipboard.md b/concept/breadwinner/game mechanics/Clipboard.md new file mode 100644 index 0000000..0859b7e --- /dev/null +++ b/concept/breadwinner/game mechanics/Clipboard.md @@ -0,0 +1,5 @@ +This is your on-person **information carrier** provided to you by the **oh-so-kind managers** from high up! + +**You can use it to write** up the quota of the day, also write up storage places for later reference, where you can find different kinds of loafs, or perhaps treasures. + +Basically a *book and quill* from minecraft but takes up no inventory space. COOOL! \ No newline at end of file diff --git a/concept/breadwinner/game mechanics/Day cycle.md b/concept/breadwinner/game mechanics/Day cycle.md new file mode 100644 index 0000000..da292ef --- /dev/null +++ b/concept/breadwinner/game mechanics/Day cycle.md @@ -0,0 +1,15 @@ +Since this game is set inside a liminal infinite corporate warehouse, there are *no windows*. Why would there be? + +# Day +When the lights are on, it is **daytime**. The lights are terrible, they do not light up much, but it would cost more to be able to light up all of the warehouse, due to it being infinite. + +Due to this, it is **not** entirely pitch black, but it is *pretty dark.* + +**Entities** still **roam around**, but they are more spread out, and therefore *entity* *interactions* are *minimal* to *none*. + +# Night +[[The PSA system]] announces the "*daylight savings*" which literally means they turn off all lights in the warehouse. + +**Entities roam around**, and the chances for interacting with them is increased. Every \ (idk if it should be minute, maybe it should be 3 or 4 minutes depending on how it will feel in testing) it gets more and more higher. + +You are always safe in [[The safe zone]], no matter when you go in. \ No newline at end of file diff --git a/concept/breadwinner/game mechanics/Smartwatch.md b/concept/breadwinner/game mechanics/Smartwatch.md new file mode 100644 index 0000000..1f67f76 --- /dev/null +++ b/concept/breadwinner/game mechanics/Smartwatch.md @@ -0,0 +1,3 @@ +you can always check the PROPER time by pulling this little thing up + +You can also check some cool stats with it as well. Of course you can, its a **smart watch**!!!!!!! \ No newline at end of file diff --git a/concept/breadwinner/game mechanics/THE NARRATOR.md b/concept/breadwinner/game mechanics/THE NARRATOR.md new file mode 100644 index 0000000..399f3d0 --- /dev/null +++ b/concept/breadwinner/game mechanics/THE NARRATOR.md @@ -0,0 +1,10 @@ +The narrator talks to the player when they are still in [[The safe zone]]. + +Once the player has left [[The safe zone]], the narrator can easily break the 4th wall, and talk through [[The PSA system]]. This disturbes breadlife. Could come in handy in a bad situation! + +The narrator is self aware, and hates hearing himself on [[The PSA system]], and reacts to it accordingly. Oh yeah, he also says some cheesy one liners because its funny as hell, probably. + +The narrator **mocks** the player after their mistakes, and has **memory**. +It remembers. *It always remembers*. + +BIG BROTHER?? \ No newline at end of file diff --git a/concept/breadwinner/game mechanics/The PSA system.md b/concept/breadwinner/game mechanics/The PSA system.md new file mode 100644 index 0000000..3585cd0 --- /dev/null +++ b/concept/breadwinner/game mechanics/The PSA system.md @@ -0,0 +1,9 @@ +There are **loudspeakers** littered around the warehouse, that can be used as *distractions* for different kinds of entities. + +The main thing with them is, that due to corner cutting, they could not be connected to a centralized network, and operate separately. Therefore **you must get near their respective computer**, if you want to either play a sound or music through them. + +It also **announces the daylight savings time**: you have 3 minutes left before the day cycle turns to night. Every speaker announces it at the same time in the beginning, but the longer you play, the bigger the difference will be between computers due to something idk like synchronization issues, due to them not being able to sync to other computers or the outside. Thank the budget cuts. You can always check the REAL TIME with your **auto-syncing satellite-technology included BreadMart [[Smartwatch]] ^tm + +[[THE NARRATOR]] can speak through it once in a while. Especially at **bad** moments. +Sometimes good :3 + diff --git a/concept/breadwinner/game mechanics/The pawn shop.md b/concept/breadwinner/game mechanics/The pawn shop.md new file mode 100644 index 0000000..c6eb557 --- /dev/null +++ b/concept/breadwinner/game mechanics/The pawn shop.md @@ -0,0 +1,73 @@ +Should have the icon of a pawn from chess +It is an online marketplace, which can be found on your computer in your **safe zone**, where you can **instantly sell** and **auction** your found goods in exchange for **money**. Oh and you can buy shit as well, either at the auctions, or at the instant shop + +both times when selling or buying you have to pay shipping, which increases each day up to a limit +$\text{shipping\_price} = idk$ +upper limit: $idk \cdot 10$ +# SELL +## Instant shop +no risk, small reward way of getting money for your treasures + +basically, you can instantly sell your chosen item for +$$\text{Instant Sell price} = \text{item\_value} * (0.3 + \text{base\_sell\_upgrade\_level} \cdot 0.1)$$ +- $\text{item\_value}$ is the value of the item you are trying to sell +- $\text{base\_sell\_upgrade\_level}$ is the level of the safe zone upgrade "base sell amount" + +so basically you can upgrade with your money, how much you can instant sell the items for +NO RNG INCLUDED! +## Auction +high risk, high reward way of making money from your found goods + +at first, you have to auction your items for a price, that you can set +this will determine, how many bids you will get + +$$P(\text{first\_bid\_to\_happen}) = \frac{\text{item\_value} - \text{auction\_price}}{\text{item\_value} + \text{auction\_price}} $$ + +as you can see, if you start the bidding on 0, then you are guaranteed to have a bid. + +
+ +next up, the bid amount +$$\text{bid\_amount} = \text{item\_value} \cdot \text{bid\_increase} \cdot \text{random\_spread}$$ + +where + +$\text{bid\_increase} = 0.1 + \text{bid\_amount\_upgrade\_level} \cdot 0.05$ +$\text{random\_spread} = \text{randf\_range}(0.5 + \text{min\_bid\_multiplier\_upgrade}, 1.2 + \text{max\_bid\_multiplier\_upgrade})$ + +- $\text{bid\_amount\_upgrade\_level}$ is the level of the upgrade +- $\text{min\_bid\_multiplier\_upgrade}$ raises the minimum multiplier for the bid raise +- $\text{max\_bid\_multiplier\_upgrade}$ raises the maximum multiplier for the bid raise + +
+ +$\text{current\_bid}$ this is the current active bid +$\text{last\_bid}$ this is the one bid before the current + +
+ +next up, the bid chance +$$P(\text{bid\_happens}) = \frac{\text{last\_bid} + \frac{\text{bid\_chance\_upgrade} \cdot \text{item\_value}}{10}}{\text{current\_bid} +\text{item\_value}}$$ +- $\text{bid\_chance\_upgrade}$ this practically upgrades the items value to make it more probably for a bid to occur +- $\text{current\_bid}$ the current active highest bid + +since this probability can exceed 1, it should be clamped to 1 + +### how it looks like in game +When you want to start an auction, you open the pawn shop on [[The safe zone computer]] and you go to the auction center. You press the "*put item up for auction*" button, and you select the item from your inventory. Next, a window pops up, where you have to enter the starting bid amount. You enter the starting bid, and you start the auction, and wait for the results. + +It can have a fun effect when happening, maybe even like a spinning wheel (WE LOVE GAMPLING!!!) + +# BUY + +## Instant buy +high price, for sure delivery + +if you buy something here, it will be delivered 100% + +when buying, the shipping price is counted into the shown price, so no hassle! + +## Auction buy +same system for auctioning as selling, but you participate in it as well. The same upgrades apply, but in reverse, making the chance of bidding lower with upgrades, making it easier for you to purchase items from the auction. + +can luck out with good items, and even do some reselling, and earn money. kinda like stocks! \ No newline at end of file diff --git a/concept/breadwinner/game mechanics/The safe zone computer.md b/concept/breadwinner/game mechanics/The safe zone computer.md new file mode 100644 index 0000000..83a681b --- /dev/null +++ b/concept/breadwinner/game mechanics/The safe zone computer.md @@ -0,0 +1,14 @@ +The computer is the main centre of the chilling phase of the game. +Each player has their own computer in their own container + +It is an old CRT monitor placed on top of an old pc case. + +# The desktop +the desktop has 2 major apps: +- [[The pawn shop]] +- The quota machine + +## the quota machine +its basically a program, which shows you the quota of the day. you have to manually write this up on your [[Clipboard]], or remember it in your head. + +it will get harder and harder with each passing day \ No newline at end of file diff --git a/concept/breadwinner/game mechanics/The safe zone.md b/concept/breadwinner/game mechanics/The safe zone.md new file mode 100644 index 0000000..f638ca3 --- /dev/null +++ b/concept/breadwinner/game mechanics/The safe zone.md @@ -0,0 +1,15 @@ +This is the first room, where the player(s) wake up when starting a new game. +It looks like a semi-rised shipping container room, which has some windows on the sides. The inside is very simple, but functional: +- 1 bed(s) +- a wardrobe +- a desk + - [[The safe zone computer]] +- a couch +- a coffee machine (of course) +- a big bread container next to the couch + +At the end of every day, the player(s) must return to this place, where once they are finished with the quotas, are safe from all the entities lying within the warehouse. + +Each player has their own little container, because it would be more expensive to make the container bigger for one person, and they would have to create different manufacture lines for each number of player that can play, so this cuts costs. The containers are just put next to each other side by side (longer side to longer side). + +Before going to bed tho, they have the ability to sell and auction their treasures for extra dinhero at the [[The pawn shop]]. \ No newline at end of file diff --git a/concept/breadwinner/thing groups/!Group rules.md b/concept/breadwinner/thing groups/!Group rules.md new file mode 100644 index 0000000..0a64478 --- /dev/null +++ b/concept/breadwinner/thing groups/!Group rules.md @@ -0,0 +1,11 @@ +Each group in code is exclusively lowercase + +For example the "Entity" group can be referred to as **x.*is_in_group("entity")*** where x is the entity that is being checked. + +each group +-- +- [Entity](Entity) +- [Equippable](Equippable) +- [Grabbable](Grabbable) +- [Player](Player) + diff --git a/concept/breadwinner/thing groups/Entity.md b/concept/breadwinner/thing groups/Entity.md new file mode 100644 index 0000000..e69de29 diff --git a/concept/breadwinner/thing groups/Equippable.md b/concept/breadwinner/thing groups/Equippable.md new file mode 100644 index 0000000..8af22e8 --- /dev/null +++ b/concept/breadwinner/thing groups/Equippable.md @@ -0,0 +1,24 @@ +Objects that are *equippable* can be put into the inventory +If something is equippable, it is **also** grabbable +RigidBody3D < [Grabbable](Grabbable.md) < Equippable + +Components (the node tree): +- the grabbable object +- camera (only active for one frame to take the picture of the item when put inside the inventory) + - for creating the image of the object + - placed above the object at northwest up, pointing at the centre of the object + +Properties: +- function + - what it can do, when equipped +- inv slot size + - how many slots of inventory does it take up +- weight + - how much the equippable weighs + - if a player is holding too much, they get encumbered +- description + - in english description of the equippable item. maybe some lore, or something fun +- the image + - created by the camera for dynamic inventory icons +- sell value + - how much dinhero you can, if you sell this item on the online marketplace \ No newline at end of file diff --git a/concept/breadwinner/thing groups/Grabbable.md b/concept/breadwinner/thing groups/Grabbable.md new file mode 100644 index 0000000..3302c05 --- /dev/null +++ b/concept/breadwinner/thing groups/Grabbable.md @@ -0,0 +1,13 @@ +Objects that are *grabbable* can be picked up and held by the player when holding \[LMB\] +These objects always rotate towards the player's camera + +RigidBody3D < Grabbable < [Equippable](Equippable.md) + +Components: +- the objects itself + - mesh + - collider + +Properties +- weight + - how hard is it to pick up or drag diff --git a/concept/breadwinner/thing groups/Player.md b/concept/breadwinner/thing groups/Player.md new file mode 100644 index 0000000..c9f2039 --- /dev/null +++ b/concept/breadwinner/thing groups/Player.md @@ -0,0 +1,44 @@ +The player (or players in [[Multiplayer]]) is the node that is controlled by the user. +Read about lore in [[PlayerEntity]] + +Components (node tree): +- Camera + - this is where the player percieves the game world + - this is manipulated by the procedural animation "idle" + - has the child "flashlight" +- Camera Pivot + - this is where the camera position is being manipulated by leaning +- UI + - This handles all the shown ui things like stamina currently active item and inventory slot +- Sound emitters + - this is where the sounds will be emitted from, mainly movement, breathing and flashlight + - Legs + - left, right + - left, right FX (shuffling for now) + - Head + - flashlight + - breathing + +Properties: +- Stamina + - 0 - 100 float value + - refills after 2 seconds of non-jumping or non-sprinting + - breathing heaviness and idle animation heaviness is influenced by this value +- Inventory + - this is where the player can store some items for later use + - dynamic size + - start with inv size 2, can be later upgraded to a max of 5 + - needs testing to see if its balanced or fun + - upgrade can be like a bigger pouch or a bag + - one inventory slot can hold one equippable item +- Movement states + - walking, running, crouching, grabbing, leaning + - each is a boolean + - var walking: bool = false + - each has their own functions + - set_\(boolean) --> sets the state + - set_walking(yes:bool) -> void + - set_walking(true) --> sets walking to true, running to false + - influences the audio and what can and cant the player do (cannot run and walk at the same time) +- grabbing force + - if increased, you can move more bread on a tray or hold and drag heavier objects easier diff --git a/maps/dev_map.tscn b/maps/dev_map.tscn index 9bf6909..e6fe9e7 100644 --- a/maps/dev_map.tscn +++ b/maps/dev_map.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://chykk2a3opu0d"] -[ext_resource type="PackedScene" uid="uid://kqq30y24c6kd" path="res://player/player.tscn" id="1_s8b7j"] +[ext_resource type="PackedScene" uid="uid://kqq30y24c6kd" path="res://scenes/player/player.tscn" id="1_s8b7j"] [ext_resource type="AudioStream" uid="uid://db0yck6trekrs" path="res://assets/sounds/ambiance/pc-fan-paulstretched.mp3" id="2_phkhq"] [ext_resource type="Script" uid="uid://y8x4svl5kej2" path="res://addons/spatial_audio_3d/spatial_audio_3d.gd" id="4_yb1w3"] diff --git a/player/player_manager.gd b/player/player_manager.gd deleted file mode 100644 index 2898516..0000000 --- a/player/player_manager.gd +++ /dev/null @@ -1,419 +0,0 @@ -extends CharacterBody3D -class_name PlayerCharacter - -@export_category("Movement") -@export var SPEED = 5.0 ##base walking speed -@export var SPRINT_MULTIPLIER = 1.5 ##how much faster should you move, when sprinting -@export var SPRINT_STAMINA_COST = 10.0 ##how much stamina should be consumed each frame while sprinting (delta * SPRINT_STAMINA_COST) -@export var CROUCH_SPEED_MULTIPLIER = .5 ##how much slower you should be going while crouching - -@export_category("Jump") -@export var JUMP_VELOCITY = 4.5 ##how high you can jump -@export var JUMP_STAMINA_COST = 10 ##how much stamina each jump consumes - -@export_category("Camera") -@export var LOOK_SENSITIVITY = 1.0 ##camera sensitivity -@export var CAMERA_VELOCITY_MULTIPLIER = 1.5 ##how heavy should the UI movement feel -@export var CAMERA_BOB_FREQUENCY = 2.4 ##how quick the camera bobs whilst moving -@export var CAMERA_BOB_AMPLITUDE = 0.08 ##how hard the camera bobs whilst moving -@export var CAMERA_BOB_MULTIPLIER = 200.0 ##how much the ui reacts to head bobbing -@export var CAMERA_SIDEWAYS_BOB_AMPLITUDE = 0.003 ## how many degrees does the camera bob sideways - -@export_category("UI") -@export var UI_SCALE: float = 1 ##rational scale of the ui -@export var UI_MOVEMENT_SENSITIVITY = 0.5 ##how much the UI moves when you move the camera -@export var UI_MOVEMENT_SPEED = 15.0 ##how fast the UI moves when you move the camera -@export var UI_MOVEMENT_VELOCITY_MULTIPLIER = 2.0 ##how much the ui leans when walking or strafing - -@export_category("Inventory") -@export var INVENTORY_MAX = 3 ##max number of items that can be in the player's inventory -@export var INVENTORY_ITEMS: Array = [] ##the items in the player's inventory - -@export_category("Audio") -@export var AUDIO_LOUDNESS: float = 100.0 -@export var NORMAL_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##normal footsteps -- walking -@export var HEAVY_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##heavy footsteps -- running -@export var LIGHT_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##light footsteps -- crouching -@export var SHUFFLE_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##shuffling -- random chance of playing while running -@export var FLASHLIGHT_CLICK_SOUNDS: Array[AudioStreamWAV] ##flashlight click -@export var SHUFFLE_CHANCE: float = 20 ##percentage of chance for a shuffle noise to be played whilst running - -@export_category("Grabbing") -@export var GRAB_POWER: float = 15.0 ##how fast the grabbed object snaps to the hold position -@export var GRAB_ROTATION_POWER: float = 15.0 ##how fast the object rotates towards the player -@export var GRAB_PANEL: PackedScene ##panel that goes over the grabbable object to show its grabbable - -@export_category("Player Physics") -@export_flags_3d_physics var PLAYER_COLLISION_MASK: int = 16 - -@onready var camera = $CameraPivot/PlayerCamera -@onready var camera_pivot = $CameraPivot -@onready var ui = $PlayerUi -@onready var ui_base_position = ui.position -@onready var in_game_menu = $InGameMenu -@onready var left_foot_sound_player = $SoundEmitters/LeftFoot -@onready var left_foot_texture_sound_player = $SoundEmitters/LeftFoot/LeftFootTexture -@onready var right_foot_sound_player = $SoundEmitters/RightFoot -@onready var right_foot_texture_sound_player = $SoundEmitters/RightFoot/RightFootTexture -@onready var flashlight_sound_player = $SoundEmitters/FlashlightSound -@onready var cursor_raycast = $CameraPivot/PlayerCamera/CursorRaycast -@onready var hold_position = $CameraPivot/PlayerCamera/HoldPosition -@onready var popup_panels = $PopupPanels - -var walking: bool = false -var running: bool = false -var crouching: bool = false -var in_menu: bool = false -var stamina: float = 100.0 -var stamina_recharge_on: bool = false -var selected_item: int = 0 -var t_bob: float = 0 -var last_bob_y: float = 0.0 -var held_object: RigidBody3D = null - -var _mouse_motion: Vector2 = Vector2.ZERO -var _mouse_motion_delta: Vector2 = Vector2.ZERO -var _last_camera_global_position: Vector3 = Vector3.ZERO -var _current_leg_is_right: bool = false ##if true: current leg is the right leg -var _current_footstep_sound: AudioStreamWAV = null -var _current_flashlight_sound: AudioStreamWAV = null -var _camera_original_position: Vector3 = Vector3(0,.75,0) - -func play_footstep_sound(): - var sound_to_play - if walking: - sound_to_play = NORMAL_FOOTSTEP_SOUNDS.pick_random() - while sound_to_play == _current_footstep_sound: - sound_to_play = NORMAL_FOOTSTEP_SOUNDS.pick_random() - elif running: - sound_to_play = HEAVY_FOOTSTEP_SOUNDS.pick_random() - while sound_to_play == _current_footstep_sound: - sound_to_play = HEAVY_FOOTSTEP_SOUNDS.pick_random() - if randf_range(1, 100) > 100 - SHUFFLE_CHANCE: - match _current_leg_is_right: - true: - right_foot_texture_sound_player.do_set_stream(SHUFFLE_FOOTSTEP_SOUNDS.pick_random()) - right_foot_texture_sound_player.do_play() - false: - left_foot_texture_sound_player.do_set_stream(SHUFFLE_FOOTSTEP_SOUNDS.pick_random()) - left_foot_texture_sound_player.do_play() - - elif crouching: - sound_to_play = LIGHT_FOOTSTEP_SOUNDS.pick_random() - while sound_to_play == _current_footstep_sound: - sound_to_play = LIGHT_FOOTSTEP_SOUNDS.pick_random() - - _current_footstep_sound = sound_to_play - - if _current_leg_is_right: - right_foot_sound_player.do_set_stream(sound_to_play) - right_foot_sound_player.pitch_scale = randf_range(0.8, 1.2) - right_foot_sound_player.do_play() - _current_leg_is_right = false - else: - left_foot_sound_player.do_set_stream(sound_to_play) - left_foot_sound_player.pitch_scale = randf_range(0.8, 1.2) - left_foot_sound_player.do_play() - _current_leg_is_right = true - -func ui_handling(delta): - ui.offset_transform_scale *= UI_SCALE - ui_movement_handling(delta) - ui.set_stamina_bar(stamina) - var horizontal_speed = Vector3(velocity.x, velocity.y, velocity.z).length() - - if is_on_floor() and horizontal_speed > 0.05: - t_bob += delta * (velocity.length() * float(is_on_floor()) + (int(Input.is_action_pressed("crouch"))) * 3) - - var current_sin_pos = sin(t_bob * CAMERA_BOB_FREQUENCY) - - #footstep handling - if last_bob_y >= -.95 and current_sin_pos < -.95: - play_footstep_sound() - - last_bob_y = current_sin_pos - - camera_bobbing(t_bob) - - #idle breathing - elif is_on_floor() and horizontal_speed < 0.05: - t_bob += delta * 1 - camera_breathing(t_bob) - else: - camera.rotation.z = lerpf(camera.rotation.z,0, delta * 0.004) - camera.transform.origin.y = lerpf(camera.transform.origin.y, _camera_original_position.y, delta * 5.0) - if camera.transform.origin.length() < 0.01: - t_bob = 0 - last_bob_y = 0.0 - -func ui_movement_handling(delta: float): - var mouse_offset = -_mouse_motion_delta * UI_MOVEMENT_SENSITIVITY - - var current_camera_global_position = camera.global_position - var camera_global_velocity = (current_camera_global_position - _last_camera_global_position) / delta - - var cam_local_vel = camera.global_transform.basis.inverse() * camera_global_velocity - - var inertia_offset = Vector2( - -cam_local_vel.x, - cam_local_vel.y - (cam_local_vel.z * 0.25) - ) * CAMERA_VELOCITY_MULTIPLIER - - var target_offset = mouse_offset + inertia_offset - ui.position = ui.position.lerp(ui_base_position + target_offset, delta * UI_MOVEMENT_SPEED) - - _last_camera_global_position = current_camera_global_position - - var ui_scaling_target = Vector2(-cam_local_vel.z * UI_MOVEMENT_SENSITIVITY * .002 + 1, -cam_local_vel.z * UI_MOVEMENT_SENSITIVITY * .002 + 1) - ui.offset_transform_scale = ui.offset_transform_scale.lerp(ui_scaling_target, delta * UI_MOVEMENT_SPEED) - - var ui_rotation_target = -inertia_offset.x - mouse_offset.x * 0.25 - ui.offset_transform_rotation = lerpf(ui.offset_transform_rotation, ui_rotation_target * UI_MOVEMENT_SENSITIVITY * 0.003, delta * UI_MOVEMENT_SPEED) - -func toggle_menu(): - if !in_game_menu.visible: - ui.visible = false - popup_panels.visible = false - in_game_menu.visible = true - $Cursor.visible = false - Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - in_menu = true - else: - ui.visible = true - popup_panels.visible = true - in_game_menu.visible = false - $Cursor.visible = true - Input.mouse_mode = Input.MOUSE_MODE_CAPTURED - in_menu = false - -func toggle_flashlight(): - $CameraPivot/PlayerCamera/Flashlight.visible = not $CameraPivot/PlayerCamera/Flashlight.visible - var play_sound = FLASHLIGHT_CLICK_SOUNDS.pick_random() - - while play_sound == _current_flashlight_sound: - play_sound = FLASHLIGHT_CLICK_SOUNDS.pick_random() - - flashlight_sound_player.do_set_stream(play_sound) - flashlight_sound_player.pitch_scale = randf_range(.8, 1.2) - flashlight_sound_player.do_play() - _current_flashlight_sound = play_sound - -func camera_bobbing(time: float): - camera.transform.origin.y = sin(time * CAMERA_BOB_FREQUENCY) * CAMERA_BOB_AMPLITUDE + .75 - camera.rotation.z += sin(time * CAMERA_BOB_FREQUENCY * .5) * CAMERA_SIDEWAYS_BOB_AMPLITUDE - -func camera_breathing(time: float): - camera.transform.origin.y = sin(time * CAMERA_BOB_FREQUENCY) * CAMERA_BOB_AMPLITUDE + .75 - camera.rotation.x += sin(time * CAMERA_BOB_FREQUENCY) * CAMERA_SIDEWAYS_BOB_AMPLITUDE - -func _process(delta: float) -> void: - if Input.is_action_just_pressed("next_item"): - next_item() - - if Input.is_action_just_pressed("prev_item"): - prev_item() - - if Input.is_action_just_pressed("select_item_1"): - select_item(0) - - if Input.is_action_just_pressed("select_item_2"): - select_item(1) - - if Input.is_action_just_pressed("select_item_3"): - select_item(2) - - if stamina_recharge_on: - stamina = move_toward(stamina, 100, .5) - - _mouse_motion.y = clamp(_mouse_motion.y, -1560, 1560) - transform.basis = Basis.from_euler(Vector3(0, _mouse_motion.x * -0.001 * LOOK_SENSITIVITY, 0)) - camera.transform.basis = lerp(camera.transform.basis, Basis.from_euler(Vector3(_mouse_motion.y * -0.001 * LOOK_SENSITIVITY, 0, 0)), delta * 10) - - #handle grabbable panel - if grabbable_panel != null: - var target_position = $Cursor.position - camera.unproject_position(grabbable_panel_body.global_position) - grabbable_panel.position = grabbable_panel.position.lerp(-target_position / 2, delta * 50) - -func _init() -> void: - Input.mouse_mode = Input.MOUSE_MODE_CAPTURED - -func _ready() -> void: - ui.select_item(0) - _last_camera_global_position = camera.global_position - -func next_item(): - if selected_item + 1 > INVENTORY_MAX - 1: - selected_item = 0 - else: - selected_item += 1 - ui.select_item(selected_item) - -func prev_item(): - if selected_item - 1 < 0: - selected_item = INVENTORY_MAX - 1 - else: - selected_item -= 1 - ui.select_item(selected_item) - -func select_item(index: int): - selected_item = index - ui.select_item(index) - -func _input(event): - if Input.is_action_just_pressed("open_menu"): - toggle_menu() - - if not in_menu: - if event is InputEventMouseMotion: - if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: - _mouse_motion += event.relative - _mouse_motion_delta = event.relative - - if Input.is_action_just_pressed("flashlight"): - toggle_flashlight() - - if Input.is_action_just_released("jump") or Input.is_action_just_released("sprint"): - $StaminaReset.start() - - if Input.is_action_just_pressed("grab"): - if cursor_raycast.is_colliding(): - var hit_object = cursor_raycast.get_collider() - - if hit_object is RigidBody3D and hit_object.is_in_group("grabbable"): - held_object = hit_object - held_object.gravity_scale = 0.0 - held_object.angular_damp = 5.0 - popup_panels.visible = false - - if Input.is_action_just_released("grab") and held_object != null: - held_object.gravity_scale = 1.0 - held_object.angular_damp = 0.0 - held_object = null - popup_panels.visible = true - -func is_crouched(yes:bool): - if yes: - crouching = true - walking = false - running = false - else: - crouching = false - -func is_walking(yes:bool): - if yes: - crouching = false - walking = true - running = false - else: - walking = false - -func is_running(yes:bool): - if yes: - crouching = false - walking = false - running = true - else: - running = false - - -func _physics_process(delta: float) -> void: - if not is_on_floor(): - velocity += get_gravity() * delta - - if not in_menu: - if Input.is_action_just_pressed("jump") and is_on_floor() and stamina > JUMP_STAMINA_COST: - velocity.y = JUMP_VELOCITY - stamina -= JUMP_STAMINA_COST - stamina_recharge_on = false - - var input_dir = Input.get_vector("left", "right", "forward", "backward") - #var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() - var lean_dir = -Input.get_axis("lean_left", "lean_right") * .1 - - if lean_dir: - camera_pivot.rotation.z = lerpf(camera_pivot.rotation.z, lean_dir, delta*10) - camera_pivot.position.x = lerpf(camera_pivot.position.x, -lean_dir * 5, delta * 7) - else: - camera_pivot.rotation.z = lerpf(camera_pivot.rotation.z, 0, delta*10) - camera_pivot.position.x = lerpf(camera_pivot.position.x, 0, delta * 7) - - var target_speed = SPEED - var is_moving = input_dir != Vector2.ZERO - - if Input.is_action_pressed("crouch"): - $PlayerHitBox.shape.height = lerpf($PlayerHitBox.shape.height, .5, delta * 5) - target_speed *= CROUCH_SPEED_MULTIPLIER - is_crouched(true) - else: - $PlayerHitBox.shape.height = lerpf($PlayerHitBox.shape.height, 2, delta * 10) - is_crouched(false) - - if Input.is_action_pressed("sprint") and stamina > 0: - target_speed *= SPRINT_MULTIPLIER - is_running(true) - stamina -= delta * SPRINT_STAMINA_COST - stamina_recharge_on = false - else: - is_running(false) - - - #apply motion - var local_vel = transform.basis.inverse() * velocity - var target_local_vel = Vector3(input_dir.x, 0, input_dir.y) * target_speed - var accel_rate = 6.0 if is_moving else 9.0 - local_vel.x = lerpf(local_vel.x, target_local_vel.x, delta * accel_rate) - local_vel.z = lerpf(local_vel.z, target_local_vel.z, delta * accel_rate) - - var global_horizontal = transform.basis * local_vel - velocity.x = global_horizontal.x - velocity.z = global_horizontal.z - - if is_moving and not running and not crouching: - is_walking(true) - else: - is_walking(false) - - ui_handling(delta) - - #handle grabbed object - if held_object != null: - var target_pos = hold_position.global_position - var current_pos = held_object.global_position - var direction = target_pos - current_pos - - held_object.linear_velocity = direction * GRAB_POWER - - var current_quat = held_object.global_transform.basis.get_rotation_quaternion() - var target_quat = hold_position.global_transform.basis.get_rotation_quaternion() - - var delta_quat = target_quat * current_quat.inverse() - var angle = delta_quat.get_angle() - var axis = delta_quat.get_axis() - - if angle > PI: - angle -= TAU - - held_object.angular_velocity = axis * angle * GRAB_ROTATION_POWER - else: - velocity.x = lerpf(velocity.x, 0, delta * 10) - velocity.z = lerpf(velocity.z, 0, delta * 10) - - move_and_slide() - -func _on_stamina_reset_timeout() -> void: - stamina_recharge_on = true - -var grabbable_panel = null -var grabbable_panel_body = null - -func _on_grabbable_finder_body_entered(body: Node3D) -> void: - if body.is_in_group("grabbable"): - grabbable_panel = GRAB_PANEL.instantiate() - popup_panels.add_child(grabbable_panel) - grabbable_panel_body = body - -func _on_grabbable_finder_body_exited(body: Node3D) -> void: - if body == grabbable_panel_body: - popup_panels.remove_child(grabbable_panel) - grabbable_panel = null - grabbable_panel_body = null diff --git a/project.godot b/project.godot index 58c1265..f17e642 100644 --- a/project.godot +++ b/project.godot @@ -31,6 +31,18 @@ window/stretch/aspect="expand" version_control/plugin_name="GitPlugin" version_control/autoload_on_startup=true +[file_customization] + +folder_colors={ +"res://addons/": "yellow", +"res://assets/": "red", +"res://concept/": "purple", +"res://maps/": "orange", +"res://scenes/": "blue", +"res://scripts/": "gray", +"res://shaders/": "pink" +} + [global_group] grabbable="this object can be grabbed" diff --git a/player/grab_prompt.tscn b/scenes/player/grab_prompt.tscn similarity index 95% rename from player/grab_prompt.tscn rename to scenes/player/grab_prompt.tscn index 9a70d16..2391357 100644 --- a/player/grab_prompt.tscn +++ b/scenes/player/grab_prompt.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://c02fkimxlbrje"] -[ext_resource type="Shader" uid="uid://desjwy54cjos8" path="res://player/blur_shader.gdshader" id="1_sseo3"] +[ext_resource type="Shader" uid="uid://desjwy54cjos8" path="res://shaders/blur_shader.gdshader" id="1_sseo3"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_aghy0"] shader = ExtResource("1_sseo3") diff --git a/player/in_game_menu.tscn b/scenes/player/in_game_menu.tscn similarity index 91% rename from player/in_game_menu.tscn rename to scenes/player/in_game_menu.tscn index aa93591..a2c0269 100644 --- a/player/in_game_menu.tscn +++ b/scenes/player/in_game_menu.tscn @@ -1,7 +1,7 @@ [gd_scene format=3 uid="uid://y5f3db7clptv"] -[ext_resource type="Script" uid="uid://d0g3mdq54p7oh" path="res://player/in_game_menu_manager.gd" id="1_j5o6r"] -[ext_resource type="Shader" uid="uid://desjwy54cjos8" path="res://player/blur_shader.gdshader" id="1_x6hgt"] +[ext_resource type="Script" uid="uid://d0g3mdq54p7oh" path="res://scenes/player/in_game_menu_manager.gd" id="1_s4bu6"] +[ext_resource type="Shader" uid="uid://desjwy54cjos8" path="res://shaders/blur_shader.gdshader" id="1_x6hgt"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_yf5fn"] shader = ExtResource("1_x6hgt") @@ -14,7 +14,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -script = ExtResource("1_j5o6r") +script = ExtResource("1_s4bu6") [node name="Panel" type="Panel" parent="." unique_id=501811587] material = SubResource("ShaderMaterial_yf5fn") diff --git a/player/in_game_menu_manager.gd b/scenes/player/in_game_menu_manager.gd similarity index 100% rename from player/in_game_menu_manager.gd rename to scenes/player/in_game_menu_manager.gd diff --git a/player/in_game_menu_manager.gd.uid b/scenes/player/in_game_menu_manager.gd.uid similarity index 100% rename from player/in_game_menu_manager.gd.uid rename to scenes/player/in_game_menu_manager.gd.uid diff --git a/scenes/player/input_controller_component.gd b/scenes/player/input_controller_component.gd new file mode 100644 index 0000000..e1c2217 --- /dev/null +++ b/scenes/player/input_controller_component.gd @@ -0,0 +1,95 @@ +extends Node + +@export_category("Grabbing") +@export var GRAB_POWER: float = 15.0 ##how fast the grabbed object snaps to the hold position +@export var GRAB_ROTATION_POWER: float = 15.0 ##how fast the object rotates towards the player +@export var GRAB_PANEL: PackedScene ##panel that goes over the grabbable object to show its grabbable + +@onready var ui_handler: Node = %UiHandler +@onready var player_state: Node = %PlayerState +@onready var flashlight: SpotLight3D = %Flashlight +@onready var sound_controller: Node = %SoundController +@onready var cursor_raycast: RayCast3D = %CursorRaycast +@onready var popup_panels: Control = %PopupPanels +@onready var stamina_reset: Timer = %StaminaReset +@onready var player: PlayerCharacter = $"../.." +@onready var procedural_camera_mover: Node = %ProceduralCameraMover +@onready var camera: Camera3D = %PlayerCamera +@onready var hold_position: Marker3D = %HoldPosition + + +var sensitivity: float = 0.002 + +var _mouse_motion: Vector2 = Vector2.ZERO +var _mouse_motion_delta: Vector2 = Vector2.ZERO + +var held_object: RigidBody3D = null + +func toggle_flashlight(): + flashlight.visible = !flashlight.visible + sound_controller.play_flashlight_sound() + +func _input(event): + if Input.is_action_just_pressed("open_menu"): + ui_handler.toggle_menu() + + if not player_state.in_menu: + if event is InputEventMouseMotion: + if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: + _mouse_motion += event.relative + _mouse_motion_delta = event.relative + + if Input.is_action_just_pressed("flashlight"): + toggle_flashlight() + + if Input.is_action_just_released("jump") or Input.is_action_just_released("sprint"): + stamina_reset.start() + + if Input.is_action_just_pressed("grab"): + if cursor_raycast.is_colliding(): + var hit_object = cursor_raycast.get_collider() + + if hit_object is RigidBody3D and hit_object.is_in_group("grabbable"): + held_object = hit_object + held_object.gravity_scale = 0.0 + held_object.angular_damp = 5.0 + popup_panels.visible = false + + if Input.is_action_just_released("grab") and held_object != null: + held_object.gravity_scale = 1.0 + held_object.angular_damp = 0.0 + held_object = null + popup_panels.visible = true + +func _physics_process(delta: float) -> void: + #handle grabbed object + if held_object != null: + var target_pos = hold_position.global_position + var current_pos = held_object.global_position + var direction = target_pos - current_pos + + held_object.linear_velocity = direction * GRAB_POWER + + var current_quat = held_object.global_transform.basis.get_rotation_quaternion() + var target_quat = hold_position.global_transform.basis.get_rotation_quaternion() + + var delta_quat = target_quat * current_quat.inverse() + var angle = delta_quat.get_angle() + var axis = delta_quat.get_axis() + + if angle > PI: + angle -= TAU + + held_object.angular_velocity = axis * angle * GRAB_ROTATION_POWER + +func _process(delta: float) -> void: + _mouse_motion.y = clamp(_mouse_motion.y, -1560, 1560) + player.transform.basis = Basis.from_euler(Vector3(0, _mouse_motion.x * -0.001 * procedural_camera_mover.LOOK_SENSITIVITY, 0)) + camera.transform.basis = lerp(camera.transform.basis, Basis.from_euler(Vector3(_mouse_motion.y * -0.001 * procedural_camera_mover.LOOK_SENSITIVITY, 0, 0)), delta * 10) + +#func _unhandled_input(event: InputEvent) -> void: + #if event is InputEventMouseMotion: + #player_camera.rotate_y(-event.relative.x * sensitivity) + #player_camera.rotate_x(-event.relative.y * sensitivity) + #player_camera.rotation.x = clamp(player_camera.rotation.x, deg_to_rad(-90), deg_to_rad(90)) + #player_camera.rotation.z = 0 diff --git a/scenes/player/input_controller_component.gd.uid b/scenes/player/input_controller_component.gd.uid new file mode 100644 index 0000000..3c6b71c --- /dev/null +++ b/scenes/player/input_controller_component.gd.uid @@ -0,0 +1 @@ +uid://bvvwwkswavy5x diff --git a/scenes/player/movement_component.gd b/scenes/player/movement_component.gd new file mode 100644 index 0000000..33dab3b --- /dev/null +++ b/scenes/player/movement_component.gd @@ -0,0 +1,100 @@ +extends Node + +@export_category("Movement") +@export var SPEED = 5.0 ##base walking speed +@export var SPRINT_MULTIPLIER = 1.5 ##how much faster should you move, when sprinting +@export var SPRINT_STAMINA_COST = 10.0 ##how much stamina should be consumed each frame while sprinting (delta * SPRINT_STAMINA_COST) +@export var CROUCH_SPEED_MULTIPLIER = .5 ##how much slower you should be going while crouching + +@export_category("Jump") +@export var JUMP_VELOCITY = 4.5 ##how high you can jump +@export var JUMP_STAMINA_COST = 10 ##how much stamina each jump consumes + +@export_category("Camera") +@export var LOOK_SENSITIVITY = 1.0 ##camera sensitivity +@export var CAMERA_VELOCITY_MULTIPLIER = 1.5 ##how heavy should the UI movement feel + + +var _mouse_motion: Vector2 = Vector2.ZERO + +@onready var camera_pivot: Node3D = %CameraPivot +@onready var player_camera: Camera3D = %PlayerCamera +@onready var player: PlayerCharacter = $"../.." +@onready var player_state: Node = %PlayerState +@onready var player_properties: Node = %PlayerProperties +@onready var procedural_camera_mover: Node = %ProceduralCameraMover +@onready var player_hit_box: CollisionShape3D = $"../../PlayerHitBox" + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + +func _physics_process(delta: float) -> void: + if not player.is_on_floor(): + player.velocity += player.get_gravity() * delta + + if not player_state.in_menu: + if Input.is_action_just_pressed("jump") and player.is_on_floor() and player_properties.stamina > JUMP_STAMINA_COST: + player.velocity.y = JUMP_VELOCITY + player_properties.stamina -= JUMP_STAMINA_COST + player_properties.stamina_recharge_off() + + var input_dir = Input.get_vector("left", "right", "forward", "backward") + #var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() + var lean_dir = -Input.get_axis("lean_left", "lean_right") * .1 + + if lean_dir: + camera_pivot.rotation.z = lerpf(camera_pivot.rotation.z, lean_dir, delta*10) + camera_pivot.position.x = lerpf(camera_pivot.position.x, -lean_dir * 5, delta * 7) + else: + camera_pivot.rotation.z = lerpf(camera_pivot.rotation.z, 0, delta*10) + camera_pivot.position.x = lerpf(camera_pivot.position.x, 0, delta * 7) + + var target_speed = SPEED + var is_moving = input_dir != Vector2.ZERO + + if Input.is_action_pressed("crouch"): + player_hit_box.shape.height = lerpf(player_hit_box.shape.height, .5, delta * 5) + target_speed *= CROUCH_SPEED_MULTIPLIER + player_state.is_crouched(true) + else: + player_hit_box.shape.height = lerpf(player_hit_box.shape.height, 2, delta * 10) + player_state.is_crouched(false) + + if Input.is_action_pressed("sprint") and player_properties.stamina > 0: + target_speed *= SPRINT_MULTIPLIER + player_state.is_running(true) + player_properties.stamina -= delta * SPRINT_STAMINA_COST + player_properties.stamina_recharge_off() + else: + player_state.is_running(false) + + #apply motion + var local_vel = player.transform.basis.inverse() * player.velocity + var target_local_vel = Vector3(player_camera.transform.basis * Vector3(input_dir.x, 0, input_dir.y)) * target_speed + var accel_rate = 6.0 if is_moving else 9.0 + local_vel.x = lerpf(local_vel.x, target_local_vel.x, delta * accel_rate) + local_vel.z = lerpf(local_vel.z, target_local_vel.z, delta * accel_rate) + + var global_horizontal = player.transform.basis * local_vel + player.velocity.x = global_horizontal.x + player.velocity.z = global_horizontal.z + + if is_moving and not player_state.running and not player_state.crouching: + player_state.is_walking(true) + else: + player_state.is_walking(false) + + procedural_camera_mover.do(delta) + else: + player.velocity.x = lerpf(player.velocity.x, 0, delta * 10) + player.velocity.z = lerpf(player.velocity.z, 0, delta * 10) + + player.move_and_slide() + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta: float) -> void: + #_mouse_motion.y = clamp(_mouse_motion.y, -1560, 1560) + #player.transform.basis = Basis.from_euler(Vector3(0, _mouse_motion.x * -0.001 * LOOK_SENSITIVITY, 0)) + #player.transform.basis = lerp(player_camera.transform.basis, Basis.from_euler(Vector3(_mouse_motion.y * -0.001 * LOOK_SENSITIVITY, 0, 0)), delta * 10) + # diff --git a/scenes/player/movement_component.gd.uid b/scenes/player/movement_component.gd.uid new file mode 100644 index 0000000..0568ee3 --- /dev/null +++ b/scenes/player/movement_component.gd.uid @@ -0,0 +1 @@ +uid://dr2lwciaohf6f diff --git a/player/player.tscn b/scenes/player/player.tscn similarity index 77% rename from player/player.tscn rename to scenes/player/player.tscn index 547023f..1224cde 100644 --- a/player/player.tscn +++ b/scenes/player/player.tscn @@ -1,9 +1,9 @@ [gd_scene format=3 uid="uid://kqq30y24c6kd"] -[ext_resource type="Script" uid="uid://l2rc674shj03" path="res://player/player_manager.gd" id="1_eqqp1"] +[ext_resource type="Script" uid="uid://l2rc674shj03" path="res://scenes/player/player_manager.gd" id="1_eqqp1"] [ext_resource type="AudioStream" uid="uid://he4huk3fb0vm" path="res://assets/sounds/walking/normal/normal walk-001.wav" id="2_32hag"] -[ext_resource type="PackedScene" uid="uid://bsccbqq04umeg" path="res://player/player_ui.tscn" id="2_rkbax"] -[ext_resource type="PackedScene" uid="uid://y5f3db7clptv" path="res://player/in_game_menu.tscn" id="3_g1dw6"] +[ext_resource type="PackedScene" uid="uid://bsccbqq04umeg" path="res://scenes/player/player_ui.tscn" id="2_rkbax"] +[ext_resource type="PackedScene" uid="uid://y5f3db7clptv" path="res://scenes/player/in_game_menu.tscn" id="3_g1dw6"] [ext_resource type="AudioStream" uid="uid://db5upx7hn27qe" path="res://assets/sounds/walking/normal/normal walk-002.wav" id="3_tqiix"] [ext_resource type="AudioStream" uid="uid://b00bi5iffp5lf" path="res://assets/sounds/walking/normal/normal walk-003.wav" id="4_e7oew"] [ext_resource type="AudioStream" uid="uid://6slw3x6cnmim" path="res://assets/sounds/walking/normal/normal walk-004.wav" id="5_c35mf"] @@ -58,10 +58,17 @@ [ext_resource type="AudioStream" uid="uid://bxebqhgkkeqhp" path="res://assets/sounds/flashlight/flashlight-click-005.wav" id="55_7l6ig"] [ext_resource type="AudioStream" uid="uid://ctmut3x6w0sj1" path="res://assets/sounds/flashlight/flashlight-click-006.wav" id="56_j3r50"] [ext_resource type="AudioStream" uid="uid://dsgr417h5gcn0" path="res://assets/sounds/flashlight/flashlight-click-009.wav" id="59_do7qw"] -[ext_resource type="PackedScene" uid="uid://c02fkimxlbrje" path="res://player/grab_prompt.tscn" id="59_p5tca"] +[ext_resource type="PackedScene" uid="uid://c02fkimxlbrje" path="res://scenes/player/grab_prompt.tscn" id="59_p5tca"] +[ext_resource type="Script" uid="uid://dr2lwciaohf6f" path="res://scenes/player/movement_component.gd" id="60_s3g0c"] [ext_resource type="AudioStream" uid="uid://b8ppwr5vwhej0" path="res://assets/sounds/flashlight/flashlight-click-011.wav" id="61_8rogd"] +[ext_resource type="Script" uid="uid://cjk6a0da11ge6" path="res://scenes/player/procedural_camera_mover_component.gd" id="61_hggc2"] [ext_resource type="AudioStream" uid="uid://dlyhi0c2bw5b2" path="res://assets/sounds/flashlight/flashlight-click-012.wav" id="62_48p26"] +[ext_resource type="Script" uid="uid://v8er7yn0hdh8" path="res://scenes/player/sound_controller_component.gd" id="62_b2j0d"] [ext_resource type="Script" uid="uid://y8x4svl5kej2" path="res://addons/spatial_audio_3d/spatial_audio_3d.gd" id="62_jbx34"] +[ext_resource type="Script" uid="uid://7aa26wi66kqq" path="res://scenes/player/ui_handler_component.gd" id="63_7l6ig"] +[ext_resource type="Script" uid="uid://bvvwwkswavy5x" path="res://scenes/player/input_controller_component.gd" id="64_j3r50"] +[ext_resource type="Script" uid="uid://7hmwhf7acwpj" path="res://scenes/player/state_handler_component.gd" id="65_kssj8"] +[ext_resource type="Script" uid="uid://cbdvyelf7nb1u" path="res://scenes/player/player_properties.gd" id="66_8lfxt"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g4v7s"] @@ -96,16 +103,55 @@ SHUFFLE_FOOTSTEP_SOUNDS = Array[AudioStreamWAV]([ExtResource("44_qavcc"), ExtRes FLASHLIGHT_CLICK_SOUNDS = Array[AudioStreamWAV]([ExtResource("51_pjwc4"), ExtResource("52_or4qq"), ExtResource("53_hggc2"), ExtResource("55_7l6ig"), ExtResource("56_j3r50"), ExtResource("59_do7qw"), ExtResource("61_8rogd"), ExtResource("62_48p26")]) GRAB_PANEL = ExtResource("59_p5tca") +[node name="Components" type="Node" parent="." unique_id=1652812621] + +[node name="Movement" type="Node" parent="Components" unique_id=1821617467] +unique_name_in_owner = true +script = ExtResource("60_s3g0c") + +[node name="ProceduralCameraMover" type="Node" parent="Components" unique_id=899836528] +unique_name_in_owner = true +script = ExtResource("61_hggc2") + +[node name="SoundController" type="Node" parent="Components" unique_id=1286506274] +unique_name_in_owner = true +script = ExtResource("62_b2j0d") +NORMAL_FOOTSTEP_SOUNDS = Array[AudioStreamWAV]([ExtResource("2_32hag"), ExtResource("3_tqiix"), ExtResource("4_e7oew"), ExtResource("5_c35mf"), ExtResource("6_65viv"), ExtResource("7_x7c3f"), ExtResource("8_bjvpn"), ExtResource("9_s7qer"), ExtResource("10_g4c7l"), ExtResource("11_knn7v"), ExtResource("12_7pqkx"), ExtResource("13_uw77l"), ExtResource("14_rptt4")]) +HEAVY_FOOTSTEP_SOUNDS = Array[AudioStreamWAV]([ExtResource("15_n0b8q"), ExtResource("16_jfgyi"), ExtResource("17_237xx"), ExtResource("18_wpyo2"), ExtResource("19_7crtr"), ExtResource("20_vgvch"), ExtResource("21_a1u5o"), ExtResource("22_3dxkp"), ExtResource("23_6wior"), ExtResource("24_p5tca"), ExtResource("25_jbx34"), ExtResource("26_s3g0c"), ExtResource("27_35wys"), ExtResource("28_pjwc4"), ExtResource("29_or4qq"), ExtResource("30_hggc2")]) +LIGHT_FOOTSTEP_SOUNDS = Array[AudioStreamWAV]([ExtResource("31_b2j0d"), ExtResource("32_7l6ig"), ExtResource("33_j3r50"), ExtResource("34_utr5e"), ExtResource("35_kewli"), ExtResource("36_do7qw"), ExtResource("37_2h6tc"), ExtResource("38_8rogd"), ExtResource("39_48p26"), ExtResource("40_anp34"), ExtResource("41_jdjat"), ExtResource("42_j420s"), ExtResource("43_kcq4v")]) +SHUFFLE_FOOTSTEP_SOUNDS = Array[AudioStreamWAV]([ExtResource("44_qavcc"), ExtResource("45_bd26m"), ExtResource("46_lufic"), ExtResource("47_nxclr"), ExtResource("48_onxu2"), ExtResource("49_gci7n"), ExtResource("50_tcwf7")]) +FLASHLIGHT_CLICK_SOUNDS = Array[AudioStreamWAV]([ExtResource("51_pjwc4"), ExtResource("52_or4qq"), ExtResource("53_hggc2"), ExtResource("55_7l6ig"), ExtResource("56_j3r50"), ExtResource("59_do7qw"), ExtResource("61_8rogd"), ExtResource("62_48p26")]) + +[node name="UiHandler" type="Node" parent="Components" unique_id=1264775993] +unique_name_in_owner = true +script = ExtResource("63_7l6ig") +GRAB_PANEL = ExtResource("59_p5tca") + +[node name="InputController" type="Node" parent="Components" unique_id=1680856401] +unique_name_in_owner = true +script = ExtResource("64_j3r50") + +[node name="PlayerState" type="Node" parent="Components" unique_id=1564123661] +unique_name_in_owner = true +script = ExtResource("65_kssj8") + +[node name="PlayerProperties" type="Node" parent="Components" unique_id=1984191860] +unique_name_in_owner = true +script = ExtResource("66_8lfxt") + [node name="PlayerHitBox" type="CollisionShape3D" parent="." unique_id=1513955228] shape = SubResource("CapsuleShape3D_g4v7s") [node name="CameraPivot" type="Node3D" parent="." unique_id=963377832] +unique_name_in_owner = true [node name="PlayerCamera" type="Camera3D" parent="CameraPivot" unique_id=303347613] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75045073, 0) current = true [node name="Flashlight" type="SpotLight3D" parent="CameraPivot/PlayerCamera" unique_id=1036641941] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.025482714, 0.16212702, -0.019012451) light_color = Color(0.97844106, 0.88945234, 0, 1) light_indirect_energy = 3.519 @@ -116,10 +162,12 @@ spot_angle = 18.581459 spot_angle_attenuation = 1.9318668 [node name="CursorRaycast" type="RayCast3D" parent="CameraPivot/PlayerCamera" unique_id=1978798208] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0) target_position = Vector3(0, -2, 0) [node name="HoldPosition" type="Marker3D" parent="CameraPivot/PlayerCamera" unique_id=425231379] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5698267) [node name="GrabbableFinder" type="Area3D" parent="CameraPivot/PlayerCamera" unique_id=988433915] @@ -133,11 +181,14 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7621309, 0) doppler_tracking = 2 [node name="PlayerUi" parent="." unique_id=454848358 instance=ExtResource("2_rkbax")] +unique_name_in_owner = true [node name="InGameMenu" parent="." unique_id=1952418949 instance=ExtResource("3_g1dw6")] +unique_name_in_owner = true visible = false [node name="PopupPanels" type="Control" parent="." unique_id=305048227] +unique_name_in_owner = true layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -147,6 +198,7 @@ grow_vertical = 2 mouse_filter = 2 [node name="Cursor" type="TextureRect" parent="." unique_id=785138925] +unique_name_in_owner = true anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 @@ -164,12 +216,14 @@ texture = SubResource("CurveXYZTexture_d0u6y") expand_mode = 1 [node name="StaminaReset" type="Timer" parent="." unique_id=1815815085] +unique_name_in_owner = true wait_time = 2.0 one_shot = true [node name="SoundEmitters" type="Node3D" parent="." unique_id=661429541] [node name="LeftFoot" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=49863314] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.43042383, -0.90646136, 0) area_mask = 17 doppler_tracking = 2 @@ -183,6 +237,7 @@ roomsize_multiplicator = 20.0 metadata/_custom_type_script = "uid://y8x4svl5kej2" [node name="LeftFootTexture" type="AudioStreamPlayer3D" parent="SoundEmitters/LeftFoot" unique_id=368492] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.032262772, 0.019309282, 0) area_mask = 17 script = ExtResource("62_jbx34") @@ -195,6 +250,7 @@ roomsize_multiplicator = 20.0 metadata/_custom_type_script = "uid://y8x4svl5kej2" [node name="RightFoot" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=622217520] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.3428033, -0.8860581, 0) area_mask = 17 script = ExtResource("62_jbx34") @@ -207,6 +263,7 @@ roomsize_multiplicator = 20.0 metadata/_custom_type_script = "uid://y8x4svl5kej2" [node name="RightFootTexture" type="AudioStreamPlayer3D" parent="SoundEmitters/RightFoot" unique_id=721446442] +unique_name_in_owner = true area_mask = 17 script = ExtResource("62_jbx34") reverb_volume_db = -12.0 @@ -218,6 +275,7 @@ roomsize_multiplicator = 20.0 metadata/_custom_type_script = "uid://y8x4svl5kej2" [node name="FlashlightSound" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=1011459854] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.53598464, 0) max_polyphony = 3 area_mask = 17 @@ -230,6 +288,6 @@ max_raycast_distance = 200 roomsize_multiplicator = 20.0 metadata/_custom_type_script = "uid://y8x4svl5kej2" -[connection signal="body_entered" from="CameraPivot/PlayerCamera/GrabbableFinder" to="." method="_on_grabbable_finder_body_entered"] -[connection signal="body_exited" from="CameraPivot/PlayerCamera/GrabbableFinder" to="." method="_on_grabbable_finder_body_exited"] -[connection signal="timeout" from="StaminaReset" to="." method="_on_stamina_reset_timeout"] +[connection signal="body_entered" from="CameraPivot/PlayerCamera/GrabbableFinder" to="Components/UiHandler" method="_on_grabbable_finder_body_entered"] +[connection signal="body_exited" from="CameraPivot/PlayerCamera/GrabbableFinder" to="Components/UiHandler" method="_on_grabbable_finder_body_exited"] +[connection signal="timeout" from="StaminaReset" to="Components/PlayerProperties" method="_on_stamina_reset_timeout"] diff --git a/scenes/player/player_manager.gd b/scenes/player/player_manager.gd new file mode 100644 index 0000000..c1367ee --- /dev/null +++ b/scenes/player/player_manager.gd @@ -0,0 +1,109 @@ +extends CharacterBody3D +class_name PlayerCharacter + +##TODO make it so that you can easily tweak settings from here, cascading to the components + +@export_category("Movement") +@export var SPEED = 5.0 ##base walking speed +@export var SPRINT_MULTIPLIER = 1.5 ##how much faster should you move, when sprinting +@export var SPRINT_STAMINA_COST = 10.0 ##how much stamina should be consumed each frame while sprinting (delta * SPRINT_STAMINA_COST) +@export var CROUCH_SPEED_MULTIPLIER = .5 ##how much slower you should be going while crouching + +@export_category("Jump") +@export var JUMP_VELOCITY = 4.5 ##how high you can jump +@export var JUMP_STAMINA_COST = 10 ##how much stamina each jump consumes + +@export_category("Camera") +@export var LOOK_SENSITIVITY = 1.0 ##camera sensitivity +@export var CAMERA_VELOCITY_MULTIPLIER = 1.5 ##how heavy should the UI movement feel +@export var CAMERA_BOB_FREQUENCY = 2.4 ##how quick the camera bobs whilst moving +@export var CAMERA_BOB_AMPLITUDE = 0.08 ##how hard the camera bobs whilst moving +@export var CAMERA_BOB_MULTIPLIER = 200.0 ##how much the ui reacts to head bobbing +@export var CAMERA_SIDEWAYS_BOB_AMPLITUDE = 0.003 ## how many degrees does the camera bob sideways + +@export_category("UI") +@export var UI_SCALE: float = 1 ##rational scale of the ui +@export var UI_MOVEMENT_SENSITIVITY = 0.5 ##how much the UI moves when you move the camera +@export var UI_MOVEMENT_SPEED = 15.0 ##how fast the UI moves when you move the camera +@export var UI_MOVEMENT_VELOCITY_MULTIPLIER = 2.0 ##how much the ui leans when walking or strafing + +@export_category("Inventory") +@export var INVENTORY_MAX = 3 ##max number of items that can be in the player's inventory +@export var INVENTORY_ITEMS: Array = [] ##the items in the player's inventory + +@export_category("Audio") +@export var AUDIO_LOUDNESS: float = 100.0 +@export var NORMAL_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##normal footsteps -- walking +@export var HEAVY_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##heavy footsteps -- running +@export var LIGHT_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##light footsteps -- crouching +@export var SHUFFLE_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##shuffling -- random chance of playing while running +@export var FLASHLIGHT_CLICK_SOUNDS: Array[AudioStreamWAV] ##flashlight click +@export var SHUFFLE_CHANCE: float = 20 ##percentage of chance for a shuffle noise to be played whilst running + +@export_category("Grabbing") +@export var GRAB_POWER: float = 15.0 ##how fast the grabbed object snaps to the hold position +@export var GRAB_ROTATION_POWER: float = 15.0 ##how fast the object rotates towards the player +@export var GRAB_PANEL: PackedScene ##panel that goes over the grabbable object to show its grabbable + +@export_category("Player Physics") +@export_flags_3d_physics var PLAYER_COLLISION_MASK: int = 16 + +@onready var camera = $CameraPivot/PlayerCamera +@onready var camera_pivot = $CameraPivot +@onready var ui = $PlayerUi +@onready var ui_base_position = ui.position +@onready var in_game_menu = $InGameMenu +@onready var left_foot_sound_player = $SoundEmitters/LeftFoot +@onready var left_foot_texture_sound_player = $SoundEmitters/LeftFoot/LeftFootTexture +@onready var right_foot_sound_player = $SoundEmitters/RightFoot +@onready var right_foot_texture_sound_player = $SoundEmitters/RightFoot/RightFootTexture +@onready var flashlight_sound_player = $SoundEmitters/FlashlightSound +@onready var cursor_raycast = $CameraPivot/PlayerCamera/CursorRaycast +@onready var hold_position = $CameraPivot/PlayerCamera/HoldPosition +@onready var popup_panels = $PopupPanels + +var walking: bool = false +var running: bool = false +var crouching: bool = false +var in_menu: bool = false +var stamina: float = 100.0 +var stamina_recharge_on: bool = false +var selected_item: int = 0 +var t_bob: float = 0 +var last_bob_y: float = 0.0 +var held_object: RigidBody3D = null + +var _mouse_motion: Vector2 = Vector2.ZERO +var _mouse_motion_delta: Vector2 = Vector2.ZERO +var _last_camera_global_position: Vector3 = Vector3.ZERO +var _current_leg_is_right: bool = false ##if true: current leg is the right leg +var _current_footstep_sound: AudioStreamWAV = null +var _current_flashlight_sound: AudioStreamWAV = null +var _camera_original_position: Vector3 = Vector3(0,.75,0) + +# components +@onready var procedural_camera_mover: Node = %ProceduralCameraMover +@onready var sound_controller: Node = %SoundController +@onready var ui_handler: Node = %UiHandler +@onready var input_controller: Node = %InputController +@onready var player_state: Node = %PlayerState +@onready var player_properties: Node = %PlayerProperties + +func _process(delta: float) -> void: + if Input.is_action_just_pressed("next_item"): + ui_handler.next_item() + + if Input.is_action_just_pressed("prev_item"): + ui_handler.prev_item() + + if Input.is_action_just_pressed("select_item_1"): + ui_handler.select_item(0) + + if Input.is_action_just_pressed("select_item_2"): + ui_handler.select_item(1) + + if Input.is_action_just_pressed("select_item_3"): + ui_handler.select_item(2) + +func _ready() -> void: + ui_handler.select_item(0) diff --git a/player/player_manager.gd.uid b/scenes/player/player_manager.gd.uid similarity index 100% rename from player/player_manager.gd.uid rename to scenes/player/player_manager.gd.uid diff --git a/scenes/player/player_properties.gd b/scenes/player/player_properties.gd new file mode 100644 index 0000000..986a2e7 --- /dev/null +++ b/scenes/player/player_properties.gd @@ -0,0 +1,22 @@ +extends Node + +@export_category("Inventory") +@export var INVENTORY_MAX = 3 ##max number of items that can be in the player's inventory +@export var INVENTORY_ITEMS: Array = [] ##the items in the player's inventory + +var stamina: float = 100.0 +var selected_item: int = 0 +var stamina_recharge: bool = true + +func stamina_recharge_off(): + stamina_recharge = false + +func select_item(index:int): + selected_item = index + +func _process(delta: float) -> void: + if stamina_recharge: + stamina = move_toward(stamina, 100, .5) + +func _on_stamina_reset_timeout() -> void: + stamina_recharge = true diff --git a/scenes/player/player_properties.gd.uid b/scenes/player/player_properties.gd.uid new file mode 100644 index 0000000..7197724 --- /dev/null +++ b/scenes/player/player_properties.gd.uid @@ -0,0 +1 @@ +uid://cbdvyelf7nb1u diff --git a/player/player_ui.tscn b/scenes/player/player_ui.tscn similarity index 96% rename from player/player_ui.tscn rename to scenes/player/player_ui.tscn index fd211d9..b9ce2d3 100644 --- a/player/player_ui.tscn +++ b/scenes/player/player_ui.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://bsccbqq04umeg"] -[ext_resource type="Script" uid="uid://lkb0o8too0mj" path="res://player/player_ui_manager.gd" id="1_n215f"] +[ext_resource type="Script" uid="uid://lkb0o8too0mj" path="res://scenes/player/player_ui_manager.gd" id="1_32d7b"] [node name="PlayerUi" type="Control" unique_id=454848358] layout_mode = 3 @@ -10,7 +10,7 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 offset_transform_enabled = true -script = ExtResource("1_n215f") +script = ExtResource("1_32d7b") [node name="StaminaBar" type="ProgressBar" parent="." unique_id=1844702202] layout_mode = 1 diff --git a/player/player_ui_manager.gd b/scenes/player/player_ui_manager.gd similarity index 100% rename from player/player_ui_manager.gd rename to scenes/player/player_ui_manager.gd diff --git a/player/player_ui_manager.gd.uid b/scenes/player/player_ui_manager.gd.uid similarity index 100% rename from player/player_ui_manager.gd.uid rename to scenes/player/player_ui_manager.gd.uid diff --git a/scenes/player/procedural_camera_mover_component.gd b/scenes/player/procedural_camera_mover_component.gd new file mode 100644 index 0000000..9816cd3 --- /dev/null +++ b/scenes/player/procedural_camera_mover_component.gd @@ -0,0 +1,96 @@ +extends Node + +@export_category("Camera") +@export var LOOK_SENSITIVITY = 1.0 ##camera sensitivity +@export var CAMERA_VELOCITY_MULTIPLIER = 1.5 ##how heavy should the UI movement feel +@export var CAMERA_BOB_FREQUENCY = 2.4 ##how quick the camera bobs whilst moving +@export var CAMERA_BOB_AMPLITUDE = 0.08 ##how hard the camera bobs whilst moving +@export var CAMERA_BOB_MULTIPLIER = 200.0 ##how much the ui reacts to head bobbing +@export var CAMERA_SIDEWAYS_BOB_AMPLITUDE = 0.003 ## how many degrees does the camera bob sideways + +@export_category("UI") +@export var UI_SCALE: float = 1 ##rational scale of the ui +@export var UI_MOVEMENT_SENSITIVITY = 0.5 ##how much the UI moves when you move the camera +@export var UI_MOVEMENT_SPEED = 15.0 ##how fast the UI moves when you move the camera +@export var UI_MOVEMENT_VELOCITY_MULTIPLIER = 2.0 ##how much the ui leans when walking or strafing + +@onready var player: PlayerCharacter = $"../.." +@onready var sound_controller: Node = %SoundController +@onready var camera: Camera3D = %PlayerCamera +@onready var ui: Control = %PlayerUi +@onready var player_properties: Node = %PlayerProperties +@onready var ui_base_position = ui.position + +var t_bob: float = 0.0 +var last_bob_y: float = 0.0 + +var _camera_original_position: Vector3 = Vector3(0,.75,0) +var _mouse_motion: Vector2 = Vector2.ZERO +var _mouse_motion_delta: Vector2 = Vector2.ZERO +var _last_camera_global_position: Vector3 = Vector3.ZERO + +func _ready() -> void: + _last_camera_global_position = camera.global_position + +func do(delta): + ui.offset_transform_scale *= UI_SCALE + ui_movement_handling(delta) + ui.set_stamina_bar(player_properties.stamina) + var horizontal_speed = Vector3(player.velocity.x, player.velocity.y, player.velocity.z).length() + + if player.is_on_floor() and horizontal_speed > 0.05: + t_bob += delta * (player.velocity.length() * float(player.is_on_floor()) + (int(Input.is_action_pressed("crouch"))) * 3) + + var current_sin_pos = sin(t_bob * CAMERA_BOB_FREQUENCY) + + #footstep handling + if last_bob_y >= -.95 and current_sin_pos < -.95: + sound_controller.play_footstep_sound() + + last_bob_y = current_sin_pos + + camera_bobbing(t_bob) + + #idle breathing + elif player.is_on_floor() and horizontal_speed < 0.05: + t_bob += delta * 1 + camera_breathing(t_bob) + else: + camera.rotation.z = lerpf(camera.rotation.z,0, delta * 0.004) + camera.transform.origin.y = lerpf(camera.transform.origin.y, _camera_original_position.y, delta * 5.0) + if camera.transform.origin.length() < 0.01: + t_bob = 0 + last_bob_y = 0.0 + +func ui_movement_handling(delta: float): + var mouse_offset = -_mouse_motion_delta * UI_MOVEMENT_SENSITIVITY + + var current_camera_global_position = camera.global_position + var camera_global_velocity = (current_camera_global_position - _last_camera_global_position) / delta + + var cam_local_vel = camera.global_transform.basis.inverse() * camera_global_velocity + + var inertia_offset = Vector2( + -cam_local_vel.x, + cam_local_vel.y - (cam_local_vel.z * 0.25) + ) * CAMERA_VELOCITY_MULTIPLIER + + var target_offset = mouse_offset + inertia_offset + ui.position = ui.position.lerp(ui_base_position + target_offset, delta * UI_MOVEMENT_SPEED) + + _last_camera_global_position = current_camera_global_position + + var ui_scaling_target = Vector2(-cam_local_vel.z * UI_MOVEMENT_SENSITIVITY * .002 + 1, -cam_local_vel.z * UI_MOVEMENT_SENSITIVITY * .002 + 1) + ui.offset_transform_scale = ui.offset_transform_scale.lerp(ui_scaling_target, delta * UI_MOVEMENT_SPEED) + + var ui_rotation_target = -inertia_offset.x - mouse_offset.x * 0.25 + ui.offset_transform_rotation = lerpf(ui.offset_transform_rotation, ui_rotation_target * UI_MOVEMENT_SENSITIVITY * 0.003, delta * UI_MOVEMENT_SPEED) + + +func camera_bobbing(time: float): + camera.transform.origin.y = sin(time * CAMERA_BOB_FREQUENCY) * CAMERA_BOB_AMPLITUDE + .75 + camera.rotation.z += sin(time * CAMERA_BOB_FREQUENCY * .5) * CAMERA_SIDEWAYS_BOB_AMPLITUDE + +func camera_breathing(time: float): + camera.transform.origin.y = sin(time * CAMERA_BOB_FREQUENCY) * CAMERA_BOB_AMPLITUDE + .75 + camera.rotation.x += sin(time * CAMERA_BOB_FREQUENCY) * CAMERA_SIDEWAYS_BOB_AMPLITUDE diff --git a/scenes/player/procedural_camera_mover_component.gd.uid b/scenes/player/procedural_camera_mover_component.gd.uid new file mode 100644 index 0000000..7d8ba21 --- /dev/null +++ b/scenes/player/procedural_camera_mover_component.gd.uid @@ -0,0 +1 @@ +uid://cjk6a0da11ge6 diff --git a/scenes/player/sound_controller_component.gd b/scenes/player/sound_controller_component.gd new file mode 100644 index 0000000..8954129 --- /dev/null +++ b/scenes/player/sound_controller_component.gd @@ -0,0 +1,69 @@ +extends Node + +@export_category("Audio") +@export var AUDIO_LOUDNESS: float = 100.0 +@export var NORMAL_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##normal footsteps -- walking +@export var HEAVY_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##heavy footsteps -- running +@export var LIGHT_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##light footsteps -- crouching +@export var SHUFFLE_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##shuffling -- random chance of playing while running +@export var FLASHLIGHT_CLICK_SOUNDS: Array[AudioStreamWAV] ##flashlight click +@export var SHUFFLE_CHANCE: float = 20 ##percentage of chance for a shuffle noise to be played whilst running + +var _current_flashlight_sound = null +var _current_footstep_sound = null +var _current_leg_is_right = false + +@onready var flashlight_sound_player: SpatialAudio3D = %FlashlightSound +@onready var player_state: Node = %PlayerState +@onready var left_foot_texture: SpatialAudio3D = %LeftFootTexture +@onready var right_foot: SpatialAudio3D = %RightFoot +@onready var right_foot_texture: SpatialAudio3D = %RightFootTexture +@onready var left_foot: SpatialAudio3D = %LeftFoot + +func play_flashlight_sound(): + var play_sound = FLASHLIGHT_CLICK_SOUNDS.pick_random() + + while play_sound == _current_flashlight_sound: + play_sound = FLASHLIGHT_CLICK_SOUNDS.pick_random() + + flashlight_sound_player.do_set_stream(play_sound) + flashlight_sound_player.pitch_scale = randf_range(.8, 1.2) + flashlight_sound_player.do_play() + _current_flashlight_sound = play_sound + +func play_footstep_sound(): + var sound_to_play + if player_state.walking: + sound_to_play = NORMAL_FOOTSTEP_SOUNDS.pick_random() + while sound_to_play == _current_footstep_sound: + sound_to_play = NORMAL_FOOTSTEP_SOUNDS.pick_random() + elif player_state.running: + sound_to_play = HEAVY_FOOTSTEP_SOUNDS.pick_random() + while sound_to_play == _current_footstep_sound: + sound_to_play = HEAVY_FOOTSTEP_SOUNDS.pick_random() + if randf_range(1, 100) > 100 - SHUFFLE_CHANCE: + match _current_leg_is_right: + true: + right_foot_texture.do_set_stream(SHUFFLE_FOOTSTEP_SOUNDS.pick_random()) + right_foot_texture.do_play() + false: + left_foot_texture.do_set_stream(SHUFFLE_FOOTSTEP_SOUNDS.pick_random()) + left_foot_texture.do_play() + + elif player_state.crouching: + sound_to_play = LIGHT_FOOTSTEP_SOUNDS.pick_random() + while sound_to_play == _current_footstep_sound: + sound_to_play = LIGHT_FOOTSTEP_SOUNDS.pick_random() + + _current_footstep_sound = sound_to_play + + if _current_leg_is_right: + right_foot.do_set_stream(sound_to_play) + right_foot.pitch_scale = randf_range(0.8, 1.2) + right_foot.do_play() + _current_leg_is_right = false + else: + left_foot.do_set_stream(sound_to_play) + left_foot.pitch_scale = randf_range(0.8, 1.2) + left_foot.do_play() + _current_leg_is_right = true diff --git a/scenes/player/sound_controller_component.gd.uid b/scenes/player/sound_controller_component.gd.uid new file mode 100644 index 0000000..066bbd5 --- /dev/null +++ b/scenes/player/sound_controller_component.gd.uid @@ -0,0 +1 @@ +uid://v8er7yn0hdh8 diff --git a/scenes/player/state_handler_component.gd b/scenes/player/state_handler_component.gd new file mode 100644 index 0000000..7acd909 --- /dev/null +++ b/scenes/player/state_handler_component.gd @@ -0,0 +1,30 @@ +extends Node + +var walking: bool = false +var running: bool = false +var crouching: bool = false +var in_menu: bool = false + +func is_crouched(yes:bool): + if yes: + crouching = true + walking = false + running = false + else: + crouching = false + +func is_walking(yes:bool): + if yes: + crouching = false + walking = true + running = false + else: + walking = false + +func is_running(yes:bool): + if yes: + crouching = false + walking = false + running = true + else: + running = false diff --git a/scenes/player/state_handler_component.gd.uid b/scenes/player/state_handler_component.gd.uid new file mode 100644 index 0000000..99b93fd --- /dev/null +++ b/scenes/player/state_handler_component.gd.uid @@ -0,0 +1 @@ +uid://7hmwhf7acwpj diff --git a/scenes/player/ui_handler_component.gd b/scenes/player/ui_handler_component.gd new file mode 100644 index 0000000..e48f8e0 --- /dev/null +++ b/scenes/player/ui_handler_component.gd @@ -0,0 +1,72 @@ +extends Node + +@export_category("UI") +@export var UI_SCALE: float = 1 ##rational scale of the ui +@export var UI_MOVEMENT_SENSITIVITY = 0.5 ##how much the UI moves when you move the camera +@export var UI_MOVEMENT_SPEED = 15.0 ##how fast the UI moves when you move the camera +@export var UI_MOVEMENT_VELOCITY_MULTIPLIER = 2.0 ##how much the ui leans when walking or strafing + +@export var GRAB_PANEL: PackedScene + +@onready var in_game_menu: Control = %InGameMenu +@onready var ui: Control = %PlayerUi +@onready var popup_panels: Control = %PopupPanels +@onready var player_state: Node = %PlayerState +@onready var player_properties: Node = %PlayerProperties +@onready var player: PlayerCharacter = $"../.." +@onready var cursor: TextureRect = %Cursor +@onready var player_camera: Camera3D = %PlayerCamera + +var grabbable_panel = null +var grabbable_panel_body = null + +func _on_grabbable_finder_body_entered(body: Node3D) -> void: + if body.is_in_group("grabbable"): + grabbable_panel = GRAB_PANEL.instantiate() + popup_panels.add_child(grabbable_panel) + grabbable_panel_body = body + +func _on_grabbable_finder_body_exited(body: Node3D) -> void: + if body == grabbable_panel_body: + popup_panels.remove_child(grabbable_panel) + grabbable_panel = null + grabbable_panel_body = null + +func _process(delta: float) -> void: + if grabbable_panel != null: + var target_position = cursor.position - player_camera.unproject_position(grabbable_panel_body.global_position) + grabbable_panel.position = grabbable_panel.position.lerp(-target_position / 2, delta * 50) + +func toggle_menu(): + if !in_game_menu.visible: + ui.visible = false + popup_panels.visible = false + in_game_menu.visible = true + cursor.visible = false + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + player_state.in_menu = true + else: + ui.visible = true + popup_panels.visible = true + in_game_menu.visible = false + cursor.visible = true + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + player_state.in_menu = false + +func next_item(): + if player_properties.selected_item + 1 > player_properties.INVENTORY_MAX - 1: + player_properties.selected_item = 0 + else: + player_properties.selected_item += 1 + ui.select_item(player_properties.selected_item) + +func prev_item(): + if player_properties.selected_item - 1 < 0: + player_properties.selected_item = player_properties.INVENTORY_MAX - 1 + else: + player_properties.selected_item -= 1 + ui.select_item(player_properties.selected_item) + +func select_item(index: int): + player_properties.select_item(index) + ui.select_item(index) diff --git a/scenes/player/ui_handler_component.gd.uid b/scenes/player/ui_handler_component.gd.uid new file mode 100644 index 0000000..9b5615a --- /dev/null +++ b/scenes/player/ui_handler_component.gd.uid @@ -0,0 +1 @@ +uid://7aa26wi66kqq diff --git a/player/blur_shader.gdshader b/shaders/blur_shader.gdshader similarity index 100% rename from player/blur_shader.gdshader rename to shaders/blur_shader.gdshader diff --git a/player/blur_shader.gdshader.uid b/shaders/blur_shader.gdshader.uid similarity index 100% rename from player/blur_shader.gdshader.uid rename to shaders/blur_shader.gdshader.uid