Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	update
  • Loading branch information
liplum committed May 29, 2022
2 parents 6218044 + 87b9915 commit 5ad7102
Show file tree
Hide file tree
Showing 14 changed files with 282 additions and 171 deletions.
5 changes: 5 additions & 0 deletions assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ cyber-io.speed-increase.range={0}% to {1}%
control.cyber-io.yes=Yes
control.cyber-io.no=No
control.cyber-io.ok=OK
control.cyber-io.enable=Enable {0}
control.cyber-io.validate=Validate
control.cyber-io.update-mod.success=CyberIO {0} updated successfully. Please restart the game to reload CyberIO.
control.cyber-io.update-mod.failed=Failed to update CyberIO because {0}.
Expand Down Expand Up @@ -175,6 +176,10 @@ setting.cyber-io-github-mirror.cancel-tooltip=Desert the input.
setting.cyber-io-check-update.button=Check Update
setting.cyber-io-check-update.already-latest=Current Cyber IO is already latest.
setting.cyber-io-check-update.not-support=Check update doesn't support.
setting.cyber-io-advanced-function.title=Advanced Functions
# Advanced Function
advanced.cyber-io.map-cleaner=Map Cleaner
advanced.cyber-io.map-cleaner.description=Enable Map Cleaner, you will find a special button named "Map Cleaner" in the settings menu while you are playing in a local map. Hit the button, then it will clear all contents from Cyber IO in that map.
# UI
ui.cyber-io.mouse-position.tile=Tile:{0},{1}
ui.cyber-io.mouse-position.build=Build:{0},{1}
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/net/liplum/gradle/DownloadTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ abstract class DownloadTask : DefaultTask() {
val targetFile = targetFile.get()
val sourceUrl = sourceUrl.get()
if (!targetFile.exists() || overwrite.getOrElse(false)) {
targetFile.parentFile?.mkdirs()
if (tip.isPresent) logger.lifecycle(tip.get())
logger.lifecycle("Downloading file from $sourceUrl into ${targetFile.path}, please wait for a while.")
ant.call {
Expand Down
23 changes: 23 additions & 0 deletions main/src/net/liplum/GameH.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ val OnlyServer = Condition {
val net = Vars.net
net.server() || !net.active()
}
val OnlyLocal = Condition{
val net = Vars.net
!net.server() && !net.active()
}
val OnlyDebug = Condition {
CioMod.DebugMode
}
Expand All @@ -160,6 +164,25 @@ inline fun ServerOnly(func: () -> Unit): Boolean {
return false
}

/**
* Runs codes only on Logical Server
*/
inline fun OnlyLocal(func: () -> Unit): Boolean {
val net = Vars.net
if (!net.server() && !net.active()) {
func()
}
return false
}

inline fun <reified T> T.OnlyLocalOn(func: T.() -> Unit): T {
val net = Vars.net
if (!net.server() && !net.active()) {
func()
}
return this
}

inline fun <reified T> T.ServerOnlyOn(func: T.() -> Unit): T {
val net = Vars.net
if (net.server() || !net.active()) {
Expand Down
15 changes: 14 additions & 1 deletion main/src/net/liplum/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public static final class Ctrl {
Yes = Gen("yes"),
No = Gen("no"),
OK = Gen("ok"),
Enable = Gen("enable"),
Validate = Gen("validate"),
UpdateModSuccess = Gen("update-mod.success"),
UpdateModFailed = Gen("update-mod.failed");
Expand All @@ -150,6 +151,17 @@ public static String Gen(String content) {
}
}

public static final class Advanced {
public static final String
MapCleaner = Gen("map-cleaner");

@NotNull
@Contract(pure = true)
public static String Gen(String content) {
return "advanced." + Meta.ModID + "." + content;
}
}

public static final class C {
public static final Color RedAlert = Color.valueOf("#e53935");
public static final Color RedAlertDark = Color.valueOf("#d50000");
Expand Down Expand Up @@ -303,6 +315,7 @@ public static final class CMD {
public static final String
ResetConfig = "cio-reset-config",
ReloadConfig = "cio-reload-config",
CheckUpdate = "cio-check-update";
CheckUpdate = "cio-check-update",
ClearCyberIOConetnt = "cio-clean-map";
}
}
5 changes: 5 additions & 0 deletions main/src/net/liplum/Var.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.liplum

object Var {
var EnableMapCleaner = false
}
Loading

0 comments on commit 5ad7102

Please sign in to comment.