1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-31 00:11:54 +08:00

feat(武器): 重做链式机枪并添加音效

重构链式机枪的子弹生成逻辑,降低散射衰减系数
添加射击音效资源及导入配置
调整武器属性描述和数值
移除测试用的调试代码
This commit is contained in:
2026-01-18 14:12:34 +08:00
parent 6e7272d7d9
commit 53db80ceb7
12 changed files with 76 additions and 39 deletions
+6 -11
View File
@@ -30,8 +30,7 @@ var parent: BulletBase = null
var spawnInWhen: float = 0
var spawnInWhere: Vector2 = Vector2.ZERO
var destroying: bool = false
var isChildSplit: bool = false
var isChildRefract: bool = false
var canDuplicateSelf: bool = true
var initialSpeed: float = 0
var initialDamage: float = 0
var speedScale: float = 1
@@ -144,19 +143,19 @@ func tryDestroy(becauseMap: bool = false):
await animator.animation_finished
queue_free()
func trySplit():
if is_instance_valid(launcher) and !isChildSplit:
if is_instance_valid(launcher) and canDuplicateSelf:
var value = launcher.fields.get(FieldStore.Entity.BULLET_SPLIT)
var total = MathTool.shrimpRate(value)
var last = value - floor(value)
for i in total:
var cloned = duplicate() as BulletBase
cloned.rotation = deg_to_rad(360.0 / total * i)
cloned.isChildSplit = true
cloned.rotation += deg_to_rad(360.0 / total * i + 180)
cloned.canDuplicateSelf = false
cloned.launcher = launcher
cloned.parent = parent
get_parent().add_child.call_deferred(split(cloned, i, total, last))
func tryRefract():
if is_instance_valid(launcher) and !isChildRefract:
if is_instance_valid(launcher) and canDuplicateSelf:
var value = launcher.fields.get(FieldStore.Entity.BULLET_REFRACTION)
var total = MathTool.shrimpRate(value)
var last = value - floor(value)
@@ -172,7 +171,7 @@ func tryRefract():
aimed.append(entity)
var cloned = duplicate() as BulletBase
cloned.look_at(entity.position)
cloned.isChildRefract = true
cloned.canDuplicateSelf = false
cloned.launcher = launcher
cloned.parent = parent
get_parent().add_child.call_deferred(refract(cloned, entity, i, total, last))
@@ -202,8 +201,6 @@ static func generate(
launchBy: EntityBase,
spawnPosition: Vector2,
spawnRotation: float,
asChildSplit: bool = false,
asChildRefract: bool = false,
addToWorld: bool = true,
ignoreOffset: bool = false
):
@@ -212,8 +209,6 @@ static func generate(
var instances = []
for i in range(count):
var instance: BulletBase = bullet.instantiate()
instance.isChildSplit = asChildSplit
instance.isChildRefract = asChildRefract
instance.launcher = launchBy
instance.position = spawnPosition
instance.rotation = spawnRotation + deg_to_rad(launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT) * randf_range(-1, 1) * int(!ignoreOffset))
+1 -1
View File
@@ -338,7 +338,7 @@ func tryDie(by: BulletBase = null):
var item = drops[drop]
var count = ceil(randf_range(dropCounts[drop].x, dropCounts[drop].y))
for i in range(count):
ItemDropped.generate(item, randi_range(1, 3 * round(sqrt(GameRule.difficulty - GameRule.difficultyRange.x + 1))), position + MathTool.randomVector2In(GameRule.itemDroppedSpawnOffset))
ItemDropped.generate(item, randi_range(1, round(2.5 * sqrt(GameRule.difficulty - GameRule.difficultyRange.x + 1))), position + MathTool.randomVector2In(GameRule.itemDroppedSpawnOffset))
if MathTool.rate(
GameRule.appleDropRate +
by.launcher.fields.get(FieldStore.Entity.DROP_APPLE_RATE) +