-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More settings and command fixes (#579)
* Add aggression toggle * Disable world messages by default * Simplify xp rate calls * Add player file auto saving every x minutes * Add more details to dev setup guide * Update obj spawn command * Remove unused coroutine scope
- Loading branch information
Showing
12 changed files
with
92 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,23 +60,37 @@ It is recommended to use IntelliJ IDEA to develop with Void. | |
The community edition can be downloaded for free from the [jetbrains website.](https://www.jetbrains.com/idea/download/) | ||
See [the installation guide](https://www.jetbrains.com/help/idea/installation-guide.html) for more instructions. | ||
|
||
Once inside the IDE, you can create a new project by going to `File | New | Project from version control... |` | ||
Once opened the IDE click the `Clone Repository` button or `File | New | Project from version control... |` if in the full application. | ||
|
||
Selecting `git` version control and entering the void project URL `[email protected]:GregHib/void.git` found under the `<> Code` button on the [GitHub page](https://github.com/GregHib/void). | ||
Selecting `git` version control and entering the void project URL Found under the `<> Code` button on the [GitHub page](https://github.com/GregHib/void). | ||
- `[email protected]:GregHib/void.git` if you have [GitHub authentication setup](https://docs.github.com/en/authentication). | ||
- `https://github.com/GregHib/void.git` if you don't have SSH authentication. | ||
|
||
Press clone and after a little while the project will be opened for you, the JDK indexed and gradle setup. | ||
> [!NOTE] | ||
> When git is not installed it will display an error and the option to "Download and install", click this and retry the previous step. | ||
> Click "Trust Project" if also asked. | ||
Press "clone" and after the download is complete the project will be opened for you. | ||
|
||
Under `Project Structure... | Project` settings set `SDK` to JDk 19+ (download as needed) and let it index. | ||
|
||
Run the following command in the terminal to set up Gradle or close and re-open the project to trigger IntelliJ's `Open as Gradle Project` popup. | ||
|
||
```bash | ||
./gradlew build -x test | ||
``` | ||
|
||
Extract the [cache files](https://mega.nz/folder/ZMN2AQaZ#4rJgfzbVW0_mWsr1oPLh1A) into a new directory called `/cache/` inside of the `/data/` directory. | ||
|
||
From here you can navigate in the left panel to `/game/src/main/kotlin/world/gregs/voidps/` where you will find [Main.kt](./game/src/main/kotlin/world/gregs/voidps/Main.kt) which you should be able to right-click and run. | ||
From here you can navigate in the left panel to `/game/src/main/kotlin/world/gregs/voidps/` (Or Ctrl/Cmd + N for class search) where you will find [Main.kt](./game/src/main/kotlin/world/gregs/voidps/Main.kt) which you should be able to right-click and run. | ||
|
||
You can also run in the command line using the gradle wrapper. | ||
|
||
```bash | ||
./gradlew run | ||
``` | ||
|
||
Once the server is up and running; setup the [void-client repository](https://github.com/GregHib/void-client/) or download one of the [prebuilt client.jars](https://github.com/GregHib/void-client/releases) and run to log into the game. | ||
Once the server is up and running; download one of the [prebuilt client.jars](https://github.com/GregHib/void-client/releases) or set up the [void-client repository](https://github.com/GregHib/void-client/) and run to log into the game. | ||
|
||
Don't forget to check out our [Contributing guidelines](./CONTRIBUTING.md) before submitting your first pull request! | ||
|
||
|
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
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
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 |
---|---|---|
|
@@ -24,15 +24,13 @@ import world.gregs.voidps.network.LoginServer | |
import world.gregs.voidps.network.login.protocol.decoders | ||
import world.gregs.voidps.script.loadScripts | ||
import java.util.* | ||
import kotlin.coroutines.CoroutineContext | ||
|
||
/** | ||
* @author GregHib <[email protected]> | ||
* @since April 18, 2020 | ||
*/ | ||
object Main : CoroutineScope { | ||
object Main { | ||
|
||
override val coroutineContext: CoroutineContext = Contexts.Game | ||
private val logger = InlineLogger() | ||
|
||
@OptIn(ExperimentalUnsignedTypes::class) | ||
|
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
40 changes: 40 additions & 0 deletions
40
game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/AutoSave.kts
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package world.gregs.voidps.world.interact.entity.player | ||
|
||
import world.gregs.voidps.engine.data.SaveQueue | ||
import world.gregs.voidps.engine.data.Settings | ||
import world.gregs.voidps.engine.data.settingsReload | ||
import world.gregs.voidps.engine.entity.World | ||
import world.gregs.voidps.engine.entity.character.player.Players | ||
import world.gregs.voidps.engine.entity.worldSpawn | ||
import world.gregs.voidps.engine.inject | ||
import world.gregs.voidps.engine.timer.toTicks | ||
import java.util.concurrent.TimeUnit | ||
|
||
val players: Players by inject() | ||
val saveQueue: SaveQueue by inject() | ||
|
||
worldSpawn { | ||
autoSave() | ||
} | ||
|
||
settingsReload { | ||
val minutes = Settings["storage.autoSave.minutes", 0] | ||
if (World.contains("auto_save") && minutes <= 0) { | ||
World.clearQueue("auto_save") | ||
} else if (!World.contains("auto_save") && minutes > 0) { | ||
autoSave() | ||
} | ||
} | ||
|
||
fun autoSave() { | ||
val minutes = Settings["storage.autoSave.minutes", 0] | ||
if (minutes <= 0) { | ||
return | ||
} | ||
World.queue("auto_save", TimeUnit.MINUTES.toTicks(minutes)) { | ||
for (player in players) { | ||
saveQueue.save(player) | ||
} | ||
autoSave() | ||
} | ||
} |
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