diff --git a/README.md b/README.md index 5bd68f7..03169ff 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,11 @@ BTW, it will also print the user id of the doer in the server log so that you ca ## Changelog -**List of tweaks I made for version 1.1** +**Version 1.3.0** + +- Add different notice method. + +**Version 1.1** - Add a option to turn off announcement, which means it only print it in the log file. diff --git a/modinfo.lua b/modinfo.lua index 311561d..a9c3cc8 100644 --- a/modinfo.lua +++ b/modinfo.lua @@ -1,7 +1,7 @@ name = "Breaking Warning" description = "Announce when someone is hammering or light anything." author = "辣椒小皇纸" -version = "1.2.1" +version = "1.3.0" forumthread = "" api_version = 10 @@ -30,13 +30,14 @@ configuration_options = default = "zh", }, { - name = "announce_ornot", - label = "Announce", + name = "notice_method", + label = "Notice Method", hover = "", options = { - {description = "Yes", data = true, hover = ""}, - {description = "No", data = false, hover = ""}, + {description = "Announce横幅公告", data = 1, hover = ""}, + {description = "System Message聊天栏", data = 2, hover = ""}, + {description = "None无", data = 0, hover = ""}, }, - default = true, + default = 2, }, } \ No newline at end of file diff --git a/modmain.lua b/modmain.lua index 152fdc8..27d22cc 100644 --- a/modmain.lua +++ b/modmain.lua @@ -13,8 +13,10 @@ local redskull = "󰀀" local _ACTION_HAMMER = GLOBAL.ACTIONS.HAMMER.fn GLOBAL.ACTIONS.HAMMER.fn = function(act) if act.doer and act.target and act.target.components.workable.workleft == 1 then - if GetModConfigData("announce_ornot") then + if GetModConfigData("notice_method") == 1 then GLOBAL.TheNet:Announce(redskull..common_string_warn..act.doer.name..common_string_hammer..act.target.name..redskull) + elseif GetModConfigData("notice_method") == 2 then + GLOBAL.TheNet:SystemMessage(redskull..common_string_warn..act.doer.name..common_string_hammer..act.target.name..redskull) end if act.doer.userid then print(act.doer.name.."("..act.doer.userid..")"..common_string_hammer..act.target.name) @@ -26,8 +28,10 @@ end local _ACTION_LIGHT = GLOBAL.ACTIONS.LIGHT.fn GLOBAL.ACTIONS.LIGHT.fn = function(act) if act.doer and act.target then - if GetModConfigData("announce_ornot") then + if GetModConfigData("notice_method") == 1 then GLOBAL.TheNet:Announce(redskull..common_string_warn..act.doer.name..common_string_light..act.target.name..redskull) + elseif GetModConfigData("notice_method") == 2 then + GLOBAL.TheNet:SystemMessage(redskull..common_string_warn..act.doer.name..common_string_light..act.target.name..redskull) end if act.doer.userid then print(act.doer.name.."("..act.doer.userid..")"..common_string_light..act.target.name)