Skip to content

Added support for dancer/musician performance effects - #1833

Open
madsboddum wants to merge 4 commits into
ProjectSWGCore:masterfrom
madsboddum:performance-effects
Open

madsboddum wants to merge 4 commits into
ProjectSWGCore:masterfrom
madsboddum:performance-effects

Conversation

@madsboddum

Copy link
Copy Markdown
Member

It's worth knowing that the musician ones are technically unreachable because playing instruments in holocore is not yet supported. The dancing ones have been tested though.

performance effects 1 performance effects 2

private const val TARGET_TYPE_LOCATION = 1
private const val TARGET_TYPE_TARGET = 2
private const val ACTION_COST_DIVISOR = 10
private const val MAX_LEVEL = 3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate MAX_LEVEL, should just be set to MAX_VALUE when broadcasting if this needs to be duplicated

data class StopDanceIntent(val player: Player): Intent()
data class FlourishIntent(val performer: Player, val flourishName: String) : Intent()
data class WatchIntent(val actor: Player, val target: SWGObject, val isStartWatch: Boolean) : Intent()
data class PerformEffectIntent(val performer: Player, val effect: PerformEffect, val level: Int?) : Intent()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spidey sense tingles when I see nullable int--should just be set to max value in this case if that's the client's implicit behavior

override fun execute(player: Player, target: SWGObject?, args: String) {
val firstArgument = args.trim().substringBefore(' ')
val requestedLevel = firstArgument.toIntOrNull()
val level = requestedLevel?.coerceIn(MIN_LEVEL, MAX_LEVEL)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spot in particular is where it should fallback to MAX_LEVEL if unspecified. Too much coupling between systems if the default value is set elsewhere

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Having the fallback handling here is cleaner.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants