Skip to content

Commit

Permalink
Add Plugin Metafuntion / remake charlist derma.
Browse files Browse the repository at this point in the history
  • Loading branch information
10sa committed Mar 24, 2017
1 parent de738ad commit b3703e4
Show file tree
Hide file tree
Showing 46 changed files with 122 additions and 1,013 deletions.
1 change: 1 addition & 0 deletions nutscript/gamemode/derma/cl_charlist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function PANEL:Init()
self:SetVisible(false);

self.name = vgui.Create("DLabel", self);
self.name:SetPos(0, 10);
self.name:SetFont("nut_LargeFont");
self.name:SetTextColor(color_white)
self.name:SetExpensiveShadow(1, Color(0, 0, 0, 100))
Expand Down
2 changes: 1 addition & 1 deletion nutscript/gamemode/kernel/cl_kernel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ function GM:HUDPaintTargetID(entity)
if (targetIsValid and (!drawnEntities[entity] and entity != client and entity:IsPlayer() or hook.Run("ShouldDrawTargetEntity", entity) == true or entity.DrawTargetID)) then
drawnEntities[entity] = true
end

for v in pairs(drawnEntities) do
if (IsValid(v) and v != client and (v:IsPlayer() or hook.Run("ShouldDrawTargetEntity", v) == true or v.DrawTargetID)) then
local target = 0
Expand Down
2 changes: 0 additions & 2 deletions nutscript/gamemode/language/sh_english.lua
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ nut.lang.Add("cant_equip_weapon", "이 무기를 장착한 상태에서는 할

// Vendor (framework)
nut.lang.Add("no_afford", "당신은 이 아이템을 구매할 충분한 돈이 없습니다.", language);
nut.lang.Add("vendor_no_afford", "상인은 이 아이템을 구매하기에 충분한 돈을 가지고 있지 않습니다.", language);
nut.lang.Add("vendor_cash", "이 상인은 %s을(를) 가지고 있습니다.", language);
nut.lang.Add("purchased_for", "당신은 %s을(를) %s 에 구매하였습니다.", language);
nut.lang.Add("sold", "당신은 %s을(를) %s 에 판매하였습니다.", language);
nut.lang.Add("notenoughitem", "당신은 판매할 %s을(를) 가지고 있지 않습니다.", language);
Expand Down
91 changes: 52 additions & 39 deletions nutscript/gamemode/libs/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ function nut.plugin.Load(directory)
nut.lang.Add(self:_GetPluginLanguageIdentifier(key), value, language);
end;

function PLUGIN:GetPluginLanguage(key)
return nut.lang.Get(self:_GetPluginLanguageIdentifier(key));
function PLUGIN:GetPluginLanguage(key, ...)
return nut.lang.Get(self:_GetPluginLanguageIdentifier(key), ...);
end;

function PLUGIN:GetPluginConfig(key, default)
Expand All @@ -184,9 +184,9 @@ function nut.plugin.Load(directory)
end;
end;

function PLUGIN:IncludeDir(dir, isBase)
function PLUGIN:IncludeDir(dir)
local path;
if (SCHEMA and !isBase) then
if (SCHEMA and !self.base) then
path = SCHEMA.folderName.."/plugin/"..self.uniqueID.."/"..dir;
else
path = "nutscript/plugins/"..self.uniqueID.."/"..dir;
Expand Down Expand Up @@ -227,55 +227,68 @@ function nut.plugin.Load(directory)
if (!blocked) then
PLUGIN = nut.plugin.Get(cleanName) or {};
PLUGIN.uniqueID = v;

function PLUGIN:WriteTable(data, ignoreMap, global)
return nut.util.WriteTable(v, data, ignoreMap, global)
end
function PLUGIN:WriteTable(data, ignoreMap, global)
return nut.util.WriteTable(v, data, ignoreMap, global)
end

function PLUGIN:ReadTable(ignoreMap, forceRefresh)
return nut.util.ReadTable(v, ignoreMap, forceRefresh)
end
function PLUGIN:ReadTable(ignoreMap, forceRefresh)
return nut.util.ReadTable(v, ignoreMap, forceRefresh)
end

function PLUGIN:CreatePluginIdentifier(key, caller)
return AdvNut.util.CreateIdentifier("", caller).."Plugin."..self.uniqueID.."."..key;
end;
function PLUGIN:GetPluginIdentifier(key, caller)
return AdvNut.util.CreateIdentifier("", caller).."Plugin."..self.uniqueID.."."..key;
end;

/// Don't use this function. it's private function.
function PLUGIN:_GetPluginLanguageIdentifier(key)
return self:GetPluginIdentifier("").."Language."..key;
end;
/// Don't use this function. it's private function.
function PLUGIN:_GetPluginLanguageIdentifier(key)
return self:GetPluginIdentifier("").."Language."..key;
end;

function PLUGIN:AddPluginLanguage(key, value, language)
nut.lang.Add(self:_GetPluginLanguageIdentifier(key), value, language);
end;
function PLUGIN:AddPluginLanguage(key, value, language)
nut.lang.Add(self:_GetPluginLanguageIdentifier(key), value, language);
end;

function PLUGIN:GetPluginLanguage(key)
return nut.lang.Get(self:_GetPluginLanguageIdentifier(key));
end;
function PLUGIN:GetPluginLanguage(key, ...)
return nut.lang.Get(self:_GetPluginLanguageIdentifier(key), ...);
end;

function PLUGIN:GetPluginConfig(key, default)
if (self) then
if (nut.config[self.uniqueID]) then
return nut.config[self.uniqueID][key] or default;
function PLUGIN:GetPluginConfig(key, default)
if (self) then
if (nut.config[self.uniqueID]) then
return nut.config[self.uniqueID][key] or default;
else
return default;
end;
else
return default;
end;
else
return default;
end;
end;

function PLUGIN:SetPluginConfig(key, value)
if(self.uniqueID) then
local uniqueID = self.uniqueID;
function PLUGIN:SetPluginConfig(key, value)
if(self.uniqueID) then
local uniqueID = self.uniqueID;

if (!nut.config[uniqueID]) then
nut.config[uniqueID] = {};
end;
if (!nut.config[uniqueID]) then
nut.config[uniqueID] = {};
end;

nut.config[self.uniqueID][key] = value;
nut.config[self.uniqueID][key] = value;
end;
end;

function PLUGIN:IncludeDir(dir)
local path;
if (SCHEMA and !self.base) then
path = SCHEMA.folderName.."/plugin/"..self.uniqueID.."/"..dir;
else
path = "nutscript/plugins/"..self.uniqueID.."/"..dir;
end;

for k, v in pairs(file.Find(path.."/*.lua", "LUA")) do
nut.util.Include(path.."/"..v);
end
end;
end;

nut.util.Include(directory.."/plugins/"..v, "shared");
nut.plugin.buffer[cleanName] = PLUGIN;
Expand Down
8 changes: 0 additions & 8 deletions nutscript/gamemode/utils/sh_advutil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ function AdvNut.util.DrawRoundedBox(panel, corner, x, y, w, h)
end;
end;

function AdvNut.util.PluginIncludeDir(directory, uniqueID, isBasePlugin)
local pluginPath = ((!isBasePlugin and SCHEMA.folderName) or "nutscript").."/plugins/"..uniqueID.."/"..directory;

for k, v in pairs(file.Find(pluginPath.."/*.lua", "LUA")) do
nut.util.Include(pluginPath.."/"..v);
end
end

function AdvNut.util.GetCurrentMenuSize()
return (ScrW() * nut.config.menuWidth), (ScrH() * nut.config.menuHeight);
end;
Expand Down
3 changes: 2 additions & 1 deletion nutscript/plugins/3dpanel/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ PLUGIN.name = "3D 패널 (3D Panels)"
PLUGIN.author = "Chessnut / 번역자 : Tensa"
PLUGIN.desc = "3D 패널을 추가시켜 줍니다."
PLUGIN.panels = PLUGIN.panels or {}
PLUGIN.base = true;

AdvNut.util.Include("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

nut.util.Include("sv_plugin.lua");
nut.util.Include("cl_plugin.lua");
Expand Down
3 changes: 2 additions & 1 deletion nutscript/plugins/3dtext/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ PLUGIN.name = "3D 텍스트 (3D Text)"
PLUGIN.author = "Chessnut / 번역자 : Tensa"
PLUGIN.desc = "아무곳에나 3D 텍스트를 쓸수 있게 해줍니다."
PLUGIN.text = PLUGIN.text or {}
PLUGIN.base = true;

AdvNut.util.Include("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

nut.util.Include("sv_plugin.lua");
nut.util.Include("cl_plugin.lua");
Expand Down
2 changes: 1 addition & 1 deletion nutscript/plugins/act/language/sh_korean.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local language = "korean";
local PLUGIN = PLUGIN;

PLUGIN:AddPluginLanguage("act_menu", "모션", language);
PLUGIN:AddPluginLanguage("act_cant_fallover", "기절한 상태에서는 할 수 없습니다.", language);
PLUGIN:AddPluginLanguage("act_closewall", "해당 모션은 벽에 기대야 할 수 있습니다.", language);
Expand Down
3 changes: 2 additions & 1 deletion nutscript/plugins/act/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ PLUGIN.name = "플레이어 동작 (Player Acts)"
PLUGIN.author = "Chessnut and rebel1324 / 번역자 : Tensa and Renée"
PLUGIN.desc = "플레이어의 행동을 추가시켜 줍니다."
PLUGIN.sequences = {}
PLUGIN.base = true;

AdvNut.util.Include("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

local function lean(client)
local data = {
Expand Down
4 changes: 2 additions & 2 deletions nutscript/plugins/area/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ local PLUGIN = PLUGIN or { };
PLUGIN.name = "구역 (Area)"
PLUGIN.author = "Chessnut / 번역자 : Tensa"
PLUGIN.desc = "구역과 관련된 기능을 추가합니다."
PLUGIN.base = true;


AdvNut.util.Include("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

nut.util.Include("sv_plugin.lua");
nut.util.Include("cl_plugin.lua");
Expand Down
1 change: 1 addition & 0 deletions nutscript/plugins/attachments/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local PLUGIN = PLUGIN;
PLUGIN.name = "에니메이션 확장 (Attachments)"
PLUGIN.author = "LauScript / 번역자 : Tensa"
PLUGIN.desc = "각 무기마다 에니메이션을 부여합니다."
PLUGIN.base = true;

nut.util.Include("sv_hooks.lua");
nut.util.Include("sv_lib.lua");
Expand Down
2 changes: 2 additions & 0 deletions nutscript/plugins/broadcast/cl_plugin.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local PLUGIN = PLUGIN;

surface.CreateFont("nut_ChatFontRadio", {
font = mainfont,
size = AdvNut.util.GetScreenScaleFontSize(7.5),
Expand Down
3 changes: 2 additions & 1 deletion nutscript/plugins/broadcast/sh_plugin.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
PLUGIN.name = "방송 시스템 (Broadcast System)"
PLUGIN.author = "Black Tea / 번역자 : Tensa"
PLUGIN.desc = "맵 전체에 방송되는 장비를 추가해 줍니다."
PLUGIN.base = true;

AdvNut.util.PluginIncludeDir("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

nut.util.Include("sv_plugin.lua");
nut.util.Include("cl_plugin.lua");
Expand Down
1 change: 1 addition & 0 deletions nutscript/plugins/customautocomplete.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local PLUGIN = PLUGIN
PLUGIN.name = "자동 완성 (AdvNS Custom Auto-complete)"
PLUGIN.author = "Tensa / Atebite and Chessnut"
PLUGIN.desc = "기존 플러그인을 커스텀한 자동 환성 기능을 추가합니다."
PLUGIN.base = true;

if (CLIENT) then
local chatText = ""
Expand Down
1 change: 1 addition & 0 deletions nutscript/plugins/customchatbox/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ PLUGIN.name = "채터 박스 (AdvNS Custom Chatbox)"
PLUGIN.author = "Tensa / Chessnut"
PLUGIN.desc = "기존 플러그인을 커스텀한 채팅 박스를 추가합니다."
PLUGIN.disabled = true
PLUGIN.base = true;

nut.util.Include("sh_chatbox.lua")
5 changes: 4 additions & 1 deletion nutscript/plugins/customvendor/language/sh_korean.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ PLUGIN:AddPluginLanguage("vd_admin_ask_price", "이 아이템의 가격은?", la

PLUGIN:AddPluginLanguage("created_vendor", "성공적으로 상인을 생성하였습니다.", language);
PLUGIN:AddPluginLanguage("removed_vendor", "성공적으로 상인을 삭제하였습니다.", language);
PLUGIN:AddPluginLanguage("not_trace_vendor", "당신은 상인을 바라보고 있지 않습니다.", language);
PLUGIN:AddPluginLanguage("not_trace_vendor", "당신은 상인을 바라보고 있지 않습니다.", language);

PLUGIN:AddPluginLanguage("vendor_no_afford", "상인은 이 아이템을 구매하기에 충분한 돈을 가지고 있지 않습니다.", language);
PLUGIN:AddPluginLanguage("vendor_cash", "이 상인은 %s을(를) 가지고 있습니다.", language);
5 changes: 3 additions & 2 deletions nutscript/plugins/customvendor/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ local PLUGIN = PLUGIN
PLUGIN.name = "상인 (AdvNS Custom Vendors)"
PLUGIN.author = "Tensa / Chessnut"
PLUGIN.desc = "기존 플러그인을 커스텀한 상인 플러그인을 추가합니다."
PLUGIN.base = true;

AdvNut.util.PluginIncludeDir("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

nut.util.Include("sv_plugin.lua");
nut.util.Include("sh_commands.lua");

AdvNut.util.PluginIncludeDir("derma", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("derma");
3 changes: 2 additions & 1 deletion nutscript/plugins/extrasettings/sh_plugin.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PLUGIN.name = "설정 추가 (Extra Settings)";
PLUGIN.author = "Tensa";
PLUGIN.desc = "AdvNS에서 사용 가능한 추가적인 설정을 추가합니다.";
PLUGIN.base = true;

AdvNut.util.PluginIncludeDir("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");
nut.util.Include("cl_plugin.lua");
3 changes: 2 additions & 1 deletion nutscript/plugins/flashlight/sh_plugin.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PLUGIN.name = "손전등 (Flashlight)"
PLUGIN.author = "Chessnut / 번역자 : Tensa"
PLUGIN.desc = "F키를 이용한 손전등을 추가시켜 줍니다."
PLUGIN.base = true;

function PLUGIN:PlayerSwitchFlashlight(client, state)
if (state and !client:HasItem("flashlight")) then
Expand All @@ -10,4 +11,4 @@ function PLUGIN:PlayerSwitchFlashlight(client, state)
return true
end

AdvNut.util.PluginIncludeDir("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");
2 changes: 1 addition & 1 deletion nutscript/plugins/improvedcooking/items/base/sh_food2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local cookTable = {
BASE.name = "Base Food"
BASE.uniqueID = "base_food"
BASE.weight = .5
BASE.category = PLUGIN:GetPluginLanguage("food")
BASE.category = nut.lang.Get("food");
BASE.eatsound = "physics/flesh/flesh_bloody_break.wav"
BASE.eatsoundlevel = 75
BASE.eatpitch = 200
Expand Down
3 changes: 2 additions & 1 deletion nutscript/plugins/improvedcooking/sh_plugin.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
PLUGIN.name = "개선된 요리 (Improved Cooking)"
PLUGIN.author = "Tensa / Black Tea"
PLUGIN.desc = "배고픔, 목마름과 요리를 추가해 줍니다."
PLUGIN.base = true;

PLUGIN.hungerSpeed = nut.config.hungerRestore
PLUGIN.thirstSpeed = nut.config.thristRestore
PLUGIN.meActions = nut.config.statusMeActions;

AdvNut.util.PluginIncludeDir("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

ATTRIB_COOK = nut.attribs.SetUp(PLUGIN:GetPluginLanguage("cook"), PLUGIN:GetPluginLanguage("cooking_desc"), "cook");

Expand Down
7 changes: 4 additions & 3 deletions nutscript/plugins/improvedcrafting/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ PLUGIN.name = "개선된 제작 (Improved Crafting)"
PLUGIN.author = "Tensa / Black Tea"
PLUGIN.desc = "아이템을 제작할 수 있는 기능을 추가합니다."

PLUGIN.base = true;
PLUGIN.menuEnabled = true;
PLUGIN.reqireBlueprint = true;

AdvNut.util.PluginIncludeDir("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

// 저장될 작업대 엔티티 이름(클래스) //
PLUGIN.craftingTables =
Expand Down Expand Up @@ -60,8 +61,8 @@ function RECIPES:Register(tbl)
self.recipes[ tbl.recipeID ] = tbl
end

AdvNut.util.PluginIncludeDir("recipes", PLUGIN.uniqueID, true);
AdvNut.util.PluginIncludeDir("derma", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("recipes");
PLUGIN:IncludeDir("derma");


function RECIPES:Get(name)
Expand Down
3 changes: 2 additions & 1 deletion nutscript/plugins/improveddoors/sh_plugin.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PLUGIN.name = "개선된 도어 시스템 (Improved Door System)"
PLUGIN.author = "Tensa / Chessnut"
PLUGIN.desc = "기존 도어 플러그인을 개선한 도어 플러그인입니다."
PLUGIN.base = true;

nut.config.doorCost = 50
nut.config.doorSellAmount = 25
Expand Down Expand Up @@ -55,7 +56,7 @@ function PLUGIN:SetDoorOwner(entity, client)
end;
end;

AdvNut.util.PluginIncludeDir("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

nut.util.Include("sh_commands.lua");
nut.util.Include("cl_plugin.lua");
Expand Down
1 change: 1 addition & 0 deletions nutscript/plugins/improvedobserver.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PLUGIN.name = "개선된 옵저버 (Improved Observer)"
PLUGIN.author = "Tensa / Chessnut"
PLUGIN.desc = "기존 플러그인에 기능을 추가한 옵저버 플러그인입니다."
PLUGIN.base = true;

// Thanks, Frosty! //
if (SERVER) then
Expand Down
3 changes: 2 additions & 1 deletion nutscript/plugins/improvedpersist/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ local PLUGIN = PLUGIN or { };
PLUGIN.name = "개선된 영구 저장 (Improved Persistent)"
PLUGIN.author = "Tensa / Chessnut"
PLUGIN.desc = "엔티티 저장에 대한 유효성 검사와 명령어를 추가시키고 임시 버퍼를 만듭니다."
PLUGIN.base = true;

AdvNut.util.Include("language", PLUGIN.uniqueID, true);
PLUGIN:IncludeDir("language");

nut.util.Include("sv_plugin.lua");
nut.util.Include("sh_commands.lua");
Loading

0 comments on commit b3703e4

Please sign in to comment.