Workers P2: eventToSteps verwirft Schritte ohne Ziel bei fehlender workerId
fx() setzt 'to' jetzt immer, sobald ein drittes Argument übergeben wird; stepIsValid prüft 'to' per Object.hasOwn. Ereignis 'eingang' ohne workerId liefert keinen Umschlag ohne Ziel mehr. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3386e91916
commit
66fe0f38ef
2 files changed
+30
-2
No files matched your search
@@ -186,7 +186,9 @@ const task = (who, text) => ({ op: 'task', who, text })
|
||||
const say = (who, text) => ({ op: 'say', who, text: cutBubble(text) })
|
||||
const pose = (who, p) => ({ op: 'pose', who, pose: p })
|
||||
const give = (from, to) => ({ op: 'give', from, to })
|
||||
const fx = (name, at, to) => (to === undefined ? { op: 'fx', fx: name, at } : { op: 'fx', fx: name, at, to })
|
||||
// `to` wird gesetzt, sobald ein drittes Argument übergeben wird, auch wenn es undefined ist (z. B. fehlende workerId);
|
||||
// so bleibt ein Schritt mit unbekanntem Ziel erkennbar und wird verworfen, statt ohne Ziel zu bleiben
|
||||
const fx = (name, at, ...rest) => (rest.length ? { op: 'fx', fx: name, at, to: rest[0] } : { op: 'fx', fx: name, at })
|
||||
|
||||
// Schritte der Tabelle (Übersicht §7) für ein Ereignis, noch ungeprüft gegen Roster und Plätze
|
||||
function rawSteps(e) {
|
||||
@@ -271,7 +273,7 @@ function stepIsValid(s) {
|
||||
case 'give':
|
||||
return isWorker(s.from) && isWorker(s.to)
|
||||
case 'fx':
|
||||
return isPlace(s.at) && (s.to === undefined || isPlace(s.to))
|
||||
return isPlace(s.at) && (!Object.hasOwn(s, 'to') || isPlace(s.to))
|
||||
default:
|
||||
return isWorker(s.who)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user