-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
233 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../src/main/kotlin/io/github/addoncommunity/galactifun/api/objects/planet/PlanetaryWorld.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...c/main/kotlin/io/github/addoncommunity/galactifun/api/objects/properties/OrbitPosition.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 35 additions & 3 deletions
38
plugin/src/main/kotlin/io/github/addoncommunity/galactifun/api/rockets/RocketInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,42 @@ | ||
package io.github.addoncommunity.galactifun.api.rockets | ||
|
||
import io.github.addoncommunity.galactifun.api.objects.properties.atmosphere.Gas | ||
import io.github.addoncommunity.galactifun.impl.items.RocketEngine | ||
import io.github.addoncommunity.galactifun.impl.managers.PlanetManager | ||
import io.github.addoncommunity.galactifun.units.Acceleration | ||
import io.github.addoncommunity.galactifun.units.Force | ||
import io.github.addoncommunity.galactifun.units.Mass | ||
import io.github.addoncommunity.galactifun.units.times | ||
import io.github.addoncommunity.galactifun.util.items.mass | ||
import io.github.thebusybiscuit.slimefun4.libraries.dough.blocks.BlockPosition | ||
|
||
data class RocketInfo( | ||
val commandComputer: BlockPosition, | ||
var blocks: Set<BlockPosition>, | ||
val fuel: Map<Gas, Double> | ||
) | ||
val blocks: Set<BlockPosition>, | ||
val fuel: Map<Gas, Double>, | ||
val engines: List<RocketEngine> | ||
) { | ||
val thrust: Force | ||
get() = engines.fold(Force.ZERO) { acc, engine -> acc + engine.thrust } | ||
val mass: Mass | ||
get() = blocks.fold(Mass.ZERO) { acc, block -> acc + block.block.mass } | ||
|
||
fun twr(gravity: Acceleration): Double { | ||
if (gravity == Acceleration.ZERO) return Double.POSITIVE_INFINITY | ||
return thrust / (mass * gravity) | ||
} | ||
|
||
val info: String | ||
get() = buildString { | ||
val planet = PlanetManager.getByWorld(commandComputer.world) ?: error("Planet not found") | ||
appendLine("Fuel:") | ||
for ((gas, amount) in fuel) { | ||
append(" ".repeat(4)) | ||
append(gas) | ||
appendLine(": %.2f l, %.2f kg".format(amount, amount * gas.liquidDensity)) | ||
} | ||
appendLine("Thrust: %.2f kN".format(thrust.kilonewtons)) | ||
appendLine("Mass: %.2f kg".format(mass.kilograms)) | ||
appendLine("TWR: %.2f".format(twr(planet.gravity))) | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...community/galactifun/base/BaseUniverse.kt → ...community/galactifun/impl/BaseUniverse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...y/galactifun/base/GalactifunCategories.kt → ...y/galactifun/impl/GalactifunCategories.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...munity/galactifun/base/GalactifunItems.kt → ...munity/galactifun/impl/GalactifunItems.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...oncommunity/galactifun/core/Gf2Command.kt → ...oncommunity/galactifun/impl/Gf2Command.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ncommunity/galactifun/core/Permissions.kt → ...ncommunity/galactifun/impl/Permissions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...mmunity/galactifun/base/items/FuelTank.kt → ...mmunity/galactifun/impl/items/FuelTank.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
...ity/galactifun/base/items/RocketEngine.kt → ...ity/galactifun/impl/items/RocketEngine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
package io.github.addoncommunity.galactifun.base.items | ||
package io.github.addoncommunity.galactifun.impl.items | ||
|
||
import io.github.addoncommunity.galactifun.api.objects.properties.atmosphere.Gas | ||
import io.github.addoncommunity.galactifun.units.Force | ||
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup | ||
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem | ||
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack | ||
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType | ||
import org.bukkit.inventory.ItemStack | ||
import kotlin.time.Duration | ||
|
||
class RocketEngine( | ||
itemGroup: ItemGroup, | ||
item: SlimefunItemStack, | ||
recipeType: RecipeType, | ||
recipe: Array<out ItemStack?>, | ||
val specificImpulse: Double, | ||
val thrust: Double | ||
val specificImpulse: Duration, | ||
val thrust: Force, | ||
val fuel: Gas | ||
) : SlimefunItem(itemGroup, item, recipeType, recipe) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...galactifun/core/managers/RocketManager.kt → ...galactifun/impl/managers/RocketManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ty/galactifun/base/objects/earth/Earth.kt → ...ty/galactifun/impl/objects/earth/Earth.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ity/galactifun/base/objects/earth/Moon.kt → ...ity/galactifun/impl/objects/earth/Moon.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...tifun/base/objects/earth/MoonGenerator.kt → ...tifun/impl/objects/earth/MoonGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...y/galactifun/core/space/SpaceGenerator.kt → ...y/galactifun/impl/space/SpaceGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...y/galactifun/core/space/SpacePopulator.kt → ...y/galactifun/impl/space/SpacePopulator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.