diff --git a/Resources/Bullets/cheat_bullet.tres b/Resources/Bullets/cheat_bullet.tres index f81b8919..d322e55c 100644 --- a/Resources/Bullets/cheat_bullet.tres +++ b/Resources/Bullets/cheat_bullet.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="BulletResource" load_steps=6 format=3 uid="uid://bopwqpmxoy1rd"] [ext_resource type="PackedScene" uid="uid://eqppkegmt562" path="res://Scenes/Weapons/Bullets/Yin_Yan_Bullet.tscn" id="1_5pffv"] -[ext_resource type="PackedScene" uid="uid://h11o0et1y54v" path="res://Scenes/Weapons/Bullets/explosion.tscn" id="2_26vvh"] +[ext_resource type="PackedScene" uid="uid://1lowv5ce2poq" path="res://Scenes/Weapons/Bullets/Autoclearing_Explosion_Bullet.tscn" id="2_26vvh"] [ext_resource type="Script" uid="uid://dslyrfcej3g2n" path="res://Scripts/Resources/BulletResource.cs" id="2_dbvc7"] [ext_resource type="Script" uid="uid://ci2vjo54w7i18" path="res://Scripts/Resources/Modifiers/DelayedSpeedIncreaseModifier.cs" id="2_w7k7r"] diff --git a/Resources/Items/Cheat_Gun_Item.tres b/Resources/Items/Cheat_Gun_Item.tres index 310845e1..92768804 100644 --- a/Resources/Items/Cheat_Gun_Item.tres +++ b/Resources/Items/Cheat_Gun_Item.tres @@ -20,3 +20,4 @@ UiType = 1 Selectable = true InventorySprite = ExtResource("2_5g5j1") HudItemScene = ExtResource("1_i6xgq") +DropScenePath = null diff --git a/Scenes/Maps/PlayerFSMTest.tscn b/Scenes/Maps/PlayerFSMTest.tscn index b64696ed..80a59d6f 100644 --- a/Scenes/Maps/PlayerFSMTest.tscn +++ b/Scenes/Maps/PlayerFSMTest.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=48 format=4 uid="uid://dqyfnby0t7gu1"] +[gd_scene load_steps=49 format=4 uid="uid://dqyfnby0t7gu1"] [ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_c3v4x"] [ext_resource type="Resource" uid="uid://cs3ihltcn2166" path="res://Resources/Items/IcicleGun.tres" id="3_6314l"] @@ -35,6 +35,7 @@ [ext_resource type="LabelSettings" uid="uid://buk3e7bbwmnv1" path="res://Resources/Styles/Hud_Text_Style.tres" id="27_4rfvg"] [ext_resource type="PackedScene" uid="uid://cxjumgf8bhr3l" path="res://Scenes/Elevator.tscn" id="28_3ll5g"] [ext_resource type="PackedScene" uid="uid://fxvlaidieiv7" path="res://Scenes/Interactable/ScriptableAreaTrigger.tscn" id="28_fuxq3"] +[ext_resource type="PackedScene" uid="uid://4q82gggqax87" path="res://Scenes/Items/Cheat_Gun_Pickup.tscn" id="28_pgobb"] [ext_resource type="Script" uid="uid://dkihoo85jfec5" path="res://Scripts/Resources/Events/MovePlayerEvent.cs" id="29_3ll5g"] [ext_resource type="Script" uid="uid://bgertv72tq1dt" path="res://Scripts/Components/FSM/NewPlayerStateMachine.cs" id="34_2vu2h"] [ext_resource type="Script" uid="uid://btwuahxvreivs" path="res://Scripts/Components/FSM/Player/NewInit.cs" id="35_mpb62"] @@ -106,7 +107,7 @@ tile_set = ExtResource("5_6314l") metadata/_edit_lock_ = true [node name="Props" type="TileMapLayer" parent="Tilemaps"] -tile_map_data = PackedByteArray("AAATAAUAAAAKAAwAAAATAAYAAAAKAA0AAAATAAcAAAAKAAwAAAATAAgAAAAKAAwAAAATAAkAAAAKAA0AAAANAAUAAAAJAAwAAAANAAYAAAAJAA0AAAANAAcAAAAJAAwAAAANAAgAAAAJAA0AAAANAAkAAAAJAAwAAAARAAUAAAAJAAwAAAARAAYAAAAJAA0AAAARAAcAAAAJAAwAAAARAAgAAAAJAAwAAAARAAkAAAAJAA0AAAAOAAUAAAAKAAwAAAAOAAYAAAAKAA0AAAAOAAcAAAAKAAwAAAAOAAgAAAAKAAwAAAAOAAkAAAAKAA0AAAAOAAMAAAAGAAMAAAA=") +tile_map_data = PackedByteArray("AAATAAUAAAAKAAwAAAATAAYAAAAKAA0AAAATAAcAAAAKAAwAAAATAAgAAAAKAAwAAAATAAkAAAAKAA0AAAANAAUAAAAJAAwAAAANAAYAAAAJAA0AAAANAAcAAAAJAAwAAAANAAgAAAAJAA0AAAANAAkAAAAJAAwAAAARAAUAAAAJAAwAAAARAAYAAAAJAA0AAAARAAcAAAAJAAwAAAARAAgAAAAJAAwAAAARAAkAAAAJAA0AAAAOAAUAAAAKAAwAAAAOAAYAAAAKAA0AAAAOAAcAAAAKAAwAAAAOAAgAAAAKAAwAAAAOAAkAAAAKAA0AAAAOAAMAAAAGAAMAAAAKAAsAAQAAAAAAAQALAAsAAQAAAAAAAQALAAwAAQAAAAAAAQAMAAwAAQAAAAAAAQALAAoAAQAAAAAAAgAKAAoAAQAAAAAAAgAJAAoAAQAAAAAAAgAJAAkAAQAAAAAAAgAKAAkAAQAAAAAAAgASAAAAAQAAAAAAAgATAAAAAQAAAAAAAgATAAEAAQAAAAAAAgA=") tile_set = ExtResource("5_6314l") metadata/_edit_lock_ = true @@ -217,6 +218,9 @@ offset_bottom = 425.0 text = "Pools" label_settings = ExtResource("27_4rfvg") +[node name="CheaetGun" parent="Tilemaps/Actors" instance=ExtResource("28_pgobb")] +position = Vector2(342, 193) + [node name="ElevatorControlPadBottom" parent="Tilemaps/Actors" node_paths=PackedStringArray("Targets") instance=ExtResource("20_0knpf")] position = Vector2(228, 144) Targets = [NodePath("../Path2D/Elevator")] @@ -234,7 +238,7 @@ metadata/_edit_group_ = true ElevatorPath = NodePath("..") [node name="ScriptableAreaTrigger" parent="Tilemaps" instance=ExtResource("28_fuxq3")] -position = Vector2(197, 177) +position = Vector2(230, 250) Events = Array[Object]([SubResource("Resource_pgobb")]) [node name="CameraController" type="Camera2D" parent="."] diff --git a/Scenes/Weapons/Bullets/Autoclearing_Explosion_Bullet.tscn b/Scenes/Weapons/Bullets/Autoclearing_Explosion_Bullet.tscn new file mode 100644 index 00000000..f2181c18 --- /dev/null +++ b/Scenes/Weapons/Bullets/Autoclearing_Explosion_Bullet.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=4 format=3 uid="uid://1lowv5ce2poq"] + +[ext_resource type="Script" uid="uid://df81kn4u8yigu" path="res://Scripts/Weapons/AutoclearingBulletEmitter.cs" id="1_5c773"] +[ext_resource type="Resource" uid="uid://ncukdupc7hbm" path="res://Resources/Bullets/Explosion.tres" id="2_d2d24"] +[ext_resource type="Script" uid="uid://c6467d6yx50qh" path="res://Scripts/Components/BulletSpawner.cs" id="3_d2d24"] + +[node name="AutoclearingExplosionBullet" type="Node2D"] +script = ExtResource("1_5c773") +BulletResource = ExtResource("2_d2d24") +EmitOnStart = true +EmitCoolDown = 10.0 + +[node name="BulletSpawner" type="Node2D" parent="."] +script = ExtResource("3_d2d24") diff --git a/Scenes/test.tscn b/Scenes/test.tscn index e0932203..1e033513 100644 --- a/Scenes/test.tscn +++ b/Scenes/test.tscn @@ -221,7 +221,7 @@ SpawnMarkers = Dictionary[int, NodePath]({ 2: NodePath("Factory Tilemaps/LevelProps/BossDebugTeleporterDestination"), 255: NodePath("Factory Tilemaps/Debug Room/DebugRoomStartPosition") }) -StartingEquipment = [ExtResource("4_swym2"), ExtResource("5_nqier")] +StartingEquipment = Array[ExtResource("6_8tdlb")]([ExtResource("4_swym2"), ExtResource("5_nqier")]) MapStartData = SubResource("Resource_6sau4") metadata/_edit_lock_ = true diff --git a/Scripts/Activables/BulletEmitter.cs b/Scripts/Activables/BulletEmitter.cs index e30e5213..1df35a11 100644 --- a/Scripts/Activables/BulletEmitter.cs +++ b/Scripts/Activables/BulletEmitter.cs @@ -24,7 +24,7 @@ public partial class BulletEmitter : Node2D, IActivable private BulletSpawner _bulletSpawner; - private bool _isEmitting = false; + protected bool IsEmitting = false; private double _emitTimer = 0f; @@ -33,13 +33,14 @@ public partial class BulletEmitter : Node2D, IActivable _bulletSpawner = GetNode("BulletSpawner"); if (EmitOnStart) { - _isEmitting = true; + IsEmitting = true; + CallDeferred(MethodName.Shoot); } } public override void _Process(double delta) { - if (!_isEmitting) return; + if (!IsEmitting) return; _emitTimer += delta; if (_emitTimer >= EmitCoolDown) @@ -60,17 +61,17 @@ public partial class BulletEmitter : Node2D, IActivable { case ActivationType.Open: case ActivationType.Enable: - _isEmitting = true; + IsEmitting = true; _emitTimer = 0; break; case ActivationType.Close: case ActivationType.Disable: - _isEmitting = false; + IsEmitting = false; _emitTimer = 0; break; case ActivationType.Use: case ActivationType.Toggle: - _isEmitting = !_isEmitting; + IsEmitting = !IsEmitting; _emitTimer = 0; break; case ActivationType.Destroy: diff --git a/Scripts/UI/WeaponAmmoCounter.cs b/Scripts/UI/WeaponAmmoCounter.cs index 7ea1c86f..8fe899be 100644 --- a/Scripts/UI/WeaponAmmoCounter.cs +++ b/Scripts/UI/WeaponAmmoCounter.cs @@ -21,6 +21,8 @@ public partial class WeaponAmmoCounter : Container public void Init(LootItem item) { Item = item; + + Icon.Texture = item.InventorySprite; InventoryManager.Instance.LoadedAmmoChanged += (weaponKey, count) => { diff --git a/Scripts/Weapons/AutoclearingBulletEmitter.cs b/Scripts/Weapons/AutoclearingBulletEmitter.cs new file mode 100644 index 00000000..34db98c6 --- /dev/null +++ b/Scripts/Weapons/AutoclearingBulletEmitter.cs @@ -0,0 +1,24 @@ +using Cirno.Scripts.Activables; +using Godot; + +namespace Cirno.Scripts.Weapons; + +public partial class AutoclearingBulletEmitter : BulletEmitter +{ + [Export] + public float Timeout { get; private set; } = 5f; + + private double _timeoutTimer = 0f; + + public override void _Process(double delta) + { + base._Process(delta); + if (!IsEmitting) return; + _timeoutTimer += delta; + + if (_timeoutTimer >= Timeout) + { + QueueFree(); + } + } +} \ No newline at end of file diff --git a/Scripts/Weapons/AutoclearingBulletEmitter.cs.uid b/Scripts/Weapons/AutoclearingBulletEmitter.cs.uid new file mode 100644 index 00000000..a138882c --- /dev/null +++ b/Scripts/Weapons/AutoclearingBulletEmitter.cs.uid @@ -0,0 +1 @@ +uid://df81kn4u8yigu