Skip to content

[Bug]: 在实体死亡短时间内修改血量会导致实体异常 #338

@dlcnx

Description

@dlcnx

Describe the bug

在实体或玩家死亡很短一段时间内(例如50毫秒),使用mob.setHealth()或player.setHealth()修改血量导致异常。
生物或玩家显示死亡状态但没有被清理,玩家重生会一直卡在转圈界面。
其他开发者不一定能注意到这个问题,希望在引擎层面就阻止对刚刚死亡(血量为0)的实体或玩家血量的修改。

To Reproduce

复现代码:

mc.listen("onPlayerDie", (player, source) => {
    setTimeout(() => { player.setHealth(20) }, 50);
});
mc.listen("onMobDie", (mob, source, cause) => {
    setTimeout(() => { mob.setHealth(20) }, 50);
});

玩家或生物死亡都会触发异常。

Expected behavior

在引擎层面忽略对刚刚死亡(血量为0)的实体或玩家血量的修改

Screenshots

半死不活的动物【
Image

Platform

No response

BDS Version

1.21.124

LeviLamina Version

1.7.7

LegacyScriptEngine Version

0.16.1

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions