Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-s168 committed May 5, 2024
1 parent 9d984ab commit eaf9443
Show file tree
Hide file tree
Showing 36 changed files with 297 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# VS: Tournament
Small mod that adds some utilities to Valkyrien Skies 2

[Documentation](wiki/main.md)
[Documentation](doc)
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ object TournamentConfig {
@JsonSchema(description = "The speed at which the thruster will stop applying force. (-1 means that it always applies force)")
var thrusterShutoffSpeed = 80.0

@JsonSchema(description = "The weight of a ballast when not redstone powered")
@JsonSchema(description = "The weight of a ballast when redstone powered")
var ballastWeight = 10000.0

@JsonSchema(description = "The weight of a ballast when redstone powered")
@JsonSchema(description = "The weight of a ballast when not redstone powered")
var ballastNoWeight = 800.0

@JsonSchema(description = "The force the pulse gun applies to a ship")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BlockStateProperties.POWER
import net.minecraft.world.level.material.Material
import org.valkyrienskies.tournament.TournamentConfig
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
Expand Down Expand Up @@ -62,6 +63,11 @@ class BallastBlock : Block(
.section("Usage") {
content("Power with redstone to increase weight")
}
.section("Config") {
content("The on and off weight of the ballast is configurable. " +
"The default off weight is ${TournamentConfig.SERVER.ballastNoWeight}, " +
"and the default on weight is ${TournamentConfig.SERVER.ballastWeight}.")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import org.valkyrienskies.mod.common.getShipObjectManagingPos
import org.valkyrienskies.tournament.TournamentConfig
import org.valkyrienskies.tournament.TournamentLootTables
import org.valkyrienskies.tournament.TournamentTriggers
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.ship.TournamentShips

open class BalloonBlock : Block(
Expand Down Expand Up @@ -90,6 +93,15 @@ open class BalloonBlock : Block(
level.destroyBlock(neighbor, false)
}
}
}

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Balloon")
.kind(Doc.Kind.BLOCK)
.summary("Increases lift of the ship.")
.summary("There are two variants: powered- and unpowered- balloon. The powered balloon has higher lift but requires a redstone signal.")
.summary("The powered balloon will be 3x stronger when powered than the unpowered balloon.")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.Material
import org.valkyrienskies.tournament.blockentity.ChunkLoaderBlockEntity
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.util.block.GlassBaseEntityBlock

class ChunkLoaderBlock: GlassBaseEntityBlock(
Expand Down Expand Up @@ -36,4 +39,15 @@ class ChunkLoaderBlock: GlassBaseEntityBlock(

super.onRemove(state, level, pos, newState, isMoving)
}

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Chunk Loader")
.kind(Doc.Kind.BLOCK)
.summary("Loads ships when players are not near.")
.section("Notice") {
content("Experimental feature!")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import org.valkyrienskies.mod.common.getShipObjectManagingPos
import org.valkyrienskies.mod.common.util.toJOML
import org.valkyrienskies.mod.common.util.toJOMLD
import org.valkyrienskies.tournament.blockentity.PropellerBlockEntity
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.ship.TournamentShips
import org.valkyrienskies.tournament.util.DirectionalShape
import org.valkyrienskies.tournament.util.RotShapes
Expand Down Expand Up @@ -149,4 +152,13 @@ class PropellerBlock(
override fun canConnectTo(state: BlockState, direction: Direction): Boolean =
direction in Direction.entries - state.getValue(FACING)

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Propeller")
.kind(Doc.Kind.BLOCK)
.summary("Redstone-powered ship propeller.")
.summary("There is a small propeller (designed to look like a torpedo propeller) and a large (3x3) propeller.")
.summary("Popellers take a bit of time to spin up (reach their maximum force), which makes them unsuitable for steering and similar.")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import org.valkyrienskies.tournament.util.block.DirectionalBaseEntityBlock
import org.valkyrienskies.tournament.util.debug.DebugLine
import org.valkyrienskies.tournament.util.helper.Helper3d
import org.valkyrienskies.tournament.blockentity.RopeHookBlockEntity
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.util.DirectionalShape
import org.valkyrienskies.tournament.util.RotShapes
import java.awt.Color
Expand Down Expand Up @@ -174,4 +177,14 @@ class RopeHookBlock : DirectionalBaseEntityBlock(
return defaultBlockState()
.setValue(FACING, ctx.nearestLookingDirection.opposite)
}

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Rope Hook")
.kind(Doc.Kind.BLOCK)
.summary("Allows for one rope connection at a time. " +
"Disconnects when powered with redstone. " +
"Right click two rope hooks with a rope item to connect them. ")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import org.joml.Vector3d
import org.joml.Vector3dc
import org.valkyrienskies.mod.common.ValkyrienSkiesMod
import org.valkyrienskies.mod.common.util.toDoubles
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation

class SeatBlock :
HorizontalDirectionalBlock(Properties.of(Material.WOOL)
Expand Down Expand Up @@ -72,4 +75,12 @@ class SeatBlock :
player.startRiding(seatEntity)
return InteractionResult.CONSUME
}

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Seat")
.kind(Doc.Kind.BLOCK)
.summary("A seat that players can use")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties.FAC
import net.minecraft.world.level.material.Material
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.VoxelShape
import org.valkyrienskies.tournament.TournamentConfig
import org.valkyrienskies.tournament.blockentity.SensorBlockEntity
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.util.DirectionalShape
import org.valkyrienskies.tournament.util.RotShapes

Expand Down Expand Up @@ -116,4 +120,13 @@ class SensorBlock: BaseEntityBlock(
override fun canConnectTo(state: BlockState, direction: Direction): Boolean =
direction == state.getValue(FACING)

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Distance Sensor")
.kind(Doc.Kind.BLOCK)
.summary("Redstone distance sensor that measures the distance to the block in front of it.")
.summary("The sensor has a default range of ${TournamentConfig.SERVER.sensorDistance} blocks. " +
"If the target is closer, it outputs a higher redstone signal.")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import org.valkyrienskies.mod.common.getShipManagingPos
import org.valkyrienskies.mod.common.isChunkInShipyard
import org.valkyrienskies.tournament.TournamentConfig
import org.valkyrienskies.tournament.TournamentTriggers
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.util.DirectionalShape
import org.valkyrienskies.tournament.util.RotShapes
import org.valkyrienskies.tournament.util.ShipAssembler
Expand Down Expand Up @@ -129,4 +132,15 @@ class ShipAssemblerBlock : DirectionalBlock (
.setValue(FACING, ctx.nearestLookingDirection)
}

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Ship Assembler")
.kind(Doc.Kind.BLOCK)
.summary("Assembles ships by finding a structure of connected blocks that are not blacklisted. " +
"Activated via right-click or redstone signal.")
.section("Notice") {
content("There is a limit to how many blocks can be assembled!")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import org.valkyrienskies.mod.common.getShipManagingPos
import org.valkyrienskies.mod.common.getShipObjectManagingPos
import org.valkyrienskies.mod.common.util.toJOML
import org.valkyrienskies.mod.common.util.toJOMLD
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.ship.TournamentShips
import org.valkyrienskies.tournament.util.DirectionalShape
import org.valkyrienskies.tournament.util.RotShapes
Expand Down Expand Up @@ -110,4 +113,12 @@ class SpinnerBlock : DirectionalBlock(
reader: BlockGetter,
pos: BlockPos
): VoxelShape = RotShapes.cube().makeMcShape()

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Spinner")
.kind(Doc.Kind.BLOCK)
.summary("Applies rotational force around its Y-axis.")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ import org.valkyrienskies.core.api.ships.ServerShip
import org.valkyrienskies.mod.common.getShipManagingPos
import org.valkyrienskies.mod.common.getShipObjectManagingPos
import org.valkyrienskies.mod.common.util.toJOMLD
import org.valkyrienskies.tournament.TournamentConfig
import org.valkyrienskies.tournament.TournamentItems
import org.valkyrienskies.tournament.TournamentProperties
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.ship.TournamentShips
import org.valkyrienskies.tournament.util.DirectionalShape
import org.valkyrienskies.tournament.util.RotShapes
Expand Down Expand Up @@ -210,4 +214,23 @@ class ThrusterBlock(
}
}

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Thruster")
.kind(Doc.Kind.BLOCK)
.summary("Redstone-powered, upgradable thruster.")
.summary("There are two variants. A small thruster and a \"normal\" thruster.")
.summary("The thruster is only active when redstone powered. " +
"It can be upgraded by right-clicking on it with a thruster upgrade.")
.section("Config") {
content("The maximum thruster tier is ${TournamentConfig.SERVER.thrusterTiersNormal} for the normal thruster, " +
"and ${TournamentConfig.SERVER.thrusterTiersTiny} for the small thruster.")
content("The normal thruster has a force of ${TournamentConfig.SERVER.thrusterSpeed} N, " +
"which gets multiplied by the tier / level of the thruster.")
content("The small thruster is ${TournamentConfig.SERVER.thrusterTinyForceMultiplier}x as powerful as the normal thruster " +
"=> ${TournamentConfig.SERVER.thrusterTinyForceMultiplier * TournamentConfig.SERVER.thrusterSpeed} N")
content("Thrusters shut off at a speed of ${TournamentConfig.SERVER.thrusterShutoffSpeed} m/s")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import org.valkyrienskies.mod.common.util.toJOMLD
import org.valkyrienskies.tournament.chunk.ChunkLoader
import org.valkyrienskies.tournament.chunk.ChunkLoaderManager
import org.valkyrienskies.tournament.chunk.ChunkLoadingTicket
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.util.extension.toChunkPos

class CCChunkLoadingAPI(
Expand Down Expand Up @@ -79,4 +82,26 @@ class CCChunkLoadingAPI(

override fun getFutureChunk(): ChunkPos =
getCurrPos().toChunkPos(frontOff!!)

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Chunk Loading API")
.kind(Doc.Kind.CC_API)
.summary("A simple API for loading chunks around the computer")
.summary("This API is still experimental and might not be functional")
.section("vst_chunks.start") {
content("`start(priority: number, chunkVec: {x: number, z: number})`")
content("Starts chunk-loading")
content("Will load all chunks in the rectangle of the computer's position and the given `chunkVec` (relative to the computer's position) every tick")
content("The `priority` specifies the priority of the chunk-loading. The higher this integer is, the higher the priority")
}
.section("vst_chunks.stop") {
content("`stop()`")
}
.section("vst_chunks.help") {
content("`help()`")
content("Returns a short summary of the API")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import net.minecraft.server.level.ServerLevel
import org.joml.Vector3d
import org.valkyrienskies.core.api.ships.ServerShip
import org.valkyrienskies.tournament.TournamentConfig
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.ship.TournamentShips
import org.valkyrienskies.tournament.util.extension.toDouble

Expand Down Expand Up @@ -45,4 +48,18 @@ class CCComponentsAPI(
)
}
}

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Components API")
.kind(Doc.Kind.CC_API)
.summary("A simple API for getting a list of all the thrusters on the current ship")
.summary("It is recommended to use CC: VS with this API")
.section("vst_components.get_thrusters") {
content("`get_thrusters()`")
content("Returns a list of all the thrusters on the current ship")
content("Every element in that list looks similar to this: {pos:{x,y,z}, force:{x,y,z}}")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ class DocumentationContext {

when (fmt) {
Format.MEDIAWIKI -> when (kind) {
Section.ContentKind.TEXT -> sb.append(text)
Section.ContentKind.TEXT -> sb.appendLine(text)
Section.ContentKind.CODE -> {
sb.append("<nowiki>")
sb.append(text)
sb.append("</nowiki>")
}
}
Format.GH_MARKDOWN -> when (kind) {
Section.ContentKind.TEXT -> sb.append(text)
Section.ContentKind.TEXT -> sb.appendLine(text)
Section.ContentKind.CODE -> {
sb.appendLine("```")
sb.appendLine(text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import org.valkyrienskies.mod.common.getShipObjectManagingPos
import org.valkyrienskies.mod.common.util.toJOML
import org.valkyrienskies.tournament.TournamentConfig
import org.valkyrienskies.tournament.TournamentItems
import org.valkyrienskies.tournament.doc.Doc
import org.valkyrienskies.tournament.doc.Documented
import org.valkyrienskies.tournament.doc.documentation
import org.valkyrienskies.tournament.ship.TournamentShips

class PulseGunItem: Item(
Expand Down Expand Up @@ -47,4 +50,12 @@ class PulseGunItem: Item(

return super.useOn(context)
}

class DocImpl: Documented {
override fun getDoc() = documentation {
page("Pulse Gun")
.kind(Doc.Kind.ITEM)
.summary("Applies a force impulse onto a ship when right-clicked")
}
}
}
Loading

0 comments on commit eaf9443

Please sign in to comment.