-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a sample mod that improves on some of the atmospheric aspects of Public Demo 2 v2. 'Lightly Weathered' implements a basic weather progression system tied to level transitions, and picks the background music according to zone.
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[mod] | ||
name="Lightly Weathered" | ||
id="lightly-weathered" | ||
version="1.0.0" | ||
|
||
[autoload] | ||
0="res://mods/LightlyWeathered/Main.gd" |
11 changes: 11 additions & 0 deletions
11
sample_mods/LightlyWeathered/mods/LightlyWeathered/Main.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extends Node | ||
|
||
func _ready(): | ||
overrideScript("res://mods/LightlyWeathered/Transition.gd") | ||
queue_free() | ||
|
||
func overrideScript(overrideScriptPath : String): | ||
var script : Script = load(overrideScriptPath) | ||
script.reload() | ||
var parentScript = script.get_base_script() | ||
script.take_over_path(parentScript.resource_path) |
60 changes: 60 additions & 0 deletions
60
sample_mods/LightlyWeathered/mods/LightlyWeathered/Transition.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
extends "res://Scripts/Transition.gd" | ||
|
||
var preferences: Preferences | ||
|
||
func Interact(): | ||
if not deactivated and not tutorialExit: | ||
ProgressWeather() | ||
|
||
super() | ||
|
||
if not deactivated and not tutorialExit: | ||
SetMusic() | ||
|
||
func ProgressWeather(): | ||
if shelterExit: | ||
if randf() < 0.15: | ||
gameData.season = (gameData.season % 2) + 1 | ||
|
||
if randf() < 0.5: | ||
if randf() < 0.75: | ||
gameData.TOD = (randi() % 2) + 1 | ||
else: | ||
gameData.TOD = (randi() % 4) + 1 | ||
|
||
else: | ||
if (gameData.TOD == 2 && randf() < 0.33) or (gameData.TOD != 2 && randf() < 0.5): | ||
gameData.TOD = (gameData.TOD % 4) + 1 | ||
|
||
if randf() < 0.15: | ||
gameData.aurora = true | ||
else: | ||
gameData.aurora = false | ||
|
||
if randf() < 0.5: | ||
if randf() < 0.75: | ||
gameData.weather = 1 | ||
else: | ||
gameData.weather = (randi() % 4) + 1 | ||
|
||
preferences = Preferences.Load() | ||
preferences.season = gameData.season | ||
preferences.TOD = gameData.TOD | ||
preferences.weather = gameData.weather | ||
preferences.aurora = gameData.aurora | ||
preferences.Save() | ||
|
||
func SetMusic(): | ||
if gameData.shelter: | ||
gameData.musicPreset = 1 | ||
elif gameData.permadeath: | ||
gameData.musicPreset = 4 | ||
elif gameData.currentMap == "Minefield": | ||
gameData.musicPreset = 3 | ||
else: | ||
gameData.musicPreset = 2 | ||
|
||
preferences = Preferences.Load() | ||
if preferences.musicPreset != gameData.musicPreset: | ||
preferences.musicPreset = gameData.musicPreset | ||
preferences.Save() |