From 34a0e8e380ccad2d396d0252507546273170ed13 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 12 Aug 2025 14:37:48 +0200 Subject: [PATCH] Disable debugdraw in release --- Cirno.csproj | 3 ++ Resources/Weapons/LaserWeapon.tres | 4 -- Scripts/Actors/3D/PlayerStartMarker3D.cs | 7 +-- Scripts/Actors/EnemyMarker3D.cs | 9 ++-- Scripts/Actors/ItemMarker3D.cs | 3 +- Scripts/Components/FSM/Enemy/3D/Idle.cs | 45 ++++++++++--------- Scripts/Weapons/Bullet3D.cs | 57 ++++++++++++------------ export_presets.cfg | 10 +++-- 8 files changed, 70 insertions(+), 68 deletions(-) diff --git a/Cirno.csproj b/Cirno.csproj index 5bc23e9e..20717c95 100644 --- a/Cirno.csproj +++ b/Cirno.csproj @@ -8,6 +8,9 @@ $(GIT_ASSEMBLY_SEM_VER) $(GIT_ASSEMBLY_SEM_FILE_VER) + + GODOT;GODOT_WINDOWS;GODOT_PC;GODOT4;GODOT4_5;GODOT4_5_0;GODOT4_OR_GREATER;GODOT4_0_OR_GREATER;GODOT4_1_OR_GREATER;GODOT4_2_OR_GREATER;GODOT4_3_OR_GREATER;GODOT4_4_OR_GREATER;GODOT4_5_OR_GREATER;GODOT4_5_0_OR_GREATER;GODOT;GODOT_WINDOWS;GODOT_PC;GODOT4;GODOT4_5;GODOT4_5_0;GODOT4_OR_GREATER;GODOT4_0_OR_GREATER;GODOT4_1_OR_GREATER;GODOT4_2_OR_GREATER;GODOT4_3_OR_GREATER;GODOT4_4_OR_GREATER;GODOT4_5_OR_GREATER;GODOT4_5_0_OR_GREATER;TRACE;DISABLE_DD3D + diff --git a/Resources/Weapons/LaserWeapon.tres b/Resources/Weapons/LaserWeapon.tres index b88d0dc1..42386cc3 100644 --- a/Resources/Weapons/LaserWeapon.tres +++ b/Resources/Weapons/LaserWeapon.tres @@ -13,12 +13,8 @@ AmmoPerShot = 2 RateOfFire = 0.3 BulletCapacity = 5 ReloadTime = 0.6 -AutoReload = true -InfiniteAmmo = true ItemKey = &"LASER_WEAPON" AmmoKey = &"SHIELD" -BulletsPerShot = 1 SpreadAngle = 5.0 RandomSpread = 2.5 -_rotationOffset = 0.0 ShootSound = ExtResource("2_gfnbi") diff --git a/Scripts/Actors/3D/PlayerStartMarker3D.cs b/Scripts/Actors/3D/PlayerStartMarker3D.cs index 83d08273..1377bc00 100644 --- a/Scripts/Actors/3D/PlayerStartMarker3D.cs +++ b/Scripts/Actors/3D/PlayerStartMarker3D.cs @@ -5,14 +5,15 @@ namespace Cirno.Scripts.Actors._3D; [Tool] public partial class PlayerStartMarker3D : Marker3D { - private readonly Vector3 _boxSize = new Vector3(0.5f, 0.8f, 0.5f); + public override void _Process(double delta) { if (!Engine.IsEditorHint()) return; - + +#if !DISABLE_DD3D DebugDraw3D.DrawBox(this.GlobalPosition - _boxSize / 2, Quaternion.Identity, _boxSize, Colors.Green); - +#endif //DebugDraw3D.DrawSphere(this.GlobalPosition, 0.1f, Colors.Green); } } \ No newline at end of file diff --git a/Scripts/Actors/EnemyMarker3D.cs b/Scripts/Actors/EnemyMarker3D.cs index 3ef65a57..bfca70d3 100644 --- a/Scripts/Actors/EnemyMarker3D.cs +++ b/Scripts/Actors/EnemyMarker3D.cs @@ -9,7 +9,7 @@ namespace Cirno.Scripts.Actors; public partial class EnemyMarker3D : PreviewMarker3D, IActivable { private readonly Vector3 _boxSize = new Vector3(0.5f, 0.8f, 0.5f); - + private EnemyResource _enemy; [Export] @@ -47,7 +47,6 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable SetSpriteAlpha(0.5f); } } - } } @@ -102,13 +101,13 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable { Activate(); } - + public override void _Process(double delta) { if (!Engine.IsEditorHint()) return; - +#if !DISABLE_DD3D DebugDraw3D.DrawBox(this.GlobalPosition - _boxSize / 2, Quaternion.Identity, _boxSize, Colors.Red); - +#endif //DebugDraw3D.DrawSphere(this.GlobalPosition, 0.1f, Colors.Green); } } \ No newline at end of file diff --git a/Scripts/Actors/ItemMarker3D.cs b/Scripts/Actors/ItemMarker3D.cs index 4b9f2541..ad51e3af 100644 --- a/Scripts/Actors/ItemMarker3D.cs +++ b/Scripts/Actors/ItemMarker3D.cs @@ -124,8 +124,9 @@ public partial class ItemMarker3D : PreviewMarker3D { if (!Engine.IsEditorHint()) return; +#if !DISABLE_DD3D DebugDraw3D.DrawBox(this.GlobalPosition - _boxSize / 2, Quaternion.Identity, _boxSize, Colors.Blue); - +#endif //DebugDraw3D.DrawSphere(this.GlobalPosition, 0.1f, Colors.Green); } } \ No newline at end of file diff --git a/Scripts/Components/FSM/Enemy/3D/Idle.cs b/Scripts/Components/FSM/Enemy/3D/Idle.cs index 06e58b91..2fc3e446 100644 --- a/Scripts/Components/FSM/Enemy/3D/Idle.cs +++ b/Scripts/Components/FSM/Enemy/3D/Idle.cs @@ -6,52 +6,51 @@ namespace Cirno.Scripts.Components.FSM.Enemy._3D; public partial class Idle : EnemyStateBase3D { public override EnemyState StateId => EnemyState.Idle; - - [Export] public EnemyStorage3D Storage { get; private set; } + + [Export] public EnemyStorage3D Storage { get; private set; } [Export] public PlayerDetection3D PlayerDetection { get; private set; } [Export] public GravityProvider GravityProvider { get; private set; } - + [Export] public bool DebugEnabled { get; set; } = false; - + private bool _isPlayerInRange = false; - + public override void EnterState() { base.EnterState(); PlayerDetection.SetRange(Storage.Root.EnemyResource.PlayerDetectionRange); - + _isPlayerInRange = PlayerDetection.IsPlayerInRange(Storage.Root.EnemyResource.ViewRange); - + PlayerDetection.PlayerInRange += PlayerDetectionOnPlayerInRange; - + PlayerDetection.PlayerOutOfRange += PlayerDetectionOnPlayerOutOfRange; - + // player detection // damage receiver will be a module GD.Print("Entered Idle"); } - + public override void ExitState() { base.ExitState(); PlayerDetection.PlayerInRange -= PlayerDetectionOnPlayerInRange; - + PlayerDetection.PlayerOutOfRange -= PlayerDetectionOnPlayerOutOfRange; - + // DamageReceiver.HealthProvider.ResourceDepleted -= HealthProviderOnResourceDepleted; // // DamageReceiver.HealthProvider.ResourceDecreased -= HealthProviderOnResourceDecreased; // DamageReceiver.ChangeState(false); - } - + private void HealthProviderOnResourceDepleted() { ChangeState(EnemyState.Dead); } - + private void HealthProviderOnResourceDecreased(float oldvalue, float newvalue, float maxvalue) { Storage.AiState = AiState.Enabled; @@ -63,12 +62,12 @@ public partial class Idle : EnemyStateBase3D _isPlayerInRange = true; GD.Print("Player In Range"); } - + private void PlayerDetectionOnPlayerOutOfRange() { _isPlayerInRange = false; } - + public override void PhysicsProcessState(double delta) { base.PhysicsProcessState(delta); @@ -83,15 +82,17 @@ public partial class Idle : EnemyStateBase3D if (DebugEnabled) { - DebugDraw3D.DrawText(MainObject.GlobalPosition - new Vector3(0,16,0), "Idle"); - +#if !DISABLE_DD3D + DebugDraw3D.DrawText(MainObject.GlobalPosition - new Vector3(0, 16, 0), "Idle"); +#endif } - MainObject.Velocity = new Vector3(MainObject.Velocity.X, GravityProvider.CalculateGravityVelocity(MainObject.Velocity.Y, delta), MainObject.Velocity.Z); - + MainObject.Velocity = new Vector3(MainObject.Velocity.X, + GravityProvider.CalculateGravityVelocity(MainObject.Velocity.Y, delta), MainObject.Velocity.Z); + MainObject.MoveAndSlide(); } - + public override void ProcessState(double delta) { base.ProcessState(delta); diff --git a/Scripts/Weapons/Bullet3D.cs b/Scripts/Weapons/Bullet3D.cs index 79e1b7ec..d6891fc9 100644 --- a/Scripts/Weapons/Bullet3D.cs +++ b/Scripts/Weapons/Bullet3D.cs @@ -33,12 +33,12 @@ public partial class Bullet3D : Area3D, IBullet public bool Enabled { get; private set; } = false; //public float SpriteRotation { get; private set; } = 0f; - + [Signal] public delegate void OnDestroyEventHandler(); [Signal] - public delegate void InitializedEventHandler(); + public delegate void InitializedEventHandler(); private AudioStreamPlayer3D _grazeSound; private GpuParticles3D _grazeParticles; @@ -70,7 +70,7 @@ public partial class Bullet3D : Area3D, IBullet rotation ); } - + public override void _Ready() { _grazeSound = GetNodeOrNull("GrazeSound"); @@ -84,7 +84,7 @@ public partial class Bullet3D : Area3D, IBullet public void Initialize(BulletInfo bulletInfo) { _bulletInfo = bulletInfo; - + _elapsedTime = 0f; this.Speed = bulletInfo.Speed; @@ -99,12 +99,12 @@ public partial class Bullet3D : Area3D, IBullet if (_collisionShape.Shape is SphereShape3D sphere && bulletInfo.OriginalBulletResource.BulletSize > 0) { - sphere.Radius = bulletInfo.OriginalBulletResource.BulletSize; + sphere.Radius = bulletInfo.OriginalBulletResource.BulletSize; } IsGrazed = false; IsFrozen = false; - + // Need to clone them here // _modifiers = _bulletInfo.TimeModifiers.Select(x => x.MakeClone()).ToList(); @@ -114,7 +114,7 @@ public partial class Bullet3D : Area3D, IBullet // Ugly hack to make instances unique _modifiers = _bulletInfo.TimeModifiers.Select(x => x.Wrap()).ToList(); - + EmitSignalInitialized(); } @@ -134,11 +134,11 @@ public partial class Bullet3D : Area3D, IBullet direction.X * cos - direction.Y * sin, direction.X * sin + direction.Y * cos ); - + //float zRotation = Mathf.Atan2(rotatedDir.Y, rotatedDir.X)/* - Mathf.Pi / 2f*/; - + float zRotation = Mathf.Atan2(-rotatedDir.Y, rotatedDir.X) + Mathf.Pi; - + return MakeRotationVectorRad(zRotation); } @@ -190,7 +190,6 @@ public partial class Bullet3D : Area3D, IBullet private void ApplyTimeModifiers(double delta) { - foreach (var modifier in _modifiers) { if (_elapsedTime >= modifier.TimeModifier.TimeInSeconds) @@ -205,9 +204,8 @@ public partial class Bullet3D : Area3D, IBullet { modifier.Elapsed += delta; } - + modifier.TimeModifier.Update(this, delta, modifier.Elapsed); - } } } @@ -216,7 +214,7 @@ public partial class Bullet3D : Area3D, IBullet { float radians = Mathf.DegToRad(degrees); _direction = _direction.Rotated(radians).Normalized(); // Rotate direction - + if (!BulletInfo.Attributes.HasFlag(BulletFlags.Rotateable)) return; SetSpriteRotationToDirection(); //SetRotation(Rotation + radians); @@ -227,9 +225,9 @@ public partial class Bullet3D : Area3D, IBullet if (!BulletInfo.Attributes.HasFlag(BulletFlags.Rotateable)) return; var currentRotation = _sprite.GetRotationDegrees().Z; - + _sprite.RotateZ(Mathf.DegToRad(currentRotation + degrees)); - + // SpriteRotation = Mathf.DegToRad(Mathf.RadToDeg(SpriteRotation) + degrees); //SetRotationDegrees(RotationDegrees + degrees); @@ -240,28 +238,28 @@ public partial class Bullet3D : Area3D, IBullet if (!BulletInfo.Attributes.HasFlag(BulletFlags.Rotateable)) return; var currentRotation = _sprite.GetRotation().Z; - + var axis = Basis.FromEuler(_defaultRotation).Z; _sprite?.Rotate(axis, currentRotation + radians); - + //_sprite.SetRotation(new Vector3()); //Rotate(axis, radians); //_sprite?.Rotate(Vector3.Forward, radians); //_sprite?.RotateZ(radians); //SetRotation(Rotation + radians); - } public void FacePlayer() { if (GameController.Instance.PlayerPosition.HasValue) { - _direction = (GameController.Instance.PlayerPosition.Value.ToVector2() - this.GlobalPosition.ToVector2()).Normalized(); + _direction = (GameController.Instance.PlayerPosition.Value.ToVector2() - this.GlobalPosition.ToVector2()) + .Normalized(); RotateBullet(0); // quick hack to rotate lasers //LookAt(player.GlobalPosition); } } - + public void SetDirection(Vector2 direction) { @@ -270,11 +268,9 @@ public partial class Bullet3D : Area3D, IBullet _direction = normalized; if (!BulletInfo.Attributes.HasFlag(BulletFlags.Rotateable)) return; - + SetSpriteRotationToDirection(); //SetRotation(Mathf.Atan2(normalized.Y, normalized.X) + Mathf.Pi / 2); - - } // Called every frame. 'delta' is the elapsed time since the previous frame. @@ -290,7 +286,10 @@ public partial class Bullet3D : Area3D, IBullet if (GameController.Instance is not null && GameController.Instance.DebugDraw) { - DebugDraw3D.DrawSphere(this.GlobalPosition, this._bulletInfo.OriginalBulletResource.BulletSize, Colors.DarkRed); +#if !DISABLE_DD3D + DebugDraw3D.DrawSphere(this.GlobalPosition, this._bulletInfo.OriginalBulletResource.BulletSize, + Colors.DarkRed); +#endif } } @@ -308,7 +307,7 @@ public partial class Bullet3D : Area3D, IBullet } var newPos2D = ((float)(Speed * delta) * _direction); - + this.Position += new Vector3(newPos2D.X, 0, newPos2D.Y); } @@ -335,7 +334,7 @@ public partial class Bullet3D : Area3D, IBullet private readonly StringName SolidGroup = "Solid"; private readonly StringName PermeableGroup = "Permeable"; private readonly StringName DestroyableGroup = "Destroyable"; - + private void _on_body_entered(Node3D body) { if (body.IsInGroup(DestroyableGroup) && body is IDestructible destructible && @@ -347,7 +346,7 @@ public partial class Bullet3D : Area3D, IBullet RequestCollisionDestruction(); return; } - + if (body.IsInGroup(SolidGroup) && !body.IsInGroup(PermeableGroup)) { //Debug.WriteLine("Collision"); @@ -407,7 +406,7 @@ public partial class Bullet3D : Area3D, IBullet var particleData = _bulletInfo?.OriginalBulletResource.DestructionParticlesBullet.MakeBullet( this.GlobalPosition.ToVector2()); - + var particle = PoolingManager.Instance.SpawnBullet(particleData.OriginalBulletResource); particle.GlobalPosition = this.GlobalPosition; particle.Initialize(particleData); diff --git a/export_presets.cfg b/export_presets.cfg index b66f784e..25486994 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -26,6 +26,7 @@ debug/export_console_wrapper=1 binary_format/embed_pck=false texture_format/s3tc_bptc=true texture_format/etc2_astc=false +shader_baker/enabled=false binary_format/architecture="x86_64" codesign/enable=false codesign/timestamp=true @@ -39,11 +40,11 @@ application/console_wrapper_icon="" application/icon_interpolation=4 application/file_version="0.1.0.0" application/product_version="0.1.0.0" -application/company_name="Maddo" +application/company_name="Maddo Productions" application/product_name="Cirno: No Reason" application/file_description="" application/copyright="Maddo" -application/trademarks="" +application/trademarks="Maddo Productions, 2025" application/export_angle=0 application/export_d3d12=0 application/d3d12_agility_sdk_multiarch=true @@ -65,7 +66,7 @@ ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debu Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue Remove-Item -Recurse -Force '{temp_dir}'" dotnet/include_scripts_content=false -dotnet/include_debug_symbols=true +dotnet/include_debug_symbols=false dotnet/embed_build_outputs=true [preset.1] @@ -96,6 +97,7 @@ debug/export_console_wrapper=1 binary_format/embed_pck=true texture_format/s3tc_bptc=true texture_format/etc2_astc=false +shader_baker/enabled=false binary_format/architecture="x86_64" ssh_remote_deploy/enabled=false ssh_remote_deploy/host="user@host_ip" @@ -110,5 +112,5 @@ ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") rm -rf \"{temp_dir}\"" dotnet/include_scripts_content=false -dotnet/include_debug_symbols=true +dotnet/include_debug_symbols=false dotnet/embed_build_outputs=false