Compare commits
7 Commits
2bd83504f2
...
master
Author | SHA1 | Date | |
---|---|---|---|
356897045f | |||
1e1f8cebe8
|
|||
b21ad67cfc
|
|||
4fffa8784a
|
|||
dc3f8c94f8 | |||
f06bf17757
|
|||
d74831df56
|
16
.github/workflows/flake-check.yaml
vendored
Normal file
16
.github/workflows/flake-check.yaml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
name: flake-check
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [ ubuntu-latest, homelab ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v31
|
||||
- run: nix flake check
|
||||
|
27
flake.nix
27
flake.nix
@@ -46,6 +46,30 @@
|
||||
}
|
||||
);
|
||||
|
||||
checks = forAllSystems (
|
||||
{ pkgs }:
|
||||
{
|
||||
gdformat = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "gdformat-check";
|
||||
src = pkgs.lib.sources.sourceFilesBySuffices (pkgs.lib.cleanSource ./.) [ ".gd" ];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
gdtoolkit_4
|
||||
];
|
||||
|
||||
dontBuild = true;
|
||||
doCheck = true;
|
||||
|
||||
checkPhase = ''
|
||||
export HOME=$(mktemp -d)
|
||||
find . -name "*.gd" -print0 | xargs -0 gdformat --check
|
||||
echo "All .gd files are properly formatted"
|
||||
'';
|
||||
installPhase = "mkdir $out";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
packages = forAllSystems (
|
||||
{ pkgs }:
|
||||
let
|
||||
@@ -77,7 +101,6 @@
|
||||
runHook postBuild
|
||||
'';
|
||||
installPhase = ''
|
||||
find .
|
||||
install -D -m 755 -t $out/libexec ./build/slopvivors
|
||||
install -D -m 644 -t $out/libexec ./build/slopvivors.pck
|
||||
install -d -m 755 $out/bin
|
||||
@@ -158,7 +181,7 @@
|
||||
'';
|
||||
};
|
||||
slopvivors_docker = pkgs.dockerTools.buildLayeredImage {
|
||||
name = "slopvivors-docker-${version}";
|
||||
name = "slopvivors-docker";
|
||||
tag = version;
|
||||
created = "now";
|
||||
contents = [
|
||||
|
@@ -3,5 +3,6 @@ extends Resource
|
||||
|
||||
var enemy: EnemyBase
|
||||
|
||||
|
||||
func apply(enemy: EnemyBase) -> void:
|
||||
push_error("%s does not implement apply" % self)
|
||||
|
@@ -11,10 +11,12 @@ var _enemy: EnemyBase
|
||||
|
||||
const PUDDLE = preload("res://scenes/puddle.tscn")
|
||||
|
||||
|
||||
func _init(enemy: EnemyBase, bleed_damage: float, duration: float):
|
||||
damage = bleed_damage
|
||||
_timer = Timer.new()
|
||||
|
||||
|
||||
func apply(enemy: EnemyBase) -> void:
|
||||
enemy.effects.append(self)
|
||||
while _remaining_ticks > 0:
|
||||
@@ -26,5 +28,6 @@ func apply(enemy: EnemyBase) -> void:
|
||||
p.global_position = enemy.global_position
|
||||
enemy.effects.erase(self)
|
||||
|
||||
|
||||
static func _is_bleeding(enemy: EnemyBase) -> bool:
|
||||
return false
|
||||
|
@@ -20,7 +20,6 @@ var modifiers: Array[EnemyMod] = []
|
||||
@onready var label: Label = $HBoxContainer/Label
|
||||
@onready var effect_container: HBoxContainer = $HBoxContainer/EffectContainer
|
||||
|
||||
|
||||
var player: Player
|
||||
var enemy_name: String
|
||||
var target: Node2D
|
||||
@@ -34,6 +33,7 @@ var _path_update_timer: float = 0.0
|
||||
var _compute_cache: KeyedCache = KeyedCache.new()
|
||||
var _effects_visible = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
enemy_name = _gen_name()
|
||||
match enemy_rarity:
|
||||
@@ -67,6 +67,7 @@ func _find_player():
|
||||
func _gen_name() -> String:
|
||||
return "Unnamed enemy"
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
for effect in effects:
|
||||
if effect in _effects_visible:
|
||||
|
19
scenes/main_menu.gd
Normal file
19
scenes/main_menu.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends Control
|
||||
|
||||
const MAIN = preload("res://scenes/main.tscn")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_new_game_button_pressed() -> void:
|
||||
get_tree().change_scene_to_packed(MAIN)
|
||||
|
||||
|
||||
func _on_options_button_pressed() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_exit_game_button_pressed() -> void:
|
||||
get_tree().quit()
|
1
scenes/main_menu.gd.uid
Normal file
1
scenes/main_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://sd158y3mdmkt
|
69
scenes/main_menu.tscn
Normal file
69
scenes/main_menu.tscn
Normal file
@@ -0,0 +1,69 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cynet50emve6c"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://sd158y3mdmkt" path="res://scenes/main_menu.gd" id="1_l6cm7"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_vue75"]
|
||||
colors = PackedColorArray(0.252028, 0.252028, 0.252028, 1, 0.25098, 0.25098, 0.25098, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_l6cm7"]
|
||||
gradient = SubResource("Gradient_vue75")
|
||||
|
||||
[node name="MainMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_l6cm7")
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource("GradientTexture1D_l6cm7")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 20
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 20
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="NewGameButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "New game"
|
||||
|
||||
[node name="OptionsButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Options"
|
||||
|
||||
[node name="ExitGameButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Exit game"
|
||||
|
||||
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/NewGameButton" to="." method="_on_new_game_button_pressed"]
|
||||
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"]
|
||||
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/ExitGameButton" to="." method="_on_exit_game_button_pressed"]
|
@@ -31,7 +31,6 @@ func _ready() -> void:
|
||||
add_child(weapon)
|
||||
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if dead:
|
||||
return
|
||||
|
@@ -4,6 +4,7 @@ extends Node2D
|
||||
@export var color: Color = Color.CRIMSON
|
||||
@onready var base: Sprite2D = $Base
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var player: Player = get_tree().get_first_node_in_group(GlobalConst.GROUP_PLAYER)
|
||||
var shader = preload("res://assets/shaders/base_color_tint.gdshader")
|
||||
|
@@ -25,9 +25,11 @@ enum WeaponTag {
|
||||
|
||||
var _player: Player
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_player = get_tree().get_first_node_in_group(GlobalConst.GROUP_PLAYER)
|
||||
|
||||
|
||||
func _on_attack_cd_timer_timeout() -> void:
|
||||
do_attack()
|
||||
|
||||
@@ -87,15 +89,18 @@ func has_property(key: String) -> bool:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func did_crit() -> bool:
|
||||
var weapon_crit = get_calculated("attack_crit_chance")
|
||||
var player_crit = _player.player_stats.get_final("crit_chance", _player.modifiers)
|
||||
|
||||
return randf() >= 1 - weapon_crit + player_crit
|
||||
|
||||
|
||||
func did_bleed() -> bool:
|
||||
return randf() >= 1 - bleed_chance
|
||||
|
||||
|
||||
func base_damage() -> Array[Variant]:
|
||||
var damage = get_calculated("attack_damage")
|
||||
var is_crit := did_crit()
|
||||
|
@@ -9,8 +9,6 @@ const WEAPON_SWORD_PROJECTILE = preload("res://scenes/weapons/weapon_sword_proje
|
||||
signal projectile_hit(projectile: WeaponSwordProjectile, enemy: EnemyBase)
|
||||
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
bleed_chance = 0.2
|
||||
targeting_range_shape.shape.radius = attack_range
|
||||
|
Reference in New Issue
Block a user