generated from Weathercold/mindustry-clj-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
d493bfb
commit 89718b2
Showing
12 changed files
with
118 additions
and
95 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea/** linguist-generated | ||
.flake.lock linguist-generated linguist-language=JSON |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,32 +1,27 @@ | ||
(ns logging.core.translating | ||
(:require [logging.core.setting :refer [defsetting]] | ||
[logging.util.lambdas :refer [cons1]] | ||
[logging.util.log :refer [info]]) | ||
(:import (arc Events) | ||
(arc.util CommandHandler Reflect) | ||
(:import (arc.util CommandHandler Reflect) | ||
(java.util Locale) | ||
(mindustry Vars) | ||
(mindustry.game EventType$ClientLoadEvent))) | ||
(mindustry Vars))) | ||
|
||
(def foo-has-translation | ||
"Whether foo client supports chat translation." | ||
(try (Reflect/get (Class/forName "mindustry.client.ClientVars") "enableTranslation") | ||
true | ||
(catch Exception _ false))) | ||
(def target-lang (.getLanguage (Locale/getDefault))) | ||
(delay | ||
(try (Reflect/get (Class/forName "mindustry.client.ClientVars") "enableTranslation") | ||
true | ||
(catch Exception _ false)))) | ||
(def target-lang (delay (.getLanguage (Locale/getDefault)))) | ||
(def supported-langs (agent nil)) ; TODO: initialize | ||
|
||
(defsetting enable-translation | ||
"extra-enabletranslation" | ||
(not (or foo-has-translation Vars/headless)) | ||
(defsetting enable-translation "extra-enabletranslation" true | ||
#(and | ||
% | ||
(not foo-has-translation) | ||
(not @foo-has-translation) | ||
(not Vars/headless))) | ||
(def supported-langs (agent nil)) ; TODO: initialize | ||
|
||
(defn register-command [^CommandHandler handler]) | ||
(defn -init [] | ||
(when @foo-has-translation (info "@extra-logging.footranslation")) | ||
(when Vars/headless (info "@extra-logging.headlesstranslation"))) | ||
|
||
(Events/on EventType$ClientLoadEvent | ||
(cons1 (fn [_] | ||
(when foo-has-translation (info "@extra-logging.footranslation")) | ||
(when Vars/headless (info "@extra-logging.headlesstranslation"))))) | ||
(defn -register-client-commands [^CommandHandler _]) |
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,17 +1,26 @@ | ||
(ns logging.main | ||
(:require [logging.core.settings] | ||
[logging.core.translating :as transl] | ||
(:require (logging.core [events :as events] | ||
[log-handler :as log-h] | ||
[settings :as settings] | ||
[translating :as transl]) | ||
[logging.util.log :refer [debug]]) | ||
(:import (arc.util CommandHandler))) | ||
|
||
(defn main [] (debug "Creating mod")) | ||
(defn -main [] | ||
(settings/refresh!) | ||
(log-h/-main) | ||
(debug "Creating mod") | ||
(events/-main)) | ||
|
||
(defn init [] (debug "Initializing")) | ||
(defn -init [] | ||
(debug "Initializing") | ||
(settings/-init) | ||
(transl/-init)) | ||
|
||
(defn load-content [] (debug "Loading content")) | ||
(defn -load-content [] (debug "Loading content")) | ||
|
||
(defn register-client-commands [^CommandHandler handler] | ||
(defn -register-client-commands [^CommandHandler handler] | ||
(debug "Registering commands") | ||
(transl/register-command handler)) | ||
(transl/-register-client-commands handler)) | ||
|
||
(defn register-server-commands [^CommandHandler _] (debug "Registering commands")) | ||
(defn -register-server-commands [^CommandHandler _] (debug "Registering commands")) |
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