You may add flavor text to any hashtag by typing text after a line break after the hashtag. Resolves #40

This commit is contained in:
raeleus 2024-10-04 00:15:29 -07:00
parent 1de7948af9
commit a0e8318cbc
2 changed files with 16 additions and 4 deletions

View file

@ -84,6 +84,15 @@ const modifier = (text) => {
state.characterName = getCharacterName(rawText)
text = sanitizeText(text)
var lineBreakIndex = text.indexOf("\n")
if (lineBreakIndex > -1) {
state.flavorText = text.substring(lineBreakIndex + 1)
if (!state.flavorText.startsWith(" ")) state.flavorText = " " + state.flavorText
text = text.substring(0, lineBreakIndex)
} else {
state.flavorText = null
}
command = text.substring(text.search(/#/) + 1)
var commandName = getCommandName(command).toLowerCase().replaceAll(/[^a-z0-9\s]*/gi, "")
@ -192,6 +201,8 @@ const modifier = (text) => {
text = processCommandSynonyms(command, commandName, statNames, doFlipCommandAbility)
}
if (state.flavorText != null) text += state.flavorText
return { text }
}
@ -1371,7 +1382,6 @@ function doGoToLocation(command) {
if (index != -1) {
location = state.locations[index]
var direction = pointDirection(state.x, state.y, location.x, location.y)
log(`direction:${direction}`)
var args = rotate(state.x, state.y, state.x + parseInt(arg0), state.y, direction)
arg0 = Math.round(args[0])
arg1 = Math.round(args[1])