Skip to content

Commit

Permalink
Added permissions and removed some options used for the video
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCymaera committed Oct 14, 2024
1 parent dec8a0a commit d0eb492
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
9 changes: 2 additions & 7 deletions src/main/kotlin/com/heledron/sky_torch/laser/Cloud.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Cloud(
val growth: Double,
val maxAge: Int,
val blocks: List<BlockData>,
var disableSmartRendering: Boolean = false,
): GameObject() {
var age = 0

Expand Down Expand Up @@ -51,12 +50,8 @@ class Cloud(
AppState.renderer.render(this, getModel())
}

private fun getSmartRenderLocation(): Location {
return if (disableSmartRendering) location else renderLocation
}

private fun getModel() = blockModel(
location = getSmartRenderLocation(),
location = renderLocation,
init = {
it.brightness = Display.Brightness(15, 15)
it.teleportDuration = 1
Expand All @@ -67,7 +62,7 @@ class Cloud(
val index = (age.toFloat() / maxAge * blocks.size).toInt().coerceAtMost(blocks.size - 1)

// val location = location.clone().add(velocity.clone().normalize().multiply(size / 2))
val diff = location.toVector().subtract(getSmartRenderLocation().toVector())
val diff = location.toVector().subtract(renderLocation.toVector())

it.block = blocks[index]

Expand Down
14 changes: 1 addition & 13 deletions src/main/kotlin/com/heledron/sky_torch/laser/burnWave.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class BurnWaveOptions {
var airDragCoefficient = .005


var disableRotation = false
var disableSmartRendering = false
var disableHeat = false
}

Expand Down Expand Up @@ -62,17 +60,7 @@ private fun spawnBurnCloud(placement: BurnWavePlacement, options: BurnWaveOption
maxAge = Random.nextInt(options.durationMin, options.durationMax),
blocks = options.palette.burn.burnWave.random(),
renderLocation = placement.render.toLocation(placement.world),
disableSmartRendering = options.disableSmartRendering,
).apply {
if (options.disableRotation) {
pitch = 0f
yaw = 0f
pitchVelocity = 0f
yawVelocity = 0f
}



// val affectedPlayers = mutableListOf<org.bukkit.entity.Player>()

onUpdate = {
Expand Down Expand Up @@ -102,7 +90,7 @@ private fun spawnBurnCloud(placement: BurnWavePlacement, options: BurnWaveOption
val top = location.clone().add(.0,scanUpwards,.0)
val ground = raycastGround(top, Vector(0, -1, 0), scanUpwards + scanDownwards)?.hitPosition?.toLocation(location.world!!) ?: location.clone()

if (location.block.type.isOccluding && !options.disableRotation) {
if (location.block.type.isOccluding) {
location.y = location.y.lerp(ground.y + size / 2, .03)
}

Expand Down
20 changes: 19 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,30 @@ commands:
items:
description: Open the items menu
usage: /items
permission: sky_torch.items
reload_config:
description: Reload the configuration file
usage: /reload_config
permission: sky_torch.reload_config
preset:
description: Select a preset
usage: /preset <enum>
permission: sky_torch.preset
scale:
description: Scale the laser
usage: /scale <double>
usage: /scale <double>
permission: sky_torch.scale

permissions:
sky_torch.items:
description: Allows access to the items command
default: op
sky_torch.reload_config:
description: Allows access to the reload_config command
default: op
sky_torch.preset:
description: Allows access to the preset command
default: op
sky_torch.scale:
description: Allows access to the scale command
default: op

0 comments on commit d0eb492

Please sign in to comment.