Compare commits

...

3 Commits

Author SHA1 Message Date
58bb1d9ca5 trying to fix CI
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 23s
Create tag and build when new code gets to main / Export (push) Failing after 1m43s
2026-01-25 00:24:51 +01:00
cf7591b413 this is so easy to develop there must be a catch
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 26s
Create tag and build when new code gets to main / Export (push) Failing after 1m55s
2026-01-25 00:16:16 +01:00
92cc4f0264 sooooo coded a feature first try? weird
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 25s
Create tag and build when new code gets to main / Export (push) Failing after 1m48s
2026-01-24 23:29:22 +01:00
6 changed files with 121 additions and 47 deletions

View File

@@ -1,7 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAction_00601_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F7c0f83388bfc4d2c9d09befcec9dd79bc90908_003Fb8_003F4d300c4d_003FAction_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAction_00602_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F7c0f83388bfc4d2c9d09befcec9dd79bc90908_003F87_003Fded27e2d_003FAction_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACharacterBody3D_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fe56b84c3fa498fb86fc1eba376f62f482127e3fe80415c5fb2acde2bf6d89793_003FCharacterBody3D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnemy_005FScriptMethods_002Egenerated_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F8e71dc81611862c01a2cb998a1f327de14747655_003FEnemy_005FScriptMethods_002Egenerated_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANode_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F716d154fef5cbe863cd637bd32beda6e3cec5f12e8fed2dc5b2d8149a0d558ab_003FNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANode_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fdf73a4db74df89d59655c5fb6326406f47fbfa9af1fa81518fe0a07c49d34133_003FNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

View File

@@ -2,10 +2,10 @@
[ext_resource type="PackedScene" uid="uid://bei4nhkf8lwdo" path="res://player_controller/PlayerController.tscn" id="1_62kkh"]
[ext_resource type="Material" uid="uid://31aulub2nqov" path="res://assets/greybox/m_greybox.tres" id="2_3uydm"]
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://components/damage/RDamage.cs" id="2_5fa36"]
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="3_3uydm"]
[ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="5_8fd2t"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://components/movement/RMovement.cs" id="5_ybosk"]
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://components/knockback/RKnockback.cs" id="6_1hrkh"]
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="6_7m3bq"]
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="7_caohq"]
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://components/health/RHealth.cs" id="9_2e4ci"]
@@ -15,6 +15,11 @@
[ext_resource type="Resource" uid="uid://dg1xbjhyhgnnk" path="res://scenes/enemies/flying_enemy/flying_enemy_health.tres" id="11_2e4ci"]
[ext_resource type="PackedScene" uid="uid://qup00a7x2sji" path="res://scenes/FixedDashTarget/fixed_dashthrough_target.tscn" id="15_5fa36"]
[sub_resource type="Resource" id="Resource_1hrkh"]
script = ExtResource("2_5fa36")
DamageDealt = 1.0
metadata/_custom_type_script = "uid://jitubgv6judn"
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_0xm2m"]
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
@@ -37,10 +42,6 @@ ssil_radius = 8.4
sdfgi_use_occlusion = true
glow_enabled = true
[sub_resource type="Resource" id="Resource_q21h6"]
script = ExtResource("6_1hrkh")
metadata/_custom_type_script = "uid://b44cse62qru7j"
[sub_resource type="Resource" id="Resource_5fa36"]
script = ExtResource("5_ybosk")
GravityModifier = 5.0
@@ -56,6 +57,7 @@ metadata/_custom_type_script = "uid://baiapod3csndf"
[node name="Player" parent="." instance=ExtResource("1_62kkh")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 7.5)
TutorialDone = true
RDamage = SubResource("Resource_1hrkh")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_1bvp3")
@@ -135,7 +137,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9, 3.5, 2.5)
[node name="Enemy" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_3uydm")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13.5, 2.5, -8.336809)
Target = NodePath("../Player")
RKnockback = SubResource("Resource_q21h6")
RMovement = SubResource("Resource_5fa36")
[node name="Enemy2" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_3uydm")]

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=64 format=3 uid="uid://bei4nhkf8lwdo"]
[gd_scene load_steps=66 format=3 uid="uid://bei4nhkf8lwdo"]
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
[ext_resource type="PackedScene" uid="uid://cf3rrgr1imvv4" path="res://scenes/path/path.tscn" id="2_6lejt"]
@@ -86,6 +86,9 @@ top_radius = 0.2
bottom_radius = 0.2
height = 1.0
[sub_resource type="SphereShape3D" id="SphereShape3D_abfq8"]
radius = 2.0
[sub_resource type="SphereShape3D" id="SphereShape3D_cmijs"]
radius = 1.0
@@ -96,6 +99,9 @@ height = 3.5
[sub_resource type="SphereShape3D" id="SphereShape3D_nob5r"]
radius = 0.4
[sub_resource type="SphereShape3D" id="SphereShape3D_ue7xq"]
radius = 1.5
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
blend_mode = 1
@@ -322,6 +328,14 @@ visible = false
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, -1)
mesh = SubResource("CylinderMesh_nodcl")
[node name="DashDamage" type="ShapeCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
enabled = false
shape = SubResource("SphereShape3D_abfq8")
target_position = Vector3(0, 0, 0)
max_results = 512
collision_mask = 16
[node name="CloseEnemyDetector" type="ShapeCast3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
@@ -344,6 +358,16 @@ collision_mask = 256
target_position = Vector3(0, -2, 0)
collision_mask = 256
[node name="SlidingEnemyDetector" type="Area3D" parent="."]
collision_layer = 0
collision_mask = 16
monitoring = false
monitorable = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="SlidingEnemyDetector"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("SphereShape3D_ue7xq")
[node name="InvincibilityTime" type="Timer" parent="."]
one_shot = true
@@ -628,12 +652,6 @@ to = NodePath("../OnWall/Hanging")
event = &"dash_to_planted"
delay_in_seconds = "0.0"
[node name="OnPoweredDash" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("28_n7qhm")
to = NodePath("../Dashing/PoweredDash")
event = &"powered_dash"
delay_in_seconds = "0.0"
[node name="OnAimedDash" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("28_n7qhm")
to = NodePath("../Dashing/AimedDash")
@@ -774,9 +792,6 @@ delay_in_seconds = "0.0"
[node name="Dash" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("27_34snm")
[node name="PoweredDash" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("27_34snm")
[node name="AimedDash" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("27_34snm")

View File

@@ -66,7 +66,10 @@ public partial class PlayerController : CharacterBody3D,
public ShapeCast3D CeilingDetector;
public RayCast3D DirectGroundDetector;
public Area3D WeaponHitbox;
public AudioStreamPlayer3D SFXPlayer;
public AudioStreamPlayer3D SfxPlayer;
public ShapeCast3D DashDamageDetector;
public Area3D SlidingEnemyDetector;
// Inspector stuff
[Export] public Marker3D TutorialWeaponTarget;
@@ -325,13 +328,9 @@ public partial class PlayerController : CharacterBody3D,
private StateChartState _onWallHanging;
private StateChartState _onWallRunning;
private StateChartState _attack;
private StateChartState _attackReady;
private StateChartState _attackStandard;
private StateChartState _attackDash;
private Transition _onDashEnded;
private Transition _onJumpFromWall;
private Transition _onJumpFromWallFalling;
private Transition _onLeaveWallFromRun;
@@ -375,8 +374,8 @@ public partial class PlayerController : CharacterBody3D,
DashIndicatorMeshCylinder = DashIndicatorMesh.Mesh as CylinderMesh;
DashIndicatorMesh.Visible = false;
SFXPlayer = GetNode<AudioStreamPlayer3D>("SFXPlayer");
_audioStream = SFXPlayer.GetStreamPlayback() as AudioStreamPlaybackInteractive;
SfxPlayer = GetNode<AudioStreamPlayer3D>("SFXPlayer");
_audioStream = SfxPlayer.GetStreamPlayback() as AudioStreamPlaybackInteractive;
// Camera stuff
HeadSystem = GetNode<HeadSystem>("HeadSystem");
@@ -395,6 +394,8 @@ public partial class PlayerController : CharacterBody3D,
GroundDetector = GetNode<ShapeCast3D>("GroundDetector");
CeilingDetector = GetNode<ShapeCast3D>("CeilingDetector");
DirectGroundDetector = GetNode<RayCast3D>("DirectGroundDetector");
DashDamageDetector = GetNode<ShapeCast3D>("DashDamage");
SlidingEnemyDetector = GetNode<Area3D>("SlidingEnemyDetector");
RayCast3D stairsBelowRayCast3D = GetNode<RayCast3D>("StairsBelowRayCast3D");
RayCast3D stairsAheadRayCast3D = GetNode<RayCast3D>("StairsAheadRayCast3D");
_headCollisionDetectors = new RayCast3D[NUM_OF_HEAD_COLLISION_DETECTORS];
@@ -447,7 +448,6 @@ public partial class PlayerController : CharacterBody3D,
_airGlidingDoubleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/AirGlideDoubleJumpEnabled"));
_onGroundSlideJump = Transition.Of(GetNode("StateChart/Root/Movement/Sliding/GroundSlide/OnJump"));
_onAirGlideDoubleJump = Transition.Of(GetNode("StateChart/Root/Movement/Sliding/AirGlideDoubleJumpEnabled/OnJump"));
_onDashEnded = Transition.Of(GetNode("StateChart/Root/Movement/Dashing/OnDashEnded"));
// _actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
_powerExpired = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/Expired"));
@@ -472,8 +472,6 @@ public partial class PlayerController : CharacterBody3D,
_onAirborneToGrounded = Transition.Of(GetNode("StateChart/Root/Movement/Airborne/OnGrounded"));
// Attack states
_attack = StateChartState.Of(GetNode("StateChart/Root/Attack"));
_attackReady = StateChartState.Of(GetNode("StateChart/Root/Attack/Ready"));
_attackStandard = StateChartState.Of(GetNode("StateChart/Root/Attack/StandardAttack"));
_attackDash = StateChartState.Of(GetNode("StateChart/Root/Attack/DashAttack"));
@@ -552,6 +550,7 @@ public partial class PlayerController : CharacterBody3D,
_weaponDash.StateExited += OnWeaponDashFinished;
SlidingEnemyDetector.BodyEntered += EnemyHitWhileSliding;
_sliding.StateEntered += SlideStarted;
_sliding.StateExited += SlideEnded;
_slideCanceled.StateEntered += OnSlideCanceled;
@@ -1364,7 +1363,7 @@ public partial class PlayerController : CharacterBody3D,
// Slide management //
///////////////////////////
private bool _isSlideInputDown = false;
private bool _isSlideInputDown;
public void OnInputSlideStarted()
{
@@ -1381,7 +1380,6 @@ public partial class PlayerController : CharacterBody3D,
public record SlopeRecord(
Vector3 Position,
Vector3 Normal,
Vector3 Direction,
float AngleRadians
);
@@ -1400,7 +1398,7 @@ public partial class PlayerController : CharacterBody3D,
var angle = normal.AngleTo(Vector3.Up);
var vectorInPlane = normal.Cross(Vector3.Up).Normalized();
var direction = normal.Cross(vectorInPlane).Normalized();
return new SlopeRecord(position, normal, direction, angle);
return new SlopeRecord(position, direction, angle);
}
public void SetupSlideCollision()
@@ -1419,8 +1417,11 @@ public partial class PlayerController : CharacterBody3D,
public void SlideStarted()
{
_targetSpeed = Velocity.Length();
SetupSlideCollision();
_audioStream!.SwitchToClipByName("glide");
SetupSlideCollision();
SlidingEnemyDetector.Monitoring = true;
_isInvincible = true;
}
public bool CanStandUpFromSlide()
@@ -1445,7 +1446,7 @@ public partial class PlayerController : CharacterBody3D,
var finalSpeed = Mathf.Max(currentVelocity * speedLossRate, minimumVelocity);
// Going down a slope?
var (position, _, slopeDirection, slopeAngleRadians) = GetSlope();
var (position, slopeDirection, slopeAngleRadians) = GetSlope();
// Change velocity based on Input
var horizontalVelocity = ComputeHVelocity(delta, AccelerationGroundSlide, DecelerationGroundSlide);
@@ -1546,11 +1547,22 @@ public partial class PlayerController : CharacterBody3D,
}
public void SlideEnded()
{
_audioStream!.SwitchToClipByName("footsteps");
SlidingEnemyDetector.Monitoring = false;
_isInvincible = false;
SetupStandingCollision();
_audioStream!.SwitchToClipByName("footsteps");
_targetSpeed = WalkSpeed;
}
public void EnemyHitWhileSliding(Node enemy)
{
if(enemy is not IDamageable damageable)
return;
_hitEnemies.Add(damageable);
TriggerDamage();
}
public void JumpFromGroundSlide()
{
_jumpStrengthMultiplier = GroundSlideJumpMultiplier + Velocity.Length()*GroundSlideJumpSpeedFactor;
@@ -1707,11 +1719,13 @@ public partial class PlayerController : CharacterBody3D,
if (DashSystem.CanDashThroughTarget && DashSystem.CollidedObject is ITargetable targetable)
correctedLocation = ComputePositionAfterTargetedDash(targetable.GetTargetGlobalPosition(), DashSystem.CollisionPoint);
// Start invincibility timer for the duration of the dash and a bit more afterwards
OnHitInvincibility();
_preDashVelocity = Velocity;
_dashDirection = (correctedLocation - GlobalPosition).Normalized();
SetupDashDamageDetector(correctedLocation);
var dashTween = CreatePositionTween(correctedLocation, AimedDashTime);
// dashTween.TweenMethod(Callable.From<float>(AimedDashTweenOngoing), 0.0f, 1.0f, AimedDashTime);
@@ -1721,6 +1735,28 @@ public partial class PlayerController : CharacterBody3D,
_customMantleCurve = DashSystem.MantleSystem.MantleCurve;
_customMantleStartTransform = DashSystem.MantleSystem.GlobalTransform;
}
public void SetupDashDamageDetector(Vector3 endDashLocation)
{
RemoveChildNode(DashDamageDetector);
DashDamageDetector.SetTargetPosition(DashDamageDetector.ToLocal(endDashLocation));
DashDamageDetector.Enabled = true;
}
public void ComputeDashDamage()
{
for (var i = 0; i < DashDamageDetector.GetCollisionCount(); i++)
{
var collidedObject = DashDamageDetector.GetCollider(i);
if (collidedObject is not IDamageable damageable) continue;
_hitEnemies.Add(damageable);
}
TriggerDamage();
RecoverChildNode(DashDamageDetector);
DashDamageDetector.Enabled = false;
}
public void AimedDashTweenEnded()
{
var dashEvent = isOnFloorCustom() ? "grounded" : "dash_finished";
@@ -1730,6 +1766,7 @@ public partial class PlayerController : CharacterBody3D,
{
ManageAttackedEnemyPostDash(DashSystem.CollidedObject as Node);
DashSystem.CollidedObject = null;
ComputeDashDamage();
if (_customMantle)
{
@@ -1775,6 +1812,8 @@ public partial class PlayerController : CharacterBody3D,
_audioStream.SwitchToClipByName("dash");
// Start invincibility timer for the duration of the dash and a bit more afterwards
OnHitInvincibility();
SetupDashDamageDetector(WeaponSystem.GlobalPosition);
DashSystem.ShouldMantle = false;
_dashDirection = (WeaponSystem.GlobalPosition - GlobalPosition).Normalized();
@@ -1785,6 +1824,7 @@ public partial class PlayerController : CharacterBody3D,
public void DashToFlyingWeaponTweenEnded()
{
RecoverWeapon();
ComputeDashDamage();
var vel = _dashDirection * PostDashSpeed;
SetVelocity(vel);
@@ -1815,6 +1855,8 @@ public partial class PlayerController : CharacterBody3D,
_wallHugStartLocation = dashLocation;
_wallHugStartProjectedVelocity = Velocity.Slide(_wallHugStartNormal);
SetupDashDamageDetector(dashLocation);
var dashTween = CreatePositionTween(dashLocation, AimedDashTime);
dashTween.Finished += DashToPlantedWeaponTweenEnded;
}
@@ -1828,7 +1870,7 @@ public partial class PlayerController : CharacterBody3D,
var resultingEvent = shouldDashToHanging ? "dash_to_planted" : "dash_finished";
if (!shouldDashToHanging) RecoverWeapon(); // Manually recover weapon before enemy is freed in case it owns the weapon object
if (WeaponSystem.PlantObject is ITargetable targetable)
if (WeaponSystem.PlantObject is ITargetable)
{
HeadSystem.OnMantle(); // Recycle mantle animation
SetVerticalVelocity(PostDashSpeed);
@@ -1836,6 +1878,7 @@ public partial class PlayerController : CharacterBody3D,
ManageAttackedEnemyPostDash(WeaponSystem.PlantObject);
WeaponSystem.PlantObject = null;
ComputeDashDamage();
_playerState.SendEvent(resultingEvent);
}
@@ -1929,14 +1972,14 @@ public partial class PlayerController : CharacterBody3D,
}
_targetLocation = target.GetTargetGlobalPosition();
var targetDistance = _targetLocation.DistanceTo(GlobalPosition);
// var targetDistance = _targetLocation.DistanceTo(GlobalPosition);
positionOnScreen = _camera.UnprojectPosition(_targetLocation);
_isEnemyInDashAttackRange = true; //targetDistance < TargetInRangeDistance; // Removing the "almost dash" UI
if (_isEnemyInDashAttackRange)
{
enemyTargetState = PlayerUi.TargetState.TargetDashThrough;
if (_targetObject is IDamageable damageable && _targetObject is IHealthable healthable)
if (_targetObject is IDamageable damageable and IHealthable healthable)
{
var wouldBeDamage = damageable.ComputeDamage(new DamageRecord(this, RDamage));
if (wouldBeDamage.Damage.DamageDealt < healthable.CurrentHealth)
@@ -2018,12 +2061,7 @@ public partial class PlayerController : CharacterBody3D,
stunnable.Stun();
}
var shouldKnockback = false;
if (_targetObject is IHealthable healthable)
{
if (healthable.CurrentHealth > 0) shouldKnockback = true;
}
var shouldKnockback = _targetObject is IHealthable { CurrentHealth: > 0 };
if (shouldKnockback)
{
Velocity = -_dashDirection*RKnockback.Modifier;
@@ -2038,7 +2076,7 @@ public partial class PlayerController : CharacterBody3D,
_playerState.SendEvent("attack_finished");
}
public Vector3 ComputePositionAfterTargetedDash(Vector3 targetLocation, Vector3 targetHitLocation)
public static Vector3 ComputePositionAfterTargetedDash(Vector3 targetLocation, Vector3 targetHitLocation)
{
return targetLocation + (targetLocation - targetHitLocation);
}

View File

@@ -1,10 +1,12 @@
using System;
using Godot;
using GodotStateCharts;
using Movementtests.interfaces;
using Movementtests.systems.damage;
namespace Movementtests.systems;
public partial class WeaponSystem : RigidBody3D
public partial class WeaponSystem : RigidBody3D, IDamageDealer
{
[Signal]
public delegate void WeaponThrownEventHandler();
@@ -12,6 +14,8 @@ public partial class WeaponSystem : RigidBody3D
[Signal]
public delegate void WeaponRetrievedEventHandler();
[Export]
public RDamage RDamage { get; set; }
[Export(PropertyHint.Range, "0,100,1,or_greater")]
public float ThrowForce { get; set; } = 1f;
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
@@ -107,6 +111,17 @@ public partial class WeaponSystem : RigidBody3D
tween.Finished += ThrowWeaponOnCurve;
}
public void PlantInEnemy(Node3D enemy)
{
GetTree().GetRoot().CallDeferred(Node.MethodName.RemoveChild, this);
enemy.CallDeferred(Node.MethodName.AddChild, this);
if (enemy is IDamageable damageable)
{
damageable.TakeDamage(new DamageRecord(this, RDamage));
}
}
public void RethrowWeapon()
{
_weaponState.SendEvent("throw");
@@ -130,8 +145,7 @@ public partial class WeaponSystem : RigidBody3D
// WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 0.2f, 0.2f);
if (PlantObject is Node3D node)
{
GetTree().GetRoot().CallDeferred(Node.MethodName.RemoveChild, this);
node.CallDeferred(Node.MethodName.AddChild, this);
PlantInEnemy(node);
}
CallDeferred(Node3D.MethodName.SetGlobalPosition, PlantLocation);
CallDeferred(Node3D.MethodName.LookAt, GlobalTransform.Origin + PlantNormal, Vector3.Up, true);

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=12 format=3 uid="uid://ckm3d6k08a72u"]
[gd_scene load_steps=14 format=3 uid="uid://ckm3d6k08a72u"]
[ext_resource type="Script" uid="uid://iii3wfto4t5b" path="res://systems/weapon/WeaponSystem.cs" id="1_csqwk"]
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://components/damage/RDamage.cs" id="2_m0v1h"]
[ext_resource type="PackedScene" uid="uid://dbe5f0p6lvqtr" path="res://systems/tween_queue/tween_queue_system.tscn" id="2_x1nha"]
[ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="3_5owyf"]
[ext_resource type="ArrayMesh" uid="uid://cho5fixitrbds" path="res://assets/swords/resources/sword23.tres" id="3_svc06"]
@@ -8,6 +9,11 @@
[ext_resource type="Script" uid="uid://cytafq8i1y8qm" path="res://addons/godot_state_charts/atomic_state.gd" id="5_m0v1h"]
[ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="6_jpdh0"]
[sub_resource type="Resource" id="Resource_jpdh0"]
script = ExtResource("2_m0v1h")
DamageDealt = 2.0
metadata/_custom_type_script = "uid://jitubgv6judn"
[sub_resource type="CylinderShape3D" id="CylinderShape3D_avini"]
height = 1.0
radius = 0.1
@@ -43,6 +49,7 @@ continuous_cd = true
contact_monitor = true
max_contacts_reported = 1
script = ExtResource("1_csqwk")
RDamage = SubResource("Resource_jpdh0")
[node name="TweenQueueSystem" parent="." instance=ExtResource("2_x1nha")]