Tales of Maj'Eyal

Tales of Maj'Eyal

评价数不足
Stealth.lua (line 29 Bad Argument) Detection Bug Fix
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
11.498 KB
5 月 11 日 下午 12:27
1 项改动说明 ( 查看 )

订阅以下载
Stealth.lua (line 29 Bad Argument) Detection Bug Fix

描述
A dirty patch to avoid calculating detection for actors in memory but not deployed, just "died" actors, characters in transition from level to level, or dummy actors (projectiles, etc).

Skipping the check in that case is correct and safe.
If self.x or self.y is nil, then the player (or entity using stealth) is not placed on the map — so:
No stealth detection should occur.
The entity should not be visible to or interactable with enemies.
It’s either during initialization, level transition, or removal.

Detailed Scenarios Where self.x/y Might Be nil:

1. Actor Not Yet Spawned or Placed
During character creation or special scripted spawns (e.g. timed events).
self.x/y are set when placed via game.level:addEntity(self, "actor", x, y)

2. During Level Transitions
Between zones or levels, actors are temporarily de-referenced.
self.x/y are nil until the actor is placed into the new map.
This happens mid-turn during some engine states.

3. Just After Death or Teleport/Phasing
If the actor dies or is removed, the coordinates may be unset immediately.
If an effect lingers (like a stealth aura) post-removal, the logic might still be triggered once.

4. Fake or Preview Actors
Some systems create "preview" or "clone" versions of the player to run simulations (e.g. projected stats).
These often lack map presence.