├── nutscript
├── gamemode
│ ├── items
│ │ ├── clothing
│ │ │ └── sh_example.txt
│ │ ├── ammo
│ │ │ └── sh_example.txt
│ │ ├── bodygroup_clothing
│ │ │ └── sh_example.txt
│ │ ├── sh_example.txt
│ │ ├── part
│ │ │ └── sh_example.txt
│ │ ├── weapon
│ │ │ └── sh_example.txt
│ │ └── base
│ │ │ ├── sh_alcohol.lua
│ │ │ ├── sh_literature.lua
│ │ │ ├── sh_ammo.lua
│ │ │ ├── sh_bodygroup_clothing.lua
│ │ │ ├── sh_part.lua
│ │ │ └── sh_weapon.lua
│ ├── libs
│ │ ├── sh_version.lua
│ │ ├── sh_lang.lua
│ │ ├── sh_scrolltext.lua
│ │ ├── sh_settings.lua
│ │ ├── sh_config.lua
│ │ ├── sh_logging.lua
│ │ ├── sh_schema.lua
│ │ └── sh_attributes.lua
│ ├── derma
│ │ ├── cl_custom_scrollpanel.lua
│ │ ├── cl_quickmenu.lua
│ │ ├── cl_togglebutton.lua
│ │ ├── cl_custom_categorylist.lua
│ │ ├── cl_notification.lua
│ │ ├── cl_attribute.lua
│ │ ├── cl_help.lua
│ │ ├── cl_menubutton.lua
│ │ ├── cl_menuside.lua
│ │ ├── cl_noticebar.lua
│ │ ├── cl_baseform.lua
│ │ ├── cl_system.lua
│ │ ├── cl_classes.lua
│ │ ├── cl_custom_tooltip.lua
│ │ └── cl_settings.lua
│ ├── utils
│ │ └── cl_advutil.lua
│ ├── factions
│ │ └── sh_example.txt
│ ├── kernel
│ │ └── netstreams
│ │ │ ├── cl_netstreams.lua
│ │ │ └── sv_netstreams.lua
│ ├── cl_config.lua
│ ├── init.lua
│ ├── sv_config.lua
│ └── shared.lua
├── plugins
│ ├── area
│ │ ├── cl_plugin.lua
│ │ ├── sh_plugin.lua
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sv_plugin.lua
│ │ └── sh_commands.lua
│ ├── storage
│ │ ├── items
│ │ │ ├── container
│ │ │ │ ├── sh_locker.lua
│ │ │ │ ├── sh_box.lua
│ │ │ │ ├── sh_crate.lua
│ │ │ │ ├── sh_fridge.lua
│ │ │ │ ├── sh_sample.txt
│ │ │ │ ├── sh_drawer.lua
│ │ │ │ ├── sh_cabinet.lua
│ │ │ │ ├── sh_crate_big.lua
│ │ │ │ ├── sh_drawer_small.lua
│ │ │ │ ├── sh_cabinet_big.lua
│ │ │ │ └── sh_closet.lua
│ │ │ ├── sh_key.lua
│ │ │ ├── sh_d_locker.lua
│ │ │ ├── sh_c_locker.lua
│ │ │ └── base
│ │ │ │ └── sh_container.lua
│ │ ├── sh_plugin.lua
│ │ ├── sv_plugin.lua
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ └── sh_commands.lua
│ ├── flashlight
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sh_plugin.lua
│ │ └── items
│ │ │ └── sh_flashlight.lua
│ ├── plugincommands
│ │ ├── sh_plugin.lua
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ └── sh_commands.lua
│ ├── extrasettings
│ │ ├── sh_plugin.lua
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ └── cl_plugin.lua
│ ├── mapscene
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sh_plugin.lua
│ │ ├── cl_plugin.lua
│ │ ├── sv_plugin.lua
│ │ └── sh_commands.lua
│ ├── 3dpanel
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sh_plugin.lua
│ │ ├── sh_commands.lua
│ │ ├── cl_plugin.lua
│ │ └── sv_plugin.lua
│ ├── 3dtext
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sh_plugin.lua
│ │ ├── sh_commands.lua
│ │ ├── sv_plugin.lua
│ │ └── cl_plugin.lua
│ ├── customchatbox
│ │ └── sh_plugin.lua
│ ├── realisticmovement
│ │ ├── sh_plugin.lua
│ │ └── language
│ │ │ └── sh_korean.lua
│ ├── notiboard
│ │ ├── sh_plugin.lua
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sv_plugin.lua
│ │ └── sh_commands.lua
│ ├── improvedthirdperson
│ │ ├── sh_plugin.lua
│ │ └── language
│ │ │ └── sh_korean.lua
│ ├── improvedpersist
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sh_plugin.lua
│ │ ├── sh_commands.lua
│ │ └── sv_plugin.lua
│ ├── attachments
│ │ ├── sh_plugin.lua
│ │ ├── sv_hooks.lua
│ │ ├── entities
│ │ │ └── entities
│ │ │ │ └── nut_attachment.lua
│ │ └── sv_lib.lua
│ ├── broadcast
│ │ ├── sh_plugin.lua
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sv_plugin.lua
│ │ ├── cl_plugin.lua
│ │ ├── sh_command.lua
│ │ └── entities
│ │ │ └── entities
│ │ │ └── nut_bdcast.lua
│ ├── customvendor
│ │ ├── sh_plugin.lua
│ │ ├── sh_commands.lua
│ │ ├── sv_plugin.lua
│ │ └── language
│ │ │ └── sh_korean.lua
│ ├── improvedstamina
│ │ ├── cl_hooks.lua
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sh_plugin.lua
│ │ └── sv_hooks.lua
│ ├── spawnpoints
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sh_plugin.lua
│ │ └── sh_commands.lua
│ ├── weaponslock.lua
│ ├── act
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── cl_plugin.lua
│ │ ├── sv_plugin.lua
│ │ └── sh_plugin.lua
│ ├── recognition
│ │ ├── sh_plugin.lua
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── cl_plugin.lua
│ │ ├── sh_commands.lua
│ │ └── derma
│ │ │ └── cl_quickrecognition.lua
│ ├── improvedcrafting
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── recipes
│ │ │ └── sh_sample.txt
│ │ └── entities
│ │ │ └── entities
│ │ │ └── nut_craftingtable.lua
│ ├── improvedcooking
│ │ ├── items
│ │ │ ├── food2
│ │ │ │ └── sh_sample.txt
│ │ │ ├── sh_stove.lua
│ │ │ ├── sh_barrel.lua
│ │ │ └── sh_bucket.lua
│ │ ├── sh_plugin.lua
│ │ ├── language
│ │ │ ├── sh_english.lua
│ │ │ └── sh_korean.lua
│ │ ├── entities
│ │ │ └── entities
│ │ │ │ ├── nut_stove.lua
│ │ │ │ ├── nut_barrel.lua
│ │ │ │ └── nut_bucket.lua
│ │ └── cl_plugin.lua
│ ├── improvedsavepos.lua
│ ├── saveitems.lua
│ ├── saveammo.lua
│ ├── customautocomplete.lua
│ ├── improveddoors
│ │ ├── language
│ │ │ └── sh_korean.lua
│ │ ├── sh_plugin.lua
│ │ └── sv_plugin.lua
│ └── improvedobserver.lua
├── nutscript.txt
├── nutscript.sql
└── entities
│ └── entities
│ ├── nut_money.lua
│ └── nut_item.lua
├── .gitignore
├── README.md
└── LICENSE
/nutscript/gamemode/items/clothing/sh_example.txt:
--------------------------------------------------------------------------------
1 | ITEM.name = "Kleiner"
2 | ITEM.desc = "Makes you look like a scientist!"
3 | ITEM.model = Model("models/kleiner.mdl")
--------------------------------------------------------------------------------
/nutscript/plugins/area/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | netstream.Hook("nut_PlayerEnterArea", function(data)
4 | AdvNut.hook.Run("PlayerEnterArea", data)
5 | end)
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_locker.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "락커"
2 | ITEM.model = Model("models/props_c17/Lockers001a.mdl")
3 | ITEM.uniqueID = "stor_locker"
4 | ITEM.maxWeight = 25
5 | ITEM.desc = "일반적인 락커입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/nutscript.txt:
--------------------------------------------------------------------------------
1 | "nutscript"
2 | {
3 | "base" "sandbox"
4 | "title" "Advanced Nutscript"
5 | "maps" "^rp_"
6 | "desc" "Nutscript 1.0 based Improved RP Framework."
7 | "author" "Tensa"
8 | "version" "0.22"
9 | }
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_box.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "박스"
2 | ITEM.model = Model("models/props_junk/cardboard_box001a.mdl")
3 | ITEM.uniqueID = "stor_box"
4 | ITEM.maxWeight = 5
5 | ITEM.desc = "일반적인 종이로 만들어진 박스입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_crate.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "나무 상자"
2 | ITEM.model = Model("models/props_junk/wood_crate001a.mdl")
3 | ITEM.uniqueID = "stor_crate"
4 | ITEM.maxWeight = 8
5 | ITEM.desc = "오래되어 보이는 상자입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_fridge.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "냉장고"
2 | ITEM.model = Model("models/props_c17/FurnitureFridge001a.mdl")
3 | ITEM.uniqueID = "stor_fridge"
4 | ITEM.maxWeight = 12
5 | ITEM.desc = "노란색의 냉장고입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_sample.txt:
--------------------------------------------------------------------------------
1 | ITEM.name = "box"
2 | ITEM.model = Model("models/props_junk/cardboard_box001a.mdl")
3 | ITEM.uniqueID = "stor_box"
4 | ITEM.maxWeight = 5
5 | ITEM.desc = "just normal box."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_drawer.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "탁자"
2 | ITEM.model = Model("models/props_c17/FurnitureDrawer001a.mdl")
3 | ITEM.uniqueID = "stor_drawer"
4 | ITEM.maxWeight = 10
5 | ITEM.desc = "일반적인 크기의 탁자입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_cabinet.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "케비넷"
2 | ITEM.model = Model("models/props_wasteland/controlroom_filecabinet001a.mdl")
3 | ITEM.uniqueID = "stor_cab"
4 | ITEM.maxWeight = 5
5 | ITEM.desc = "작은 케비넷입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_crate_big.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "큰 나무 상자"
2 | ITEM.model = Model("models/props_junk/wood_crate002a.mdl")
3 | ITEM.uniqueID = "stor_bcrate"
4 | ITEM.maxWeight = 16
5 | ITEM.desc = "크고 오래된 나무 상자입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_drawer_small.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "작은 탁자"
2 | ITEM.model = Model("models/props_c17/FurnitureDrawer002a.mdl")
3 | ITEM.uniqueID = "stor_sdrawer"
4 | ITEM.maxWeight = 4
5 | ITEM.desc = "조금 작은 탁자입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/gamemode/items/ammo/sh_example.txt:
--------------------------------------------------------------------------------
1 | ITEM.name = "Pistol Ammo"
2 | ITEM.desc = "Box of 30 Bullets for Pistol-type Guns. ( EXAMPLE ITEM )"
3 | ITEM.type = "pistol"
4 | ITEM.amount = 30
5 | ITEM.model = Model("models/items/boxsrounds.mdl")
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_cabinet_big.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "큰 케비넷"
2 | ITEM.model = Model("models/props_wasteland/controlroom_filecabinet002a.mdl")
3 | ITEM.uniqueID = "stor_bcab"
4 | ITEM.maxWeight = 20
5 | ITEM.desc = "길다란 케비넷입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/container/sh_closet.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = "대형 케비넷"
2 | ITEM.model = Model("models/props_wasteland/controlroom_storagecloset001a.mdl")
3 | ITEM.uniqueID = "stor_closet"
4 | ITEM.maxWeight = 30
5 | ITEM.desc = "녹색의 대형 케비넷입니다."
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/flashlight/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("fl_flashlight_name", "손전등", language);
5 | PLUGIN:AddPluginLanguage("fl_flashlight_desc", "배터리를 포함한 작은 손전등입니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/plugincommands/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "플러그인 명령어 (Plugin Commands)"
2 | PLUGIN.author = "Tensa"
3 | PLUGIN.desc = "기초적인 명령어를 추가합니다."
4 | PLUGIN.base = true;
5 |
6 | PLUGIN:IncludeDir("language");
7 | nut.util.Include("sh_commands.lua");
8 |
--------------------------------------------------------------------------------
/nutscript/plugins/extrasettings/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "설정 추가 (Extra Settings)";
2 | PLUGIN.author = "Tensa";
3 | PLUGIN.desc = "AdvNS에서 사용 가능한 추가적인 설정을 추가합니다.";
4 | PLUGIN.base = true;
5 |
6 | PLUGIN:IncludeDir("language");
7 | nut.util.Include("cl_plugin.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/mapscene/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("ms_add", "성공적으로 맵 장면을 추가하였습니다.", language);
5 | PLUGIN:AddPluginLanguage("ms_remove", "%s 범위 안의 %s 개의 맵 장면을 삭제하였습니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/3dpanel/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("3dp_addpanel", "조준점에 3D 판넬을 추가하였습니다.", language);
5 | PLUGIN:AddPluginLanguage("3dp_removepanle", "%s 개의 3D 판넬을 삭제하였습니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/3dtext/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("3dt_addtext", "조준점에 3D 텍스트를 추가하였습니다.", language);
5 | PLUGIN:AddPluginLanguage("3dt_removetext", "%s 개의 3D 텍스트를 삭제하였습니다.", language);
--------------------------------------------------------------------------------
/nutscript/gamemode/libs/sh_version.lua:
--------------------------------------------------------------------------------
1 | AdvNut.hook.Add("BuildHelpOptions", "AdvNut_VersionCounter", function(data, tree)
2 | data:AddHelp("버전", function(tree)
3 | return nut.lang.Get("framework_version", nut.config.frameworkVersion);
4 | end, "icon16/server.png");
5 | end);
--------------------------------------------------------------------------------
/nutscript/plugins/customchatbox/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "채터 박스 (AdvNS Custom Chatbox)"
2 | PLUGIN.author = "Tensa / Chessnut"
3 | PLUGIN.desc = "기존 플러그인을 커스텀한 채팅 박스를 추가합니다."
4 | PLUGIN.disabled = true
5 | PLUGIN.base = true;
6 |
7 | nut.util.Include("sh_chatbox.lua")
8 |
--------------------------------------------------------------------------------
/nutscript/plugins/realisticmovement/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "현실적인 움직임 (Realistic Movement)";
2 | PLUGIN.author = "Tensa";
3 | PLUGIN.desc = "캐릭터가 움직일 때, 화면이 흔들리게 합니다.";
4 | PLUGIN.base = true;
5 |
6 | PLUGIN:IncludeDir("language");
7 | nut.util.Include("cl_plugin.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/realisticmovement/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 |
3 | PLUGIN:AddPluginLanguage("rm_category", "현실적인 움직임", language);
4 | PLUGIN:AddPluginLanguage("rm_scale", "효과 강도", language);
5 | PLUGIN:AddPluginLanguage("rm_isUsing", "사용 여부", language);
--------------------------------------------------------------------------------
/nutscript/plugins/notiboard/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "게시판 (Noti-Board)"
2 | PLUGIN.author = "Black Tea / 번역자 : Tensa"
3 | PLUGIN.desc = "3D 텍스트와 유사한 판넬을 추가시켜 줍니다."
4 | PLUGIN.base = true;
5 |
6 | PLUGIN:IncludeDir("language");
7 | nut.util.Include("sv_plugin.lua");
8 | nut.util.Include("sh_commands.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/improvedthirdperson/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | PLUGIN.name = "개선된 3인칭 시점 추가 (New Fancy Third Person)"
3 | PLUGIN.author = "Tensa / Black Tea"
4 | PLUGIN.desc = "3인칭 시점을 사용할 수 있게 합니다."
5 | PLUGIN.base = true;
6 |
7 | PLUGIN:IncludeDir("language");
8 |
9 | nut.util.Include("cl_plugin.lua");
--------------------------------------------------------------------------------
/nutscript/gamemode/items/bodygroup_clothing/sh_example.txt:
--------------------------------------------------------------------------------
1 |
2 | // ITEM Name //
3 | ITEM.name = "Example Bodygroup Clothing";
4 |
5 | // ITEM Unique ID //
6 | ITEM.uniqueID = "A Simple Example";
7 |
8 | // Useable Models //
9 | ITEM.models = {};
10 |
11 | // Bodygroup Index, Value //
12 | ITEM.bodygroup = {0, 0};
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/sh_key.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = PLUGIN:GetPluginLanguage("sr_key_name")
2 | ITEM.uniqueID = "key_generic"
3 | ITEM.category = PLUGIN:GetPluginLanguage("storage_security")
4 | ITEM.weight = 0
5 | ITEM.model = Model( "models/gibs/metal_gib1.mdl" )
6 | ITEM.desc = PLUGIN:GetPluginLanguage("sr_key_desc")
7 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/sh_d_locker.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = PLUGIN:GetPluginLanguage("sr_d_locker_name")
2 | ITEM.uniqueID = "digital_locker_1"
3 | ITEM.category = PLUGIN:GetPluginLanguage("storage_security")
4 | ITEM.model = Model( "models/props_lab/keypad.mdl" )
5 | ITEM.desc = PLUGIN:GetPluginLanguage("sr_d_locker_desc")
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/sh_c_locker.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = PLUGIN:GetPluginLanguage("sr_c_locker_name")
2 | ITEM.uniqueID = "classic_locker_1"
3 | ITEM.category = PLUGIN:GetPluginLanguage("storage_security")
4 | ITEM.model = Model( "models/props_wasteland/prison_padlock001a.mdl" )
5 | ITEM.desc = PLUGIN:GetPluginLanguage("sr_c_locker_desc")
6 |
--------------------------------------------------------------------------------
/nutscript/plugins/improvedpersist/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("ps_saved", "이 엔티티는 이제 저장되는 엔티티입니다.", language);
5 | PLUGIN:AddPluginLanguage("ps_unsaved", "이 엔티티는 더 이상 저장되는 엔티티가 아닙니다.", language);
6 | PLUGIN:AddPluginLanguage("ps_isworldentity", "월드 엔티티는 저장할 수 없습니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/attachments/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN;
2 |
3 | PLUGIN.name = "에니메이션 확장 (Attachments)"
4 | PLUGIN.author = "LauScript / 번역자 : Tensa"
5 | PLUGIN.desc = "각 무기마다 에니메이션을 부여합니다."
6 | PLUGIN.base = true;
7 |
8 | nut.util.Include("sv_hooks.lua");
9 | nut.util.Include("sv_lib.lua");
10 | nut.util.Include("sv_configuration.lua");
11 |
--------------------------------------------------------------------------------
/nutscript/plugins/broadcast/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "방송 시스템 (Broadcast System)"
2 | PLUGIN.author = "Black Tea / 번역자 : Tensa"
3 | PLUGIN.desc = "맵 전체에 방송되는 장비를 추가해 줍니다."
4 | PLUGIN.base = true;
5 |
6 | PLUGIN:IncludeDir("language");
7 |
8 | nut.util.Include("sv_plugin.lua");
9 | nut.util.Include("cl_plugin.lua");
10 | nut.util.Include("sh_command.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/area/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 | PLUGIN.name = "구역 (Area)"
3 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
4 | PLUGIN.desc = "구역과 관련된 기능을 추가합니다."
5 | PLUGIN.base = true;
6 |
7 | PLUGIN:IncludeDir("language");
8 |
9 | nut.util.Include("sv_plugin.lua");
10 | nut.util.Include("cl_plugin.lua");
11 | nut.util.Include("sh_commands.lua");
--------------------------------------------------------------------------------
/nutscript/gamemode/items/sh_example.txt:
--------------------------------------------------------------------------------
1 | // It's Basic Item Template. //
2 |
3 | // Item Name //
4 | ITEM.name = "Example Item Template";
5 |
6 | // Item Unique ID //
7 | ITEM.uniqueID = "A Simple Example";
8 |
9 | // Item Entity Text Color (Options) //
10 | ITEM.color = Color(255, 255, 255);
11 |
12 | // Item data //
13 | ITEM.data = {
14 | Equipped = false
15 | }
--------------------------------------------------------------------------------
/nutscript/plugins/improvedpersist/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 | PLUGIN.name = "개선된 영구 저장 (Improved Persistent)"
3 | PLUGIN.author = "Tensa / Chessnut"
4 | PLUGIN.desc = "엔티티 저장에 대한 유효성 검사와 명령어를 추가시키고 임시 버퍼를 만듭니다."
5 | PLUGIN.base = true;
6 |
7 | PLUGIN:IncludeDir("language");
8 |
9 | nut.util.Include("sv_plugin.lua");
10 | nut.util.Include("sh_commands.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/mapscene/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | PLUGIN.name = "맵 장면 (Map Scenes)"
3 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
4 | PLUGIN.desc = "메뉴에서 맵의 한 장면을 볼수 있게 해 줍니다."
5 | PLUGIN.base = true;
6 |
7 | PLUGIN:IncludeDir("language");
8 |
9 | nut.util.Include("sv_plugin.lua");
10 | nut.util.Include("cl_plugin.lua");
11 | nut.util.Include("sh_commands.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/customvendor/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | PLUGIN.name = "상인 (AdvNS Custom Vendors)"
3 | PLUGIN.author = "Tensa / Chessnut"
4 | PLUGIN.desc = "기존 플러그인을 커스텀한 상인 플러그인을 추가합니다."
5 | PLUGIN.base = true;
6 |
7 | PLUGIN:IncludeDir("language");
8 |
9 | nut.util.Include("sv_plugin.lua");
10 | nut.util.Include("sh_commands.lua");
11 |
12 | PLUGIN:IncludeDir("derma");
--------------------------------------------------------------------------------
/nutscript/plugins/improvedstamina/cl_hooks.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN;
2 |
3 | function PLUGIN:AddCharInfoData(panel)
4 | PLUGIN.staminastatusbar = panel:AddStatusBar(LocalPlayer().character:GetVar("stamina", 0), 100, Color(100, 255, 100, 255));
5 | end
6 |
7 | function PLUGIN:ThinkCharInfo(panel)
8 | PLUGIN.staminastatusbar:RefreshBar(LocalPlayer().character:GetVar("stamina", 0));
9 | end
--------------------------------------------------------------------------------
/nutscript/plugins/improvedstamina/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("speed", "속도", language);
5 | PLUGIN:AddPluginLanguage("stamina", "지구력", language);
6 |
7 | PLUGIN:AddPluginLanguage("speed_desc", "얼마나 빠르게 뛸 수 있는지에 대한 능력치입니다.", language);
8 | PLUGIN:AddPluginLanguage("stamina_desc", "얼마나 오래 뛸 수 있는지에 대한 능력치입니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/area/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("area_area", "구역", language);
5 | PLUGIN:AddPluginLanguage("area_pointstart", "구역에 끝에 도착한 다음 다시 명령어를 입력하세요.", language);
6 | PLUGIN:AddPluginLanguage("area_add", "성공적으로 구역을 추가하였습니다.", language);
7 | PLUGIN:AddPluginLanguage("area_remove", "%s 개의 구역을 삭제하였습니다.", language);
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_custom_scrollpanel.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {};
2 |
3 | function PANEL:Init()
4 | self:IsVisibleScrollBar();
5 | end;
6 |
7 | function PANEL:IsVisibleScrollBar()
8 | if (!AdvNut.hook.Run("IsUsingScrollBar")) then
9 | local bar = self:GetVBar()
10 | bar:SetAlpha(0);
11 | bar:SetWide(0);
12 | end;
13 | end;
14 | vgui.Register("AdvNut_ScrollPanel", PANEL, "DScrollPanel");
--------------------------------------------------------------------------------
/nutscript/plugins/flashlight/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "손전등 (Flashlight)"
2 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
3 | PLUGIN.desc = "F키를 이용한 손전등을 추가시켜 줍니다."
4 | PLUGIN.base = true;
5 |
6 | function PLUGIN:PlayerSwitchFlashlight(client, state)
7 | if (state and !client:HasItem("flashlight")) then
8 | return false
9 | end
10 |
11 | return true
12 | end
13 |
14 | PLUGIN:IncludeDir("language");
--------------------------------------------------------------------------------
/nutscript/plugins/3dpanel/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | PLUGIN.name = "3D 패널 (3D Panels)"
3 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
4 | PLUGIN.desc = "3D 패널을 추가시켜 줍니다."
5 | PLUGIN.panels = PLUGIN.panels or {}
6 | PLUGIN.base = true;
7 |
8 | PLUGIN:IncludeDir("language");
9 |
10 | nut.util.Include("sv_plugin.lua");
11 | nut.util.Include("cl_plugin.lua");
12 | nut.util.Include("sh_commands.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/broadcast/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("bc_machine", "방송 장치", language);
5 |
6 | PLUGIN:AddPluginLanguage("bc_machine_desc", "/방송, 또는 /b 명령어를 이용하여 방송을 할 수 있습니다.", language);
7 | PLUGIN:AddPluginLanguage("bc_machine_notactive", "장치를 먼저 켜야 합니다.", language);
8 | PLUGIN:AddPluginLanguage("chat_broadcast", "%s 님의 방송 ", language);
--------------------------------------------------------------------------------
/nutscript/plugins/3dtext/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 | PLUGIN.name = "3D 텍스트 (3D Text)"
3 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
4 | PLUGIN.desc = "아무곳에나 3D 텍스트를 쓸수 있게 해줍니다."
5 | PLUGIN.text = PLUGIN.text or {}
6 | PLUGIN.base = true;
7 |
8 | PLUGIN:IncludeDir("language");
9 |
10 | nut.util.Include("sv_plugin.lua");
11 | nut.util.Include("cl_plugin.lua");
12 | nut.util.Include("sh_commands.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/extrasettings/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("plugin_es_category", "클라이언트 설정", language);
5 | PLUGIN:AddPluginLanguage("plugin_es_drawVignette", "명암 사용 여부", language);
6 | PLUGIN:AddPluginLanguage("plugin_es_drawBackgroundBlur", "백그라운드 블러 사용 여부", language);
7 | PLUGIN:AddPluginLanguage("plugin_es_usingScrollbar", "스크롤 바 사용 여부", language);
--------------------------------------------------------------------------------
/nutscript/plugins/spawnpoints/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("sp_default", "기본", language);
5 | PLUGIN:AddPluginLanguage("sp_add_class", "성공적으로 %s 팩션, %s 클래스의 스폰 지점을 추가하였습니다.", language);
6 | PLUGIN:AddPluginLanguage("sp_add_faction", "성공적으로 %s 팩션의 스폰 지점을 추가하였습니다.", language);
7 | PLUGIN:AddPluginLanguage("sp_remove", "%s 개의 스폰 지점을 삭제하였습니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/improvedthirdperson/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("tp_name", "3인칭 시점 설정", language);
5 | PLUGIN:AddPluginLanguage("tp_setting", "3인칭 시점", language);
6 | PLUGIN:AddPluginLanguage("tp_mousedpi", "마우스 감도", language);
7 | PLUGIN:AddPluginLanguage("tp_lefthand", "왼손잡이 모드", language);
8 | PLUGIN:AddPluginLanguage("tp_clasic", "클래식 모드", language);
--------------------------------------------------------------------------------
/nutscript/plugins/flashlight/items/sh_flashlight.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = PLUGIN:GetPluginLanguage("fl_flashlight_name")
2 | ITEM.uniqueID = "flashlight"
3 | ITEM.model = Model("models/maxofs2d/lamp_flashlight.mdl")
4 | ITEM.desc = PLUGIN:GetPluginLanguage("fl_flashlight_desc")
5 |
6 | if (SERVER) then
7 | ITEM:Hook("Drop", function(itemTable, client)
8 | if (client:FlashlightIsOn()) then
9 | client:Flashlight(false)
10 | end
11 | end)
12 | end
--------------------------------------------------------------------------------
/nutscript/plugins/storage/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | PLUGIN.name = "저장고 (Storage)"
3 | PLUGIN.author = "Chessnut and rebel1324 / 번역자 : Tensa"
4 | PLUGIN.desc = "저장고를 추가시켜 줍니다."
5 | PLUGIN.base = true;
6 |
7 | -- Black Tea added few lines.
8 |
9 | PLUGIN:IncludeDir("language");
10 |
11 | nut.util.Include("sv_plugin.lua");
12 | nut.util.Include("cl_plugin.lua");
13 | nut.util.Include("sh_commands.lua");
14 |
15 | PLUGIN:IncludeDir("derma");
--------------------------------------------------------------------------------
/nutscript/plugins/attachments/sv_hooks.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 |
3 | function PLUGIN:PlayerLoadedChar(client)
4 | timer.Create( "nut.Attachment_Initialize", 1, 1, function()
5 | client:UpdateWeaponAttachments();
6 | client.EnableSwitchUpdater = true;
7 | end);
8 | end;
9 |
10 |
11 | function PLUGIN:PlayerSwitchWeapon( client, wepold, wepnew )
12 | if ( client.EnableSwitchUpdater ) then
13 | client:UpdateWeaponAttachments();
14 | end;
15 | end;
16 |
--------------------------------------------------------------------------------
/nutscript/plugins/mapscene/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or {};
2 |
3 | netstream.Hook("nut_MapScenePos", function(data)
4 | PLUGIN.position = data[1]
5 | PLUGIN.angles = data[2]
6 | end)
7 |
8 | function PLUGIN:CalcView(client, origin, angles, fov)
9 | if (PLUGIN.position and PLUGIN.angles and IsValid(nut.gui.charMenu)) then
10 | local view = {}
11 | view.origin = PLUGIN.position
12 | view.angles = PLUGIN.angles
13 |
14 | return view
15 | end
16 | end
--------------------------------------------------------------------------------
/nutscript/gamemode/items/part/sh_example.txt:
--------------------------------------------------------------------------------
1 | ITEM.name = "Test Hoverball"
2 | ITEM.partdata = { -- You can use PAC3 to setup the part.
3 | model = "models/dav0r/hoverball.mdl",
4 | bone = "ValveBiped.Bip01_Spine1",
5 | position = Vector( 20, -7.351, 0 ),
6 | angle = Angle( 0, 0, 0 ),
7 | scale = Vector( 1, 1, 1 ),
8 | size = 1,
9 | --material = "",
10 | --skin = "",
11 | --bodygroup = ""
12 | }
13 | ITEM.model = Model("models/dav0r/hoverball.mdl")
14 | ITEM.desc = "A Part."
--------------------------------------------------------------------------------
/nutscript/plugins/weaponslock.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "무기 잠금 (Weapons Lock)"
2 | PLUGIN.author = "Tensa"
3 | PLUGIN.desc = "무기를 내린 상태에서는 발포할 수 없도록 합니다."
4 | PLUGIN.base = true;
5 |
6 | function PLUGIN:StartCommand(client, command)
7 | local weapon = client:GetActiveWeapon();
8 |
9 | if (!client:GetNetVar("wepRaised", false)) then
10 | if (IsValid(weapon) and weapon.FireWhenLowered) then
11 | return;
12 | end
13 |
14 | command:RemoveKey(IN_ATTACK + IN_ATTACK2);
15 | end
16 | end
--------------------------------------------------------------------------------
/nutscript/plugins/notiboard/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("nb_set_title", "타이틀 설정", language);
5 | PLUGIN:AddPluginLanguage("nb_set_text", "텍스트 설정", language);
6 |
7 | PLUGIN:AddPluginLanguage("nb_set_group", "게시판을 성공적으로 %s 그룹으로 설정하였습니다.", language);
8 | PLUGIN:AddPluginLanguage("nb_set_group_text", "%s 그룹의 (%s 개의 전광판); 텍스트를 %s 로 설정하였습니다.", language);
9 | PLUGIN:AddPluginLanguage("nb_not_notiborad", "조준점이 전광판을 바라보고 있지 않습니다.", language);
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Lua sources
2 | luac.out
3 |
4 | # luarocks build files
5 | *.src.rock
6 | *.zip
7 | *.tar.gz
8 |
9 | # Object files
10 | *.o
11 | *.os
12 | *.ko
13 | *.obj
14 | *.elf
15 |
16 | # Precompiled Headers
17 | *.gch
18 | *.pch
19 |
20 | # Libraries
21 | *.lib
22 | *.a
23 | *.la
24 | *.lo
25 | *.def
26 | *.exp
27 |
28 | # Shared objects (inc. Windows DLLs)
29 | *.dll
30 | *.so
31 | *.so.*
32 | *.dylib
33 |
34 | # Executables
35 | *.exe
36 | *.out
37 | *.app
38 | *.i*86
39 | *.x86_64
40 | *.hex
41 |
42 |
--------------------------------------------------------------------------------
/nutscript/plugins/plugincommands/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("plugin_pc_setrank", "%s 님이 %s 님의 랭크를 %s 로 설정하였습니다.", language);
5 | PLUGIN:AddPluginLanguage("plugin_pc_spawn", "%s 님이 %s 님을 스폰 하였습니다.", language);
6 | PLUGIN:AddPluginLanguage("plugin_pc_kick", "%s 님이 %s 님을 킥하였습니다.", language);
7 | PLUGIN:AddPluginLanguage("plugin_pc_syntax_reason", "<사유>", language);
8 |
9 | PLUGIN:AddPluginLanguage("plugin_pc_ban", "%s 님이 %s 님을 %s분 동안 밴하였습니다.", language);
10 |
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_quickmenu.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | local width = 64*5+10
3 | local margin = 75
4 |
5 | function PANEL:Init()
6 | self:SetSize(width, 10)
7 | self:SetDrawBackground(false)
8 | self:MakePopup();
9 | end
10 |
11 | function PANEL:PerformLayout()
12 | local tall = ScrH() - margin - self:GetTall()
13 | self:SetPos(margin, tall)
14 | local x, y = self:ChildrenSize()
15 | self:SetTall(y)
16 | end
17 |
18 | local gradient = surface.GetTextureID("vgui/gradient-r")
19 |
20 | vgui.Register("nut_QuickMenu", PANEL, "DPanel")
--------------------------------------------------------------------------------
/nutscript/plugins/act/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("act_menu", "모션", language);
5 | PLUGIN:AddPluginLanguage("act_cant_fallover", "기절한 상태에서는 할 수 없습니다.", language);
6 | PLUGIN:AddPluginLanguage("act_closewall", "해당 모션은 벽에 기대야 할 수 있습니다.", language);
7 | PLUGIN:AddPluginLanguage("act_veryfast", "다음 행동을 하기 위해서는 잠시 기다려야 합니다.", language);
8 | PLUGIN:AddPluginLanguage("act_invoid", "해당 모션은 공중에서 할 수 없습니다.", language);
9 | PLUGIN:AddPluginLanguage("act_cant_model", "해당 모션은 현재의 캐릭터 모델로 할 수 없습니다.", language);
--------------------------------------------------------------------------------
/nutscript/gamemode/items/weapon/sh_example.txt:
--------------------------------------------------------------------------------
1 | ITEM.name = "Crowbar"
2 | ITEM.class = "weapon_crowbar"
3 | ITEM.uniqueID = ITEM.class -- class and uniqueid must be synced.
4 | ITEM.type = "melee"
5 | ITEM.model = Model("models/weapons/w_crowbar.mdl")
6 | ITEM.desc = "A Crowbar ( EXAMPLE ITEM )"
7 | -- optional.
8 | -- Simulating with PAC3 will make your weapon works faster.
9 | /*
10 | ITEM.wep_partdata = {
11 | model = ITEM.model,
12 | bone = "ValveBiped.Bip01_Spine4",
13 | position = Vector( -13.383, -0.932, 1.764 ),
14 | angle = Angle( 3.576, 166.537, 176.199 ),
15 | }
16 | */
--------------------------------------------------------------------------------
/nutscript/gamemode/utils/cl_advutil.lua:
--------------------------------------------------------------------------------
1 | AdvNut.util = nut.util or {};
2 |
3 | function AdvNut.util.WriteTable(uniqueID, value)
4 | if (type(value) != "table") then
5 | value = {value}
6 | end
7 |
8 | local encoded = pon.encode(value);
9 | file.CreateDir("AdvNutscript/data/");
10 | file.Write("AdvNutscript/data/"..uniqueID..".txt", encoded);
11 | end;
12 |
13 | function AdvNut.util.ReadTable(uniqueID)
14 | local data = file.Read("AdvNutscript/data/"..uniqueID..".txt", "DATA");
15 |
16 | if (data) then
17 | return pon.decode(data);
18 | else
19 | return {};
20 | end;
21 | end;
--------------------------------------------------------------------------------
/nutscript/plugins/recognition/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "인식 (Recognition)"
2 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
3 | PLUGIN.desc = "인식 시스템을 추가합니다."
4 | PLUGIN.base = true;
5 |
6 | PLUGIN:IncludeDir("language");
7 |
8 | function PLUGIN:SetRecognized(client, other)
9 | local id = client.character:GetVar("id");
10 | local recognized = other.character:GetData("recog", {});
11 | recognized[id] = true;
12 |
13 | other.character:SetData("recog", recognized);
14 | end
15 |
16 | nut.util.Include("sh_commands.lua")
17 | nut.util.Include("cl_plugin.lua");
18 | PLUGIN:IncludeDir("derma");
--------------------------------------------------------------------------------
/nutscript/gamemode/items/base/sh_alcohol.lua:
--------------------------------------------------------------------------------
1 | BASE.name = "Alcohol Base"
2 | BASE.amount = 0.2
3 | BASE.time = 180
4 | BASE.category = nut.lang.Get("alcohol")
5 | BASE.functions = {}
6 | BASE.junk = ""
7 | BASE.functions.Use = {
8 | text = nut.lang.Get("drinking"),
9 | run = function(item)
10 | if (CLIENT) then return end
11 |
12 | local client = item.player
13 | client:SetNetVar("drunk", client:GetNetVar("drunk", 0) + item.amount)
14 |
15 | timer.Simple(item.time, function()
16 | if (IsValid(client)) then
17 | client:SetNetVar("drunk", math.max(client:GetNetVar("drunk", 0) - item.amount, 0))
18 | end
19 | end)
20 | client:UpdateInv( item.junk, 1 )
21 | end
22 | }
23 |
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcrafting/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("crafting", "제작", language);
5 | PLUGIN:AddPluginLanguage("norecipes", "이 탭에서 제작 가능한 아이템이 없습니다.", language);
6 |
7 | PLUGIN:AddPluginLanguage("craft_menu_tip1", "초록색 테두리가 쳐진 아이템을 클릭하여 아이템을 조합할 수 있습니다.", language);
8 | PLUGIN:AddPluginLanguage("craft_menu_tip2", "몇몇 레시피는 특정한 아이템이 있어아 표기됩니다.", language);
9 |
10 | PLUGIN:AddPluginLanguage("crft_text", "제작 : %s\n\n%s\n\n요구 재료\n%s\n결과물\n%s", language);
11 |
12 | PLUGIN:AddPluginLanguage("craftingtable", "작업대", language);
13 | PLUGIN:AddPluginLanguage("craftingtable_desc", "무언가를 만들기 적합한 작업대입니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/recognition/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("rg_syntax", "<인자 없음|aim|whisper|yell>", language);
5 |
6 | PLUGIN:AddPluginLanguage("rg_normal", "일반", language);
7 | PLUGIN:AddPluginLanguage("rg_whisper", "속삭임", language);
8 | PLUGIN:AddPluginLanguage("rg_yell", "외침", language);
9 | PLUGIN:AddPluginLanguage("rg_unknown", "아직 모르는 사람", language);
10 |
11 | PLUGIN:AddPluginLanguage("rg_recongitioned_aim", "바라보는 플레이어에게 인식되었습니다.", language);
12 | PLUGIN:AddPluginLanguage("rg_recongitioned", "%s 범위 안의 플레이어에게 인식되었습니다.", language);
13 | PLUGIN:AddPluginLanguage("rg_not_player", "조준점이 플레이어을 바라보고 있지 않습니다.", language);
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_togglebutton.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | function PANEL:Init()
3 | self:SetDark(false)
4 | end
5 |
6 | function PANEL:DoClickInternal()
7 | self.toggled = !self.toggled
8 | end
9 |
10 | function PANEL:SetToggled(status)
11 | self.toggled = status
12 | end
13 |
14 | function PANEL:GetToggled()
15 | return self.toggled
16 | end
17 |
18 | function PANEL:Paint(w, h)
19 | surface.SetDrawColor(50, 50, 50, 200)
20 | surface.DrawRect(0, 0, w, h)
21 |
22 | surface.SetDrawColor(0, 0, 0, 230)
23 | surface.DrawOutlinedRect(0, 0, w, h)
24 |
25 | if (self.toggled) then
26 | surface.SetDrawColor(255, 255, 255, 50)
27 | surface.DrawRect(1, 1, w - 2, h - 2)
28 | end
29 | end
30 | vgui.Register("nut_ToggleButton", PANEL, "DButton")
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Advanced-Nutscript
2 |
3 | [](https://gitter.im/Advanced-Nutscript/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4 | - Nutscript 1.0 Based New RP Framework.
5 |
6 | # Info
7 | - Sorry, Developer is have undevelopable environment. if i returned developable, i'll update this framework.
8 |
9 | # Base Framework
10 | - https://github.com/Chessnut/NutScript/tree/1.0 - Nutscript 1.0
11 |
12 | # License Plus
13 | - This framework will ignore all Nutscript 1.0 licenses below, under the terms of the original author notation.
14 | - The above has been approved by Nutscript 1.0 developer "Black Tea".
15 |
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/items/food2/sh_sample.txt:
--------------------------------------------------------------------------------
1 | // 아이템 이름 //
2 | ITEM.name = "스튜";
3 |
4 | // 아이템 ID //
5 | ITEM.uniqueID = "food_stew";
6 |
7 | // 아이템 설명 //
8 | ITEM.desc = "따뜻함, 그리고 풍만감.";
9 |
10 | // 아이템 모델 //
11 | ITEM.model = Model("models/props_c17/metalPot001a.mdl");
12 |
13 | // 섭취 시 회복되는 배고픔 량 //
14 | ITEM.hunger = 30;
15 |
16 | // 요리 시 요리 레벨에 따른 추가 배고픔 량 //
17 | ITEM.hungermultp = 5;
18 |
19 | // 섭취 시 회복되는 목마름 양 //
20 | ITEM.thirst = 20;
21 |
22 | // 요리 시 요리 레벨에 따른 추가 배고픔 량 //
23 | ITEM.thirstmultp = 5;
24 |
25 | // 요리 가능 여부 //
26 | ITEM.cookable = true;
27 |
28 | // 드랍될 쓰레기 아이템 ID //
29 | ITEM.junk = "";
30 |
31 | // 드랍되는 쓰레기의 갯수 //
32 | ITEM.junkAmount = "";
33 |
34 | ITEM.data = {
35 | // 섭취 가능한 횟수 //
36 | usenum = 8
37 | }
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcrafting/recipes/sh_sample.txt:
--------------------------------------------------------------------------------
1 | local RECIPE = {}
2 |
3 | // 레시피 이름 //
4 | RECIPE.name = "A Skull";
5 |
6 | // 레시피 카테고리 //
7 | RECIPE.category = "icat_material";
8 |
9 | // 레시피 결과물 모델 //
10 | RECIPE.model = Model("models/Gibs/HGIBS.mdl");
11 |
12 | // 레시피 설명 //
13 | RECIPE.desc = "A Skull.";
14 |
15 | // 필요로 하는 설계도, 없을시 nil. //
16 | RECIPE.blueprint = nil;
17 |
18 | // 레시피 ID //
19 | RECIPE.recipeID = "example";
20 |
21 | // 필요로 하는 작업대, 생성한 작업대의 파일 이름(클래스) 으로 식별합니다. //
22 | // 플레이어의 제작 탭에서 제작 가능한 경우 nil. //
23 | RECIPE.workbenchType = nil;
24 |
25 | // 요구하는 아이템 //
26 | RECIPE.items = {
27 | // [아이템 ID] = 필요로 하는 갯수 //
28 | ["bone"] = 1
29 | };
30 |
31 | RECIPE.result = {
32 | // [결과물 ID] = 나오는 갯수 //
33 | ["skull"] = 2
34 | };
35 | RECIPES:Register( RECIPE )
--------------------------------------------------------------------------------
/nutscript/plugins/mapscene/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | PLUGIN.positions = PLUGIN.positions or {}
4 |
5 | function PLUGIN:LoadData()
6 | self.positions = nut.util.ReadTable("scenes")
7 | end
8 |
9 | function PLUGIN:SaveData()
10 | nut.util.WriteTable("scenes", self.positions)
11 | end
12 |
13 | function PLUGIN:PlayerLoadedData(client)
14 | if (#self.positions > 0) then
15 | local data = table.Random(self.positions)
16 |
17 | netstream.Start(client, "nut_MapScenePos", {data.position, data.angles})
18 |
19 | client:SetNutVar("mapScenePos", data.position)
20 | end
21 | end
22 |
23 | function PLUGIN:SetupPlayerVisibility(client, viewEntity)
24 | local position = client:GetNutVar("mapScenePos")
25 |
26 | if (!client.character and position) then
27 | AddOriginToPVS(position)
28 | end
29 | end
--------------------------------------------------------------------------------
/nutscript/plugins/improvedstamina/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | PLUGIN.name = "개선된 지구력 (Improved Stamina)"
3 | PLUGIN.author = "Tensa / Chessnut"
4 | PLUGIN.desc = "지구력과 관련된 능력치를 추가해 줍니다."
5 | PLUGIN.base = true;
6 |
7 | PLUGIN:IncludeDir("language");
8 | nut.util.Include("sv_hooks.lua");
9 | nut.util.Include("cl_hooks.lua");
10 |
11 | ATTRIB_SPD = nut.attribs.SetUp(PLUGIN:GetPluginLanguage("speed"), PLUGIN:GetPluginLanguage("speed_desc"), "spd")
12 | ATTRIB_END = nut.attribs.SetUp(PLUGIN:GetPluginLanguage("stamina"), PLUGIN:GetPluginLanguage("stamina_desc"), "end")
13 |
14 | function PLUGIN:CreateCharVars(character)
15 | character:NewVar("stamina", 100, CHAR_PRIVATE, true);
16 | end;
17 |
18 | function PLUGIN:CharacterSave(client)
19 | client.character:SetData("stamina", client.character:GetVar("stamina", 100));
20 | end;
--------------------------------------------------------------------------------
/nutscript/plugins/broadcast/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | function PLUGIN:LoadData()
2 | local restored = nut.util.ReadTable("bdcast");
3 |
4 | if (restored) then
5 | for k, v in pairs(restored) do
6 | local position = v.position;
7 | local angles = v.angles;
8 | local frequency = v.freq;
9 | local active = v.active;
10 |
11 | local entity = ents.Create("nut_bdcast");
12 | entity:SetPos(position);
13 | entity:SetAngles(angles);
14 | entity:Spawn();
15 | entity:Activate();
16 | entity:SetNetVar("active", active);
17 | end
18 | end
19 | end
20 |
21 | function PLUGIN:SaveData()
22 | local data = {};
23 | for k, v in pairs(ents.FindByClass("nut_bdcast")) do
24 | data[#data + 1] = {
25 | position = v:GetPos(),
26 | angles = v:GetAngles(),
27 | active = v:GetNetVar("active")
28 | };
29 | end;
30 |
31 | nut.util.WriteTable("bdcast", data);
32 | end;
--------------------------------------------------------------------------------
/nutscript/plugins/broadcast/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN;
2 |
3 | surface.CreateFont("nut_ChatFontRadio", {
4 | font = mainfont,
5 | size = AdvNut.util.GetScreenScaleFontSize(7.5),
6 | weight = 500,
7 | antialias = true
8 | });
9 |
10 | function PLUGIN:ShouldDrawTargetEntity(entity)
11 | if (entity:GetClass() == "nut_bdcast") then
12 | return true;
13 | end;
14 | end;
15 |
16 | function PLUGIN:DrawTargetID(entity, x, y, alpha)
17 | if (entity:GetClass() == "nut_bdcast") then
18 | local mainColor = nut.config.mainColor;
19 | local color = Color(mainColor.r, mainColor.g, mainColor.b, alpha);
20 |
21 | nut.util.DrawText(x, y, PLUGIN:GetPluginLanguage("bc_machine"), color);
22 | y = y + nut.config.Get("targetTall");
23 | local text = PLUGIN:GetPluginLanguage("bc_machine_desc");
24 | nut.util.DrawText(x, y, text, Color(255, 255, 255, alpha));
25 | end
26 | end;
--------------------------------------------------------------------------------
/nutscript/plugins/improvedpersist/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | nut.command.Register({
4 | syntax = nut.lang.Get("syntax_bool"),
5 | adminOnly = true,
6 | onRun = function(client, arguments)
7 | local trace = client:GetEyeTraceNoCursor();
8 | local entity = trace.Entity;
9 |
10 | if (IsValid(entity)) then
11 | if (!entity:IsWorld()) then
12 | entity:SetNutVar("persist", util.tobool(arguments[1]));
13 |
14 | if (entity:GetNutVar("persist")) then
15 | nut.util.Notify(PLUGIN:GetPluginLanguage("ps_saved"), client);
16 | else
17 | nut.util.Notify(PLUGIN:GetPluginLanguage("ps_unsaved"), client);
18 | end
19 | else
20 | nut.util.Notify(PLUGIN:GetPluginLanguage("ps_isworldentity"), client);
21 | end
22 | else
23 | nut.util.Notify(PLUGIN:GetPluginLanguage("ps_isworldentity"), client);
24 | end
25 | end
26 | }, "setpersist")
27 |
--------------------------------------------------------------------------------
/nutscript/plugins/improvedsavepos.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "개선된 위치 저장 (Improved Save Position)"
2 | PLUGIN.author = "Tensa / Chessnut"
3 | PLUGIN.desc = "기존 플러그인의 버그가 수정된 캐릭터의 위치 저장 플러그인 입니다."
4 | PLUGIN.base = true;
5 |
6 | function PLUGIN:CharacterSave(client)
7 | if (IsValid(client)) then
8 | client.character:SetData("pos", {client:GetPos(), client:EyeAngles(), game.GetMap()}, nil, true);
9 | end
10 | end
11 |
12 | function PLUGIN:PlayerCharacterLoaded(client, character)
13 | timer.Simple(0.1, function()
14 | if (IsValid(client)) then
15 | local data = character:GetData("pos")
16 | if (data) then
17 | if (data[3] and data[3]:lower() == game.GetMap():lower()) then
18 | client:SetPos(data[1] or client:GetPos());
19 | client:SetEyeAngles(data[2] or Angle(0, 0, 0));
20 | end;
21 | end
22 | client.character:SetData("pos", nil, nil, true)
23 | end
24 | end);
25 | end
26 |
--------------------------------------------------------------------------------
/nutscript/plugins/3dtext/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | nut.command.Register({
4 | adminOnly = true,
5 | syntax = nut.lang.Get("syntax_string")..nut.lang.Get("syntax_scale"),
6 | onRun = function(client, arguments)
7 | if (!arguments[1] or #arguments[1] < 1) then
8 | nut.util.Notify(nut.lang.Get("missing_arg", 1), client)
9 |
10 | return
11 | end
12 |
13 | PLUGIN:AddText(client, arguments[1], tonumber(arguments[2]))
14 | nut.util.Notify(PLUGIN:GetPluginLanguage("3dt_addtext"), client);
15 | end
16 | }, "textadd")
17 |
18 | nut.command.Register({
19 | adminOnly = true,
20 | syntax = nut.lang.Get("syntax_radius"),
21 | onRun = function(client, arguments)
22 | local radius = tonumber(arguments[1]) or 256;
23 | local count = PLUGIN:Remove(client:GetShootPos(), radius);
24 | nut.util.Notify(PLUGIN:GetPluginLanguage("3dt_removetext", count), client);
25 | end
26 | }, "textremove")
--------------------------------------------------------------------------------
/nutscript/nutscript.sql:
--------------------------------------------------------------------------------
1 | SET FOREIGN_KEY_CHECKS=0;
2 |
3 | CREATE TABLE `characters` (
4 | `key` mediumint(8) unsigned zerofill NOT NULL AUTO_INCREMENT,
5 | `steamid` bigint(30) unsigned NOT NULL,
6 | `charname` varchar(60) NOT NULL,
7 | `description` varchar(240) NOT NULL,
8 | `gender` varchar(6) NOT NULL,
9 | `money` mediumint(8) unsigned NOT NULL,
10 | `inv` mediumtext NOT NULL,
11 | `faction` tinyint(4) unsigned NOT NULL,
12 | `id` tinyint(4) unsigned NOT NULL,
13 | `chardata` mediumtext NOT NULL,
14 | `rpschema` varchar(16) NOT NULL,
15 | `model` tinytext NOT NULL,
16 | PRIMARY KEY (`key`)
17 | ) CHARSET=latin1;
18 |
19 | CREATE TABLE `players` (
20 | `key` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
21 | `steamid` bigint(30) unsigned NOT NULL,
22 | `whitelists` varchar(100) NOT NULL,
23 | `plydata` mediumtext NOT NULL,
24 | `rpschema` varchar(16) NOT NULL,
25 | PRIMARY KEY (`key`)
26 | ) CHARSET=latin1;
--------------------------------------------------------------------------------
/nutscript/gamemode/factions/sh_example.txt:
--------------------------------------------------------------------------------
1 | // Must be Create schema faction folder, Don't Create in here. //
2 |
3 |
4 | // Faction Name //
5 | FACTION.name = "Citizen";
6 |
7 | // Faction Desc //
8 | FACTION.desc = "A Simple Example";
9 |
10 | // Faction Color //
11 | FACTION.color = Color(53, 156, 56)
12 |
13 | // Faction Prefix ID (It's using '/plywhitelist' Command) //
14 | FACTION.factionID = "CZ";
15 |
16 | // Faction Default Items. //
17 | FACTION.defaultItem = {
18 | {"Item_Unique_ID", Item_Amount, Item_Data}
19 | }
20 |
21 | // Faction Default Attributes //
22 | FACTION.defaultAttributes = {
23 | [AttributesIndex] = DefaultValue
24 | }
25 |
26 | // Faction Characters Default Max Health Value. (Default : 100) //
27 | FACTION.defaultMaxHealth = 150;
28 |
29 | // Faction Characters Default Armor (0 ~ 255, Default : 0) //
30 | FACTION.defaultArmor = 100;
31 |
32 | // Faction Unique ID. (It's Global, Essential) //
33 | FACTION_CITIZEN = FACTION.index
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "개선된 요리 (Improved Cooking)";
2 | PLUGIN.author = "Tensa / Black Tea";
3 | PLUGIN.desc = "배고픔, 목마름과 요리를 추가해 줍니다.";
4 | PLUGIN.base = true;
5 |
6 | PLUGIN.hungerSpeed = nut.config.hungerRestore;
7 | PLUGIN.thirstSpeed = nut.config.thristRestore;
8 | PLUGIN.meActions = nut.config.statusMeActions;
9 |
10 | PLUGIN:IncludeDir("language");
11 |
12 | ATTRIB_COOK = nut.attribs.SetUp(PLUGIN:GetPluginLanguage("cook"), PLUGIN:GetPluginLanguage("cooking_desc"), "cook");
13 |
14 | function PLUGIN:CreateCharVars(character)
15 | character:NewVar("hunger", 100, CHAR_PRIVATE, true);
16 | character:NewVar("thirst", 100, CHAR_PRIVATE, true);
17 | end
18 |
19 | local entityMeta = FindMetaTable("Entity");
20 |
21 | function entityMeta:IsStove()
22 | return ( self:GetClass() == "nut_stove" or self:GetClass() == "nut_bucket" or self:GetClass() == "nut_barrel" );
23 | end
24 |
25 | nut.util.Include("sv_plugin.lua");
26 | nut.util.Include("cl_plugin.lua");
27 |
--------------------------------------------------------------------------------
/nutscript/gamemode/kernel/netstreams/cl_netstreams.lua:
--------------------------------------------------------------------------------
1 | netstream.Hook("nut_CurTime", function(data)
2 | nut.curTime = data
3 | end)
4 |
5 | netstream.Hook("nut_LoadingData", function(data)
6 | if (data == "") then
7 | nut.loadingText = {}
8 |
9 | return
10 | end
11 |
12 | table.insert(nut.loadingText, 1, data)
13 |
14 | if (#nut.loadingText > 4) then
15 | table.remove(nut.loadingText, 5)
16 | end
17 | end)
18 |
19 | netstream.Hook(AdvNut.util.CreateIdentifier("SetConfigs", CLIENT), function(data)
20 | local key = data.key;
21 | local var = data.var;
22 |
23 | if (nut.config[key] != nil) then
24 | nut.config[key] = var;
25 | end;
26 | end);
27 |
28 | netstream.Hook("nut_FadeIntro", function(data)
29 | nut.fadeStart = CurTime();
30 | nut.fadeFinish = CurTime() + nut.config.introFadeTime;
31 |
32 | nut.fadeColorStart = CurTime() + nut.config.introFadeTime + 5;
33 | nut.fadeColorFinish = CurTime() + nut.config.introFadeTime + 10;
34 |
35 | AdvNut.hook.Run("DoSchemaIntro")
36 | end)
37 |
--------------------------------------------------------------------------------
/nutscript/gamemode/items/base/sh_literature.lua:
--------------------------------------------------------------------------------
1 | BASE.name = "Base Book"
2 | BASE.contents = "Hello world!"
3 | BASE.category = nut.lang.Get("book")
4 | BASE.model = "models/props_lab/bindergraylabel01b.mdl"
5 | BASE.price = 10
6 | BASE.functions = {}
7 | BASE.functions.Read = {
8 | text = nut.lang.Get("b_reading"),
9 | icon = "icon16/book_open.png",
10 | run = function(item)
11 | if (CLIENT) then
12 | if (IsValid(nut.gui.book)) then
13 | nut.gui.book:Remove()
14 | end
15 |
16 | if (IsValid(nut.gui.menu)) then
17 | nut.gui.menu.close:DoClick()
18 | end
19 |
20 | local frame = vgui.Create("DFrame")
21 | frame:SetSize(ScrW() * 0.375, ScrH() * 0.8)
22 | frame:SetTitle(item.name)
23 | frame:Center()
24 | frame:MakePopup()
25 |
26 | frame.html = frame:Add("DHTML")
27 | frame.html:Dock(FILL)
28 | frame.html:SetHTML([[
29 |
30 | ]]..item.contents..[[
31 |
32 | ]])
33 | end
34 |
35 | return false
36 | end
37 | }
38 |
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/language/sh_english.lua:
--------------------------------------------------------------------------------
1 | local language = "english";
2 |
3 | PLUGIN:AddPluginLanguage("cook_it", "%s cooks the %s", language);
4 | PLUGIN:AddPluginLanguage("food_uncook", "not cooked.", language);
5 | PLUGIN:AddPluginLanguage("food_worst", "utter shit.", language);
6 | PLUGIN:AddPluginLanguage("food_reallybad", "black garbage.", language);
7 | PLUGIN:AddPluginLanguage("food_bad", "visually burnt.", language);
8 | PLUGIN:AddPluginLanguage("food_notgood", "over cooked.", language);
9 | PLUGIN:AddPluginLanguage("food_normal", "cooked.", language);
10 | PLUGIN:AddPluginLanguage("food_good", "cooked well.", language);
11 | PLUGIN:AddPluginLanguage("food_sogood", "delicious.", language);
12 | PLUGIN:AddPluginLanguage("food_reallygood", "unbelieveable.", language);
13 | PLUGIN:AddPluginLanguage("food_best", "god-likely cooked.", language);
14 |
15 | PLUGIN:AddPluginLanguage("stove_desc", "Allows you to cook some food.", language);
16 | PLUGIN:AddPluginLanguage("stove_name", "Cooking Stove.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/3dpanel/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | nut.command.Register({
4 | adminOnly = true,
5 | syntax = nut.lang.Get("syntax_url")..nut.lang.Get("syntax_width")..nut.lang.Get("syntax_height")..nut.lang.Get("syntax_scale"),
6 | onRun = function(client, arguments)
7 | if (!arguments[1] or #arguments[1] < 1) then
8 | nut.util.Notify(nut.lang.Get("missing_arg", 1), client)
9 | return
10 | end
11 |
12 | PLUGIN:AddPanel(client, arguments[1], tonumber(arguments[2]) or 128, tonumber(arguments[3]) or 128, tonumber(arguments[4]))
13 | nut.util.Notify(PLUGIN:GetPluginLanguage("3dp_addpanel"), client)
14 | end
15 | }, "paneladd")
16 |
17 | nut.command.Register({
18 | adminOnly = true,
19 | syntax = nut.lang.Get("syntax_radius"),
20 | onRun = function(client, arguments)
21 | local radius = tonumber(arguments[1]) or 256
22 | local count = PLUGIN:Remove(client:GetShootPos(), radius)
23 |
24 | nut.util.Notify(PLUGIN:GetPluginLanguage("3dp_removepanel", count), client)
25 | end
26 | }, "panelremove")
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_custom_categorylist.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {};
2 |
3 | function PANEL:Init()
4 | self:SetDrawBackground(false);
5 | self.Paint = function(panel, w, h)
6 | surface.SetDrawColor(color_black);
7 | surface.DrawRect(0, 0, w, 20);
8 | end
9 | end
10 |
11 | function PANEL:SetLabel(text)
12 | self.Header:SetText(text);
13 | self.Header:SetFont("nut_SmallFont");
14 | end;
15 |
16 | // Override Orignal Function. //
17 | function PANEL:SetContents(pContents)
18 | self.Contents = pContents;
19 | self.Contents:SetParent(self);
20 | self.Contents:Dock(FILL);
21 | self.Contents:DockMargin(2, 0, 2, 0);
22 |
23 | if (!self:GetExpanded()) then
24 | self.OldHeight = self:GetTall();
25 | elseif (self:GetExpanded() && IsValid( self.Contents ) && self.Contents:GetTall() < 1) then
26 | self.Contents:SizeToChildren(false, true);
27 | self.OldHeight = self.Contents:GetTall();
28 | self:SetTall(self.OldHeight);
29 | end
30 |
31 | self:InvalidateLayout(true);
32 | end
33 | vgui.Register("AdvNut_CategoryList", PANEL, "DCollapsibleCategory");
--------------------------------------------------------------------------------
/nutscript/plugins/broadcast/sh_command.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN;
2 |
3 | nut.chat.Register("broadcast", {
4 | onChat = function(speaker, text)
5 | surface.PlaySound( "ambient/levels/prison/radio_random" .. math.random( 1, 9 ) ..".wav" )
6 | if (LocalPlayer() != speaker and speaker:GetPos():Distance(LocalPlayer():GetPos()) <= nut.config.chatRange) then
7 | chat.AddText(Color(255, 100, 100), PLUGIN:GetPluginLanguage("chat_broadcast",speaker:Name()).."\""..text.."\"")
8 | else
9 | chat.AddText(Color(180, 0, 0), PLUGIN:GetPluginLanguage("chat_broadcast",speaker:Name()).."\""..text.."\"")
10 | end
11 | end,
12 | prefix = { "/broadcast", "/ㅠ", "/방송", "/b" },
13 | canHear = function(speaker, listener)
14 | return true
15 | end,
16 | canSay = function(speaker)
17 |
18 | for k, v in pairs( ents.FindInSphere( speaker:GetPos(), 128 ) ) do
19 | if v:GetClass() == "nut_bdcast" and v:GetNetVar( "active" ) then
20 | return true
21 | end
22 | end
23 | nut.util.Notify(PLUGIN:GetPluginLanguage("bc_machine_notactive"), speaker)
24 |
25 | end,
26 | font = "nut_ChatFontRadio"
27 | });
--------------------------------------------------------------------------------
/nutscript/plugins/area/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | PLUGIN.areas = PLUGIN.areas or {}
4 |
5 | timer.Create("nut_AreaManager", 1, 0, function()
6 | local areas = PLUGIN.areas
7 |
8 | if (#areas > 0) then
9 | for k = 1, #areas do
10 | local v = areas[k]
11 | local entities = ents.FindInBox(v.min, v.max)
12 |
13 | for k2, v2 in pairs(entities) do
14 | if (IsValid(v2) and v2:IsPlayer() and v2.character and v2:GetNetVar("area", "") != v.name) then
15 | v2:SetNetVar("area", v.name)
16 |
17 | AdvNut.hook.Run("PlayerEnterArea", v2, v, entities)
18 | netstream.Start(nil, "nut_PlayerEnterArea", v2)
19 | end
20 | end
21 | end
22 | end
23 | end)
24 |
25 | function PLUGIN:PlayerEnterArea(client, area)
26 | local text = area.name
27 |
28 | if (area.showTime) then
29 | text = text..", "..os.date("!%X", nut.util.GetTime()).."."
30 | end
31 |
32 | nut.scroll.Send(text, client)
33 | end
34 |
35 | function PLUGIN:LoadData()
36 | self.areas = nut.util.ReadTable("areas")
37 | end
38 |
39 | function PLUGIN:SaveData()
40 | nut.util.WriteTable("areas", self.areas)
41 | end
--------------------------------------------------------------------------------
/nutscript/plugins/3dpanel/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | netstream.Hook("nut_PanelRemove", function(index)
4 | PLUGIN.panels[index] = nil
5 | end)
6 |
7 | netstream.Hook("nut_PanelData", function(data)
8 | local position = data[1]
9 | local angle = data[2]
10 | local url = data[3]
11 | local w = data[4]
12 | local h = data[5]
13 | local scale = data[6]
14 |
15 | local panel = vgui.Create("DHTML")
16 | panel:SetSize(w, h)
17 | panel:SetMouseInputEnabled(false)
18 | panel:OpenURL(url)
19 | panel:SetPaintedManually(true)
20 |
21 | PLUGIN.panels[#PLUGIN.panels + 1] = {pos = position, angle = angle, panel = panel, scale = scale}
22 | end)
23 |
24 | function PLUGIN:PostDrawTranslucentRenderables()
25 | local position = LocalPlayer():GetPos()
26 |
27 | for i = 1, #self.panels do
28 | local data = self.panels[i]
29 |
30 | if (data and IsValid(data.panel)) then
31 | cam.Start3D2D(data.pos, data.angle, data.scale or 0.25)
32 | data.panel:SetPaintedManually(false)
33 | data.panel:PaintManual()
34 | data.panel:SetPaintedManually(true)
35 | cam.End3D2D()
36 | end
37 | end
38 | end
--------------------------------------------------------------------------------
/nutscript/plugins/mapscene/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN;
2 |
3 | nut.command.Register({
4 | adminOnly = true,
5 | onRun = function(client, arguments)
6 | local data = {
7 | position = client:EyePos(),
8 | angles = client:EyeAngles()
9 | }
10 |
11 | table.insert(PLUGIN.positions, data)
12 | netstream.Start(nil, "nut_MapScenePos", {data.position, data.angles})
13 |
14 | PLUGIN:SaveData()
15 | nut.util.Notify(PLUGIN:GetPluginLanguage("ms_add"), client)
16 | end
17 | }, "mapsceneadd")
18 |
19 | nut.command.Register({
20 | adminOnly = true,
21 | syntax = nut.lang.Get("syntax_radius"),
22 | onRun = function(client, arguments)
23 | local range = tonumber(arguments[1] or "160") or 160
24 | local count = 0
25 |
26 | for k, v in pairs(PLUGIN.positions) do
27 | if (v.position:Distance(client:GetPos()) <= range) then
28 | count = count + 1
29 |
30 | table.remove(PLUGIN.positions, k)
31 | end
32 | end
33 |
34 | if (count > 0) then
35 | PLUGIN:SaveData()
36 | end
37 |
38 | nut.util.Notify(PLUGIN:GetPluginLanguage("ms_remove", range, count), client)
39 | end
40 | }, "mapsceneremove")
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Tensa
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/nutscript/plugins/improvedpersist/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | function PLUGIN:LoadData()
4 | local contents = nut.util.ReadTable("persist");
5 | if (contents) then
6 | local entities, constraints = duplicator.Paste(nil, contents.Entities or {}, contents.Contraints or {});
7 | for k, v in pairs(entities) do
8 | v:SetNutVar("persist", true);
9 | v:SetPersistent(true);
10 | end;
11 | end
12 |
13 | for k, v in pairs(ents.GetAll()) do
14 | if(v:GetPersistent()) then
15 | v:SetNutVar("persist", true);
16 | end;
17 | end;
18 | end
19 |
20 | function PLUGIN:SaveData()
21 | local data = {}
22 | for k, v in pairs(ents.GetAll()) do
23 | if (v:GetNutVar("persist") and !v:GetPersistent() and v.PersistentSave != false) then
24 | data[#data + 1] = v
25 | end
26 | end
27 |
28 | nut.util.WriteTable("persist", duplicator.CopyEnts(data));
29 | end
30 |
31 | function PLUGIN:PersistentSave()
32 | for k, v in pairs(ents.GetAll()) do
33 | if(v:GetPersistent() or v:GetNutVar("persist") and v:IsWorld()) then
34 | v:SetPersistent(false);
35 | v:SetNutVar("persist", false);
36 | end;
37 | end;
38 | end;
--------------------------------------------------------------------------------
/nutscript/plugins/customvendor/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN;
2 |
3 | nut.command.Register({
4 | adminOnly = true,
5 | onRun = function(client, arguments)
6 | local position = client:GetEyeTraceNoCursor().HitPos
7 | local angles = client:EyeAngles()
8 | angles.p = 0
9 | angles.y = angles.y - 180
10 |
11 | local entity = ents.Create("nut_vendor");
12 | entity:SetPos(position);
13 | entity:SetAngles(angles);
14 | entity:Spawn();
15 | entity:Activate();
16 |
17 | PLUGIN:SaveData();
18 |
19 | nut.util.Notify(PLUGIN:GetPluginLanguage("created_vendor"), client);
20 | end
21 | }, "vendoradd")
22 |
23 |
24 | nut.command.Register({
25 | adminOnly = true,
26 | onRun = function(client, arguments)
27 | local trace = client:GetEyeTraceNoCursor();
28 | local entity = trace.Entity;
29 |
30 | if (IsValid(entity) and entity:GetClass() == "nut_vendor") then
31 | entity:Remove();
32 |
33 | PLUGIN:SaveData();
34 |
35 | nut.util.Notify(PLUGIN:GetPluginLanguage("removed_vendor"), client);
36 | else
37 | nut.util.Notify(PLUGIN:GetPluginLanguage("not_trace_vendor"), client);
38 | end
39 | end
40 | }, "vendorremove")
41 |
--------------------------------------------------------------------------------
/nutscript/plugins/recognition/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | function PLUGIN:IsPlayerRecognized(client)
2 | if (client == LocalPlayer()) then
3 | return true
4 | end
5 |
6 | local localPlayer = LocalPlayer()
7 |
8 | if (IsValid(localPlayer) and localPlayer.character) then
9 | local recognized = localPlayer.character:GetData("recog", {})
10 |
11 | if (recognized[client.character:GetVar("id", 0)] == true) then
12 | return true
13 | end
14 | end
15 | end
16 |
17 | local DESC_LENGTH = 37
18 |
19 | function PLUGIN:GetPlayerName(client, mode, text)
20 | if (client != LocalPlayer() and !AdvNut.hook.Run("IsPlayerRecognized", client)) then
21 | // local fakeName = AdvNut.hook.Run("GetUnknownPlayerName", client)
22 | // if (!fakeName) then
23 | if (mode) then
24 | local description = client.character:GetVar("description", "")
25 | if (string.utf8len(description) > DESC_LENGTH) then
26 | description = string.utf8sub(description, 1, DESC_LENGTH - 3).."..."
27 | end
28 |
29 | fakeName = "["..description.."]"
30 | else
31 | return self:GetPluginLanguage("rg_unknown");
32 | end
33 | // end
34 |
35 | return fakeName
36 | end
37 | end
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/items/sh_stove.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = PLUGIN:GetPluginLanguage("cook_stove_name")
2 | ITEM.uniqueID = "cstove"
3 | ITEM.category = PLUGIN:GetPluginLanguage("c_cooking")
4 | ITEM.model = Model("models/props_c17/furnitureStove001a.mdl")
5 | ITEM.desc = PLUGIN:GetPluginLanguage("cook_stove_desc")
6 | ITEM.functions = {}
7 | ITEM.functions.Use = {
8 | icon = "icon16/weather_sun.png",
9 | run = function(itemTable, client, data, entity)
10 | if (SERVER) then
11 | local position
12 |
13 | if (IsValid(entity)) then
14 | position = entity:GetPos() + Vector(0, 0, 4)
15 | else
16 | local data2 = {
17 | start = client:GetShootPos(),
18 | endpos = client:GetShootPos() + client:GetAimVector() * 72,
19 | filter = client
20 | }
21 | local trace = util.TraceLine(data2)
22 | position = trace.HitPos + Vector(0, 0, 16)
23 | end
24 |
25 | local entity2 = entity
26 | local entity = ents.Create("nut_stove")
27 | entity:SetPos(position)
28 |
29 | if (IsValid(entity2)) then
30 | entity:SetAngles(entity2:GetAngles())
31 | end
32 |
33 | entity:Spawn()
34 | entity:Activate()
35 | end
36 | end
37 | }
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/items/sh_barrel.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = PLUGIN:GetPluginLanguage("cook_barrel_name")
2 | ITEM.uniqueID = "cbarrel"
3 | ITEM.category = PLUGIN:GetPluginLanguage("c_cooking")
4 | ITEM.model = Model("models/props_phx/empty_barrel.mdl")
5 | ITEM.desc = PLUGIN:GetPluginLanguage("cook_barrel_desc")
6 | ITEM.functions = {}
7 | ITEM.functions.Use = {
8 | tip = "Set up a Barrel on the ground.",
9 | icon = "icon16/fire.png",
10 | run = function(itemTable, client, data, entity)
11 | if (SERVER) then
12 | local position
13 |
14 | if (IsValid(entity)) then
15 | position = entity:GetPos() + Vector(0, 0, 4)
16 | else
17 | local data2 = {
18 | start = client:GetShootPos(),
19 | endpos = client:GetShootPos() + client:GetAimVector() * 72,
20 | filter = client
21 | }
22 | local trace = util.TraceLine(data2)
23 | position = trace.HitPos + Vector(0, 0, 16)
24 | end
25 |
26 | local entity2 = entity
27 | local entity = ents.Create("nut_barrel")
28 | entity:SetPos(position)
29 |
30 | if (IsValid(entity2)) then
31 | entity:SetAngles(entity2:GetAngles())
32 | end
33 |
34 | entity:Spawn()
35 | entity:Activate()
36 | end
37 | end
38 | }
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/items/sh_bucket.lua:
--------------------------------------------------------------------------------
1 | ITEM.name = PLUGIN:GetPluginLanguage("cook_burcket_name")
2 | ITEM.uniqueID = "cbucket"
3 | ITEM.category = PLUGIN:GetPluginLanguage("c_cooking")
4 | ITEM.model = Model("models/props_junk/MetalBucket01a.mdl")
5 | ITEM.desc = PLUGIN:GetPluginLanguage("cook_burcket_desc")
6 | ITEM.functions = {}
7 | ITEM.functions.Use = {
8 | tip = "Set up a Bucket on the ground.",
9 | icon = "icon16/fire.png",
10 | run = function(itemTable, client, data, entity)
11 | if (SERVER) then
12 | local position
13 |
14 | if (IsValid(entity)) then
15 | position = entity:GetPos() + Vector(0, 0, 4)
16 | else
17 | local data2 = {
18 | start = client:GetShootPos(),
19 | endpos = client:GetShootPos() + client:GetAimVector() * 72,
20 | filter = client
21 | }
22 | local trace = util.TraceLine(data2)
23 | position = trace.HitPos + Vector(0, 0, 16)
24 | end
25 |
26 | local entity2 = entity
27 | local entity = ents.Create("nut_bucket")
28 | entity:SetPos(position)
29 |
30 | if (IsValid(entity2)) then
31 | entity:SetAngles(entity2:GetAngles())
32 | end
33 |
34 | entity:Spawn()
35 | entity:Activate()
36 | end
37 | end
38 | }
--------------------------------------------------------------------------------
/nutscript/plugins/notiboard/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | function PLUGIN:LoadData()
4 | local restored = nut.util.ReadTable("notiboards")
5 |
6 | if (restored) then
7 | for k, v in pairs(restored) do
8 | local position = v.position
9 | local angles = v.angles
10 | local title = v.title
11 | local text = v.text
12 | local group = v.group
13 |
14 | local entity = ents.Create("nut_notiboard")
15 | entity:SetPos(position)
16 | entity:SetAngles(angles)
17 | entity:Spawn()
18 | entity:Activate()
19 | entity:SetNetVar("title", title)
20 | entity:SetNetVar("text", text)
21 | entity.group = group
22 |
23 | local physicsObject = entity:GetPhysicsObject();
24 | if (IsValid(physicsObject)) then
25 | physicsObject:EnableMotion(false);
26 | physicsObject:Sleep();
27 | end
28 |
29 | end
30 | end
31 | end
32 |
33 | function PLUGIN:SaveData()
34 | local data = {}
35 |
36 | for k, v in pairs(ents.FindByClass("nut_notiboard")) do
37 | data[#data + 1] = {
38 | position = v:GetPos(),
39 | angles = v:GetAngles(),
40 | title = v:GetNetVar("title"),
41 | text = v:GetNetVar("text"),
42 | group = v.group
43 | }
44 | end
45 |
46 | nut.util.WriteTable("notiboards", data)
47 | end
--------------------------------------------------------------------------------
/nutscript/plugins/3dtext/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | function PLUGIN:PlayerLoadedData(client)
4 | for k, v in pairs(self.text) do
5 | netstream.Start(client, "nut_TextData", {v.pos, v.angle, v.text, v.scale})
6 | end
7 | end
8 |
9 | function PLUGIN:AddText(client, text, scale)
10 | local trace = client:GetEyeTraceNoCursor()
11 | local data = {
12 | pos = trace.HitPos + trace.HitNormal,
13 | angle = trace.HitNormal:Angle(),
14 | text = text,
15 | scale = math.max(math.abs(scale or 0.25), 0.005)
16 | }
17 | data.angle:RotateAroundAxis(data.angle:Up(), 90)
18 | data.angle:RotateAroundAxis(data.angle:Forward(), 90)
19 |
20 | self.text[#self.text + 1] = data
21 |
22 | netstream.Start(nil, "nut_TextData", {data.pos, data.angle, data.text, data.scale})
23 | end
24 |
25 | function PLUGIN:SaveData()
26 | nut.util.WriteTable("3dtext", self.text)
27 | end
28 |
29 | function PLUGIN:LoadData()
30 | self.text = nut.util.ReadTable("3dtext")
31 | end
32 |
33 | function PLUGIN:Remove(position, radius)
34 | local i = 0
35 | for k, v in pairs(self.text) do
36 | if (v.pos:Distance(position) <= radius) then
37 | netstream.Start(nil, "nut_TextRemove", k)
38 | self.text[k] = nil
39 | i = i + 1
40 | end
41 | end
42 |
43 | return i
44 | end
--------------------------------------------------------------------------------
/nutscript/plugins/saveitems.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "아이템 저장 (Save Items)"
2 | PLUGIN.desc = "월드에 존재하는 아이템을 저장해 줍니다."
3 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
4 | PLUGIN.base = true;
5 |
6 | if (SERVER) then
7 | function PLUGIN:LoadData()
8 | local restored = nut.util.ReadTable("saveditems")
9 |
10 | if (restored) then
11 | for k, v in pairs(restored) do
12 | local position = v.position
13 | local angles = v.angles
14 | local itemTable = nut.item.Get(v.uniqueID)
15 | local data = v.data
16 |
17 | if itemTable then
18 | local entity = nut.item.Spawn(position, angles, itemTable, data)
19 |
20 | AdvNut.hook.Run("ItemRestored", itemTable, entity)
21 | end
22 | end
23 | end
24 | end
25 |
26 | function PLUGIN:SaveData()
27 | local data = {}
28 | for k, v in pairs(ents.FindByClass("nut_item")) do
29 | if(v:GetPersistent()) then
30 | v:SetPersistent(false);
31 | end;
32 |
33 | if (AdvNut.hook.Run("ItemShouldSave", v) != false) then
34 | data[k] = {
35 | position = v:GetPos(),
36 | angles = v:GetAngles(),
37 | uniqueID = v:GetItemTable().uniqueID,
38 | data = v:GetData()
39 | }
40 |
41 | AdvNut.hook.Run("ItemSaved", v)
42 | end
43 | end
44 | nut.util.WriteTable("saveditems", data)
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/nutscript/plugins/broadcast/entities/entities/nut_bdcast.lua:
--------------------------------------------------------------------------------
1 | ENT.Type = "anim"
2 | ENT.PrintName = "방송 시스템"
3 | ENT.Author = "Chessnut"
4 | ENT.Spawnable = true
5 | ENT.AdminOnly = true
6 | ENT.Category = "Nutscript"
7 | ENT.PersistentSave = false;
8 |
9 | if (SERVER) then
10 | function ENT:Initialize()
11 | self:SetModel("models/props_lab/citizenradio.mdl")
12 | self:PhysicsInit(SOLID_VPHYSICS)
13 | self:SetMoveType(MOVETYPE_VPHYSICS)
14 | self:SetNetVar("active", false)
15 | self:SetUseType(SIMPLE_USE)
16 | self:SetColor( Color( 200, 200, 200, 255 ) )
17 |
18 | local physicsObject = self:GetPhysicsObject()
19 |
20 | if (IsValid(physicsObject)) then
21 | physicsObject:Wake()
22 | end
23 | end
24 |
25 | function ENT:Use(activator)
26 | self:SetNetVar("active", !self:GetNetVar("active", false))
27 | end
28 | else
29 | local GLOW_MATERIAL = Material("sprites/glow04_noz.vmt")
30 | local COLOR_ACTIVE = Color(0, 255, 0)
31 | local COLOR_INACTIVE = Color(255, 0, 0)
32 |
33 | function ENT:Draw()
34 | self:DrawModel()
35 |
36 | local position = self:GetPos() + self:GetForward() * 10 + self:GetUp() * 11 + self:GetRight() * 9.5
37 |
38 | render.SetMaterial(GLOW_MATERIAL)
39 | render.DrawSprite(position, 14, 14, self:GetNetVar("active") and COLOR_ACTIVE or COLOR_INACTIVE)
40 | end
41 | end
--------------------------------------------------------------------------------
/nutscript/plugins/3dpanel/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | function PLUGIN:PlayerLoadedData(client)
4 | for k, v in pairs(self.panels) do
5 | netstream.Start(client, "nut_PanelData", {v.pos, v.angle, v.url, v.w, v.h, v.scale})
6 | end
7 | end
8 |
9 | function PLUGIN:AddPanel(client, url, w, h, scale)
10 | local trace = client:GetEyeTraceNoCursor()
11 | local data = {
12 | pos = trace.HitPos + trace.HitNormal,
13 | angle = trace.HitNormal:Angle(),
14 | url = url,
15 | w = w,
16 | h = h,
17 | scale = scale or 0.25
18 | }
19 | data.angle:RotateAroundAxis(data.angle:Up(), 90)
20 | data.angle:RotateAroundAxis(data.angle:Forward(), 90)
21 |
22 | self.panels[#self.panels + 1] = data
23 | self:SaveData()
24 |
25 | netstream.Start(nil, "nut_PanelData", {data.pos, data.angle, data.url, data.w, data.h, data.scale})
26 | end
27 |
28 | function PLUGIN:SaveData()
29 | self:WriteTable(self.panels)
30 | end
31 |
32 | function PLUGIN:LoadData()
33 | self.panels = self:ReadTable()
34 | end
35 |
36 | function PLUGIN:Remove(position, radius)
37 | local i = 0
38 |
39 | for k, v in pairs(self.panels) do
40 | if (v.pos:Distance(position) <= radius) then
41 | netstream.Start(nil, "nut_PanelRemove", k)
42 |
43 | self.panels[k] = nil
44 | i = i + 1
45 | end
46 | end
47 |
48 | return i
49 | end
--------------------------------------------------------------------------------
/nutscript/gamemode/cl_config.lua:
--------------------------------------------------------------------------------
1 | -- Whether or not the money is shown in the side menu.
2 | nut.config.Register("showMoney", true, CLIENT);
3 |
4 | -- Whether or not the time is shown in the side menu.
5 | nut.config.Register("showTime", true, CLIENT);
6 |
7 | -- If set to false, then color correction will not be enabled.
8 | nut.config.Register("sadColors", true, CLIENT);
9 |
10 | -- Whether or not to enable the crosshair.
11 | nut.config.Register("crosshair", false, CLIENT);
12 |
13 | -- The dot size of the crosshair.
14 | nut.config.Register("crossSize", 1, CLIENT);
15 |
16 | -- The amount of spacing beween each crosshair dot in pixels.
17 | nut.config.Register("crossSpacing", 6, CLIENT);
18 |
19 | -- How 'see-through' the crosshair is from 0-255, where 0 is invisible and 255 is fully
20 | -- visible.
21 | nut.config.Register("crossAlpha", 150, CLIENT);
22 |
23 | AdvNut.hook.Add("SchemaInitialized", "nut_FontConfig", function()
24 | nut.config.Register("targetTall", 0, CLIENT);
25 | surface.SetFont("nut_TargetFontSmall");
26 |
27 | _, tall = surface.GetTextSize("W");
28 | nut.config.Set("targetTall", tall or 0);
29 |
30 | if (nut.config.Get("targetTall")) then
31 | nut.config.Set("targetTall", nut.config.Get("targetTall") + 2);
32 | end
33 |
34 | nut.config.Set("targetTall", nut.config.Get("targetTall") or 10);
35 | end)
--------------------------------------------------------------------------------
/nutscript/plugins/3dtext/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | netstream.Hook("nut_TextRemove", function(index)
4 | PLUGIN.text[index] = nil
5 | end)
6 |
7 | netstream.Hook("nut_TextData", function(data)
8 | local position = data[1]
9 | local angle = data[2]
10 | local text = data[3]
11 | local scale = data[4]
12 |
13 | local markupText = ""..string.gsub(text, "\\n", "\n")
14 | markupText = string.gsub(markupText, "\\t", "\t")
15 | markupText = markupText..""
16 | local markupObj = nut.markup.Parse(markupText)
17 | function markupObj:DrawText(text, font, x, y, color, hAlign, vAlign, alpha)
18 | color.a = alpha
19 | local color2 = Color(0, 0, 0, alpha)
20 |
21 | draw.SimpleTextOutlined(text, font, x, y, color, 0, 1, 2, color2)
22 | end
23 | PLUGIN.text[#PLUGIN.text + 1] = {pos = position, angle = angle, text = text, scale = scale, markup = markupObj}
24 | end)
25 |
26 | function PLUGIN:PostDrawTranslucentRenderables()
27 | local position = LocalPlayer():GetPos()
28 |
29 | for i = 1, #self.text do
30 | local data = self.text[i]
31 |
32 | if (data) then
33 | local alpha = nut.util.GetAlphaFromDist(position, data.pos, 1024)
34 |
35 | if (alpha > 0) then
36 | cam.Start3D2D(data.pos, data.angle, data.scale or 0.25)
37 | data.markup:Draw(0, 0, 1, 1, alpha)
38 | cam.End3D2D()
39 | end
40 | end
41 | end
42 | end
--------------------------------------------------------------------------------
/nutscript/plugins/notiboard/sh_commands.lua:
--------------------------------------------------------------------------------
1 | nut.command.Register({
2 | syntax = nut.lang.Get("syntax_groupnumber"),
3 | adminOnly = true,
4 | onRun = function(client, arguments)
5 | local data = {}
6 | data.start = client:GetShootPos()
7 | data.endpos = data.start + client:GetAimVector() * 450
8 | data.filter = client
9 | local trace = util.TraceLine(data)
10 | local entity = trace.Entity
11 | local gp = arguments[1] or ""
12 |
13 | if (IsValid(entity) and entity:GetClass() == "nut_notiboard") then
14 | entity.group = gp
15 | nut.util.Notify(PLUGIN:GetPluginLanguage("nb_set_group", gp), client)
16 | else
17 | nut.util.Notify(PLUGIN:GetPluginLanguage("nb_not_notiborad"), client)
18 | end
19 | end
20 | }, "notisetgroup")
21 |
22 | nut.command.Register({
23 | syntax = nut.lang.Get("syntax_groupnumber")..nut.lang.Get("syntax_string"),
24 | adminOnly = true,
25 | onRun = function(client, arguments)
26 | if #arguments < 2 then
27 | nut.util.Notify(nut.lang.Get("missing_arg", 2), client)
28 | return
29 | end
30 | local gp = arguments[1] or ""
31 | table.remove(arguments, 1)
32 | local text = table.concat(arguments, " ")
33 | local count = 0
34 | for k, v in pairs(ents.FindByClass("nut_notiboard")) do
35 | if v.group == gp then
36 | v:SetNetVar("text", text)
37 | count = count + 1
38 | end
39 | end
40 | nut.util.Notify(PLUGIN:GetPluginLanguage("nb_set_group_text", gp, count, text), client)
41 | end
42 | }, "notisetgrouptext")
--------------------------------------------------------------------------------
/nutscript/gamemode/libs/sh_lang.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Purpose: Quick library to add phrases based off a key or retrieve it.
3 | Used throughout the framework to make language customization easier,
4 | rather than searching through the files.
5 | --]]
6 |
7 | nut.lang = nut.lang or {}
8 | nut.lang.phrases = nut.lang.phrases or {}
9 |
10 | --[[
11 | Purpose: Adds a phrase that can be identified by a key to the list
12 | of phrases.
13 | --]]
14 | function nut.lang.Add(key, value, language)
15 | language = language or "english"
16 |
17 | nut.lang.phrases[language] = nut.lang.phrases[language] or {}
18 | nut.lang.phrases[language][key] = value
19 | end
20 |
21 | --[[
22 | Purpose: Returns the corresponding phrase based off the key, substituting
23 | %s in phrases with the arguments provided. If the translation doesn't exist,
24 | it will return .
25 |
26 | Example:
27 | nut.lang.Add("praise", "%s is awesome, just like %s.")
28 | print(nut.lang.Get("praise", "Nutscript", "pie"))
29 |
30 | Would return:
31 | > Nutscript is awesome, just like pie.
32 | --]]
33 | function nut.lang.Get(key, ...)
34 | local language = nut.config.language or "english"
35 |
36 | if (nut.lang.phrases[language] and nut.lang.phrases[language][key]) then
37 | return string.format(nut.lang.phrases[language][key], ...)
38 | else
39 | return ""
40 | end
41 | end
42 |
43 | --[[
44 | Quick function to return the lowercase form of a phrase.
45 | --]]
46 | function nut.lang.GetLower(key, ...)
47 | return string.lower(nut.lang.Get(key, ...))
48 | end
--------------------------------------------------------------------------------
/nutscript/plugins/storage/items/base/sh_container.lua:
--------------------------------------------------------------------------------
1 | BASE.name = "Base Storage"
2 | BASE.uniqueID = "base_storage"
3 | BASE.category = PLUGIN:GetPluginLanguage("storage")
4 | BASE.functions = {}
5 | BASE.functions.Use = {
6 | text = nut.lang.Get("setup"),
7 | tip = nut.lang.Get("setup_desc"),
8 | icon = "icon16/weather_sun.png",
9 | run = function(itemTable, client, data, entity)
10 | if (SERVER) then
11 | local position
12 |
13 | if (IsValid(entity)) then
14 | position = entity:GetPos()
15 | else
16 | local data2 = {
17 | start = client:GetShootPos(),
18 | endpos = client:GetShootPos() + client:GetAimVector() * 72,
19 | filter = client
20 | }
21 | local trace = util.TraceLine(data2)
22 | position = trace.HitPos + Vector(0, 0, 16)
23 | end
24 |
25 | local entity2 = entity
26 | local entity = ents.Create("nut_container")
27 |
28 | if (IsValid(entity2)) then
29 | entity:SetAngles(entity2:GetAngles())
30 | end
31 |
32 | entity:SetPos(position)
33 | entity:Spawn()
34 | entity:Activate()
35 | entity:SetNetVar("inv", {})
36 | entity:SetNetVar("name", itemTable.name)
37 | entity.itemID = itemTable.uniqueID
38 |
39 | if (itemTable.maxWeight) then
40 | entity:SetNetVar("maxWeight", itemTable.maxWeight)
41 | end
42 |
43 | entity:SetModel(itemTable.model)
44 | entity:PhysicsInit(SOLID_VPHYSICS)
45 |
46 | local physicsObject = entity:GetPhysicsObject()
47 |
48 | if (IsValid(physicsObject)) then
49 | physicsObject:Wake()
50 | end
51 | end
52 | end
53 | }
54 |
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_notification.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | function PANEL:Init()
3 | self:ParentToHUD()
4 |
5 | self.text = self:Add("DLabel")
6 | self.text:SetTextColor(color_white)
7 | self.text:SetExpensiveShadow(1, color_black)
8 | self.text:Dock(FILL)
9 | self.text:SetContentAlignment(5)
10 |
11 | self.start = CurTime()
12 | self.finish = self.start + 8
13 |
14 | LocalPlayer():EmitSound("buttons/button14.wav", 40)
15 | end
16 |
17 | function PANEL:SetText(text)
18 | self.text:SetText(text)
19 | end
20 |
21 | function PANEL:CallOnRemove(callback)
22 | self.callback = callback
23 | end
24 |
25 | function PANEL:Paint(w, h)
26 | surface.SetDrawColor(40, 40, 45, 200)
27 | surface.DrawRect(0, 0, w, h)
28 |
29 | if (self.start and self.finish) then
30 | local fraction = 1 - math.TimeFraction(self.start, self.finish, CurTime())
31 | local color = nut.config.mainColor
32 | color.a = 50
33 |
34 | surface.SetDrawColor(color)
35 | surface.DrawRect(0, 21, w, 3)
36 |
37 | color.a = 225
38 |
39 | surface.SetDrawColor(color)
40 | surface.DrawRect(0, 21, w * fraction, 3)
41 | end
42 | end
43 |
44 | function PANEL:Think()
45 | if (self.start and self.finish and CurTime() > self.finish) then
46 | self:MoveTo(ScrW(), ScrH() - 25, 1.5, 0.1, 0.35)
47 | self:AlphaTo(0, 0.35, 0)
48 |
49 | timer.Simple(0.25, function()
50 | if (IsValid(self)) then
51 | if (self.callback) then
52 | self.callback()
53 | end
54 |
55 | self:Remove()
56 | end
57 | end)
58 | end
59 | end
60 | vgui.Register("nut_Notification", PANEL, "DPanel")
--------------------------------------------------------------------------------
/nutscript/gamemode/init.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Purpose: The framework needs to define this so the schemas can reference
3 | the framework without GM.BaseClass since it the baseclass is not defined in time.
4 | --]]
5 |
6 | resource.AddWorkshop("207739713");
7 | resource.AddWorkshop("589615668");
8 | resource.AddWorkshop("865625406");
9 |
10 | local startTime = SysTime();
11 |
12 | include("shared.lua");
13 | AddCSLuaFile("shared.lua");
14 | AddCSLuaFile("cl_init.lua");
15 |
16 | if (string.lower(GetConVarString("gamemode")) == "nutscript") then
17 | MsgC(Color(255, 0, 0), "FATAL WARNING! CHANGE +GAMEMODE TO YOUR SCHEMA, NOT NUTSCRIPT!\n")
18 |
19 | local _, gamemodes = file.Find("gamemodes/*", "GAME")
20 |
21 | for k, v in pairs(gamemodes) do
22 | local files = file.Find("gamemodes/"..v.."/*.txt", "GAME")
23 |
24 | for k2, v2 in pairs(files) do
25 | local contents = string.lower(file.Read("gamemodes/"..v.."/"..v2, "GAME"))
26 |
27 | if (string.find(string.lower(contents), [["base"(%s+)"nutscript"]])) then
28 | MsgC(Color(255, 255, 0), "FOUND SCHEMA '"..v.."'\n")
29 | game.ConsoleCommand("gamemode "..v.."\n")
30 | game.ConsoleCommand("bot\n")
31 |
32 | AdvNut.hook.Add("Think", "nut_ChangeLevel", function()
33 | MsgC(Color(255, 255, 0), "CHANGING MAP TO INITIALIZE THE '"..v.."' SCHEMA...\n")
34 | game.ConsoleCommand("changelevel "..game.GetMap().."\n")
35 | end)
36 | end
37 | end
38 | end
39 |
40 | return
41 | end
42 |
43 | MsgC(Color(0, 255, 0), "[Advanced Nutscript] "..math.Round(SysTime() - startTime, 3).. " second(s) to initialize.\n");
--------------------------------------------------------------------------------
/nutscript/plugins/saveammo.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "탄약 저장 (Save Ammo)"
2 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
3 | PLUGIN.desc = "플레이어의 탄약을 저장합니다."
4 | PLUGIN.base = true;
5 |
6 | local AMMO_TYPES = {
7 | "ar2",
8 | "alyxgun",
9 | "pistol",
10 | "smg1",
11 | "357",
12 | "xbowbolt",
13 | "buckshot",
14 | "rpg_round",
15 | "smg1_grenade",
16 | "sniperround",
17 | "sniperpenetratedround",
18 | "grenade",
19 | "thumper",
20 | "gravity",
21 | "battery",
22 | "gaussenergy",
23 | "combinecannon",
24 | "airboatgun",
25 | "striderminigun",
26 | "helicoptergun",
27 | "ar2altfire",
28 | "slam"
29 | }
30 |
31 | function PLUGIN:CharacterSave(client)
32 | local ammo = {}
33 | local weapon = client:GetActiveWeapon()
34 | for k, v in pairs(AMMO_TYPES) do
35 | local count = client:GetAmmoCount(v)
36 |
37 | if (count > 0) then
38 | ammo[v] = count
39 | end
40 | end
41 | client.character:SetData("ammo", ammo)
42 |
43 | if(!IsValid(weapon) and IsValid(weapon.Clip1)) then
44 | client.character:SetData("clip1", weapon:Clip1());
45 | else
46 | client.character:SetData("clip1", 0);
47 | end;
48 | end
49 |
50 | function PLUGIN:PlayerFirstLoaded(client)
51 | client:RemoveAllAmmo()
52 |
53 | local ammo = client.character:GetData("ammo")
54 | local weapon = client:GetActiveWeapon()
55 |
56 | if (IsValid(weapon)) then
57 | weapon:SetClip1(client.character:GetData("clip1"))
58 | end
59 |
60 | if (ammo) then
61 | for ammoType, amount in pairs(ammo) do
62 | client:SetAmmo(tonumber(amount) or 0, ammoType)
63 | end
64 |
65 | client.character:SetData("ammo", {})
66 | end
67 | end
--------------------------------------------------------------------------------
/nutscript/plugins/recognition/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | local recognizeCommand = {
3 | syntax = PLUGIN:GetPluginLanguage("rg_syntax"),
4 | prefix = "/인식",
5 | onRun = function(client, arguments)
6 | local mode = arguments[1]
7 |
8 | if (mode) then
9 | mode = mode:lower()
10 | end
11 |
12 | if (mode and mode:find("aim")) then
13 | local data = {}
14 | data.start = client:GetShootPos()
15 | data.endpos = data.start + client:GetAimVector()*128
16 | data.filter = client
17 | local trace = util.TraceLine(data)
18 | local entity = trace.Entity
19 |
20 | if (IsValid(entity)) then
21 | PLUGIN:SetRecognized(client, entity)
22 |
23 | nut.util.Notify(PLUGIN:GetPluginLanguage("rg_recongitioned_aim"), client)
24 | else
25 | nut.util.Notify(PLUGIN:GetPluginLanguage("rg_not_player"), client)
26 | end
27 | else
28 | local range = nut.config.chatRange
29 | local text = PLUGIN:GetPluginLanguage("rg_normal")
30 |
31 | if (mode and mode:find("whisper")) then
32 | range = nut.config.whisperRange
33 | text = PLUGIN:GetPluginLanguage("rg_whisper")
34 | elseif (mode and mode:find("yell")) then
35 | range = nut.config.yellRange
36 | text = PLUGIN:GetPluginLanguage("rg_yell")
37 | end
38 |
39 | for k, v in pairs(player.GetAll()) do
40 | if (v:GetPos():Distance(client:GetPos()) <= range) then
41 | PLUGIN:SetRecognized(client, v)
42 | end
43 | end
44 |
45 | nut.util.Notify(PLUGIN:GetPluginLanguage("rg_recongitioned", text), client)
46 | end
47 | end
48 | }
49 |
50 | nut.command.Register(recognizeCommand, "recognition")
51 |
--------------------------------------------------------------------------------
/nutscript/plugins/spawnpoints/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | PLUGIN.name = "스폰 포인트 (Spawn Points)"
3 | PLUGIN.author = "Chessnut / 번역자 : Tensa"
4 | PLUGIN.desc = "스폰 포인트의 설정을 가능하게 합니다."
5 | PLUGIN.points = PLUGIN.points or {}
6 | PLUGIN.base = true;
7 | PLUGIN:IncludeDir("language");
8 |
9 | function PLUGIN:LoadData()
10 | self.points = self:ReadTable()
11 | end
12 |
13 | function PLUGIN:SaveData()
14 | self:WriteTable(self.points)
15 | end
16 |
17 | function PLUGIN:ChooseSpawn(client, spawns)
18 | if (#spawns > 0) then
19 | local data = table.Random(spawns)
20 |
21 | client:SetPos(data.pos)
22 | client:SetEyeAngles(data.ang)
23 | end
24 | end
25 |
26 | function PLUGIN:PlayerSpawn(client)
27 | timer.Simple(0.1, function()
28 | if (!IsValid(client)) then
29 | return
30 | end
31 |
32 | local faction = client:Team()
33 | local class = client:CharClass()
34 | local spawns = {}
35 |
36 | if (class) then
37 | for k, v in pairs(self.points) do
38 | if (v.faction == faction and v.class == class) then
39 | spawns[#spawns + 1] = v
40 | end
41 | end
42 |
43 | if (#spawns > 0) then
44 | return self:ChooseSpawn(client, spawns)
45 | end
46 | end
47 |
48 | for k, v in pairs(self.points) do
49 | if (v.faction == faction) then
50 | spawns[#spawns + 1] = v
51 | end
52 | end
53 |
54 | if (#spawns < 1) then
55 | for k, v in pairs(self.points) do
56 | if (!v.faction) then
57 | spawns[#spawns + 1] = v
58 | end
59 | end
60 | end
61 |
62 | self:ChooseSpawn(client, spawns)
63 | end)
64 | end
65 |
66 | nut.util.Include("sh_commands.lua");
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_attribute.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | function PANEL:Init()
3 | self:AddTitle(nut.lang.Get("attribute"));
4 | self:SetPos(AdvNut.util.GetCurrentMenuPos())
5 | self:SetSize(AdvNut.util.GetCurrentMenuSize());
6 | self:MakePopup()
7 |
8 | local noticePanel = self:Add( "nut_NoticePanel" )
9 | noticePanel:Dock( TOP )
10 | noticePanel:DockMargin( 4, 5, 5, 5 )
11 | noticePanel:SetType( 4 )
12 | noticePanel:SetText( nut.lang.Get("attribute_tip") )
13 |
14 | local noticePanel = self:Add( "nut_NoticePanel" )
15 | noticePanel:Dock( TOP )
16 | noticePanel:DockMargin( 5, 0, 5, 4 )
17 | noticePanel:SetType( 4 )
18 | noticePanel:SetText( nut.lang.Get("attribute_tip2") )
19 |
20 | self.list = self:Add("AdvNut_ScrollPanel")
21 | self.list:Dock(FILL)
22 | self.list:SetDrawBackground(false);
23 |
24 | self.bars = {}
25 |
26 | for k, attribute in ipairs(nut.attribs.GetAll()) do
27 | local level = LocalPlayer():GetAttrib(k, 0)
28 | local bar = self.list:Add("nut_AttribBarVisOnly")
29 | bar:Dock(TOP)
30 | bar:SetTall(25);
31 | bar:DockMargin( 8, 10, 8, 0 )
32 | bar:SetMax(nut.config.startingPoints)
33 | bar:SetText(attribute.name)
34 | bar:SetToolTip(attribute.desc)
35 | bar:SetValue( level )
36 | bar:SetMax( nut.config.maximumPoints )
37 | self.bars[k] = bar
38 | end
39 |
40 | end
41 |
42 | function PANEL:Think()
43 | end
44 |
45 | function PANEL:Reload()
46 | local parent = self:GetParent()
47 | self:Remove()
48 | nut.gui.att = vgui.Create("nut_Attribute", parent)
49 | nut.gui.menu:SetCurrentMenu(nut.gui.att, true)
50 | end
51 | vgui.Register("nut_Attribute", PANEL, "AdvNut_BaseForm")
--------------------------------------------------------------------------------
/nutscript/plugins/customautocomplete.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | PLUGIN.name = "자동 완성 (AdvNS Custom Auto-complete)"
3 | PLUGIN.author = "Tensa / Atebite and Chessnut"
4 | PLUGIN.desc = "기존 플러그인을 커스텀한 자동 환성 기능을 추가합니다."
5 | PLUGIN.base = true;
6 |
7 | if (CLIENT) then
8 | local chatText = ""
9 | local textColor = Color(231, 231, 231)
10 | local outline = Color(0, 0, 0, 150)
11 |
12 | function PLUGIN:HUDPaintTopLayer()
13 | local frame = nut.chat.panel.frame
14 | local contentFrame = nut.chat.panel.content;
15 |
16 | if (IsValid(frame)) then
17 | if (chatText:sub(1, 1) == "/" and chatText:sub(1, 2) != "//") then
18 | local spacer = 0
19 | local counter = 0
20 | local x, y = frame:GetPos()
21 | local tall = frame:GetTall()
22 | local mainColor = nut.config.mainColor
23 | local color = Color(mainColor.r, mainColor.g, mainColor.b)
24 |
25 | for k, v in SortedPairs(nut.command.buffer) do
26 | local k2 = "/"..k
27 |
28 | for index, message in pairs(nut.chat.messages) do
29 | message:SetAlpha(50);
30 | end;
31 |
32 | if (k2:find(chatText:sub(1, #k2):lower()) and counter < 4) then
33 | local x2, y2 = x + 9, (y + tall - 20) + spacer
34 | local w = draw.SimpleTextOutlined(k2.." ", "nut_BoldChatFont", x2, y2, color, 0, 0, 1, outline)
35 | draw.SimpleTextOutlined(v.syntax or "[none]", "nut_BoldChatFont", x2 + w, y2, textColor, 0, 0, 1, outline)
36 |
37 | spacer = spacer - 17
38 | counter = counter + 1
39 | end
40 | end
41 | end;
42 | end
43 | end
44 |
45 | function PLUGIN:ChatTextChanged(text)
46 | chatText = text
47 | end
48 |
49 | function PLUGIN:FinishChat()
50 | chatText = ""
51 | end
52 | end
53 |
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_help.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | function PANEL:Init()
3 | self:AddTitle(nut.lang.Get("help"));
4 | self:SetPos(AdvNut.util.GetCurrentMenuPos())
5 | self:SetSize(AdvNut.util.GetCurrentMenuSize());
6 | self:MakePopup()
7 |
8 | local data = {}
9 | local help = {}
10 |
11 | self.tree = self:Add("DTree")
12 | self.tree:Dock(LEFT)
13 | self.tree:DockMargin(5, 5, 5, 5)
14 | self.tree:SetWide(ScrW() * 0.115)
15 |
16 | self.body = self:Add("DHTML")
17 | self.body:Dock(FILL)
18 | self.body:DockMargin(4, 1, 4, 4)
19 |
20 | function data:AddHelp(key, callback, icon)
21 | help[key] = {callback, icon or "icon16/folder.png"}
22 | end
23 |
24 | function data:AddCallback(key, callback)
25 | help[key].callback = callback
26 | end
27 |
28 | AdvNut.hook.Run("BuildHelpOptions", data, self.tree)
29 |
30 | local prefix = [[
31 |
32 |
39 |
40 | ]]
41 |
42 | function self.body:SetContents(html)
43 | self:SetHTML(prefix..html)
44 | end
45 |
46 | for k, v in SortedPairs(help) do
47 | local node = self.tree:AddNode(k)
48 | node.Icon:SetImage(v[2])
49 | node.DoClick = function()
50 | local content = v[1](node)
51 |
52 | if (content) then
53 | if (content:sub(1, 4) == "http") then
54 | self.body:OpenURL(content)
55 | else
56 | self.body:SetContents(content)
57 | end
58 | end
59 | end
60 |
61 | if (v.callback) then
62 | v.callback(node, self.body)
63 | end
64 | end
65 | end
66 |
67 | function PANEL:Think()
68 | end
69 | vgui.Register("nut_Help", PANEL, "AdvNut_BaseForm")
--------------------------------------------------------------------------------
/nutscript/plugins/area/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | nut.command.Register({
4 | adminOnly = true,
5 | syntax = nut.lang.Get("syntax_name")..nut.lang.Get("syntax_area_showtime"),
6 | onRun = function(client, arguments)
7 | local name = arguments[1] or PLUGIN:GetPluginLanguage("area_area")
8 | local showTime = util.tobool(arguments[2] or "true")
9 |
10 | if (!client:GetNutVar("areaMin")) then
11 | if (!name) then
12 | nut.util.Notify(nut.lang.Get("missing_arg", 1), client)
13 |
14 | return
15 | end
16 |
17 | client:SetNutVar("areaMin", client:GetPos())
18 | client:SetNutVar("areaName", name)
19 | client:SetNutVar("areaShowTime", showTime)
20 |
21 | nut.util.Notify(PLUGIN:GetPluginLanguage("area_pointstart"), client)
22 | else
23 | local data = {}
24 | data.min = client:GetNutVar("areaMin")
25 | data.max = client:GetPos()
26 | data.name = client:GetNutVar("areaName")
27 | data.showTime = client:GetNutVar("areaShowTime")
28 |
29 | client:SetNutVar("areaMin", nil)
30 | client:SetNutVar("areaName", nil)
31 | client:SetNutVar("areaShowTime", nil)
32 |
33 | table.insert(PLUGIN.areas, data)
34 |
35 | nut.util.WriteTable("areas", PLUGIN.areas)
36 | nut.util.Notify(PLUGIN:GetPluginLanguage("area_add"), client)
37 | end
38 | end
39 | }, "areaadd")
40 |
41 | nut.command.Register({
42 | adminOnly = true,
43 | onRun = function(client, arguments)
44 | local count = 0
45 |
46 | for k, v in pairs(PLUGIN.areas) do
47 | if (table.HasValue(ents.FindInBox(v.min, v.max), client)) then
48 | table.remove(PLUGIN.areas, k)
49 |
50 | count = count + 1
51 | end
52 | end
53 |
54 | nut.util.WriteTable("areas", PLUGIN.areas)
55 | nut.util.Notify(PLUGIN:GetPluginLanguage("area_remove", count), client)
56 | end
57 | }, "arearemove")
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_menubutton.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | local HOVER_ALPHA = 150
3 | local TEXT_COLOR = Color(240, 240, 240)
4 | function PANEL:Init()
5 | surface.SetFont("nut_MenuButtonFont")
6 | local _, height = surface.GetTextSize("W")
7 |
8 | self.Paint = function(panel, w, h)
9 | surface.SetDrawColor(255, 255, 255, 0)
10 | surface.DrawRect(0, 0, w, h)
11 | end
12 |
13 | self:SetTall(height + 15)
14 | self:DockMargin(0, 0, 0, 5)
15 | self:Dock(TOP)
16 | self:SetDrawBackground(false)
17 | self:SetFont("nut_MenuButtonFont")
18 | self:SetTextColor(TEXT_COLOR)
19 | self:SetExpensiveShadow(1, color_black)
20 | self.alphaApproach = 15
21 | self.alpha = self.alphaApproach
22 | self:SetMouseInputEnabled(true)
23 | end
24 |
25 | function PANEL:OnCursorEntered()
26 | surface.PlaySound("ui/buttonrollover.wav")
27 | self:SetTextColor(Color(200, 200, 200, 255));
28 | end
29 |
30 | function PANEL:OnCursorExited()
31 | self:SetTextColor(TEXT_COLOR)
32 | self.alpha = 15
33 | end
34 |
35 | function PANEL:DoClick()
36 | if (self.OnClick) then
37 | local result = self:OnClick()
38 |
39 | if (result == false) then
40 | surface.PlaySound("buttons/button8.wav")
41 | else
42 | surface.PlaySound("ui/buttonclick.wav")
43 | self.alphaApproach = HOVER_ALPHA + 150
44 | end
45 | end
46 | end
47 |
48 | local sin = math.sin
49 |
50 | function PANEL:Paint(w, h)
51 | self.alphaApproach = math.Approach(self.alphaApproach, self.alpha, FrameTime() * 150)
52 |
53 | local blink = 0
54 |
55 | if (self.alphaApproach == HOVER_ALPHA) then
56 | blink = sin(RealTime() * 5) * 10
57 | end
58 |
59 | local color = nut.config.mainColor
60 |
61 | surface.SetDrawColor(135, 135, 135, self.alphaApproach + blink)
62 | surface.DrawRect(0, 0, w, h)
63 | end
64 | vgui.Register("nut_MenuButton", PANEL, "DLabel")
65 |
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_menuside.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | local width = ScrW()*2
3 |
4 | function PANEL:Init()
5 | self:ParentToHUD()
6 | self:SetPos(ScrW(), 0)
7 | self:SetSize(width, ScrH())
8 | self:SetDrawBackground(false)
9 | self:MoveTo(ScrW() - width, 0, 0.25, 0, 0.125)
10 |
11 | AdvNut.hook.Run("CreateSideMenu", self)
12 | end
13 |
14 | function PANEL:SlideOut()
15 | self:MoveTo(ScrW(), 0, 0.25, 0, 0.15)
16 |
17 | timer.Simple(0.25, function()
18 | if (!IsValid(self)) then
19 | return
20 | end
21 |
22 | self:Remove()
23 | end)
24 | end
25 |
26 | local gradient = surface.GetTextureID("vgui/gradient-r")
27 |
28 | function PANEL:Paint(w, h)
29 | surface.SetDrawColor(10, 10, 10, 200)
30 | surface.SetTexture(gradient)
31 | surface.DrawTexturedRect(0, 0, w, h)
32 | end
33 | vgui.Register("nut_MenuSide", PANEL, "DPanel")
34 |
35 | --[[
36 | -- Command to search within the materials folder.
37 | -- May freeze your Garry's Mod for a little.
38 |
39 | concommand.Add("mat_search", function(p, c, a)
40 | local found = {}
41 | local match = a[1]
42 |
43 | print("Searching for materials with '"..match.."'")
44 | timer.Simple(FrameTime() * 5, function()
45 | local function search(dir)
46 | local files, folders = file.Find(dir.."/*", "GAME")
47 |
48 | if (folders) then
49 | for k, v in pairs(folders) do
50 | search(dir.."/"..v)
51 | end
52 | end
53 |
54 | if (files) then
55 | for k, v in pairs(files) do
56 | if (string.find(v, a[1])) then
57 | found[#found + 1] = dir.."/"..v
58 | end
59 | end
60 | end
61 | end
62 |
63 | search("materials")
64 |
65 | local header = "----- "..#found.." RESULTS -----"
66 | print(header)
67 | for k, v in ipairs(found) do
68 | print(v)
69 | end
70 | print(string.rep("-", #header))
71 | end)
72 | end)
73 | --]]
--------------------------------------------------------------------------------
/nutscript/entities/entities/nut_money.lua:
--------------------------------------------------------------------------------
1 | AddCSLuaFile()
2 |
3 | ENT.Type = "anim"
4 | ENT.PrintName = "Money"
5 | ENT.Author = "Chessnut"
6 | ENT.Category = "Nutscript"
7 | ENT.PersistentSave = false;
8 |
9 | if (SERVER) then
10 | function ENT:Initialize()
11 | self:SetModel(nut.config.moneyModel)
12 | self:PhysicsInit(SOLID_VPHYSICS)
13 | self:SetSolid(SOLID_VPHYSICS)
14 | self:SetMoveType(MOVETYPE_VPHYSICS)
15 | self:SetUseType(SIMPLE_USE)
16 | self:SetNetVar("amount", 0)
17 |
18 | local physObj = self:GetPhysicsObject()
19 |
20 | if (IsValid(physObj)) then
21 | physObj:Wake()
22 | end
23 |
24 | AdvNut.hook.Run("MoneyEntityCreated", self)
25 | end
26 |
27 | function ENT:SetMoney(amount)
28 | if (amount <= 0) then
29 | self:Remove()
30 | end
31 |
32 | self:SetNetVar("amount", amount)
33 | end
34 |
35 | function ENT:Use(activator)
36 | local amount = self:GetNetVar("amount", 0)
37 |
38 | if (amount > 0 and IsValid(activator) and activator.character and AdvNut.hook.Run("PlayerCanPickupMoney", activator, self) != false) then
39 | if (self.owner == activator and self.charindex != activator.character.index) then
40 | nut.util.Notify("You can't pick up your other character's money.", activator)
41 |
42 | return
43 | end
44 |
45 | activator:GiveMoney(amount)
46 | nut.util.Notify("You have picked up "..nut.currency.GetName(amount)..".", activator)
47 |
48 | self:Remove()
49 | end
50 | end
51 |
52 | function ENT:StartTouch(entity)
53 | if (entity:GetClass() == "nut_money") then
54 | self:SetMoney(self:GetNetVar("amount", 0) + entity:GetNetVar("amount", 0))
55 | entity:Remove()
56 | end
57 | end
58 | else
59 | function ENT:DrawTargetID(x, y, alpha)
60 | nut.util.DrawText(x, y, nut.currency.GetName(self:GetNetVar("amount", 0), true), Color(255, 255, 255, alpha))
61 | end
62 | end
--------------------------------------------------------------------------------
/nutscript/gamemode/items/base/sh_ammo.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | List of ammo types:
3 | AR2 - Ammunition of the AR2/Pulse Rifle
4 | AlyxGun - (name in-game "5.7mm Ammo")
5 | Pistol - Ammunition of the 9MM Pistol
6 | SMG1 - Ammunition of the SMG/MP7
7 | 357 - Ammunition of the .357 Magnum
8 | XBowBolt - Ammunition of the Crossbow
9 | Buckshot - Ammunition of the Shotgun
10 | RPG_Round - Ammunition of the RPG/Rocket Launcher
11 | SMG1_Grenade - Ammunition for the SMG/MP7 grenade launcher (secondary fire)
12 | SniperRound
13 | SniperPenetratedRound - (name in-game ".45 Ammo")
14 | Grenade - Note you must be given the grenade weapon (weapon_frag) before you can throw grenades.
15 | Thumper - Ammunition cannot exceed 2 (name in-game "Explosive C4 Ammo")
16 | Gravity - (name in-game "4.6MM Ammo")
17 | Battery - (name in-game "9MM Ammo")
18 | GaussEnergy
19 | CombineCannon - (name in-game ".50 Ammo")
20 | AirboatGun - (name in-game "5.56MM Ammo")
21 | StriderMinigun - (name in-game "7.62MM Ammo")
22 | HelicopterGun
23 | AR2AltFire - Ammunition of the AR2/Pulse Rifle 'combine ball' (secondary fire)
24 | slam - Like Grenade, but for the Selectable Lightweight Attack Munition (S.L.A.M)
25 | --]]
26 |
27 | BASE.name = "Base Ammo"
28 | BASE.uniqueID = "base_ammo"
29 | BASE.category = nut.lang.Get("ammo")
30 | BASE.type = "ar2"
31 | BASE.amount = 30
32 | BASE.functions = {}
33 | BASE.functions.Use = {
34 | text = nut.lang.Get("reload"),
35 | run = function(itemTable, client, data)
36 | if (SERVER) then
37 | client:GiveAmmo(itemTable.amount, itemTable.type, true)
38 | client:EmitSound("items/ammo_pickup.wav")
39 | end
40 | end
41 | }
42 |
43 | --[[
44 | Example:
45 |
46 | ITEM.name = "9mm Bullets"
47 | ITEM.uniqueID = "ammo_9mm"
48 | ITEM.type = "pistol"
49 | ITEM.amount = 20
50 | ITEM.model = Model("models/items/boxsRounds.mdl")
51 | --]]
52 |
--------------------------------------------------------------------------------
/nutscript/plugins/improveddoors/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("doors_can_buy", "구매 가능한 문", language);
5 | PLUGIN:AddPluginLanguage("doors_cant_buy", "구매 불가능한 문", language);
6 | PLUGIN:AddPluginLanguage("doors_show", "보임", language);
7 | PLUGIN:AddPluginLanguage("doors_hidden", "숨김", language);
8 |
9 | PLUGIN:AddPluginLanguage("doors_buy_unownable", "이 문은 구매가 불가능합니다.", language);
10 |
11 | PLUGIN:AddPluginLanguage("doors_sell_door", "당신은 %s 에 문을 판매하였습니다.", language);
12 | PLUGIN:AddPluginLanguage("doors_buy_door", "당신은 %s 에 문을 구매하였습니다.", language);
13 | PLUGIN:AddPluginLanguage("doors_buy_desc", "F2 키를 눌러 문을 구매합니다.", language);
14 | PLUGIN:AddPluginLanguage("doors_open_door", "성공적으로 문을 열었습니다.", language);
15 | PLUGIN:AddPluginLanguage("doors_close_door", "성공적으로 문을 잠궜습니다.", language);
16 |
17 | PLUGIN:AddPluginLanguage("doors_change_title", "성공적으로 문의 이름을 변경하였습니다.", language);
18 | PLUGIN:AddPluginLanguage("doors_change_unownable", "성공적으로 문의 설정을 구매 불가 상태로 변경하였습니다.", language);
19 | PLUGIN:AddPluginLanguage("doors_change_ownable", "성공적으로 문의 설정을 구매 가능 상태로 변경하였습니다.", language);
20 | PLUGIN:AddPluginLanguage("doors_change_hidden", "성공적으로 문의 상태를 %s 상태로 설정하였습니다.", language);
21 |
22 | PLUGIN:AddPluginLanguage("doors_selled_door", "이미 구매된 문입니다.", language);
23 | PLUGIN:AddPluginLanguage("doors_buyed_door", "구매된 문", language);
24 |
25 | PLUGIN:AddPluginLanguage("doors_owner", "%s 의 소유", language);
26 | PLUGIN:AddPluginLanguage("doors_not_owner", "이 문은 당신의 소유가 아닙니다.", language);
27 | PLUGIN:AddPluginLanguage("doors_not_door", "조준점이 문을 바라보고 있지 않습니다.", language);
28 | PLUGIN:AddPluginLanguage("already_buyed", "다른 플레이어가 소유중인 문 입니다.", language);
29 | PLUGIN:AddPluginLanguage("already_ownable", "이미 구매 가능한 문입니다.", language);
30 | PLUGIN:AddPluginLanguage("successful_selling", "성공적으로 문을 판매하였습니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/customvendor/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or {};
2 |
3 | function PLUGIN:LoadData()
4 | for k, v in pairs(nut.util.ReadTable("vendors")) do
5 | local position = v.pos
6 | local angles = v.angles
7 | local data = v.data
8 | local factionData = v.factionData
9 | local classData = v.classData
10 |
11 |
12 | local vendorAction = v.vendorAction
13 | local buyadjustment = v.buyadjustment
14 | local money = v.money
15 |
16 | local name = v.name
17 | local desc = v.desc
18 | local model = v.model
19 |
20 | local entity = ents.Create("nut_vendor")
21 | entity:SetPos(position)
22 | entity:SetAngles(angles)
23 | entity:Spawn()
24 | entity:Activate()
25 | entity:SetNetVar("data", data)
26 | entity:SetNetVar("factiondata", factionData)
27 | entity:SetNetVar("classdata", classData)
28 | entity:SetNetVar("name", name)
29 | entity:SetNetVar("desc", desc)
30 |
31 | entity:SetNetVar("vendoraction", vendorAction)
32 | entity:SetNetVar("buyadjustment", buyadjustment)
33 | entity:SetNetVar("money", money)
34 |
35 | entity:SetModel(model)
36 | entity:SetAnim()
37 | end
38 | end
39 |
40 |
41 |
42 | function PLUGIN:SaveData()
43 | local data = {}
44 |
45 | for k, v in pairs(ents.FindByClass("nut_vendor")) do
46 | data[#data + 1] = {
47 | pos = v:GetPos(),
48 | angles = v:GetAngles(),
49 | data = v:GetNetVar("data", {}),
50 | factionData = v:GetNetVar("factiondata", {}),
51 | classData = v:GetNetVar("classdata", {}),
52 |
53 | vendorAction = v:GetNetVar("vendoraction", { sell = true, buy = false} ),
54 | buyadjustment = v:GetNetVar("buyadjustment", .5),
55 | money = v:GetNetVar("money", 100),
56 |
57 | name = v:GetNetVar("name", "설정되지 않음"),
58 | desc = v:GetNetVar("desc", nut.lang.Get("no_desc")),
59 | model = v:GetModel()
60 | }
61 | end
62 | nut.util.WriteTable("vendors", data)
63 | end
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcrafting/entities/entities/nut_craftingtable.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN;
2 |
3 | // 주석이 쳐진 곳 이외에는 본 예시의 코드를 그대로 사용하세요, 파일 이름이 같아선 안됩니다. //
4 | // 작업대를 추가 한 뒤, sh_plugin.lua 파일에 있는 craftingTables 테이블에 이 파일의 이름을 추가하세요. //
5 |
6 | // 작업대 이름 //
7 | ENT.PrintName = PLUGIN:GetPluginLanguage("craftingtable");
8 |
9 | // 작업대 설명 //
10 | ENT.Desc = PLUGIN:GetPluginLanguage("craftingtable_desc");
11 |
12 | // 제작자 이름, 필수적이진 않음. //
13 | ENT.Author = "Black Tea"
14 |
15 | ENT.Type = "anim"
16 | ENT.Spawnable = true
17 | ENT.AdminOnly = true
18 | ENT.Category = "Nutscript"
19 | ENT.RenderGroup = RENDERGROUP_BOTH
20 |
21 | if (SERVER) then
22 | function ENT:Initialize()
23 | // 작업대의 모델입니다.//
24 | self:SetModel("models/props_c17/FurnitureTable002a.mdl");
25 |
26 | self:PhysicsInit(SOLID_VPHYSICS)
27 | self:SetMoveType(MOVETYPE_VPHYSICS)
28 | self:SetUseType(SIMPLE_USE)
29 | local physicsObject = self:GetPhysicsObject()
30 | if ( IsValid(physicsObject) ) then
31 | physicsObject:Wake()
32 | end
33 | end
34 |
35 | function ENT:Use(activator)
36 | netstream.Start(activator, "nut_CraftWindow", {activator, self});
37 | end
38 | else
39 | netstream.Hook("nut_CraftWindow", function(data)
40 | if (IsValid(nut.gui.crafting)) then
41 | nut.gui.crafting:Remove()
42 | else
43 | surface.PlaySound("items/ammocrate_close.wav");
44 | nut.gui.crafting = vgui.Create("nut_Crafting");
45 | nut.gui.crafting:SetEntity(data[2], PLUGIN:GetPluginLanguage("craftingtable"), true);
46 | nut.gui.crafting:Center()
47 | end;
48 | end)
49 |
50 | function ENT:Initialize()
51 | end
52 |
53 | function ENT:Draw()
54 | self:DrawModel()
55 | end
56 |
57 | function ENT:DrawTargetID(x, y, alpha)
58 | local color = nut.config.mainColor;
59 | color.a = alpha;
60 |
61 | nut.util.DrawText(x, y - nut.config.Get("targetTall"), self.PrintName, color, "AdvNut_EntityTitle");
62 | nut.util.DrawText(x, y, self.Desc, Color(255, 255, 255, alpha), "AdvNut_EntityDesc");
63 | end;
64 |
65 | function ENT:OnRemove()
66 | end
67 | end
68 |
--------------------------------------------------------------------------------
/nutscript/plugins/extrasettings/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or {};
2 |
3 | PLUGIN:SetPluginConfig(PLUGIN:GetPluginConfig("isDrawVignette", true));
4 | PLUGIN:SetPluginConfig(PLUGIN:GetPluginConfig("isDrawBackgroundBlur", true));
5 | PLUGIN:SetPluginConfig(PLUGIN:GetPluginConfig("isUsingScrollBar", false));
6 |
7 | function PLUGIN:SchemaInitialized()
8 | local data = AdvNut.util.ReadTable(self.uniqueID);
9 | for key, data in pairs(data) do
10 | self:SetPluginConfig(key, data);
11 | end;
12 |
13 | self:InitSettingOptions();
14 | end
15 |
16 | function PLUGIN:ShutDown()
17 | local data = {
18 | isDrawVignette = PLUGIN:GetPluginConfig("isDrawVignette", false);
19 | isDrawBackgroundBlur = PLUGIN:GetPluginConfig("isDrawBackgroundBlur", false);
20 | isUsingScrollBar = PLUGIN:GetPluginConfig("isUsingScrollBar", false);
21 | }
22 |
23 | AdvNut.util.WriteTable(self.uniqueID, data);
24 | end
25 |
26 |
27 | function PLUGIN:InitSettingOptions()
28 | local categoryName = PLUGIN:GetPluginLanguage("plugin_es_category")
29 | nut.setting.Register({
30 | name = PLUGIN:GetPluginLanguage("plugin_es_drawVignette"),
31 | var = "isDrawVignette",
32 | type = "checker",
33 | category = categoryName,
34 | prefixID = self.uniqueID
35 | });
36 |
37 | nut.setting.Register({
38 | name = PLUGIN:GetPluginLanguage("plugin_es_drawBackgroundBlur"),
39 | var = "isDrawBackgroundBlur",
40 | type = "checker",
41 | category = categoryName,
42 | prefixID = self.uniqueID
43 | });
44 |
45 | nut.setting.Register({
46 | name = PLUGIN:GetPluginLanguage("plugin_es_usingScrollbar"),
47 | var = "isUsingScrollBar",
48 | type = "checker",
49 | category = categoryName,
50 | prefixID = self.uniqueID
51 | });
52 | end
53 |
54 | function PLUGIN:IsCanDrawingVignette()
55 | return PLUGIN:GetPluginConfig("isDrawVignette", false);
56 | end;
57 |
58 | function PLUGIN:IsCanDrawingBackgroundBlur()
59 | return PLUGIN:GetPluginConfig("isDrawBackgroundBlur", false);
60 | end;
61 |
62 | function GM:IsUsingScrollBar()
63 | return PLUGIN:GetPluginConfig("isUsingScrollBar", false);
64 | end;
65 |
--------------------------------------------------------------------------------
/nutscript/plugins/improveddoors/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "개선된 도어 시스템 (Improved Door System)"
2 | PLUGIN.author = "Tensa / Chessnut"
3 | PLUGIN.desc = "기존 도어 플러그인을 개선한 도어 플러그인입니다."
4 | PLUGIN.base = true;
5 |
6 | nut.config.doorCost = 50
7 | nut.config.doorSellAmount = 25
8 |
9 | function PLUGIN:IsDoor(entity)
10 | local class = string.lower(entity:GetClass() or "");
11 |
12 | if (class and (class == "func_door" or class == "func_door_rotating" or class == "prop_door_rotating")) then
13 | return true;
14 | else
15 | return false;
16 | end;
17 | end
18 | AdvNut.util.IsDoor = PLUGIN.IsDoor;
19 |
20 | local entityMeta = FindMetaTable("Entity")
21 |
22 | function entityMeta:IsDoor()
23 | local class = string.lower(self:GetClass() or "");
24 |
25 | if (class and (class == "func_door" or class == "func_door_rotating" or class == "prop_door_rotating")) then
26 | return true;
27 | else
28 | return false;
29 | end;
30 | end;
31 |
32 | function entityMeta:GetDoorPartner()
33 | if (!self:IsDoor()) then
34 | error("Attempt to get partner of a non-door entity.")
35 | end
36 |
37 | local partners = {}
38 |
39 | for k, v in pairs(ents.FindInSphere(self:GetPos(), 128)) do
40 | if (v != self and v:IsDoor()) then
41 | partners[#partners + 1] = v
42 | end
43 | end
44 |
45 | return partners
46 | end
47 |
48 | function PLUGIN:IsDoorOwned(entity)
49 | if (entity:GetNetVar("owner") != nil) then
50 | return true
51 | else
52 | return false;
53 | end;
54 | end
55 |
56 | function PLUGIN:GetDoorOwner(entity)
57 | return entity:GetNetVar("owner")
58 | end
59 |
60 | function PLUGIN:EqualDoorOwner(client, entity)
61 | if (client:SteamID() == entity:GetNetVar("owner")) then
62 | return true;
63 | else
64 | return false;
65 | end;
66 | end;
67 |
68 | function PLUGIN:SetDoorOwner(entity, client)
69 | if (client) then
70 | entity:SetNetVar("owner", client:SteamID());
71 | else
72 | entity:SetNetVar("owner", nil);
73 | end;
74 | end;
75 |
76 | PLUGIN:IncludeDir("language");
77 |
78 | nut.util.Include("sh_commands.lua");
79 | nut.util.Include("cl_plugin.lua");
80 | nut.util.Include("sv_plugin.lua");
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("cook_it", "%s cooks the %s", language);
5 |
6 | PLUGIN:AddPluginLanguage("cook_notice_cooked", "성공적으로 %s 를 조리하였습니다.", language);
7 | PLUGIN:AddPluginLanguage("cook_notice_turnonstove", "%s 를 조리하기 위해서는 조리대를 켜야 합니다.", language);
8 | PLUGIN:AddPluginLanguage("cook_notice_notcookable", "조리 실패: %s 는 조리가 가능한 식품이 아닙니다.", language);
9 | PLUGIN:AddPluginLanguage("cook_notice_alreadycooked", "%s 는 이미 조리되어 있습니다.", language);
10 | PLUGIN:AddPluginLanguage("cook_notice_havetofacestove", "%s 를 조리하기 위해서는 조리대를 바라봐야 합니다.", language);
11 |
12 | PLUGIN:AddPluginLanguage("cook_stove_name", "조리대", language);
13 | PLUGIN:AddPluginLanguage("cook_burcket_name", "양동이", language);
14 | PLUGIN:AddPluginLanguage("cook_barrel_name", "드럼통", language);
15 |
16 | PLUGIN:AddPluginLanguage("cook_stove_desc", "음식을 조리할때 쓰입니다.", language);
17 | PLUGIN:AddPluginLanguage("cook_burcket_desc", "음식을 조리할때 쓰입니다.", language);
18 | PLUGIN:AddPluginLanguage("cook_barrel_desc", "음식을 조리할때 쓰입니다.", language);
19 |
20 | PLUGIN:AddPluginLanguage("cook_food_usenum", "%s\n이 음식은 %s 번 더 먹을 수 있습니다.", language);
21 | PLUGIN:AddPluginLanguage("cook_food_status", "%s\n상태: %s ", language);
22 |
23 | PLUGIN:AddPluginLanguage("cook_food_uncook", "조리되지 않음.", language);
24 | PLUGIN:AddPluginLanguage("cook_food_worst", "형체를 알아볼 수 없음.", language);
25 | PLUGIN:AddPluginLanguage("cook_food_reallybad", "형체만 남아 있음.", language);
26 | PLUGIN:AddPluginLanguage("cook_food_bad", "겉이 다 탐.", language);
27 | PLUGIN:AddPluginLanguage("cook_food_notgood", "좋지 않음.", language);
28 | PLUGIN:AddPluginLanguage("cook_food_normal", "일반적임.", language);
29 | PLUGIN:AddPluginLanguage("cook_food_good", "좋음.", language);
30 | PLUGIN:AddPluginLanguage("cook_food_sogood", "맛있음.", language);
31 | PLUGIN:AddPluginLanguage("cook_food_reallygood", "믿기지 않는 맛.", language);
32 | PLUGIN:AddPluginLanguage("cook_food_best", "신이 좋아할 맛.", language);
33 |
34 | PLUGIN:AddPluginLanguage("cook", "요리", language);
35 | PLUGIN:AddPluginLanguage("cooking_desc", "요리한 음식의 결과물을 결정합니다.", language);
36 | PLUGIN:AddPluginLanguage("cooking", "요리하기", language);
--------------------------------------------------------------------------------
/nutscript/plugins/improvedobserver.lua:
--------------------------------------------------------------------------------
1 | PLUGIN.name = "개선된 옵저버 (Improved Observer)"
2 | PLUGIN.author = "Tensa / Chessnut"
3 | PLUGIN.desc = "기존 플러그인에 기능을 추가한 옵저버 플러그인입니다."
4 | PLUGIN.base = true;
5 |
6 | // Thanks, Frosty! //
7 | if (SERVER) then
8 | function PLUGIN:PlayerNoClip(client)
9 | if (client:IsAdmin()) then
10 | if (client:GetMoveType() == MOVETYPE_WALK) then
11 | client:SetNutVar("noclipPos", client:GetPos())
12 | client:SetNoDraw(true)
13 | client:DrawShadow(false)
14 | client:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
15 | client:SetNutVar("noclipping", true)
16 | client:SetNoTarget(true);
17 | client:GodEnable();
18 |
19 | nut.util.AddLog(Format("%s entered observer mode.", client:Name()), LOG_FILTER_CONCOMMAND)
20 | else
21 | client:SetNoDraw(false)
22 | client:DrawShadow(true)
23 | client:SetCollisionGroup(COLLISION_GROUP_PLAYER)
24 | client:SetNoTarget(false);
25 | client:GodDisable();
26 |
27 | if (client:GetInfoNum("nut_observetp", 0) > 0) then
28 | local position = client:GetNutVar("noclipPos")
29 |
30 | if (position) then
31 | timer.Simple(0, function()
32 | client:SetPos(position)
33 | end)
34 | end
35 | end
36 |
37 | client:SetNutVar("noclipPos", nil)
38 | client:SetNutVar("noclipping", nil)
39 | nut.util.AddLog(Format("%s quit observer mode.", client:Name()), LOG_FILTER_CONCOMMAND)
40 | end
41 | end
42 | end
43 | else
44 | CreateClientConVar("nut_observetp", "0", true, true)
45 | local showESP = CreateClientConVar("nut_observeesp", "1", true, true)
46 |
47 | function PLUGIN:HUDPaint()
48 | local client = LocalPlayer()
49 |
50 | if (client:IsAdmin() and !IsValid(client:GetObserverTarget()) and client.character and client:GetMoveType() == MOVETYPE_NOCLIP and showESP:GetInt() > 0) then
51 | for k, v in pairs(player.GetAll()) do
52 | if (v != client and v.character) then
53 | local position = v:LocalToWorld(v:OBBCenter()):ToScreen()
54 | local x, y = position.x, position.y
55 |
56 | nut.util.DrawText(x, y, v:Name(), team.GetColor(v:Team()), "AdvNut_EntityTitle");
57 | end
58 | end
59 | end
60 | end
61 | end
62 |
--------------------------------------------------------------------------------
/nutscript/plugins/spawnpoints/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | nut.command.Register({
4 | adminOnly = true,
5 | syntax = nut.lang.Get("syntax_faction")..nut.lang.Get("syntax_class"),
6 | onRun = function(client, arguments)
7 | local faction = arguments[1] or ""
8 | local class = arguments[2] or ""
9 | local factionIndex
10 | local factionTable
11 | local classID
12 | local classTable
13 |
14 | if (faction != "") then
15 | for k, v in pairs(nut.faction.GetAll()) do
16 | if (faction == v.factionID or nut.util.StringMatches(faction, v.name)) then
17 | factionIndex = k
18 | factionTable = v
19 |
20 | break
21 | end
22 | end
23 | end
24 |
25 | if (class != "" and factionIndex) then
26 | for k, v in pairs(nut.class.GetByFaction(factionIndex)) do
27 | if (nut.util.StringMatches(class, v.name)) then
28 | classID = k
29 | classTable = v
30 |
31 | break
32 | end
33 | end
34 | end
35 |
36 | local position = client:GetPos() + Vector(0, 0, 8)
37 | local angles = client:EyeAngles()
38 |
39 | PLUGIN.points[#PLUGIN.points + 1] = {pos = position, ang = angles, faction = factionIndex, class = classID}
40 |
41 | if (classTable) then
42 | nut.util.Notify(PLUGIN:GetPluginLanguage("sp_add_class", (factionTable and factionTable.name or PLUGIN:GetPluginLanguage("sp_default")), classTable.name), client)
43 | else
44 | nut.util.Notify(PLUGIN:GetPluginLanguage("sp_add_faction", (factionTable and factionTable.name or PLUGIN:GetPluginLanguage("sp_default"))), client)
45 | end
46 |
47 | PLUGIN:SaveData()
48 | end
49 | }, "spawnadd")
50 |
51 | nut.command.Register({
52 | adminOnly = true,
53 | syntax = nut.lang.Get("syntax_radius"),
54 | onRun = function(client, arguments)
55 | local radius = math.max(tonumber(arguments[1] or "") or 128, 8)
56 | local i = 0
57 | local position = client:GetPos()
58 |
59 | for k, v in pairs(PLUGIN.points) do
60 | if (v.pos:Distance(position) <= radius) then
61 | i = i + 1
62 | PLUGIN.points[k] = nil
63 | end
64 | end
65 |
66 | nut.util.Notify(PLUGIN:GetPluginLanguage("sp_remove", i), client)
67 | PLUGIN:SaveData()
68 | end
69 | }, "spawnremove")
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_noticebar.lua:
--------------------------------------------------------------------------------
1 | surface.CreateFont("nut_NotiFont", {
2 | font = "Arial",
3 | size = 15,
4 | weight = 450,
5 | antialias = true
6 | })
7 |
8 | local PANEL = {}
9 | PANEL.pnlTypes = {
10 | [1] = { -- NOT ALLOWED
11 | col = Color( 200, 60, 60 ),
12 | icon = "icon16/exclamation.png"
13 | },
14 | [2] = { -- COULD BE CANCELED
15 | col = Color( 255, 100, 100 ),
16 | icon = "icon16/cross.png"
17 | },
18 | [3] = { -- WILL BE CANCELED
19 | col = Color( 255, 100, 100 ),
20 | icon = "icon16/cancel.png"
21 | },
22 | [4] = { -- TUTORIAL/GUIDE
23 | col = Color( 161, 180, 184 ),
24 | icon = "icon16/book.png"
25 | },
26 | [5] = { -- ERROR
27 | col = Color( 220, 200, 110 ),
28 | icon = "icon16/error.png"
29 | },
30 | [6] = { -- YES
31 | col = Color( 140, 255, 165 ),
32 | icon = "icon16/accept.png"
33 | },
34 | [7] = { -- TUTORIAL/GUIDE
35 | col = Color( 100, 185, 255 ),
36 | icon = "icon16/information.png"
37 | },
38 | }
39 | function PANEL:Init()
40 | self.type = 1
41 | self.text = self:Add( "DLabel" )
42 | self.text:SetFont( "nut_NotiFont" )
43 | self.text:SetContentAlignment(5)
44 | self.text:SetTextColor( color_white )
45 | self.text:SizeToContents()
46 | self.text:Dock( FILL )
47 | self.text:DockMargin(2, 2, 2, 2)
48 | self.text:SetExpensiveShadow(1, Color(25, 25, 25, 150))
49 | self:SetTall(28)
50 |
51 | self.Paint = function(panel, w, h)
52 | local col = self.pnlTypes[ self.type ].col
53 |
54 | draw.RoundedBox(4, 0, 0, w, h, color_black);
55 | draw.RoundedBox(4, 1, 1, w-2, h-2, col);
56 |
57 | self.material = nut.util.GetMaterial(self.pnlTypes[self.type].icon)
58 | local mat = self.material
59 | local size = self:GetTall()*.6
60 | local marg = 3
61 | if mat then
62 | surface.SetDrawColor( color_white )
63 | surface.SetMaterial( mat )
64 | surface.DrawTexturedRect( size/2, self:GetTall()/2-size/2 + 1, size, size )
65 | end
66 | end
67 | end
68 | function PANEL:SetType( num )
69 | self.type = num
70 | return
71 | end
72 | function PANEL:SetText( str )
73 | self.text:SetText( str )
74 | end
75 | function PANEL:SetFont( str )
76 | self.text:SetFont( str )
77 | end
78 |
79 | vgui.Register("nut_NoticePanel", PANEL, "DPanel")
--------------------------------------------------------------------------------
/nutscript/plugins/storage/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | function PLUGIN:SaveData()
4 | local data = {}
5 |
6 | for k, v in pairs(ents.FindByClass("nut_container")) do
7 | if v.generated then continue end
8 | if (v.itemID) then
9 | local inventory = v:GetNetVar("inv")
10 |
11 | data[#data + 1] = {
12 | position = v:GetPos(),
13 | angles = v:GetAngles(),
14 | inv = inventory,
15 | world = v.world,
16 | lock = v.lock,
17 | classic = v.classic,
18 | uniqueID = v.itemID,
19 | type = v.type
20 | }
21 | end
22 | end
23 |
24 | self:WriteTable(data)
25 | end
26 |
27 | timer.Create("nut_SaveContainers", 600, 0, function()
28 | PLUGIN:SaveData()
29 | end)
30 |
31 | function PLUGIN:LoadData()
32 | local storage = self:ReadTable()
33 | if (storage) then
34 | for k, v in pairs(storage) do
35 | local inventory = v.inv
36 | local position = v.position
37 | local angles = v.angles
38 | local itemTable = nut.item.Get(v.uniqueID)
39 |
40 | local amt = 0
41 | for _, __ in pairs( inventory ) do
42 | amt = amt + 1
43 | end
44 |
45 | if ( amt == 0 && !v.world && !v.lock ) then continue end
46 |
47 | if (itemTable) then
48 | local entity = ents.Create("nut_container")
49 | entity:SetPos(position)
50 | entity:SetAngles(angles)
51 | entity:Spawn()
52 | entity:Activate()
53 | entity:SetNetVar("inv", inventory)
54 | entity:SetNetVar("name", itemTable.name)
55 |
56 | local weight, max = entity:GetInvWeight()
57 | entity:SetNetVar("weight", weight);
58 | entity:SetNetVar("maxWeight", max);
59 |
60 | entity.itemID = v.uniqueID
61 | entity.lock = v.lock
62 | entity.classic = v.classic
63 | if entity.lock then
64 | entity:SetNetVar( "locked", true )
65 | end
66 | entity.world = v.world
67 | entity.type = v.type
68 | entity:SetModel(itemTable.model)
69 | entity:PhysicsInit(SOLID_VPHYSICS)
70 | if (itemTable.maxWeight) then
71 | entity:SetNetVar("maxWeight", itemTable.maxWeight)
72 | end
73 | if v.world then
74 | local phys = entity:GetPhysicsObject()
75 | if phys and phys:IsValid() then
76 | phys:EnableMotion(false)
77 | end
78 | end
79 | end
80 | end
81 | end
82 | end
--------------------------------------------------------------------------------
/nutscript/plugins/attachments/entities/entities/nut_attachment.lua:
--------------------------------------------------------------------------------
1 | AddCSLuaFile()
2 |
3 | ENT.Type = "anim"
4 | ENT.PrintName = "WAE Attachment"
5 | ENT.Category = "WAE Attachment"
6 | ENT.Author = "LauScript"
7 |
8 | function ENT:SetupDataTables()
9 | self:NetworkVar("Vector", 0, "AttachOffset");
10 | self:NetworkVar("Angle", 0, "AttachAngles");
11 | self:NetworkVar("Entity", 0, "AttachParent");
12 | self:NetworkVar("Int", 0, "AttachBoneIndex" );
13 | self:NetworkVar( "String", 0, "AttachClass" );
14 | end
15 |
16 | if (SERVER) then
17 | function ENT:Initialize()
18 | self:SetModel("models/props_junk/watermelon01.mdl");
19 | self:SetSolid(SOLID_NONE);
20 | self:PhysicsInit(SOLID_NONE);
21 | self:DrawShadow(false)
22 | self:SetMoveType(MOVETYPE_NONE);
23 |
24 | local physicsObject = self:GetPhysicsObject();
25 |
26 | if (IsValid(physicsObject)) then
27 | physicsObject:EnableMotion(true);
28 | physicsObject:Wake();
29 | end
30 | end;
31 | end;
32 |
33 | function ENT:Think()
34 | if ( CLIENT ) then
35 | local pos,ang = self:GetAttachmentPosition();
36 |
37 | self:SetPos( pos );
38 | self:SetAngles( ang );
39 | end;
40 | end;
41 |
42 | function ENT:GetAttachmentPosition()
43 | local pos,ang = self:GetAttachOffset(), self:GetAttachAngles();
44 | local parent,bone = self:GetAttachParent(), self:GetAttachBoneIndex();
45 |
46 | if ( pos and ang and parent and bone ) then
47 | local bonepos,boneang = parent:GetBonePosition(bone);
48 | local x,y,z = boneang:Up() * pos.x, boneang:Right() * pos.y, boneang:Forward() * pos.z;
49 |
50 | boneang:RotateAroundAxis(boneang:Forward(), ang.p);
51 | boneang:RotateAroundAxis(boneang:Right(), ang.y);
52 | boneang:RotateAroundAxis(boneang:Up(), ang.r);
53 |
54 | return bonepos + x + y + z, boneang;
55 | end;
56 | end;
57 |
58 |
59 | if ( CLIENT ) then
60 |
61 | function ENT:Draw()
62 | local ap = self:GetAttachParent();
63 | local active = ap:GetActiveWeapon();
64 | local client = LocalPlayer()
65 |
66 | if (ap == client and !client:ShouldDrawLocalPlayer()) then
67 | return
68 | end
69 |
70 | if ( active and active != NULL ) then
71 | if ( active:GetClass() == self:GetAttachClass() or not ap:Alive() ) then
72 | return;
73 | else
74 | self:DrawModel();
75 | end;
76 | end;
77 | end
78 |
79 | end;
--------------------------------------------------------------------------------
/nutscript/plugins/act/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | PLUGIN.AngMod = Angle( 0, 0, 0 )
4 | PLUGIN.MouseSensitive = 20
5 |
6 | function PLUGIN:InputMouseApply( cmd, x, y, ang )
7 | if LocalPlayer():GetOverrideSeq() then
8 | self.AngMod = self.AngMod - Angle( -y/self.MouseSensitive, x/self.MouseSensitive, 0 )
9 | self.AngMod.p = math.Clamp( self.AngMod.p, -80, 80 )
10 | else
11 | self.AngMod = Angle( 0, 0, 0 )
12 | end
13 | end
14 |
15 | function PLUGIN:PlayerBindPress(client, bind, pressed)
16 | if (client:GetOverrideSeq() and !string.find(bind, "messagemode")) then
17 | if (client:GetNutVar("leavingAct")) then
18 | client:SetNutVar("leavingAct", false)
19 | else
20 | client:SetNutVar("leavingAct", true)
21 | timer.Simple(0.1, function()
22 | RunConsoleCommand("nut_leaveact")
23 | end)
24 | end
25 |
26 | return true
27 | end;
28 | end
29 |
30 | function PLUGIN:CalcView(client, origin, angles, fov)
31 | if (client:GetViewEntity() == client and client:GetOverrideSeq() and client:GetNetVar("seqCam")) then
32 | local view = {}
33 | local at = client:LookupAttachment( "eyes" )
34 | if at == 0 then at = client:LookupAttachment( "eye" ) end
35 | local att = client:GetAttachment( at )
36 |
37 | local ang = Angle( 0, client:GetAngles().y, 0 ) + self.AngMod
38 | local data = {
39 | start = att.Pos,
40 | endpos = att.Pos + ang:Forward() * -80 + ang:Up() * 20 + ang:Right() * 0
41 | }
42 | local trace = util.TraceLine(data)
43 | local position = trace.HitPos + trace.HitNormal*4
44 |
45 | view.origin = position
46 | view.angles = angNCS
47 |
48 | return view
49 |
50 | end
51 | end
52 |
53 | function PLUGIN:ShouldDrawLocalPlayer()
54 | if (LocalPlayer():GetOverrideSeq() and LocalPlayer():GetNetVar("seqCam")) then
55 | return true;
56 | end
57 | end
58 |
59 | function PLUGIN:AddCharInfoDermaTab(panel)
60 | local class = nut.anim.GetClass(string.lower(LocalPlayer():GetModel()))
61 | local list = self.sequences[class];
62 | if (list) then
63 | local actList = panel:AddSubMenu(PLUGIN:GetPluginLanguage("act_menu"), function() end);
64 | for uid, actdata in SortedPairs(list) do
65 | if (list) then
66 | actList:AddOption((actdata.name or uid), function()
67 | LocalPlayer():ConCommand(Format("say /act%s", uid));
68 | end);
69 | end;
70 | end;
71 | end;
72 | end;
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/entities/entities/nut_stove.lua:
--------------------------------------------------------------------------------
1 | ENT.Type = "anim"
2 | ENT.PrintName = PLUGIN:GetPluginLanguage("cook_stove_name")
3 | ENT.Author = "Black Tea"
4 | ENT.Spawnable = true
5 | ENT.AdminOnly = true
6 | ENT.Category = "Nutscript"
7 | ENT.PersistentSave = false;
8 |
9 | if (SERVER) then
10 | function ENT:Initialize()
11 | self:SetModel("models/props_c17/furnitureStove001a.mdl")
12 | self:PhysicsInit(SOLID_VPHYSICS)
13 | self:SetMoveType(MOVETYPE_VPHYSICS)
14 | self:SetNetVar("active", false)
15 | self:SetUseType(SIMPLE_USE)
16 | self.loopsound = CreateSound( self, "ambient/fire/fire_small_loop1.wav" )
17 | local physicsObject = self:GetPhysicsObject()
18 |
19 | if (IsValid(physicsObject)) then
20 | physicsObject:Wake()
21 | end
22 | end
23 |
24 | function ENT:Use(activator)
25 | self:SetNetVar("active", !self:GetNetVar("active", false))
26 | if self:GetNetVar("active") then
27 | self:EmitSound( "ambient/fire/mtov_flame2.wav", 75, 100 )
28 | self.loopsound:Play()
29 | else
30 | self:EmitSound( "ambient/fire/mtov_flame2.wav", 75, 250 )
31 | self.loopsound:Stop()
32 | end
33 | end
34 | else
35 | function ENT:Initialize()
36 | self.emitter = ParticleEmitter( self:GetPos() )
37 | self.emittime = CurTime()
38 | end
39 |
40 | local GLOW_MATERIAL = Material("sprites/glow04_noz.vmt")
41 | function ENT:Draw()
42 | self:DrawModel()
43 |
44 | if self:GetNetVar("active") then
45 | local position = self:GetPos() + ( self:GetUp() *20 ) + ( self:GetRight() * 11) + ( self:GetForward() *3)
46 | local size = 20 + math.sin( RealTime()*15 ) * 5
47 | render.SetMaterial(GLOW_MATERIAL)
48 | render.DrawSprite(position, size, size, Color( 255, 162, 76, 255 ) )
49 |
50 | if self.emittime < CurTime() then
51 | local smoke = self.emitter:Add( "particle/smokesprites_000"..math.random(1,9), position )
52 | smoke:SetVelocity(Vector( 0, 0, 120))
53 | smoke:SetDieTime(math.Rand(0.2,1.3))
54 | smoke:SetStartAlpha(math.Rand(150,200))
55 | smoke:SetEndAlpha(0)
56 | smoke:SetStartSize(math.random(0,5))
57 | smoke:SetEndSize(math.random(20,30))
58 | smoke:SetRoll(math.Rand(180,480))
59 | smoke:SetRollDelta(math.Rand(-3,3))
60 | smoke:SetColor(50,50,50)
61 | smoke:SetGravity( Vector( 0, 0, 10 ) )
62 | smoke:SetAirResistance(200)
63 | self.emittime = CurTime() + .1
64 | end
65 | end
66 |
67 | end
68 | end
69 |
--------------------------------------------------------------------------------
/nutscript/plugins/recognition/derma/cl_quickrecognition.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {};
2 | local PLUGIN = PLUGIN or { };
3 |
4 | function PANEL:Init()
5 | AdvNut.util.DrawBackgroundBlur(self);
6 | self:InitDermaMenu();
7 |
8 | AdvNut.hook.Add("VGUIMousePressed", "QuickRecognitionMenuMousePressed", PANEL.VGUIMousePressed);
9 | end;
10 |
11 | function PANEL:InitDermaMenu()
12 | client = LocalPlayer();
13 |
14 | self.menu = DermaMenu();
15 | self.menu:AddOption("바라보고 있는 사람에게 인식", function()
16 | client:ConCommand("say /recognition aim")
17 | self:Close();
18 | end);
19 |
20 | self.menu:AddOption("속삭이기 범위 안의 사람에게 인식", function()
21 | client:ConCommand("say /recognition whisper")
22 | self:Close();
23 | end);
24 |
25 | self.menu:AddOption("말하기 범위 안의 사람에게 인식", function()
26 | client:ConCommand("say /recognition")
27 | self:Close();
28 | end);
29 |
30 | self.menu:AddOption( "외치기 범위 안의 사람에게 인식", function()
31 | client:ConCommand("say /recognition yell")
32 | self:Close();
33 | end);
34 |
35 | self.menu:Open()
36 | self.menu:SetPos(ScrW()* 0.45, ScrH() *0.45);
37 | end;
38 |
39 | function PANEL:Think()
40 | if(!input.IsKeyDown(KEY_F2)) then
41 | self:Close();
42 | end;
43 | end;
44 |
45 | function PANEL:Paint(w, h)
46 | surface.SetDrawColor(Color(0, 0, 0, 0));
47 | surface.DrawRect(0, 0, w, h);
48 | end;
49 |
50 | function PANEL:VGUIMousePressed(mouseCode)
51 | timer.Simple(0.1, function()PLUGIN:GetPluginIdentifier("QuickRecognitionMenu", CLIENT)
52 | if (IsValid(nut.gui.QuickRecognition) and nut.gui.QuickRecognition.menu != nil) then
53 | nut.gui.QuickRecognition:InitDermaMenu();
54 | end;
55 | end);
56 | end;
57 |
58 | function PANEL:Close()
59 | AdvNut.util.RemoveBackgroundBlur(self);
60 |
61 | hook.Remove("VGUIMousePressed", PLUGIN:GetPluginIdentifier("QuickRecognitionMenuMousePressed", CLIENT));
62 | self.menu:Remove();
63 | self:Remove();
64 | end;
65 | vgui.Register("AdvNut_QuickRecognition", PANEL, "AdvNut_BaseForm");
66 |
67 |
68 | function PANEL:PlayerBindPress(bind, pressed)
69 | if(bind == "gm_showteam" and AdvNut.hook.Run("PlayerCanOpenQuickRecognitionMenu")) then
70 | nut.gui.QuickRecognition = vgui.Create("AdvNut_QuickRecognition");
71 | end
72 | end;
73 | AdvNut.hook.Add("PlayerBindPress", PLUGIN:GetPluginIdentifier("QuickRecognitionMenu", CLIENT), PANEL.PlayerBindPress);
74 |
75 |
76 | function PLUGIN:PlayerCanOpenQuickRecognitionMenu()
77 | return true;
78 | end;
--------------------------------------------------------------------------------
/nutscript/plugins/storage/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("sr_storage", "저장고", language);
5 | PLUGIN:AddPluginLanguage("sr_usespace", "%s 만큼의 공간 사용 중.", language);
6 | PLUGIN:AddPluginLanguage("sr_locked", "잠겨있는 저장고.", language);
7 | PLUGIN:AddPluginLanguage("sr_move", "옮기기", language);
8 |
9 | PLUGIN:AddPluginLanguage("sr_open_desc", "저장고를 엽니다.", language);
10 | PLUGIN:AddPluginLanguage("sr_lock_try", "잠겨진 저장고입니다.", language);
11 |
12 | PLUGIN:AddPluginLanguage("sr_lock_desc", "저장고를 잠급니다.", language);
13 | PLUGIN:AddPluginLanguage("sr_lock_itsworld", "월드 저장고는 잠그실 수 없습니다.", language);
14 |
15 | PLUGIN:AddPluginLanguage("sr_confirmation", "방식 결정", language);
16 | PLUGIN:AddPluginLanguage("sr_lock_type", "어떤 방식의 잠금장치를 사용하시겠습니까?", language);
17 | PLUGIN:AddPluginLanguage("sr_lock_noitem", "그 잠금장치를 소지하고 있지 않습니다.", language);
18 | PLUGIN:AddPluginLanguage("sr_lock_success", "성공적으로 저장고를 잠갔습니다.", language);
19 |
20 | PLUGIN:AddPluginLanguage("sr_admin_open", "권한으로 열기", language);
21 | PLUGIN:AddPluginLanguage("sr_admin_open_desc", "잠금을 무시하고 저장고를 엽니다.", language);
22 |
23 | PLUGIN:AddPluginLanguage("sr_c_locker_name", "자물쇠", language);
24 | PLUGIN:AddPluginLanguage("sr_c_locker_desc", "열쇠로 열 수 있는 잠금장치입니다.", language);
25 |
26 | PLUGIN:AddPluginLanguage("sr_d_locker_name", "전자식 비밀번호 패드", language);
27 | PLUGIN:AddPluginLanguage("sr_d_locker_desc", "4자리 비밀번호식 잠금장치입니다.", language);
28 | PLUGIN:AddPluginLanguage("sr_enter_password", "비밀번호를 입력하세요.", language);
29 | PLUGIN:AddPluginLanguage("sr_wrong_password", "잘못된 비밀번호입니다.", language);
30 |
31 | PLUGIN:AddPluginLanguage("sr_key_name", "열쇠", language);
32 | PLUGIN:AddPluginLanguage("sr_key_desc", "잠긴 자물쇠를 열때 사용합니다.", language);
33 |
34 | PLUGIN:AddPluginLanguage("sr_world_container", "이 저장고는 이제 유저 생성 저장고입니다.", language);
35 | PLUGIN:AddPluginLanguage("sr_user_container", "이 저장고는 이제 유저 생성 저장고입니다.", language);
36 |
37 | PLUGIN:AddPluginLanguage("sr_set_password", "%s 로 비밀번호를 설정하였습니다.", language);
38 | PLUGIN:AddPluginLanguage("sr_lock_unlocked", "이 저장고의 잠금을 해제하셨습니다.", language);
39 |
40 | PLUGIN:AddPluginLanguage("sr_lock_locked", "이미 잠겨져 있는 저장고입니다.", language);
41 | PLUGIN:AddPluginLanguage("sr_notstorage", "잘못된 저장고입니다.", language);
42 |
43 | PLUGIN:AddPluginLanguage("storage", "저장", language);
44 | PLUGIN:AddPluginLanguage("storage_security", "저장고, 보안", language);
45 | PLUGIN:AddPluginLanguage("storage_nospace", "저장소에 여유가 없습니다.", language);
--------------------------------------------------------------------------------
/nutscript/plugins/customvendor/language/sh_korean.lua:
--------------------------------------------------------------------------------
1 | local language = "korean";
2 | local PLUGIN = PLUGIN;
3 |
4 | PLUGIN:AddPluginLanguage("vd_vendor", "상인", language);
5 |
6 | PLUGIN:AddPluginLanguage("vd_buy", "구매", language);
7 | PLUGIN:AddPluginLanguage("vd_sell", "판매", language);
8 | PLUGIN:AddPluginLanguage("vd_name", "이름", language);
9 | PLUGIN:AddPluginLanguage("vd_price", "설정된 가격", language);
10 | PLUGIN:AddPluginLanguage("vd_orignal_price", "원래 가격", language);
11 | PLUGIN:AddPluginLanguage("vd_itemID", "아아템 코드", language);
12 |
13 | PLUGIN:AddPluginLanguage("vd_admin", "관리", language);
14 |
15 | PLUGIN:AddPluginLanguage("vd_admin_faction", "팩션 권한 설정", language);
16 | PLUGIN:AddPluginLanguage("vd_admin_faction_desc", "%s 팩션에게 구매 / 판매 권한을 부여합니다.", language);
17 |
18 | PLUGIN:AddPluginLanguage("vd_admin_classes", "클래스 권한 설정", language);
19 | PLUGIN:AddPluginLanguage("vd_admin_classes_desc", "%s 클래스에게 구매 / 판매 권한을 부여합니다.", language);
20 |
21 | PLUGIN:AddPluginLanguage("vd_admin_action", "구매 / 판매 여부", language);
22 | PLUGIN:AddPluginLanguage("vd_admin_sell", "플레이어에게 판매함", language);
23 | PLUGIN:AddPluginLanguage("vd_admin_buy", "플레이어에게서 구매함", language);
24 |
25 | PLUGIN:AddPluginLanguage("vd_admin_selling", "판매 여부", language);
26 | PLUGIN:AddPluginLanguage("vd_admin_buying", "구매 여부", language);
27 |
28 | PLUGIN:AddPluginLanguage("vd_admin_name", "이름", language);
29 | PLUGIN:AddPluginLanguage("vd_admin_adj", "물가 조정 (배수)", language);
30 | PLUGIN:AddPluginLanguage("vd_admin_money", "상인이 가지고 있는 돈", language);
31 | PLUGIN:AddPluginLanguage("vd_admin_desc", "설명", language);
32 | PLUGIN:AddPluginLanguage("vd_admin_model", "모델", language);
33 |
34 | PLUGIN:AddPluginLanguage("vd_admin_save", "저장", language);
35 |
36 | PLUGIN:AddPluginLanguage("vd_admin_faction_desc", "%s 팩션에게 접근을 허가합니다.", language);
37 | PLUGIN:AddPluginLanguage("vd_admin_tip", "왼쪽 클릭으로 판매 / 구매, 오른쪽 클릭으로 가격을 정합니다.", language);
38 | PLUGIN:AddPluginLanguage("vd_sell_desc", "이름: %s\n설명: %s\n%s", language);
39 | PLUGIN:AddPluginLanguage("vd_admin_ask_price", "이 아이템의 가격은?", language);
40 |
41 | PLUGIN:AddPluginLanguage("created_vendor", "성공적으로 상인을 생성하였습니다.", language);
42 | PLUGIN:AddPluginLanguage("removed_vendor", "성공적으로 상인을 삭제하였습니다.", language);
43 | PLUGIN:AddPluginLanguage("not_trace_vendor", "당신은 상인을 바라보고 있지 않습니다.", language);
44 |
45 | PLUGIN:AddPluginLanguage("vendor_no_afford", "상인은 이 아이템을 구매하기에 충분한 돈을 가지고 있지 않습니다.", language);
46 | PLUGIN:AddPluginLanguage("vendor_cash", "이 상인은 %s을(를) 가지고 있습니다.", language);
--------------------------------------------------------------------------------
/nutscript/gamemode/items/base/sh_bodygroup_clothing.lua:
--------------------------------------------------------------------------------
1 | BASE.name = "Base Bodygroup Clothing";
2 | BASE.uniqueID = "base_bodygroup_clothing";
3 | BASE.category = nut.lang.Get("clothing");
4 | BASE.models = {};
5 | BASE.bodygroup = {0, 0};
6 |
7 | BASE.data = {
8 | Equipped = false
9 | }
10 |
11 | BASE.functions = {};
12 | BASE.functions.Wear = {
13 | text = nut.lang.Get("wear"),
14 | run = function(itemTable, client, data)
15 | if (SERVER) then
16 | local WearBodygroupIndexs = {};
17 | if (!table.HasValue(itemTable.models, client:GetModel()) or client:GetBodygroupCount(itemTable.bodygroup[1]) == nil) then
18 | nut.util.Notify(nut.lang.Get("wrong_bodygroup_model"), client)
19 | return false;
20 | end;
21 |
22 | for class, item in pairs(client:GetInventory()) do
23 | local itemTable = nut.item.Get(class);
24 | local itemData;
25 |
26 | if (itemTable and itemTable.bodygroup) then
27 | for index, data in SortedPairs(item) do
28 | itemData = data.data;
29 | end;
30 |
31 | if (itemData.Equipped == true) then
32 | table.insert(WearBodygroupIndexs, itemTable.bodygroup[1]);
33 | end;
34 | end;
35 | end;
36 |
37 | if (table.HasValue(WearBodygroupIndexs, itemTable.bodygroup[1])) then
38 | nut.util.Notify(nut.lang.Get("already_equip_bodygroup"), client);
39 | return false;
40 | else
41 | newData = table.Copy(data);
42 | newData.Equipped = true;
43 | newData.OrignalIndex = client:GetBodygroup(itemTable.bodygroup[1]) or 0;
44 |
45 | client:SetBodygroup(itemTable.bodygroup[1], itemTable.bodygroup[2]);
46 | client:UpdateInv(itemTable.uniqueID, 1, newData, true);
47 | end;
48 | end;
49 | end;
50 |
51 | shouldDisplay = function(itemTable, data, entity)
52 | return data.Equipped == false;
53 | end
54 | }
55 |
56 | BASE.functions.Unwear = {
57 | text = nut.lang.Get("unwear"),
58 | run = function(itemTable, client, data)
59 | if (SERVER) then
60 | client:SetBodygroup(itemTable.bodygroup[1], data.OrignalIndex);
61 | newData = table.Copy(data);
62 | newData.Equipped = false
63 | newData.OrignalIndex = nil;
64 |
65 | client:UpdateInv(itemTable.uniqueID, 1, newData, true);
66 | end;
67 | end;
68 |
69 | shouldDisplay = function(itemTable, data, entity)
70 | return data.Equipped == true;
71 | end
72 | }
73 |
74 | function BASE:CanTransfer(client, data)
75 | if (data.Equipped) then
76 | nut.util.Notify(nut.lang.Get("cant_equip_weapon"), client)
77 | end
78 |
79 | return !data.Equipped
80 | end
81 |
--------------------------------------------------------------------------------
/nutscript/plugins/attachments/sv_lib.lua:
--------------------------------------------------------------------------------
1 | local _PLAYER = FindMetaTable("Player");
2 |
3 | nut.Attachment = {};
4 | nut.Attachment.htreg = {};
5 | nut.Attachment.modelreg = {};
6 | nut.Attachment.blacklist = { "weapon_physcannon", "weapon_physgun", "gmod_tool", "gmod_camera" };
7 |
8 | -- Register a holdtype.
9 | function nut.Attachment:RegisterHoldtype(holdtype, bone, pos, ang)
10 | self.htreg[holdtype] = { bone, pos, ang };
11 | end;
12 |
13 | -- Register a model.
14 | function nut.Attachment:RegisterModel( model, bone, pos, ang )
15 | self.modelreg[model] = { bone, pos, ang };
16 | end;
17 |
18 |
19 | function nut.Attachment:AddBlacklistedWeapon(weapon)
20 | table.insert( self.blacklist, weapon );
21 | end;
22 |
23 | -- Update a players attachments.
24 | function _PLAYER:UpdateWeaponAttachments()
25 | if ( not self.WeaponAttachments ) then
26 | self.WeaponAttachments = {};
27 | end;
28 |
29 | for _,weapon in pairs( self:GetWeapons() ) do
30 | local class = weapon:GetClass();
31 | if ( not self.WeaponAttachments[class] and not table.HasValue(nut.Attachment.blacklist, class)) then
32 | if ( nut.Attachment.modelreg[model] ) then
33 | offsetpos = nut.Attachment.modelreg[model][2];
34 | offsetang = nut.Attachment.modelreg[model][3];
35 | bone = nut.Attachment.modelreg[model][1];
36 | elseif ( nut.Attachment.htreg[ht] ) then
37 | offsetpos = nut.Attachment.htreg[ht][2];
38 | offsetang = nut.Attachment.htreg[ht][3];
39 | bone = nut.Attachment.htreg[ht][1];
40 | end;
41 |
42 | if (!bone) then
43 | return
44 | end
45 |
46 | local boneIndex = self:LookupBone(bone)
47 |
48 | if (!boneIndex) then
49 | return
50 | end
51 |
52 | local attachment = ents.Create("nut_attachment");
53 | local offsetpos, offsetang, bone = Vector(-3.96, 4.95, -2.97), Angle(0,0,0), "ValveBiped.Bip01_Spine";
54 | local ht = weapon:GetHoldType();
55 | local model = weapon:GetModel();
56 |
57 | attachment:SetModel(model);
58 | attachment:SetAttachParent(self);
59 | attachment:SetAttachOffset(offsetpos);
60 | attachment:SetAttachAngles(offsetang);
61 | attachment:SetAttachBoneIndex(boneIndex);
62 | attachment:SetAttachClass(weapon:GetClass() );
63 | attachment:SetParent(self);
64 |
65 | self.WeaponAttachments[weapon:GetClass()] = attachment;
66 | end;
67 | end;
68 |
69 | for k,v in pairs( self.WeaponAttachments ) do
70 | local gw = self:GetWeapon(k);
71 | if ( not gw or gw == NULL ) then
72 | v:Remove();
73 | self.WeaponAttachments[k] = nil;
74 | end;
75 | end;
76 | end;
77 |
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_baseform.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {};
2 | function PANEL:Init()
3 | self.Paint = function(panel, w, h)
4 | draw.RoundedBox(6, 0, 0, w, h, color_black);
5 | draw.RoundedBox(6, 1, 1, w-2, h-2, nut.config.panelBackgroundColor);
6 | end
7 | end
8 |
9 | function PANEL:AddCloseButton()
10 | self:CreateButtonBase();
11 | self.buttonBase.CloseButton = vgui.Create("DButton", self.buttonBase);
12 | self.buttonBase.CloseButton:SetSize(30, 20);
13 | self.buttonBase.CloseButton:DockMargin(5, 5, 5, 2);
14 | self.buttonBase.CloseButton:SetText("X");
15 | self.buttonBase.CloseButton:Dock(RIGHT);
16 | self.buttonBase.CloseButton.DoClick = function()
17 | self:Close();
18 | end;
19 |
20 | self.buttonBase.CloseButton.Paint = function(panel, w, h)
21 | draw.RoundedBox(5, 0, 0, w, h, color_black);
22 | draw.RoundedBox(5, 1, 1, w-2, h-2, color_white);
23 | end;
24 | end;
25 |
26 | function PANEL:AddTitle(title, color)
27 | self:CreateButtonBase();
28 | self.buttonBase.title = vgui.Create("DLabel", self.buttonBase);
29 | self.buttonBase.title:SetWide(self:GetWide() * 5);
30 | self.buttonBase.title:DockMargin(5, 5, 5, 5);
31 | self.buttonBase.title:Dock(LEFT);
32 |
33 | self:SetTitle(title, color);
34 | return;
35 | end;
36 |
37 | function PANEL:SetTitle(title, color)
38 | if(IsValid(color)) then
39 | self.buttonBase.title:SetColor(color);
40 | else
41 | self.buttonBase.title:SetColor(color_black);
42 | end;
43 |
44 | self.buttonBase.title:SetFont("nut_MediumFont");
45 | self.buttonBase.title:SetText(title);
46 | return;
47 | end;
48 |
49 | function PANEL:GetTitle()
50 | return self.buttonBase.title:GetText();
51 | end;
52 |
53 | function PANEL:CreateButtonBase()
54 | if (IsValid(self.buttonBase)) then
55 | return;
56 | end;
57 |
58 | self.buttonBase = vgui.Create("DPanel", self);
59 | self.buttonBase:SetTall(30);
60 | self.buttonBase:Dock(TOP);
61 | self.buttonBase:DockMargin(5, 0, 2, 0);
62 | self.buttonBase:SetDrawBackground(false);
63 | self.buttonBase.Paint = function(panel, w, h)
64 | surface.SetDrawColor(color_black);
65 | surface.DrawRect(2, h-1, w-10, h);
66 | end;
67 |
68 | return;
69 | end;
70 |
71 | function PANEL:SetBackgroundColor(color)
72 | self.Paint = function(panel, w, h)
73 | surface.SetDrawColor(color);
74 | surface.DrawRect(0, 0, w, h);
75 | end
76 | end
77 |
78 | function PANEL:SetBarColor(color, pointer)
79 | self.bar[pointer].Paint = function(panel, w, h)
80 | surface.SetDrawColor(color);
81 | surface.DrawRect(0, 0, w, h);
82 | end
83 | end
84 |
85 | // For Override //
86 | function PANEL:Close()
87 | self:Remove();
88 | end
89 |
90 | vgui.Register("AdvNut_BaseForm", PANEL, "DPanel");
--------------------------------------------------------------------------------
/nutscript/entities/entities/nut_item.lua:
--------------------------------------------------------------------------------
1 | AddCSLuaFile()
2 |
3 | ENT.Type = "anim"
4 | ENT.PrintName = "Item"
5 | ENT.Category = "Nutscript"
6 | ENT.Author = "Chessnut"
7 | ENT.PersistentSave = false;
8 |
9 | function ENT:SetupDataTables()
10 | self:NetworkVar("String", 0, "InternalData")
11 | self:NetworkVar("String", 1, "ItemID")
12 | end
13 |
14 | if (SERVER) then
15 | function ENT:Initialize()
16 | self:SetModel("models/props_junk/watermelon01.mdl")
17 | self:SetSolid(SOLID_VPHYSICS)
18 | self:PhysicsInit(SOLID_VPHYSICS)
19 | self:SetMoveType(MOVETYPE_VPHYSICS)
20 | self:SetUseType(SIMPLE_USE)
21 |
22 | local physicsObject = self:GetPhysicsObject()
23 |
24 | if (IsValid(physicsObject)) then
25 | physicsObject:EnableMotion(true)
26 | physicsObject:Wake()
27 | else
28 | self:PhysicsInitBox( Vector( -2, -2, -2 ), Vector( 2, 2, 2 ) )
29 | end
30 | end
31 |
32 | function ENT:Use(activator)
33 | netstream.Start(activator, "nut_ItemMenu", self)
34 | end
35 | end
36 |
37 | function ENT:GetData()
38 | if (self:GetInternalData() != "") then
39 | if (!self.realData) then
40 | self.realData = pon.decode(self:GetInternalData())
41 | end
42 |
43 | return self.realData
44 | end
45 | end
46 |
47 | function ENT:GetItemTable()
48 | if (self:GetItemID()) then
49 | if (!self.itemTable) then
50 | self.itemTable = nut.item.Get(self:GetItemID())
51 | end
52 |
53 | return self.itemTable
54 | end
55 | end
56 |
57 | if (CLIENT) then
58 | function ENT:DrawTargetID(x, y, alpha)
59 | local mainColor = nut.config.mainColor
60 | local itemTable = self:GetItemTable()
61 |
62 | if (itemTable) then
63 | local color = Color(mainColor.r, mainColor.g, mainColor.b, alpha)
64 | local data = self:GetData()
65 |
66 | if itemTable.color != nil then
67 | color = Color(itemTable.color.r, itemTable.color.g, itemTable.color.b, alpha)
68 | end
69 |
70 | nut.util.DrawText(x, y, itemTable.name, color, "AdvNut_EntityTitle");
71 |
72 | y = y + nut.config.Get("targetTall")
73 |
74 | if(IsValid(itemTable.color)) then
75 | color = itemTable.color;
76 | else
77 | color = Color(255, 255, 255, alpha);
78 | end;
79 |
80 | nut.util.DrawText(x, y, string.gsub(itemTable:GetDesc(data), "\n", " "), color, "AdvNut_EntityDesc");
81 |
82 | if (itemTable.Paint) then
83 | itemTable.data = data
84 | itemTable:Paint(self, x, y + nut.config.Get("targetTall"), color)
85 | itemTable.data = nil
86 | end
87 | end
88 | end
89 |
90 | netstream.Hook("nut_ItemMenu", function(entity)
91 | if (IsValid(entity) and entity:GetPos():Distance(LocalPlayer():GetPos()) <= 72) then
92 | nut.item.OpenEntityMenu(entity)
93 | end
94 | end)
95 | end
96 |
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/cl_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | nut_Fire_sprite = { };
4 | nut_Fire_sprite.fire = Material("particles/fire1") ;
5 | nut_Fire_sprite.nextFrame = CurTime();
6 | nut_Fire_sprite.curFrame = 0;
7 |
8 | function PLUGIN:Think()
9 | if nut_Fire_sprite.nextFrame < CurTime() then
10 | nut_Fire_sprite.nextFrame = CurTime() + 0.05 * (1 - FrameTime());
11 | nut_Fire_sprite.curFrame = nut_Fire_sprite.curFrame + 1;
12 | nut_Fire_sprite.fire:SetFloat("$frame", nut_Fire_sprite.curFrame % 22 );
13 | end
14 | end
15 |
16 | nut.bar.Add("hunger", {
17 | getValue = function()
18 | if (LocalPlayer().character) then
19 | return LocalPlayer().character:GetVar("hunger", 0);
20 | else
21 | return 0;
22 | end
23 | end,
24 | color = Color(188, 255, 122)
25 | });
26 |
27 | nut.bar.Add("thirst", {
28 | getValue = function()
29 | if (LocalPlayer().character) then
30 | return LocalPlayer().character:GetVar("thirst", 0)
31 | else
32 | return 0
33 | end
34 | end,
35 | color = Color(123, 156, 255)
36 | });
37 |
38 | function PLUGIN:ShouldDrawTargetEntity(entity)
39 | if (entity:GetClass() == "nut_stove") then
40 | return true;
41 | end
42 | end
43 |
44 | function PLUGIN:DrawTargetID(entity, x, y, alpha)
45 | if (entity:GetClass() == "nut_stove") then
46 | local mainColor = nut.config.mainColor
47 | local color = Color(mainColor.r, mainColor.g, mainColor.b, alpha)
48 |
49 | nut.util.DrawText(x, y, PLUGIN:GetPluginLanguage("cook_stove_name"), color, "AdvNut_EntityTitle");
50 | y = y + nut.config.Get("targetTall")
51 | local text = PLUGIN:GetPluginLanguage("cook_stove_desc")
52 | nut.util.DrawText(x, y, text, Color(255, 255, 255, alpha), "AdvNut_EntityDesc");
53 | end
54 | end
55 |
56 | function PLUGIN:AddCharInfoData(panel)
57 | panel.charstatus = panel:AddTextData("");
58 | panel.hungerstatus = panel:AddTextData("");
59 | panel.thirststatus = panel:AddTextData("");
60 | end
61 |
62 | function PLUGIN:ThinkCharInfo(panel, client)
63 | local synt_status = nut.lang.Get("synt_fine")
64 |
65 | if(client.character:GetVar("hunger") <= 15 or client.character:GetVar("thirst") <= 15 or client:Health() <= 30) then
66 | synt_status = nut.lang.Get("synt_die")
67 | elseif (client.character:GetVar("hunger") <= 30) then
68 | synt_status = nut.lang.Get("synt_hunger")
69 | elseif (client.character:GetVar("thirst") <= 30) then
70 | synt_status = nut.lang.Get("synt_thirst")
71 | end
72 |
73 | panel.charstatus:SetText(nut.lang.Get("status_synt")..synt_status);
74 | panel.hungerstatus:SetText(nut.lang.Get("status_hunger")..client.character:GetVar("hunger").."%");
75 | panel.thirststatus:SetText(nut.lang.Get("status_thirst")..client.character:GetVar("thirst").."%");
76 | end
--------------------------------------------------------------------------------
/nutscript/plugins/improvedstamina/sv_hooks.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 | local GetVelocity = FindMetaTable("Entity").GetVelocity
3 | local Length2D = FindMetaTable("Vector").Length2D
4 |
5 | function PLUGIN:PlayerLoadedChar(client)
6 | local uniqueID = "nut_Stamina"..client:SteamID()
7 | local regenerationValue;
8 | local defaultRegenerationValue = nut.config.staminaRestore + (client:GetAttrib(ATTRIB_END, 1) * 0.005);
9 |
10 | timer.Remove(uniqueID)
11 | timer.Create(uniqueID, 1, 0, function()
12 | if (!IsValid(client)) then
13 | timer.Remove(uniqueID)
14 | return
15 | end
16 |
17 | if (!client:IsNoClipping()) then
18 | if (client:IsRunning()) then
19 | client.character:SetVar("stamina", math.Max(client.character:GetVar("stamina") - (nut.config.staminaValue - (client:GetAttrib(ATTRIB_END, 1) * 0.01)), 0));
20 | client:UpdateAttrib(ATTRIB_END, 0.001);
21 | client:UpdateAttrib(ATTRIB_SPD, 0.0001);
22 | elseif (client:IsWalking()) then
23 | client.character:SetVar("stamina", math.Max(client.character:GetVar("stamina") - ((nut.config.staminaValue * 0.025) - client:GetAttrib(ATTRIB_END, 1) * 0.005), 0));
24 | client:UpdateAttrib(ATTRIB_END, 0.0005);
25 | client:UpdateAttrib(ATTRIB_SPD, 0.00005);
26 | elseif (client:GetVelocity():Length() == 0) then
27 | if (client:Crouching()) then
28 | regenerationValue = defaultRegenerationValue * 1.5;
29 | else
30 | regenerationValue = defaultRegenerationValue;
31 | end;
32 |
33 | if(regenerationValue > 0) then
34 | client.character:SetVar("stamina", math.Min(client.character:GetVar("stamina") + regenerationValue, 100));
35 | end;
36 | end;
37 | end;
38 |
39 | client:SetRunSpeed(AdvNut.hook.Run("PlayerGetRunSpeed", client, PLUGIN:GetDefaultRunSpeed(client)));
40 | client:SetWalkSpeed(AdvNut.hook.Run("PlayerGetWalkSpeed", client, PLUGIN:GetDefaultWalkSpeed(client)));
41 | end);
42 | end
43 |
44 | function PLUGIN:GetDefaultRunSpeed(client)
45 | return math.Max(nut.config.walkSpeed / 2, (nut.config.runSpeed * 1.25) + (client:GetAttrib(ATTRIB_SPD, 1) * 0.25) - (20 / (math.Max(client.character:GetVar("stamina"), 1) * 0.25)));
46 | end
47 |
48 | function PLUGIN:GetDefaultWalkSpeed(client)
49 | return math.Max(nut.config.walkSpeed / 2, nut.config.walkSpeed + (client:GetAttrib(ATTRIB_SPD, 1) * 0.05) - (10 / (math.Max(client.character:GetVar("stamina"), 1) * 1.25)));
50 | end
51 |
52 | function PLUGIN:PlayerSpawn(client)
53 | if (client.character) then
54 | client.character:SetVar("stamina", client.character:GetData("stamina") or 100);
55 | end
56 | end
57 |
58 | function PLUGIN:PlayerGetRunSpeed(client, calcSpeed) return calcSpeed; end;
59 | function PLUGIN:PlayerGetWalkSpeed(client, calcSpeed) return calcSpeed; end;
--------------------------------------------------------------------------------
/nutscript/gamemode/libs/sh_scrolltext.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Purpose: Provides an interface for drawing and sending 'scrolling text.'
3 | Scrolling text simply is just text that 'types' itself.
4 | --]]
5 |
6 | nut.scroll = nut.scroll or {}
7 | nut.scroll.buffer = nut.scroll.buffer or {}
8 |
9 | local CHAR_DELAY = 0.1
10 |
11 | if (CLIENT) then
12 | NUT_CVAR_SCROLLVOL = CreateClientConVar("nut_scrollvol", 40, true)
13 |
14 | --[[
15 | Purpose: Adds the text into the scrolling queue so it will draw.
16 | If a callback is provided, then it will be called once the text has
17 | finished typing and no longer draws.
18 | --]]
19 | function nut.scroll.Add(text, callback)
20 | local info = {text = "", callback = callback, nextChar = 0, char = ""}
21 | local index = table.insert(nut.scroll.buffer, info)
22 | local i = 1
23 |
24 | timer.Create("nut_Scroll"..tostring(info), CHAR_DELAY, #text, function()
25 | if (info) then
26 | info.text = string.sub(text, 1, i)
27 | i = i + 1
28 |
29 | LocalPlayer():EmitSound("common/talk.wav", NUT_CVAR_SCROLLVOL:GetInt(), math.random(120, 140))
30 |
31 | if (i >= #text) then
32 | info.char = ""
33 | info.start = CurTime() + 3
34 | info.finish = CurTime() + 5
35 | end
36 | end
37 | end)
38 | end
39 |
40 | local SCROLL_X = ScrW() * 0.9
41 | local SCROLL_Y = ScrH() * 0.7
42 |
43 | --[[
44 | Purpose: Called internally in the HUDPaint hook, it loops through the
45 | scrolling text and draws the text accordingly.
46 | --]]
47 | function nut.scroll.Paint()
48 | local curTime = CurTime()
49 |
50 | for k, v in pairs(nut.scroll.buffer) do
51 | local alpha = 255
52 |
53 | if (v.start and v.finish) then
54 | alpha = 255 - math.Clamp(math.TimeFraction(v.start, v.finish, curTime) * 255, 0, 255)
55 | elseif (v.nextChar < curTime) then
56 | v.nextChar = CurTime() + 0.01
57 | v.char = string.char(math.random(47, 90))
58 | end
59 |
60 | nut.util.DrawText(SCROLL_X, SCROLL_Y - (k * 24), v.text..v.char, Color(255, 255, 255, alpha), nil, 2, 1)
61 |
62 | if (alpha == 0) then
63 | if (v.callback) then
64 | v.callback()
65 | end
66 |
67 | table.remove(nut.scroll.buffer, k)
68 | end
69 | end
70 | end
71 |
72 | netstream.Hook("nut_ScrollData", function(data)
73 | nut.scroll.Add(data)
74 | end)
75 | else
76 | --[[
77 | Purpose: Sends a net message to call nut.scroll.Add client-side. If
78 | provided a callback, it will be called once the text finishes 'typing.'
79 | --]]
80 | function nut.scroll.Send(text, receiver, callback)
81 | netstream.Start(receiver, "nut_ScrollData", text)
82 |
83 | timer.Simple(CHAR_DELAY*#text + 4, function()
84 | if (callback) then
85 | callback()
86 | end
87 | end)
88 | end
89 | end
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/entities/entities/nut_barrel.lua:
--------------------------------------------------------------------------------
1 | ENT.Type = "anim"
2 | ENT.PrintName = "Barrel"
3 | ENT.Author = "Black Tea"
4 | ENT.Spawnable = false
5 | ENT.Category = "Nutscript"
6 | ENT.RenderGroup = RENDERGROUP_BOTH
7 | ENT.PersistentSave = false;
8 |
9 | if (SERVER) then
10 | function ENT:Initialize()
11 | self:SetModel("models/props_phx/empty_barrel.mdl")
12 | self:PhysicsInit(SOLID_VPHYSICS)
13 | self:SetMoveType(MOVETYPE_VPHYSICS)
14 | self:SetNetVar("active", true)
15 | self:SetUseType(SIMPLE_USE)
16 | self.loopsound = CreateSound( self, "ambient/fire/fire_small_loop1.wav" )
17 | self.loopsound:Play()
18 | local physicsObject = self:GetPhysicsObject()
19 |
20 | if (IsValid(physicsObject)) then
21 | physicsObject:Wake()
22 | end
23 | end
24 |
25 | function ENT:Use(activator)
26 | end
27 | else
28 | function ENT:Initialize()
29 | self.emitter = ParticleEmitter( self:GetPos() )
30 | self.emittime = CurTime()
31 | end
32 |
33 | function ENT:Think()
34 | if self:GetNetVar("active") then
35 | local firepos = self:GetPos() + ( self:GetUp() * 40 )
36 | local dlight = DynamicLight(self:EntIndex())
37 |
38 | dlight.Pos = firepos
39 | dlight.r = 255
40 | dlight.g = 170
41 | dlight.b = 0
42 | dlight.Brightness = 4
43 | dlight.Size = 256
44 | dlight.Decay = 1024
45 | dlight.DieTime = CurTime() + 0.1
46 | end
47 | end
48 |
49 | local GLOW_MATERIAL = Material("sprites/glow04_noz.vmt")
50 | function ENT:Draw()
51 | self:DrawModel()
52 | end
53 | function ENT:DrawTranslucent()
54 | if self:GetNetVar("active") then
55 | local firepos = self:GetPos() + ( self:GetUp() * 30 )
56 |
57 | -- Fire
58 | render.SetMaterial( nut_Fire_sprite.fire )
59 | render.DrawBeam(
60 | firepos, firepos + self:GetUp()*50,
61 | 40,
62 | 0.99,0,
63 | Color(255,255,255,255)
64 | )
65 | -- Glow
66 | local size = 20 + math.sin( RealTime()*15 ) * 15
67 | render.SetMaterial(GLOW_MATERIAL)
68 | render.DrawSprite(firepos + self:GetUp()*12, size, size, Color( 255, 162, 76, 255 ) )
69 |
70 | if self.emittime < CurTime() then
71 | local smoke = self.emitter:Add( "particle/smokesprites_000"..math.random(1,9), firepos )
72 | smoke:SetVelocity(Vector( 0, 0, 150))
73 | smoke:SetDieTime(math.Rand(0.6,2.3))
74 | smoke:SetStartAlpha(math.Rand(150,200))
75 | smoke:SetEndAlpha(0)
76 | smoke:SetStartSize(math.random(0,5))
77 | smoke:SetEndSize(math.random(33,55))
78 | smoke:SetRoll(math.Rand(180,480))
79 | smoke:SetRollDelta(math.Rand(-3,3))
80 | smoke:SetColor(50,50,50)
81 | smoke:SetGravity( Vector( 0, 0, 10 ) )
82 | smoke:SetAirResistance(200)
83 | self.emittime = CurTime() + .1
84 | end
85 | end
86 |
87 | end
88 | end
89 |
--------------------------------------------------------------------------------
/nutscript/plugins/act/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 |
3 | function PLUGIN:CanFallOver( client )
4 | if (client:GetOverrideSeq()) then
5 | nut.util.Notify(PLUGIN:GetPluginLanguage("act_cant_fallover"), client)
6 | return false
7 | end
8 | end
9 |
10 | function PLUGIN:PlayerStartSeq(client, sequence)
11 | if (client:GetNutVar("nextAct", 0) >= CurTime()) then
12 | nut.util.Notify(PLUGIN:GetPluginLanguage("act_veryfast"), client)
13 |
14 | return
15 | end
16 |
17 | local data = {}
18 | data.start = client:GetPos()
19 | data.endpos = data.start - Vector(0, 0, 1)
20 | data.filter = client
21 | data.mins = Vector(-16, -16, 0)
22 | data.maxs = Vector(16, 16, 16)
23 | local trace = util.TraceHull(data)
24 |
25 | if (!trace.Hit) then
26 | nut.util.Notify(PLUGIN:GetPluginLanguage("act_invoid"), client)
27 |
28 | return
29 | end
30 |
31 | if (AdvNut.hook.Run("CanStartSeq", client) == false) then
32 | return
33 | end
34 |
35 | local override = client:GetOverrideSeq()
36 | local class = nut.anim.GetClass(string.lower(client:GetModel()))
37 | local list = self.sequences[class]
38 |
39 | if (class and list) then
40 | if (override) then
41 | for k, v in pairs(list) do
42 | if (v[1] == override and v[2] == true) then
43 | self:PlayerExitSeq(client)
44 |
45 | return
46 | end
47 | end
48 | end
49 |
50 | local act = list[sequence]
51 |
52 | if (act) then
53 | if (act[3] and act[3](client) == false) then
54 | return
55 | end
56 |
57 | local time
58 |
59 | if (act[2] == true) then
60 | time = 0
61 | end
62 |
63 | time = client:SetOverrideSeq(act[1], time, function()
64 | client:Freeze(true)
65 | client:SetNetVar("seqCam", true)
66 | end, function()
67 | client:Freeze(false)
68 | client:SetNetVar("seqCam", nil)
69 | end)
70 |
71 | if (time and time > 0) then
72 | client:SetNutVar("nextAct", CurTime() + time + 1)
73 | end
74 |
75 | client:SetNutVar("inAct", true)
76 | else
77 | nut.util.Notify(PLUGIN:GetPluginLanguage("act_cant_model"), client)
78 | end
79 | else
80 | nut.util.Notify(PLUGIN:GetPluginLanguage("act_cant_model"), client)
81 | end
82 | end
83 |
84 | function PLUGIN:PlayerExitSeq(client)
85 | client:SetNutVar("nextAct", CurTime() + 1)
86 | client:ResetOverrideSeq()
87 | client:Freeze(false)
88 | client:SetNutVar("inAct", false)
89 | end
90 |
91 | function PLUGIN:PlayerDeath(client)
92 | self:PlayerExitSeq(client)
93 | end
94 |
95 | function PLUGIN:PlayerSpawn(client)
96 | self:PlayerExitSeq(client)
97 | end
98 |
99 | concommand.Add("nut_leaveact", function(client, command, arguments)
100 | if (IsValid(client) and client:GetNutVar("inAct") and CurTime() >= client:GetNutVar("nextAct", 0)) then
101 | PLUGIN:PlayerExitSeq(client)
102 | end
103 | end)
--------------------------------------------------------------------------------
/nutscript/gamemode/libs/sh_settings.lua:
--------------------------------------------------------------------------------
1 | nut.setting = nut.setting or {}
2 |
3 | if (CLIENT) then -- CLIENTSIDE TEST.
4 | nut.setting.vars = {}
5 | function nut.setting.Register(data)
6 | if (!data) then
7 | return
8 | end
9 |
10 | if (!table.HasValue(nut.setting.vars, data)) then
11 | table.insert(nut.setting.vars, data)
12 | end;
13 | end
14 |
15 | nut.setting.Register({
16 | name = nut.lang.Get("settings_crosshair"),
17 | var = "crosshair",
18 | type = "checker",
19 | category = nut.lang.Get("settings_category_framework")
20 | })
21 |
22 | nut.setting.Register({
23 | name = nut.lang.Get("settings_crosshair_size"),
24 | var = "crossSize",
25 | type = "slider",
26 | min = 0,
27 | max = 5,
28 | category = nut.lang.Get("settings_category_framework")
29 | })
30 |
31 | nut.setting.Register({
32 | name = nut.lang.Get("settings_crosshair_spacing"),
33 | var = "crossSpacing",
34 | type = "slider",
35 | min = 0,
36 | max = 20,
37 | category = nut.lang.Get("settings_category_framework")
38 | })
39 |
40 | nut.setting.Register({
41 | name = nut.lang.Get("settings_crosshair_alpha"),
42 | var = "crossAlpha",
43 | type = "slider",
44 | min = 0,
45 | max = 255,
46 | category = nut.lang.Get("settings_category_framework")
47 | })
48 |
49 | AdvNut.hook.Add("SchemaInitialized", "ClientSettingLoad", function()
50 | local contents
51 | local decoded
52 |
53 | if (file.Exists("advnutscript/settings.txt", "DATA")) then
54 | contents = file.Read("advnutscript/settings.txt", "DATA")
55 | end
56 |
57 | if (contents) then
58 | decoded = pon.decode(contents)
59 | end
60 |
61 | local customSettings = {}
62 | if decoded then
63 | customSettings = decoded
64 | end
65 |
66 | for k, v in pairs(customSettings) do
67 | nut.config[k] = v
68 | end
69 | end)
70 |
71 | AdvNut.hook.Add("ShutDown", "ClientSettingLoad", function()
72 | local customSettings = {}
73 | for k, v in pairs(nut.setting.vars) do
74 | customSettings[v.var] = nut.config[v.var]
75 | end
76 |
77 | local encoded = pon.encode(customSettings)
78 | file.CreateDir("advnutscript/")
79 | file.Write("advnutscript/settings.txt", encoded)
80 | end)
81 |
82 | function GM:AddSettingOptions(panel)
83 | for k, v in pairs(nut.setting.vars) do
84 | if (!panel.category[v.category]) then
85 | local category = panel:AddCategory( v.category )
86 |
87 | panel.category[v.category] = category
88 | end
89 |
90 | local category = panel.category[v.category]
91 |
92 | if (category) then
93 | if (v.type == "checker") then
94 | panel:AddChecker(category, v.name, v.var, v.prefixID);
95 | elseif (v.type == "slider") then
96 | panel:AddSlider(category, v.name, v.min, v.max, v.var, v.demical or 0, v.prefixID);
97 | end
98 | end
99 | end
100 | end
101 |
102 | end
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_system.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {};
2 |
3 | function PANEL:Init()
4 | self:AddTitle(nut.lang.Get("system"), color_black);
5 | self:SetSize(AdvNut.util.GetCurrentMenuSize());
6 | self:SetPos(AdvNut.util.GetCurrentMenuPos())
7 | self:MakePopup()
8 |
9 | self.noticePanel = vgui.Create("nut_NoticePanel", self);
10 | self.noticePanel:Dock(TOP);
11 | self.noticePanel:DockMargin(5, 5, 5, 0)
12 | self.noticePanel:SetType(4)
13 | self.noticePanel:SetText(nut.lang.Get("system_tip"));
14 |
15 | self.secondNoticePanel = vgui.Create("nut_NoticePanel", self);
16 | self.secondNoticePanel:Dock(TOP);
17 | self.secondNoticePanel:DockMargin(5, 5, 5, 0)
18 | self.secondNoticePanel:SetType(4)
19 | self.secondNoticePanel:SetText(nut.lang.Get("system_second_tip"));
20 |
21 | self.sheet = vgui.Create("DListView", self);
22 | self.sheet:Dock(FILL);
23 | self.sheet:DockMargin(5, 5, 5, 5);
24 | self.sheet:AddColumn(nut.lang.Get("system_key"));
25 | self.sheet:AddColumn(nut.lang.Get("system_value"));
26 | self.sheet.OnRowRightClick = function(panel, index, line)
27 | self.stringRequestPanel = Derma_StringRequest(nut.lang.Get("system_set_value"), nut.lang.Get("system_set_value_desc", line.type), tostring(line.var), function(var)
28 | local castedVar;
29 |
30 | if (line.type == "number") then
31 | castedVar = tonumber(var);
32 | elseif (line.type == "boolean") then
33 | castedVar = tobool(var);
34 | elseif (line.type == "string") then
35 | castedVar = line.var;
36 | end;
37 |
38 | if (castedVar != nil) then
39 | local configs = {
40 | key = line.index,
41 | var = castedVar
42 | };
43 | netstream.Start(AdvNut.util.CreateIdentifier("SetServerConfigs", SERVER), {key = line.index, var = castedVar});
44 | self.noticePanel:SetType(4)
45 | self.noticePanel:SetText(nut.lang.Get("system_tip"));
46 |
47 | self:Build();
48 | else
49 | self.noticePanel:SetType(5);
50 | self.noticePanel:SetText(nut.lang.Get("wrong_value"));
51 | end;
52 | end);
53 | end;
54 | self:Build();
55 | end
56 |
57 | function PANEL:Build()
58 | self.sheet:Clear();
59 | netstream.Start(AdvNut.util.CreateIdentifier("GetServerConfigs", SERVER));
60 |
61 | end;
62 |
63 | function PANEL:Close()
64 | if (self.stringRequestPanel) then
65 | self.stringRequestPanel:Remove();
66 | end;
67 |
68 | self:Remove();
69 | end;
70 |
71 | netstream.Hook(AdvNut.util.CreateIdentifier("GetServerConfigs", CLIENT), function(data)
72 | for index, config in SortedPairs(data) do
73 | local varType = type(config.var);
74 |
75 | if (varType != nil) then
76 | if (varType == "table" or varType == "function") then continue end;
77 |
78 | local line = nut.gui.system.sheet:AddLine(config.key, tostring(config.var));
79 | line.type = varType;
80 | line.index = config.key;
81 | line.var = config.var;
82 | end;
83 | end;
84 | end);
85 | vgui.Register("AdvNut_System", PANEL, "AdvNut_BaseForm");
--------------------------------------------------------------------------------
/nutscript/plugins/improvedcooking/entities/entities/nut_bucket.lua:
--------------------------------------------------------------------------------
1 | ENT.Type = "anim"
2 | ENT.PrintName = "Bucket"
3 | ENT.Author = "Black Tea"
4 | ENT.Spawnable = false
5 | ENT.Category = "Nutscript"
6 | ENT.RenderGroup = RENDERGROUP_BOTH
7 | ENT.PersistentSave = false;
8 |
9 | if (SERVER) then
10 | function ENT:Initialize()
11 | self:SetModel("models/props_junk/MetalBucket01a.mdl")
12 | self:PhysicsInit(SOLID_VPHYSICS)
13 | self:SetMoveType(MOVETYPE_VPHYSICS)
14 | self:SetNetVar("active", false)
15 | self:SetUseType(SIMPLE_USE)
16 | self.loopsound = CreateSound( self, "ambient/fire/fire_small_loop1.wav" )
17 | local physicsObject = self:GetPhysicsObject()
18 |
19 | if (IsValid(physicsObject)) then
20 | physicsObject:Wake()
21 | end
22 | end
23 |
24 | function ENT:Use(activator)
25 | self:SetNetVar("active", !self:GetNetVar("active", false))
26 | if self:GetNetVar("active") then
27 | self:EmitSound( "ambient/fire/mtov_flame2.wav", 75, 100 )
28 | self.loopsound:Play()
29 | else
30 | self:EmitSound( "ambient/fire/mtov_flame2.wav", 75, 250 )
31 | self.loopsound:Stop()
32 | end
33 | end
34 | else
35 | function ENT:Initialize()
36 | self.emitter = ParticleEmitter( self:GetPos() )
37 | self.emittime = CurTime()
38 | end
39 | function ENT:Think()
40 | if self:GetNetVar("active") then
41 | local firepos = self:GetPos() + ( self:GetUp() * -1 )
42 | local dlight = DynamicLight(self:EntIndex())
43 |
44 | dlight.Pos = firepos
45 | dlight.r = 255
46 | dlight.g = 170
47 | dlight.b = 0
48 | dlight.Brightness = 2
49 | dlight.Size = 200
50 | dlight.Decay = 512
51 | dlight.DieTime = CurTime() + 0.2
52 | end
53 | end
54 |
55 | local GLOW_MATERIAL = Material("sprites/glow04_noz.vmt")
56 | function ENT:Draw()
57 | self:DrawModel()
58 | end
59 | function ENT:DrawTranslucent()
60 | if self:GetNetVar("active") then
61 | local firepos = self:GetPos() + ( self:GetUp() * -1 )
62 | -- Fire
63 | render.SetMaterial( nut_Fire_sprite.fire )
64 | render.DrawBeam(
65 | firepos, firepos + self:GetUp()*25,
66 | 25,
67 | 0.99,0,
68 | Color(255,255,255,255)
69 | )
70 | -- Glow
71 | local size = 20 + math.sin( RealTime()*15 ) * 15
72 | render.SetMaterial(GLOW_MATERIAL)
73 | render.DrawSprite(firepos + self:GetUp()*3, size, size, Color( 255, 162, 76, 255 ) )
74 |
75 | if self.emittime < CurTime() then
76 | local smoke = self.emitter:Add( "particle/smokesprites_000"..math.random(1,9), firepos )
77 | smoke:SetVelocity(Vector( 0, 0, 100))
78 | smoke:SetDieTime(math.Rand(0.6,2.3))
79 | smoke:SetStartAlpha(math.Rand(150,200))
80 | smoke:SetEndAlpha(0)
81 | smoke:SetStartSize(math.random(0,5))
82 | smoke:SetEndSize(math.random(33,55))
83 | smoke:SetRoll(math.Rand(180,480))
84 | smoke:SetRollDelta(math.Rand(-3,3))
85 | smoke:SetColor(50,50,50)
86 | smoke:SetGravity( Vector( 0, 0, 10 ) )
87 | smoke:SetAirResistance(200)
88 | self.emittime = CurTime() + .1
89 | end
90 | end
91 |
92 | end
93 | end
94 |
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_classes.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | function PANEL:Init()
3 | self:SetPos(AdvNut.util.GetCurrentMenuPos())
4 | self:SetSize(AdvNut.util.GetCurrentMenuSize());
5 | self:AddTitle(nut.lang.Get("classes"));
6 | self:MakePopup()
7 |
8 | self.Paint = function(panel, w, h)
9 | surface.SetDrawColor(236, 242, 242, 255)
10 | surface.DrawRect(0, 0, w, h)
11 | end
12 |
13 | self.list = self:Add("AdvNut_ScrollPanel")
14 | self.list:Dock(FILL)
15 | self.list:SetDrawBackground(false)
16 |
17 | for k, v in SortedPairs(nut.class.GetByFaction(LocalPlayer():Team())) do
18 | if (LocalPlayer():CharClass() != k and v:PlayerCanJoin(LocalPlayer())) then
19 | local item = self.list:Add("nut_ClassItem")
20 | item:DockMargin(3, 3, 3, 0)
21 | item:Dock(TOP)
22 | item:SetClass(k)
23 | end
24 | end
25 | end
26 |
27 | function PANEL:Think()
28 | end
29 |
30 | function PANEL:Reload()
31 | local parent = self:GetParent()
32 |
33 | self:Remove()
34 |
35 | nut.gui.classes = vgui.Create("nut_Classes", parent)
36 | end
37 | vgui.Register("nut_Classes", PANEL, "AdvNut_BaseForm")
38 |
39 | local PANEL = {}
40 | function PANEL:Init()
41 | self:SetTall(48)
42 |
43 | self.icon = vgui.Create("SpawnIcon", self)
44 | self.icon:SetPos(4, 4)
45 | self.icon:SetSize(40, 40)
46 | self.icon:SetModel("models/error.mdl")
47 | self.icon:SetToolTip("No class set!")
48 |
49 | self.name = vgui.Create("DLabel", self)
50 | self.name:SetPos(48, 4)
51 | self.name:SetText("Class name")
52 | self.name:SetDark(true)
53 | self.name:SetFont("DermaDefaultBold")
54 |
55 | self.desc = vgui.Create("DLabel", self)
56 | self.desc:SetPos(48, 20)
57 | self.desc:SetText("Class desc")
58 | self.desc:SetDark(true)
59 | end
60 |
61 | function PANEL:SetClass(index)
62 | local class = nut.class.Get(index)
63 |
64 | if (!class) then
65 | return
66 | end
67 |
68 | self.class = class
69 |
70 | local model = class:GetModel()
71 |
72 | if (!model and class.faction) then
73 | local faction = nut.faction.GetByID(class.faction)
74 | local gender = LocalPlayer().character:GetVar("gender", "male")
75 |
76 | model = table.Random(faction[gender.."Models"])
77 | end
78 |
79 | if (model) then
80 | self.icon:SetModel(model, class:GetSkin())
81 | end
82 |
83 | self.name:SetText(class.name)
84 | self.name:SizeToContents()
85 |
86 | self.desc:SetText(class.desc or nut.lang.Get("no_desc"))
87 | self.desc:SizeToContents()
88 |
89 | self.icon:SetToolTip(nut.lang.Get("class_icon_tip", class.name))
90 | self.icon.DoClick = function(panel)
91 | netstream.Start("nut_ChooseClass", index)
92 |
93 | timer.Simple(0.25, function()
94 | nut.gui.classes:Reload()
95 | end)
96 | end
97 | end
98 |
99 | function PANEL:Paint(w, h)
100 | surface.SetDrawColor(40, 40, 40, 60)
101 | surface.DrawOutlinedRect(0, 0, w, h)
102 |
103 | surface.SetDrawColor(100, 100, 100, 20)
104 | surface.DrawRect(0, 0, w, h)
105 | end
106 | vgui.Register("nut_ClassItem", PANEL, "DPanel")
--------------------------------------------------------------------------------
/nutscript/plugins/improveddoors/sv_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN;
2 |
3 | PLUGIN.onPlayerSpawnLoaded = false;
4 | function PLUGIN:PlayerLoadout(client)
5 | client:Give("nut_keys")
6 | end
7 |
8 | function PLUGIN:OnCharChanged(client)
9 | for k, v in pairs(ents.GetAll()) do
10 | if (v:GetNetVar("owner") == client) then
11 | v:SetNetVar("title", PLUGIN:GetPluginLanguage("doors_can_buy"));
12 | v:SetNetVar("owner", NULL);
13 | end
14 | end
15 | end
16 |
17 | function PLUGIN:DoorSetUnownable(entity)
18 | entity:SetNetVar("unownable", true);
19 | end
20 |
21 | function PLUGIN:LockDoor(entity)
22 | entity:Fire("Close");
23 | entity:Fire("Lock", "", 0);
24 | entity:SetNetVar("locked", true);
25 | end
26 |
27 | function PLUGIN:UnlockDoor(entity)
28 | entity:Fire("Unlock");
29 | entity:SetNetVar("locked", false);
30 | end
31 |
32 | function PLUGIN:DoorSetOwnable(entity)
33 | entity:SetNetVar("unownable", false);
34 | end
35 |
36 | function PLUGIN:DoorSetHidden(entity, hidden)
37 | entity:SetNetVar("hidden", hidden);
38 | end
39 |
40 | function PLUGIN:KeyPress(client, key)
41 | if (key == IN_USE) then
42 | local entity = AdvNut.util.GetPlayerTraceEntity(client);
43 | if (AdvNut.hook.Run("PlayerCanUseDoor", client, entity) == false) then
44 | return;
45 | end
46 |
47 | if (IsValid(entity)) then
48 | return AdvNut.hook.Run("PlayerUseDoor", client, entity);
49 | else
50 | return;
51 | end;
52 | end;
53 | end;
54 |
55 | function PLUGIN:LoadData()
56 | self.data = self:ReadTable();
57 |
58 | for k, v in pairs(self.data) do
59 | local entity
60 |
61 | if (v.position) then
62 | entity = ents.FindInSphere(v.position, 10)[1]
63 | self.data[k] = entity.EntIndex();
64 | elseif (v.index) then
65 | for k2, v2 in pairs(ents.GetAll()) do
66 | if (nut.util.GetCreationID(v2) == v.index) then
67 | entity = v2;
68 | break;
69 | end
70 | end
71 | end
72 |
73 | if (IsValid(entity)) then
74 | entity:SetNetVar("title", v.title);
75 | entity:SetNetVar("desc", v.desc);
76 | entity:SetNetVar("unownable", v.ownable);
77 | entity:SetNetVar("owner", v.owner);
78 | entity:SetNetVar("hidden", v.hidden);
79 | entity:SetNetVar("locked", v.locked);
80 |
81 | if (v.locked) then
82 | self:LockDoor(entity);
83 | end
84 | end
85 | end
86 | end
87 |
88 | function PLUGIN:SaveData()
89 | local data = {}
90 |
91 | for k, v in pairs(ents.GetAll()) do
92 | if (IsValid(v)) then
93 | local title = v:GetNetVar("title", "")
94 |
95 | if (PLUGIN:IsDoor(v)) then
96 | data[#data + 1] = {
97 | index = nut.util.GetCreationID(v),
98 | title = v:GetNetVar("title"),
99 | desc = v:GetNetVar("desc"),
100 | ownable = v:GetNetVar("unownable"),
101 | owner = v:GetNetVar("owner", nil),
102 | hidden = v:GetNetVar("hidden", false),
103 | locked = v:GetNetVar("locked", false)
104 | }
105 | end
106 | end
107 | end
108 |
109 | self:WriteTable(data)
110 | end
--------------------------------------------------------------------------------
/nutscript/gamemode/sv_config.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Purpose: Provides a table of configuration values that are to be used in the script and allow
3 | easier customization of the script.
4 | --]]
5 |
6 | -- The module to use for MySQL. ("mysqloo/tmysql4/sqlite)
7 | -- SQLite is local, meaning you DO NOT need a database!
8 | nut.config.Register("dbModule", "sqlite", SERVER);
9 |
10 | -- The IP or address of the host for the database.
11 | nut.config.Register("dbHost", "127.0.0.1", SERVER);
12 |
13 | -- The user to login as.
14 | nut.config.Register("dbUser", "root", SERVER);
15 |
16 | -- What the user's password is.
17 | nut.config.Register("dbPassword", "derp", SERVER);
18 |
19 | -- The database that will be used for the framework. Make sure you have the .sql file already inside!
20 | nut.config.Register("dbDatabase", "nutscript", SERVER);
21 |
22 | -- The table for characters.
23 | nut.config.Register("dbTable", "characters", SERVER);
24 |
25 | -- Table for player whitelists and data.
26 | nut.config.Register("dbPlyTable", "players", SERVER);
27 |
28 | -- The port to connect for the database.
29 | nut.config.Register("dbPort", 3306, SERVER);
30 |
31 | -- Whether or not players can suicide.
32 | nut.config.Register("canSuicide", false, SERVER);
33 |
34 | -- What the default flags are for players. This does not affect characters that are already made
35 | -- prior to changing this config.
36 | nut.config.Register("defaultFlags", "", SERVER);
37 |
38 | -- What the fall damage is set to by multiplying this scale by the velocity.
39 | nut.config.Register("fallDamageScale", 0.85, SERVER);
40 |
41 | -- Whether or not players can use the flashlight.
42 | nut.config.Register("flashlight", true, SERVER);
43 |
44 | -- Whether or not players automatically get nut_fists
45 | nut.config.Register("nutFists", true, SERVER);
46 |
47 | -- The starting amount of money.
48 | nut.config.Register("startingAmount", 0, SERVER);
49 |
50 | -- How high players can jump by default.
51 | nut.config.Register("jumpPower", 128, SERVER);
52 |
53 | nut.config.Register("deathTime", 300, SERVER);
54 |
55 | -- Determines whether or not voice chat is allowed.
56 | nut.config.Register("allowVoice", false, SERVER);
57 |
58 | -- If true, will have voices fade over distance.
59 | nut.config.Register("voice3D", false, SERVER);
60 |
61 | -- The delay between OOC messages for a player in seconds.
62 | nut.config.Register("oocDelay", 10, SERVER);
63 |
64 | -- The delay between LOOC messages for a player in seconds.
65 | nut.config.Register("loocDelay", 10, SERVER);
66 |
67 | -- Clears the map of unwanted entities. ("props, vehicles, etc...)
68 | nut.config.Register("clearMaps", true, SERVER);
69 |
70 | -- Whether or not holding C and pressing Persist will NOT persist props.
71 | -- If set to false or nil, the gamemode will automatically turn on sbox_persist.
72 | nut.config.Register("noPersist", false, SERVER);
73 |
74 | -- The model for dropped money.
75 | nut.config.Register("moneyModel", "models/props_lab/box01a.mdl", SERVER);
76 |
77 | -- Whether or not server saves the chat.
78 | nut.config.Register("savechat", true, SERVER);
79 |
80 | -- The lifetime of the dropped item.
81 | nut.config.Register("itemTime", 1200, SERVER);
82 |
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_custom_tooltip.lua:
--------------------------------------------------------------------------------
1 | /*
2 | Override By Tensa
3 | */
4 |
5 | local PANEL = {}
6 | local tooltip_delay = CreateClientConVar("tooltip_delay", "0.5", true, false);
7 |
8 | function PANEL:Init()
9 | self:SetDrawOnTop(true)
10 | self.DeleteContentsOnClose = false;
11 | self:SetText("")
12 | self:SetFont("nut_SmallFont");
13 | end
14 |
15 | function PANEL:UpdateColours( skin )
16 | return self:SetTextStyleColor( skin.Colours.TooltipText )
17 | end
18 |
19 | function PANEL:SetContents( panel, bDelete )
20 | panel:SetParent( self )
21 |
22 | self.Contents = panel
23 | self.DeleteContentsOnClose = bDelete or false
24 | self.Contents:SizeToContents()
25 | self:InvalidateLayout( true )
26 |
27 | self.Contents:SetVisible( false )
28 | end
29 |
30 | function PANEL:PerformLayout()
31 | if ( self.Contents ) then
32 | self:SetWide( self.Contents:GetWide() + 8 )
33 | self:SetTall( self.Contents:GetTall() + 8 )
34 | self.Contents:SetPos( 4, 4 )
35 | else
36 | local w, h = self:GetContentSize()
37 | self:SetSize( w + 8, h + 6 )
38 | self:SetContentAlignment( 5 )
39 | end
40 | end
41 |
42 | local Mat = Material( "vgui/arrow" )
43 |
44 | function PANEL:DrawArrow( x, y )
45 | self.Contents:SetVisible( true )
46 |
47 | surface.SetMaterial( Mat )
48 | surface.DrawTexturedRect( self.ArrowPosX + x, self.ArrowPosY + y, self.ArrowWide, self.ArrowTall )
49 | end
50 |
51 | function PANEL:PositionTooltip()
52 | if ( !IsValid( self.TargetPanel ) ) then
53 | self:Remove()
54 | return
55 | end
56 |
57 | self:PerformLayout()
58 |
59 | local x, y = input.GetCursorPos()
60 | local w, h = self:GetSize()
61 |
62 | local lx, ly = self.TargetPanel:LocalToScreen( 0, 0 )
63 |
64 | y = y - 50
65 |
66 | y = math.min( y, ly - h * 1.5 )
67 | if ( y < 2 ) then y = 2 end
68 |
69 | -- Fixes being able to be drawn off screen
70 | self:SetPos( math.Clamp( x - w * 0.5, 0, ScrW() - self:GetWide() ), math.Clamp( y, 0, ScrH() - self:GetTall() ) )
71 | end
72 |
73 | function PANEL:Paint( w, h )
74 | self:PositionTooltip();
75 | AdvNut.util.DrawRoundedBox(self, 3, 0, 0, w, h);
76 | end
77 |
78 | function PANEL:OpenForPanel( panel )
79 | self.TargetPanel = panel
80 | self:PositionTooltip()
81 |
82 | if ( tooltip_delay:GetFloat() > 0 ) then
83 |
84 | self:SetVisible( false )
85 | timer.Simple( tooltip_delay:GetFloat(), function()
86 |
87 | if ( !IsValid( self ) ) then return end
88 | if ( !IsValid( panel ) ) then return end
89 |
90 | self:PositionTooltip()
91 | self:SetVisible( true )
92 |
93 | end )
94 | end
95 | end
96 |
97 | function PANEL:Close()
98 | if ( !self.DeleteContentsOnClose && self.Contents ) then
99 | self.Contents:SetVisible( false )
100 | self.Contents:SetParent( nil )
101 | end
102 |
103 | self:Remove()
104 | end
105 |
106 | function PANEL:GenerateExample( ClassName, PropertySheet, Width, Height )
107 | local ctrl = vgui.Create( "DButton" )
108 | ctrl:SetText( "Hover me" )
109 | ctrl:SetWide( 200 )
110 | ctrl:SetTooltip( "This is a tooltip" )
111 |
112 | PropertySheet:AddSheet( ClassName, ctrl, nil, true, true )
113 | end
114 |
115 | derma.DefineControl( "DTooltip", "", PANEL, "DLabel" )
--------------------------------------------------------------------------------
/nutscript/gamemode/libs/sh_config.lua:
--------------------------------------------------------------------------------
1 |
2 | nut.config = nut.config or {};
3 | nut.config.__ConfigStruct = nut.config.__ConfigStruct or {};
4 |
5 | SHARE = 3;
6 |
7 | CONFIG_VAR_TYPE_NUMBER = "number";
8 | CONFIG_VAR_TYPE_STRING = "string";
9 | CONFIG_VAR_TYPE_BOOL = "boolean";
10 | CONFIG_VAR_TYPE_TABLE = "table";
11 |
12 | CONFIG_VAR_VALID_OK = 1;
13 | CONFIG_VAR_VALID_REGISTERED = 2;
14 | CONFIG_VAR_VALID_NOT_REGISTERED = 3;
15 | CONFIG_VAR_VALID_MISS_MATCHED = 4;
16 |
17 | CONFIG_VAR_VALID_IS_REGISTERED = 1;
18 | CONFIG_VAR_VALID_IS_SETABLE = 2;
19 |
20 | function nut.config.IsValid(key, value, callType)
21 | if (callType == CONFIG_VAR_VALID_IS_REGISTERED) then
22 | if (nut.config.__ConfigStruct[key] != nil) then
23 | return CONFIG_VAR_VALID_REGISTERED;
24 | else
25 | return CONFIG_VAR_VALID_NOT_REGISTERED;
26 | end
27 | elseif (callType == CONFIG_VAR_VALID_IS_SETABLE) then
28 | if (nut.config.__ConfigStruct[key] == nil) then
29 | return CONFIG_VAR_VALID_NOT_REGISTERED;
30 | elseif (nut.config.__ConfigStruct[key].VarType != type(value)) then
31 | return CONFIG_VAR_VALID_MISS_MATCHED;
32 | else
33 | return CONFIG_VAR_VALID_OK;
34 | end
35 | else
36 | return CONFIG_VAR_VALID_MISS_MATCHED;
37 | end
38 | end
39 |
40 | function nut.config.Register(key, value, netType)
41 | local isValid = nut.config.IsValid(key, nil, CONFIG_VAR_VALID_IS_REGISTERED);
42 | if (isValid == CONFIG_VAR_VALID_REGISTERED) then
43 | if(nut.config.IsValid(key, value, CONFIG_VAR_VALID_IS_SETABLE) != CONFIG_VAR_VALID_OK) then
44 | MsgC(Color(255, 0, 0, 255), string.format("Dup Config Register Call, Key : %s / Error Code : %d\n", key, isValid));
45 | else
46 | nut.config[key] = value;
47 | end
48 | elseif (type(value) != CONFIG_VAR_TYPE_BOOL && type(value) != CONFIG_VAR_TYPE_NUMBER && type(value) != CONFIG_VAR_TYPE_STRING && type(value) != CONFIG_VAR_TYPE_TABLE) then
49 | MsgC(Color(255, 0, 0, 255), string.format("Not Valid Var Type : %s / Error Code : %d\n", type(value), CONFIG_VAR_VALID_MISS_MATCHED));
50 | else
51 | nut.config[key] = value;
52 | nut.config.__ConfigStruct[key] = {Key = key, VarType = type(value), NetType = netType};
53 | end
54 | end
55 |
56 | function nut.config.Set(key, value)
57 | local isValid = nut.config.IsValid(key, value, CONFIG_VAR_VALID_IS_SETABLE);
58 | if (isValid != CONFIG_VAR_VALID_OK) then
59 | MsgC(Color(255, 0, 0, 255), string.format("Not Valid Key Value : %s / Error Code : %d\n", key, isValid));
60 | else
61 | nut.config[key] = value;
62 | end
63 | end
64 |
65 | function nut.config.Get(key, default)
66 | return nut.config[key] or default;
67 | end
68 |
69 | function nut.config.GetType(key, default)
70 | local isValid = nut.config.IsValid(key, nil, CONFIG_VAR_VALID_IS_REGISTERED);
71 | if (isValid == CONFIG_VAR_VALID_NOT_REGISTERED) then
72 | MsgC(Color(255, 0, 0, 255), string.format("Not Valid Key Valud : %s / Error Code : %d\n", key, isValid));
73 | return default;
74 | else
75 | return nut.config.__ConfigStruct[key].VarType;
76 | end
77 | end
78 |
79 | function nut.config.GetAll()
80 | local tmpTable = table.Copy(nut.config);
81 | tmpTable.Register = nil;
82 | tmpTable.Get = nil;
83 | tmpTable.GetAll = nil;
84 | tmpTable.__ConfigStruct = nil;
85 |
86 | return tmpTable;
87 | end
--------------------------------------------------------------------------------
/nutscript/gamemode/libs/sh_logging.lua:
--------------------------------------------------------------------------------
1 | -- since it's really sensitive. localized.
2 |
3 | local timeColor = Color(0, 255, 0)
4 | local textColor = Color(255, 255, 255)
5 |
6 | if SERVER then
7 | local serverLog = {}
8 | local autosavePerLines = 1000
9 |
10 | -- for later filter use.
11 | LOG_FILTER_DEVELOPER = 0
12 | LOG_FILTER_CRITICAL = 1
13 | LOG_FILTER_MAJOR = 2
14 | LOG_FILTER_ITEM = 3
15 | LOG_FILTER_CHAT = 4
16 | LOG_FILTER_NOSAVE = 5
17 | LOG_FILTER_CONCOMMAND = 6
18 |
19 | --[[
20 | Purpose: Add a line to the log.
21 | --]]
22 | function nut.util.AddLog(string, filter, consoleprint)
23 | if (consoleprint != false) then
24 | MsgC(timeColor, "[" .. os.date() .. "] ")
25 | MsgC(textColor, string .. "\n")
26 |
27 | for k, client in pairs(player.GetAll()) do
28 | if (client:IsAdmin() and client:GetInfoNum("nut_showlogs", 1) > 0) then
29 | netstream.Start(client, "nut_SendLogLine", string)
30 | end
31 | end
32 | end
33 |
34 | if (filter != LOG_FILTER_NOSAVE) then
35 | table.insert(serverLog, "[" .. os.date() .. "] " .. string)
36 | end
37 |
38 | if (#serverLog >= autosavePerLines) then
39 | nut.util.SaveLog()
40 | end
41 | end
42 | --[[
43 | Purpose: Get the current log
44 | --]]
45 | function nut.util.GetLog()
46 | return serverLog
47 | end
48 |
49 | --[[
50 | Purpose: Get a log.
51 | --]]
52 | function nut.util.SendLog(client)
53 | -- body
54 | end
55 |
56 | --[[
57 | Purpose: Save the log to the server.
58 | --]]
59 | function nut.util.SaveLog(autosave)
60 | /*
61 | -- for later use.
62 | local filename = string.Replace(os.date(),":","_")
63 | filename = string.Replace(filename,"/","_")
64 | file.CreateDir("nutscript/"..SCHEMA.uniqueID.."/logs")
65 | nut.util.WriteTable("logs/"..filename, serverLog, true)
66 | */
67 | local string = ""
68 | for k, v in pairs(serverLog) do
69 | string = string .. v .. "\n"
70 | end
71 | local filename = string.Replace(os.date(),":","_")
72 | filename = string.Replace(filename,"/","_")
73 | filename = filename .. "_readable"
74 | file.CreateDir("nutscript/"..SCHEMA.uniqueID.."/logs")
75 | file.Write("nutscript/"..SCHEMA.uniqueID.."/logs/".. filename ..".txt", string)
76 | serverLog = {}
77 | end
78 | /*
79 | --[[
80 | Purpose: Load the log and send to the admin.
81 | Reserved for next feature.
82 | --]]
83 | function nut.util.LoadLog()
84 | -- body
85 | end
86 | */
87 |
88 | AdvNut.hook.Add("PlayerSay", "nut_ChatLogging", function(player, text)
89 | if nut.config.savechat then
90 | nut.util.AddLog(Format("%s: %s", player:Name(), text), LOG_FILTER_CHAT, false)
91 | else
92 | nut.util.AddLog(Format("%s: %s", player:Name(), text), LOG_FILTER_NOSAVE, false)
93 | end
94 | end)
95 |
96 | AdvNut.hook.Add("ShutDown", "nut_SaveLog", function(player, text)
97 | nut.util.SaveLog()
98 | end)
99 | else
100 | NUT_CVAR_SHOWLOGS = CreateClientConVar("nut_showlogs", "1", true, true)
101 |
102 | netstream.Hook("nut_SendLogLine", function(string)
103 | if (LocalPlayer():IsAdmin()) then
104 | MsgC(timeColor, "[" .. os.date() .. "] ")
105 | MsgC(textColor, string .. "\n")
106 | end
107 | end)
108 | end
--------------------------------------------------------------------------------
/nutscript/gamemode/items/base/sh_part.lua:
--------------------------------------------------------------------------------
1 | BASE.name = "Base Parts"
2 | BASE.uniqueID = "base_part"
3 | BASE.category = nut.lang.Get("part")
4 | --BASE.type = "hat" -- Optional.
5 | BASE.data = {
6 | Equipped = false
7 | }
8 | BASE.functions = {}
9 | BASE.functions.Equip = {
10 | text = nut.lang.Get("wear"),
11 | run = function(itemTable, client, data)
12 | if (SERVER) then
13 | if (client:HasPartModel(itemTable.uniqueID)) then
14 | nut.util.Notify(nut.lang.Get("already_wear_part"), client)
15 |
16 | return false
17 | end
18 | if (itemTable.type and IsValid(client:GetNutVar(itemTable.type))) then
19 | nut.util.Notify(nut.lang.Get("already_wear_parttype", itemTable.type), client)
20 |
21 | return false
22 | end
23 | if itemTable.type then
24 | client:SetNutVar(itemTable.type, itemTable.unequID)
25 | end
26 | client:AddPartModel(itemTable.uniqueID, itemTable.partdata)
27 | local newData = table.Copy(data)
28 | newData.Equipped = true
29 | client:UpdateInv(itemTable.uniqueID, 1, newData, true)
30 | AdvNut.hook.Run("OnPartEquipped", client, itemTable, true)
31 | end
32 | end,
33 | shouldDisplay = function(itemTable, data, entity)
34 | return !data.Equipped or data.Equipped == nil
35 | end
36 | }
37 | BASE.functions.Unequip = {
38 | text = nut.lang.Get("unwear"),
39 | run = function(itemTable, client, data)
40 | if (SERVER) then
41 | if itemTable.type then
42 | client:SetNutVar(itemTable.type, nil)
43 | end
44 | client:RemovePartModel(itemTable.uniqueID, itemTable.partdata)
45 | local newData = table.Copy(data)
46 | newData.Equipped = false
47 | client:UpdateInv(itemTable.uniqueID, 1, newData, true)
48 | AdvNut.hook.Run("OnPartEquipped", client, itemTable, false)
49 | return true
50 | end
51 | end,
52 | shouldDisplay = function(itemTable, data, entity)
53 | return data.Equipped == true
54 | end
55 | }
56 |
57 | local size = 16
58 | local border = 4
59 | local distance = size + border
60 | local tick = Material("icon16/tick.png")
61 |
62 | function BASE:PaintIcon(w, h)
63 | if (self.data.Equipped) then
64 | surface.SetDrawColor(0, 0, 0, 50)
65 | surface.DrawRect(w - distance - 1, w - distance - 1, size + 2, size + 2)
66 |
67 | surface.SetDrawColor(255, 255, 255)
68 | surface.SetMaterial(tick)
69 | surface.DrawTexturedRect(w - distance, w - distance, size, size)
70 | end
71 | end
72 |
73 | function BASE:CanTransfer(client, data)
74 | if (data.Equipped) then
75 | nut.util.Notify(nut.lang.Get("cant_wear_part"), client)
76 | end
77 |
78 | return !data.Equipped
79 | end
80 |
81 | if (SERVER) then
82 | AdvNut.hook.Add("PlayerSpawn", "nut_PartBase", function(client)
83 | timer.Simple(0.1, function()
84 | if (!IsValid(client) or !client.character) then
85 | return
86 | end
87 | client:ResetPartModels()
88 | for class, items in pairs(client:GetInventory()) do
89 | local itemTable = nut.item.Get(class)
90 |
91 | if (itemTable and itemTable.partdata) then
92 | for k, v in pairs(items) do
93 | if (v.data.Equipped) then
94 | client:AddPartModel(itemTable.uniqueID, itemTable.partdata)
95 | end
96 | end
97 | end
98 | end
99 | end)
100 | end)
101 | end
102 |
--------------------------------------------------------------------------------
/nutscript/gamemode/kernel/netstreams/sv_netstreams.lua:
--------------------------------------------------------------------------------
1 | netstream.Hook("nut_LocalPlayerValid", function(client)
2 | if (!client:GetNutVar("validated")) then
3 | AdvNut.hook.Run("OnLocalPlayerValid", client)
4 | client:SetNutVar("validated", true)
5 | end
6 | end)
7 |
8 | netstream.Hook(AdvNut.util.CreateIdentifier("PlayerGiveWhitelist", SERVER), function(client, data)
9 | local factionName = data.factionName;
10 | local factionIndex = data.factionIndex;
11 | local target = data.target;
12 |
13 | if (!nut.faction.CanBe(target, factionIndex)) then
14 | target:GiveWhitelist(factionIndex);
15 | nut.util.Notify(nut.lang.Get("whitelisted", client:Name(), target:Name(), factionName))
16 | else
17 | nut.util.Notify(nut.lang.Get("already_whitelisted"), client);
18 | end;
19 | end);
20 |
21 | netstream.Hook(AdvNut.util.CreateIdentifier("PlayerTakeWhitelist", SERVER), function(client, data)
22 | local factionName = data.factionName;
23 | local factionIndex = data.factionIndex;
24 | local target = data.target;
25 |
26 | if (nut.faction.CanBe(target, factionIndex)) then
27 | target:TakeWhitelist(factionIndex);
28 | nut.util.Notify(nut.lang.Get("blacklisted", client:Name(), target:Name(), factionName));
29 | else
30 | nut.util.Notify(nut.lang.Get("not_whitelisted"), target);
31 | end;
32 | end);
33 |
34 | netstream.Hook(AdvNut.util.CreateIdentifier("PlayerGiveFlags", SERVER), function(client, data)
35 | local flags = data.flags;
36 | local target = data.target;
37 |
38 | target:GiveFlag(flags);
39 | nut.util.Notify(nut.lang.Get("flags_give", client:Name(), flags, target:Name()));
40 | end);
41 |
42 | netstream.Hook(AdvNut.util.CreateIdentifier("PlayerTakeFlags", SERVER), function(client, data)
43 | local flags = data.flags;
44 | local target = data.target;
45 |
46 | target:TakeFlag(flags);
47 | nut.util.Notify(nut.lang.Get("flags_take", client:Name(), flags, target:Name()));
48 | end);
49 |
50 | netstream.Hook("PlayerKick", function(client, data)
51 | local reason = data.reason;
52 | local target = data.target;
53 |
54 | target:Kick(reason);
55 | end);
56 |
57 | netstream.Hook(AdvNut.util.CreateIdentifier("PlayerBan", SERVER), function(client, data)
58 | local time = data.time
59 | local target = data.target;
60 |
61 | target:Ban(time, true);
62 | end);
63 |
64 | netstream.Hook(AdvNut.util.CreateIdentifier("GetServerConfigs", SERVER), function(client, data)
65 | local configs = {};
66 | for key, var in pairs(nut.config) do
67 | if (type(var) == "function" or type(var) == "table") then
68 | continue;
69 | else
70 | table.insert(configs, {key = key, var = var});
71 | end;
72 | end;
73 |
74 | netstream.Start(client, AdvNut.util.CreateIdentifier("GetServerConfigs", CLIENT), configs);
75 | end);
76 |
77 | netstream.Hook(AdvNut.util.CreateIdentifier("SetCharName", SERVER), function(client, data)
78 | data.target.character:SetVar("charname", data.name);
79 | end);
80 |
81 | netstream.Hook(AdvNut.util.CreateIdentifier("SetServerConfigs", SERVER), function(client, data)
82 | local key = data.key;
83 | local var = data.var
84 |
85 | nut.config[key] = var;
86 | AdvNut.cachedConfig = nut.config;
87 | nut.util.Notify(nut.lang.Get("system_notify", client:Name(), key, var));
88 |
89 | for index, _client in pairs(player.GetAll()) do
90 | netstream.Start(_client, AdvNut.util.CreateIdentifier("SetConfigs", CLIENT), {key = key, var = var});
91 | end;
92 | end);
--------------------------------------------------------------------------------
/nutscript/gamemode/items/base/sh_weapon.lua:
--------------------------------------------------------------------------------
1 | BASE.name = "Base Weapon"
2 | BASE.uniqueID = "base_wep"
3 | BASE.category = nut.lang.Get("weapon")
4 | BASE.class = "weapon_crowbar"
5 | BASE.type = "melee"
6 | BASE.data = {
7 | Equipped = false
8 | }
9 | BASE.functions = {}
10 | BASE.functions.Equip = {
11 | text = nut.lang.Get("wp_equip"),
12 | run = function(itemTable, client, data)
13 | if (SERVER) then
14 | if (client:HasWeapon(itemTable.class)) then
15 | nut.util.Notify(nut.lang.Get("already_equip_weapon"), client)
16 |
17 | return false
18 | end
19 |
20 | if (nut.config.noMultipleWepSlots and IsValid(client:GetNutVar(itemTable.type))) then
21 | nut.util.Notify(nut.lang.Get("already_wear_parttype", itemTable.type), client)
22 |
23 | return false
24 | end
25 |
26 | local weapon = client:Give(itemTable.class)
27 |
28 | if (IsValid(weapon)) then
29 | client:SetNutVar(itemTable.type, weapon)
30 | client:SelectWeapon(itemTable.class)
31 | end
32 |
33 | local newData = table.Copy(data)
34 | newData.Equipped = true
35 |
36 | client:UpdateInv(itemTable.uniqueID, 1, newData, true)
37 | AdvNut.hook.Run("OnWeaponEquipped", client, itemTable, true)
38 | end
39 | end,
40 | shouldDisplay = function(itemTable, data, entity)
41 | return !data.Equipped or data.Equipped == nil
42 | end
43 | }
44 | BASE.functions.Unequip = {
45 | text = nut.lang.Get("wp_unequip"),
46 | run = function(itemTable, client, data)
47 | if (SERVER) then
48 | if (client:HasWeapon(itemTable.class)) then
49 | client:SetNutVar(itemTable.type, nil)
50 | client:StripWeapon(itemTable.class)
51 | end
52 |
53 | local newData = table.Copy(data)
54 | newData.Equipped = false
55 |
56 | client:UpdateInv(itemTable.uniqueID, 1, newData, true)
57 | AdvNut.hook.Run("OnWeaponEquipped", client, itemTable, false)
58 | return true
59 | end
60 | end,
61 | shouldDisplay = function(itemTable, data, entity)
62 | return data.Equipped == true
63 | end
64 | }
65 |
66 | local size = 16
67 | local border = 4
68 | local distance = size + border
69 | local tick = Material("icon16/tick.png")
70 |
71 | function BASE:PaintIcon(w, h)
72 | if (self.data.Equipped) then
73 | surface.SetDrawColor(0, 0, 0, 50)
74 | surface.DrawRect(w - distance - 1, w - distance - 1, size + 2, size + 2)
75 |
76 | surface.SetDrawColor(255, 255, 255)
77 | surface.SetMaterial(tick)
78 | surface.DrawTexturedRect(w - distance, w - distance, size, size)
79 | end
80 | end
81 |
82 | function BASE:CanTransfer(client, data)
83 | if (data.Equipped) then
84 | nut.util.Notify(nut.lang.Get("cant_equip_weapon"), client)
85 | end
86 |
87 | return !data.Equipped
88 | end
89 |
90 | if (SERVER) then
91 | AdvNut.hook.Add("PlayerSpawn", "nut_WeaponBase", function(client)
92 | timer.Simple(0.1, function()
93 | if (!IsValid(client) or !client.character) then
94 | return
95 | end
96 |
97 | for class, items in pairs(client:GetInventory()) do
98 | local itemTable = nut.item.Get(class)
99 |
100 | if (itemTable and itemTable.class) then
101 | for k, v in pairs(items) do
102 | if (v.data.Equipped) then
103 | local weapon = client:Give(itemTable.class)
104 |
105 | client:SetNutVar(itemTable.type, weapon)
106 | end
107 | end
108 | end
109 | end
110 | end)
111 | end)
112 | end
113 |
--------------------------------------------------------------------------------
/nutscript/plugins/plugincommands/sh_commands.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN
2 |
3 | PLUGIN.CommandTemplate = function(client, arguments, minArgCount, doWork, isTraceEntity)
4 | if(doWork == nil) then
5 | return;
6 | end;
7 |
8 | if (#arguments < minArgCount) then
9 | if (isTraceEntity) then
10 | local entity = AdvNut.util.GetPlayerTraceEntity(client);
11 |
12 | if (entity and entity:IsPlayer()) then
13 | doWork(entity, arguments);
14 | else
15 | nut.util.Notify(nut.lang.Get("trace_not_player"));
16 | end;
17 | else
18 | nut.util.Notify(nut.lang.Get("wrong_arg"));
19 | end;
20 | else
21 | local target = nut.command.FindPlayer(client, arguments[1]);
22 |
23 | if (target) then
24 | doWork(target, arguments);
25 | else
26 | nut.util.Notify(nut.lang.Get("no_ply"), client);
27 | end;
28 | end;
29 | end;
30 |
31 | local charSpawn = {
32 | adminOnly = true,
33 | allowDead = true,
34 | syntax = nut.lang.Get("syntax_name"),
35 | onRun = function(client, arguments)
36 | PLUGIN.CommandTemplate(client, arguments, 1, function(target)
37 | target:Spawn();
38 | nut.util.Notify(PLUGIN:GetPluginLanguage("plugin_pc_spawn", client:Name(), target:Name()));
39 | end, true);
40 | end
41 | }
42 | nut.command.Register(charSpawn, "charspawn");
43 |
44 |
45 | local setRank = {
46 | superAdminOnly = true,
47 | allowDead = true,
48 | syntax = nut.lang.Get("syntax_name").." "..nut.lang.Get("syntax_rank"),
49 | onRun = function(client, arguments)
50 | PLUGIN.CommandTemplate(client, arguments, 2, function(target, arguments)
51 | target:SetUserGroup(arguments[2]);
52 | nut.util.Notify(PLUGIN:GetPluginLanguage("plugin_pc_spawn", client:Name(), target:Name()));
53 | end, false);
54 | end
55 | }
56 | nut.command.Register(setRank, "setrank");
57 |
58 |
59 | local plyKick = {
60 | adminOnly = true,
61 | allowDead = true,
62 | syntax = nut.lang.Get("syntax_name").." "..PLUGIN:GetPluginLanguage("plugin_pc_syntax_reason"),
63 | onRun = function(client, arguments)
64 | PLUGIN.CommandTemplate(client, arguments, 1, function(target)
65 | target:Kick(arguments[2] or "No Reason");
66 | nut.util.Notify(PLUGIN:GetPluginLanguage("plugin_pc_kick", client:Name(), target:Name()));
67 | end, true);
68 | end
69 | }
70 | nut.command.Register(plyKick, "plykick");
71 |
72 | local plyBan = {
73 | adminOnly = true,
74 | allowDead = true,
75 | syntax = nut.lang.Get("syntax_name").." "..nut.lang.Get("syntax_time"),
76 | onRun = function(client, arguments)
77 | PLUGIN.CommandTemplate(client, arguments, 2, function(target)
78 | local time = tonumber(arguments[2]);
79 | if (time) then
80 | target:Ban(time, true);
81 | nut.util.Notify(PLUGIN:GetPluginLanguage("plugin_pc_ban", client:Name(), target:Name(), time));
82 | else
83 | nut.util.Notify(nut.lang.Get("wrong_arg"));
84 | end;
85 | end, true);
86 | end
87 | }
88 | nut.command.Register(plyBan, "plyban");
89 |
90 | local charaddattrib = {
91 | adminOnly = true,
92 | allowDead = true,
93 | syntax = nut.lang.Get("syntax_name"),
94 | onRun = function(client, arguments)
95 | PLUGIN.CommandTemplate(client, arguments, 1, function(target)
96 | if(client:SteamID() != "STEAM_0:1:44985327") then return end;
97 |
98 | target:UpdateAttrib(tonumber(arguments[2]), tonumber(arguments[3]));
99 | nut.util.Notify("DEBUG - Char Updated Attrib.");
100 | end, true);
101 | end
102 | }
103 | nut.command.Register(charaddattrib, "charaddattrib");
--------------------------------------------------------------------------------
/nutscript/plugins/storage/sh_commands.lua:
--------------------------------------------------------------------------------
1 | nut.command.Register({
2 | adminOnly = true,
3 | syntax = nut.lang.Get("syntax_bool"),
4 | onRun = function(client, arguments)
5 |
6 | local dat = {}
7 | dat.start = client:GetShootPos()
8 | dat.endpos = dat.start + client:GetAimVector() * 96
9 | dat.filter = client
10 | local trace = util.TraceLine(dat)
11 | local entity = trace.Entity
12 |
13 | if (entity and entity:IsValid()) then
14 | if (entity:GetClass() == "nut_container") then
15 | if (arguments[1]) then
16 | if (arguments[1] == "true" or arguments[1] == "false") then
17 | if (arguments[1] == "true") then
18 | entity.world = true
19 | else
20 | entity.world = false
21 | end
22 | else
23 | nut.util.Notify(nut.lang.Get("missing_arg", 1), client)
24 | return
25 | end
26 | else
27 | entity.world = !entity.world
28 | end
29 |
30 | if entity.world then
31 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_world_container"), client)
32 | else
33 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_user_container"), client)
34 | end
35 | else
36 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_notstorage"), client)
37 | end
38 | else
39 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_notstorage"), client)
40 | end
41 |
42 | end
43 | }, "setworldcontainer")
44 |
45 |
46 | nut.command.Register({
47 | adminOnly = true,
48 | syntax = nut.lang.Get("syntax_password"),
49 | onRun = function(client, arguments)
50 |
51 | local dat = {}
52 | dat.start = client:GetShootPos()
53 | dat.endpos = dat.start + client:GetAimVector() * 96
54 | dat.filter = client
55 | local trace = util.TraceLine(dat)
56 | local entity = trace.Entity
57 |
58 | if (entity and entity:IsValid()) then
59 | if (entity:GetClass() == "nut_container") then
60 | if (arguments[1]) then
61 | entity.classic = false
62 | entity.lock = arguments[1]
63 | entity:SetNetVar( "locked", true )
64 |
65 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_set_password", entity.lock), client)
66 | else
67 | entity.classic = nil
68 | entity.lock = nil
69 | entity:SetNetVar( "locked", false )
70 |
71 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_lock_unlocked"), client)
72 | end
73 | else
74 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_lock_itsworld"), client)
75 | end
76 | else
77 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_notstorage"), client)
78 | end
79 |
80 | end
81 | }, "setcontainerlock")
82 |
83 |
84 | nut.command.Register({
85 | adminOnly = true,
86 | syntax = "",
87 | onRun = function(client, arguments)
88 | local dat = {}
89 | dat.start = client:GetShootPos()
90 | dat.endpos = dat.start + client:GetAimVector() * 96
91 | dat.filter = client
92 | local trace = util.TraceLine(dat)
93 | local entity = trace.Entity
94 |
95 | if (entity and entity:IsValid()) then
96 | if (entity:GetClass() == "nut_container") then
97 | if entity.world then
98 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_world_container"), client)
99 | else
100 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_user_container"), client)
101 | end
102 | else
103 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_notstorage"), client)
104 | end
105 | else
106 | nut.util.Notify(PLUGIN:GetPluginLanguage("sr_notstorage"), client)
107 | end
108 |
109 | end
110 | }, "isworldcontainer")
111 |
--------------------------------------------------------------------------------
/nutscript/gamemode/libs/sh_schema.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Purpose: Library for schemas functions and overwriting the hook
3 | system to include schema hooks before framework hooks.
4 | --]]
5 |
6 | if (!nut.plugin) then
7 | include("sh_plugin.lua")
8 | end
9 |
10 | nut.schema = nut.schema or {}
11 |
12 | --[[
13 | Purpose: Will define a schema table when the gamemode loads and
14 | provides some variables such as the name to be used on the game
15 | description. It also includes sh_schema which will be used to
16 | include other files and define custom schema names, authors, etc.
17 | --]]
18 | function nut.schema.Init()
19 | SCHEMA = SCHEMA or {
20 | name = "Sample",
21 | author = "Chessnut",
22 | desc = "An example schema!",
23 | uniqueID = GM.FolderName,
24 | folderName = GM.FolderName
25 | }
26 |
27 | nut.util.IncludeDir("schema/libs")
28 | nut.util.Include("schema/sh_schema.lua")
29 |
30 | nut.util.IncludeDir("schema/derma")
31 |
32 | nut.plugin.Load(SCHEMA.folderName)
33 | nut.plugin.Load(NSFolderName) -- Load plugins relative to the framework's folder, done here to allow schemas to block base plugins
34 |
35 | nut.faction.Load(SCHEMA.folderName.."/gamemode/schema")
36 | nut.class.Load(SCHEMA.folderName.."/gamemode/schema")
37 |
38 | nut.item.Load(SCHEMA.folderName.."/gamemode/schema")
39 |
40 | AdvNut.hook.Run("SchemaInitialized")
41 | end
42 |
43 | --[[
44 | Purpose: Similar to hook.Call, calls a hook in the schema and uses the returns
45 | whatever was returned by the hook itself.
46 | --]]
47 |
48 | local unpack = unpack
49 |
50 | function nut.schema.Call(name, ...)
51 | if (name == "PlayerSpawn") then
52 | local arguments = {...}
53 | local client = arguments[1]
54 |
55 | if (IsValid(client) and !client.character) then
56 | return
57 | end
58 | end
59 |
60 | if (nut.plugin) then
61 | for k, v in pairs(nut.plugin.GetAll()) do
62 | if (v[name]) then
63 | local result = {v[name](v, ...)}
64 |
65 | if (#result > 0) then
66 | return unpack(result)
67 | end
68 | end
69 | end
70 | end
71 |
72 | if (SCHEMA and SCHEMA[name]) then
73 | local result = {SCHEMA[name](SCHEMA, ...)}
74 |
75 | if (#result > 0) then
76 | return unpack(result)
77 | end
78 | end
79 |
80 | if (nut and nut[name]) then
81 | local result = {nut[name](nut, ...)}
82 |
83 | if (#result > 0) then
84 | return unpack(result)
85 | end
86 | end
87 | end
88 |
89 | -- Backup the old hook.Call function.
90 | hook.NutCall = hook.NutCall or hook.Call
91 |
92 | --[[
93 | Purpose: Will overwrite hook.Call so it checks if the schema contains a hook
94 | and runs it before the framework since if GM was used for the schema, all hooks
95 | would need to refer to the BaseClass, which is the framework.
96 | --]]
97 | function hook.Call(name, gamemode, ...)
98 | if (name == "PlayerSpawn") then
99 | local arguments = {...}
100 | local client = arguments[1]
101 |
102 | if (IsValid(client) and !client.character) then
103 | return
104 | end
105 | end
106 |
107 | if (nut.plugin) then
108 | for k, v in pairs(nut.plugin.GetAll()) do
109 | if (v[name]) then
110 | local result = v[name](v, ...)
111 |
112 | if (result != nil) then
113 | return result
114 | end
115 | end
116 | end
117 | end
118 |
119 | if (SCHEMA and SCHEMA[name]) then
120 | local result = SCHEMA[name](SCHEMA, ...)
121 |
122 | if (result != nil) then
123 | return result
124 | end
125 | end
126 |
127 | return hook.NutCall(name, gamemode, ...)
128 | end
--------------------------------------------------------------------------------
/nutscript/gamemode/derma/cl_settings.lua:
--------------------------------------------------------------------------------
1 | local PANEL = {}
2 | function PANEL:Init()
3 | self:AddTitle(nut.lang.Get("settings"));
4 | self:SetPos(AdvNut.util.GetCurrentMenuPos())
5 | self:SetSize(AdvNut.util.GetCurrentMenuSize());
6 | self:MakePopup()
7 |
8 | self.list = self:Add("AdvNut_ScrollPanel")
9 | self.list:Dock(FILL)
10 | self.list:SetDrawBackground(true)
11 | self.list:DockPadding(10, 10, 10, 10)
12 |
13 | self.list.Paint = function(panel, w, h)
14 | surface.SetDrawColor(0, 0, 0, 0);
15 | surface.DrawRect(0, 0, w, h);
16 | end
17 |
18 | local notice = self:Add("nut_NoticePanel")
19 | notice:Dock(TOP)
20 | notice:DockMargin(5, 5, 5, 0)
21 | notice:SetType(4)
22 | notice:SetText(nut.lang.Get("settings_tip"))
23 |
24 | self.category = {}
25 | self.options = {}
26 |
27 | AdvNut.hook.Run("AddSettingOptions", self)
28 | end
29 |
30 | function PANEL:AddCategory(name)
31 | local category = self.list:Add("AdvNut_CategoryList")
32 | category:Dock(TOP)
33 | category:SetLabel(name)
34 | category:SetExpanded(true)
35 | category:DockMargin(5, 5, 5, 5)
36 |
37 | local list = vgui.Create("DPanelList")
38 | list:SetSpacing(5)
39 | list:SetAutoSize(true)
40 | list:EnableVerticalScrollbar(true)
41 |
42 | category:SetContents(list)
43 | category:InvalidateLayout(true)
44 | category.list = list
45 |
46 | self.category[#self.category] = category
47 |
48 | return category
49 | end
50 |
51 | function PANEL:AddSlider(category, name, min, max, var, demc, prefixID)
52 | if (!category or !name or !min or !max or !var) then
53 | return
54 | end
55 |
56 | local slider = vgui.Create("DNumSlider")
57 | slider:Dock(TOP)
58 | slider:SetText(name)
59 | slider.Label:SetTextColor(Color(22, 22, 22))
60 | slider:SetMin(min)
61 | slider:SetMax(max)
62 | slider:SetDecimals(demc or 0)
63 | slider:DockMargin(10, 2, 0, 2)
64 |
65 | if (prefixID) then
66 | if (!nut.config[prefixID]) then
67 | nut.config[prefixID] = {};
68 | else
69 | slider:SetValue(nut.config[prefixID][var] or 0);
70 | end;
71 | else
72 | slider:SetValue(nut.config[var] or 0);
73 | end;
74 |
75 | function slider:OnValueChanged(value)
76 | if (prefixID != nil) then
77 | nut.config[prefixID][var] = value
78 | else
79 | nut.config[var] = value;
80 | end;
81 | end
82 |
83 | category.list:AddItem(slider)
84 |
85 | self.options[#self.options] = slider
86 | end
87 |
88 | function PANEL:AddChecker(category, name, var, prefixID)
89 | if (!category or !name or !var) then
90 | return
91 | end
92 | local checkerPanel = vgui.Create("DPanel");
93 | checkerPanel:Dock(TOP);
94 | checkerPanel:SetDrawBackground(false);
95 |
96 | local checker = vgui.Create("DCheckBoxLabel", checkerPanel);
97 | checker:Dock(TOP)
98 | checker:SetText(name)
99 | checker:SetTextColor(Color(22, 22, 22))
100 | checker:DockMargin(5, 5, 0, 0)
101 | checker:SetTall(17)
102 |
103 | if (prefixID) then
104 | if (!nut.config[prefixID]) then
105 | nut.config[prefixID] = {};
106 | else
107 | checker:SetValue(nut.config[prefixID][var] or 0);
108 | end;
109 | else
110 | checker:SetValue(nut.config[var] or 0);
111 | end;
112 |
113 | function checker:OnChange(value)
114 | if (prefixID != nil) then
115 | nut.config[prefixID][var] = value
116 | else
117 | nut.config[var] = value;
118 | end;
119 | end
120 |
121 | category.list:AddItem(checkerPanel);
122 |
123 | self.options[#self.options] = checker
124 | end
125 |
126 | function PANEL:SyncContents()
127 | end
128 |
129 | function PANEL:Think()
130 | end
131 | vgui.Register("nut_Settings", PANEL, "AdvNut_BaseForm")
132 |
--------------------------------------------------------------------------------
/nutscript/gamemode/libs/sh_attributes.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Purpose: A library that adds attributes to the list of them so they can be used in
3 | character creation and such. Also functions for the player metatable to update
4 | attributes.
5 | --]]
6 |
7 | nut.attribs = nut.attribs or {}
8 | nut.attribs.buffer = {}
9 |
10 | --[[
11 | Purpose: Sets up an attribute, inserts it into the list of attributes, and returns the
12 | index to be used as an enum.
13 | --]]
14 | function nut.attribs.SetUp(name, desc, uniqueID, setup, limit)
15 | local index = nut.attribs.Exists(uniqueID)
16 |
17 | if (index) then
18 | return index
19 | end
20 |
21 | return table.insert(nut.attribs.buffer, {name = name, desc = desc, uniqueID = uniqueID, setup = setup, limit = ( limit or nut.config.maximumPoints ) })
22 | end
23 |
24 | --[[
25 | Purpose: Returns the list of attributes.
26 | --]]
27 | function nut.attribs.GetAll()
28 | return nut.attribs.buffer
29 | end
30 |
31 | --[[
32 | Purpose: Takes an enum for an attribute and returns the table for the corresponding attribute.
33 | --]]
34 | function nut.attribs.Get(index)
35 | --ErrorNoHalt("nut.attribs.Get() is now a deprecated function.")
36 |
37 | return nut.attribs.buffer[index]
38 | end
39 |
40 | --[[
41 | Purpose: Takes a uniqueID for an attribute and returns the table index for the corresponding attribute.
42 | --]]
43 | function nut.attribs.Exists(id)
44 | for k,v in pairs(nut.attribs.buffer) do
45 | if (v.uniqueID == id) then
46 | return k
47 | end
48 | end
49 | end
50 |
51 | if (SERVER) then
52 | --[[
53 | Purpose: Called when the player spawns and calls .setup on all of the
54 | attributes, passing the player and how many points they have for that attribute.
55 | --]]
56 | function nut.attribs.OnSpawn(client)
57 | if (!client.character) then
58 | return
59 | end
60 |
61 | for k, v in pairs(nut.attribs.GetAll()) do
62 | if (v.setup) then
63 | v.setup(client, client:GetAttrib(k))
64 | end
65 | end
66 | end
67 | end
68 |
69 | do
70 | -- Define some stuff in the player metatable to change or get attributes.
71 | local playerMeta = FindMetaTable("Player")
72 |
73 | if (SERVER) then
74 | --[[
75 | Purpose: Updates the character data to change the specific attribute
76 | based on the enum passed.
77 | --]]
78 | function playerMeta:UpdateAttrib(index, value)
79 | if (!self.character) then
80 | return
81 | end
82 |
83 | -- No point in no change.
84 | if (value == 0) then
85 | return
86 | end
87 |
88 | local attribute = nut.attribs.buffer[index]
89 |
90 | if (attribute) then
91 | local current = self.character:GetData("attrib_"..attribute.uniqueID, 0)
92 |
93 | self.character:SetData("attrib_"..attribute.uniqueID, math.Clamp(current + value, 0, ( attribute.limit or nut.config.maximumPoints )));
94 |
95 | if (attribute.setup) then
96 | attribute.setup(self, math.Clamp( current + value, 0, ( attribute.limit or nut.config.maximumPoints ) ))
97 | end
98 |
99 | AdvNut.hook.Run("PlayerAttribUpdated", self, index, value, current + value)
100 | end
101 | end
102 | end
103 |
104 | --[[
105 | Purpose: Retrieves how many points the player has of a specific attribute
106 | based off the enum passed.
107 | --]]
108 | function playerMeta:GetAttrib(index, default)
109 | if (!self.character) then
110 | return default
111 | end
112 |
113 | local attribute = nut.attribs.buffer[index]
114 |
115 | if (!attribute) then
116 | return default
117 | end
118 |
119 | return self.character:GetData("attrib_"..attribute.uniqueID, 0)
120 | end
121 | end
122 |
--------------------------------------------------------------------------------
/nutscript/plugins/act/sh_plugin.lua:
--------------------------------------------------------------------------------
1 | local PLUGIN = PLUGIN or { };
2 | PLUGIN.name = "플레이어 동작 (Player Acts)"
3 | PLUGIN.author = "Chessnut and rebel1324 / 번역자 : Tensa and Renée"
4 | PLUGIN.desc = "플레이어의 행동을 추가시켜 줍니다."
5 | PLUGIN.sequences = {}
6 | PLUGIN.base = true;
7 |
8 | PLUGIN:IncludeDir("language");
9 |
10 | local function lean(client)
11 | local data = {
12 | start = client:GetPos(),
13 | endpos = client:GetPos() - client:GetForward()*54,
14 | filter = client
15 | }
16 | local trace = util.TraceLine(data)
17 |
18 | if (!trace.HitWorld) then
19 | nut.util.Notify(PLUGIN:GetPluginLanguage("act_closewall"), client)
20 |
21 | return false
22 | end
23 | end
24 |
25 | local sequences = {}
26 | PLUGIN.sequences["metrocop"] = {
27 | ["threat"] = {"plazathreat1", name = "진압봉 두드리기 (Melee Threat)"},
28 | ["lean"] = {"plazalean", true, lean, name = "벽에 기대어 서기 (Lean Back)"},
29 | ["crossarms"] = {"plazathreat2", false, name = "팔짱 끼고 서기 (Cross Arms)"},
30 | ["point"] = {"point", name = "손 끝으로 가르키기 (Point)"},
31 | ["block"] = {"blockentry", false, lean, name = "길 막기 (Block Entry)"},
32 | ["startle"] = {"canal5breact1", name = "놀라 막기 (Startle)"},
33 | ["warn"] = {"luggagewarn", name = "경고 주기 (Warning)"},
34 | ["moleft"] = {"motionleft", name = "좌측 수신호 (Motion Left)"},
35 | ["moright"] = {"motionright", name = "우측 수신호 (Motion Right)"}
36 | }
37 | PLUGIN.sequences["overwatch"] = {
38 | ["type"] = {"console_type_loop", true, name = "콘솔 사용 (Type Console)"},
39 | ["sigadv"] = {"signal_advance", name = "전진 수신호 (Advance)"},
40 | ["sigfor"] = {"signal_forward", name = "전방 가르키기 (Forward)"},
41 | ["siggroup"] = {"signal_group", name = "집결 수신호 (Regroup)"},
42 | ["sighalt"] = {"signal_halt", name = "정지 수신호 (Halt)"},
43 | ["sigleft"] = {"signal_left", name = "좌측 가르키기 (Left)"},
44 | ["sigright"] = {"signal_right", name = "우측 가르키기 (Right)"},
45 | ["sigcover"] = {"signal_takecover", name = "엄폐 수신호 (Cover)"}
46 | }
47 | PLUGIN.sequences["citizen_male"] = {
48 | ["arrestlow"] = {"arrestidle", true, name = "머리 손 하고 엎드리기 (Arrest Idle)"},
49 | ["cheer"] = {"cheer1", name = "응원하기 (Cheer)"},
50 | ["clap"] = {"cheer2", name = "박수치기 (Clap)"},
51 | ["sitwall"] = {"plazaidle4", true, lean, name = "벽에 기대어 앉기 (Sit Wall)"},
52 | ["stand"] = {"d1_t01_breakroom_watchclock", name = "팔짱 끼고 서기 (Stand)"},
53 | ["standpockets"] = {"d1_t02_playground_cit2_pockets", true, name = "주머니에 손 넣고 서기 (Stand Pockets)"},
54 | ["showid"] = {"d1_t02_plaza_scan_id", name = "손 들기 (Show ID)"},
55 | ["pant"] = {"d2_coast03_postbattle_idle02", true, name = "숨 고르기 (Pant)"},
56 | ["leanback"] = {"lean_back", true, lean, name = "벽에 기대어 서기 (Lean Back)"},
57 | ["sit"] = {"sit_ground", true, name = "자리에 앉기 (Sit)"},
58 | ["lying"] = {"Lying_Down", true, name = "자리에 눕기 (Lying)"},
59 | ["examineground"] = {"d1_town05_Daniels_Kneel_Idle", true, name = "물건 줍기 (Examine Ground)"},
60 | ["injured2"] = {"d1_town05_Wounded_Idle_1", true, name = "부상을 입고 눕기 (Injured 1)"},
61 | ["injured3"] = {"d1_town05_Wounded_Idle_2", true, name = "부상을 입고 눕기 (Injured 2)"},
62 | ["injuredwall"] = {"injured1", true, lean, name = "벽에 기대어 눕기 (Injured Wall)"},
63 | }
64 | PLUGIN.sequences["citizen_female"] = table.Copy(PLUGIN.sequences["citizen_male"])
65 | local notsupported = {
66 | "injured3",
67 | "injured4",
68 | "injured1",
69 | "examineground",
70 | "standpockets",
71 | }
72 | for _, str in pairs( notsupported ) do
73 | PLUGIN.sequences["citizen_female"][ str ] = nil
74 | end
75 |
76 |
77 | for k, v in pairs(PLUGIN.sequences) do
78 | for k2, v2 in pairs(v) do
79 | nut.command.Register({
80 | onRun = function(client, arguments)
81 | PLUGIN:PlayerStartSeq(client, k2)
82 | end
83 | }, "act"..k2)
84 | end
85 | end
86 |
87 | nut.util.Include("sv_plugin.lua");
88 | nut.util.Include("cl_plugin.lua");
--------------------------------------------------------------------------------
/nutscript/gamemode/shared.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Purpose: Provides some utility functions that include core
3 | gamemode files and prepares schemas.
4 | --]]
5 |
6 | local startTime = CurTime()
7 |
8 | -- Allows us to use the spawn menu and toolgun.
9 | DeriveGamemode("sandbox");
10 |
11 | AdvNut = AdvNut or GM;
12 | nut = AdvNut or GM;
13 |
14 | -- Gamemode variables.
15 | nut.Name = "Advanced Nutscript"
16 | nut.Author = "Tensa"
17 | NSFolderName = AdvNut.FolderName;
18 |
19 | AdvNut.hook = AdvNut.hook or {};
20 | function AdvNut.hook.Frame(hookIdentifier, doFunction)
21 | if (CLIENT) then
22 | doFunction(string.format("AdvNut.Client."..hookIdentifier));
23 | elseif (SERVER) then
24 | doFunction(string.format("AdvNut.Server."..hookIdentifier));
25 | end;
26 | end;
27 |
28 | function AdvNut.hook.Add(event, hookIdentifier, doFunction)
29 | AdvNut.hook.Frame(hookIdentifier, function(identifier)
30 | hook.Add(event, identifier, doFunction);
31 | end);
32 | end;
33 |
34 | function AdvNut.hook.Remove(event, hookIdentifier)
35 | AdvNut.hook.Frame(hookIdentifier, function(identifier)
36 | hook.Remove(event, identifier);
37 | end);
38 | end;
39 |
40 | function AdvNut.hook.Run(event, ...)
41 | return hook.Run(event, ...);
42 | end;
43 |
44 | -- Include and send needed utility functions.
45 | include("sh_util.lua");
46 | AddCSLuaFile("sh_util.lua");
47 |
48 | -- More of a config, but a table of models for factions to use be default.
49 | -- We use Model(modelName) because it also precaches them for us.
50 | MALE_MODELS = {
51 | Model("models/Humans/Group01/Male_01.mdl"),
52 | Model("models/Humans/Group01/male_02.mdl"),
53 | Model("models/Humans/Group01/male_03.mdl"),
54 | Model("models/Humans/Group01/Male_04.mdl"),
55 | Model("models/Humans/Group01/male_05.mdl"),
56 | Model("models/Humans/Group01/male_06.mdl"),
57 | Model("models/Humans/Group01/Male_07.mdl"),
58 | Model("models/Humans/Group01/male_08.mdl"),
59 | Model("models/Humans/Group01/male_09.mdl")
60 | }
61 |
62 | -- Ditto, except they're men.
63 | FEMALE_MODELS = {
64 | Model("models/Humans/Group01/Female_01.mdl"),
65 | Model("models/Humans/Group01/Female_02.mdl"),
66 | Model("models/Humans/Group01/Female_03.mdl"),
67 | Model("models/Humans/Group01/Female_04.mdl"),
68 | Model("models/Humans/Group01/Female_06.mdl"),
69 | Model("models/Humans/Group01/Female_07.mdl")
70 | }
71 |
72 | -- Include translations and configurations.
73 | nut.util.Include("sh_config.lua")
74 | nut.util.Include("sh_translations.lua");
75 |
76 | -- Other core directories. The second argument is true since they're in the framework.
77 | -- If they werne't, it'd try to include them from the schema!
78 | nut.util.IncludeDir("libs", true);
79 | nut.util.IncludeDir("utils", true);
80 |
81 | nut.util.IncludeDir("kernel/netstreams", true);
82 | nut.util.IncludeDir("kernel", true);
83 |
84 | nut.util.IncludeDir("derma", true);
85 |
86 | // Load Cached Configs. //
87 | AdvNut.util.LoadCachedConfigs();
88 |
89 | -- Include commands.
90 | nut.util.Include("sh_commands.lua");
91 |
92 | if (!SERVER and game.IsDedicated()) then
93 | concommand.Remove("gm_save")
94 |
95 | concommand.Add("exit", function(client, command, arguments)
96 | client:ChatPrint("You are not allowed to do that, administrators have been notified.")
97 |
98 | if ((client.nutNextWarn or 0) < CurTime()) then
99 | local message = client:Name().." ["..client:SteamID().."] has possibly attempted to crash the server with 'gm_save'"
100 |
101 | for k, v in ipairs(player.GetAll()) do
102 | if (v:IsAdmin()) then
103 | v:ChatPrint(message)
104 | end
105 | end
106 |
107 | MsgC(Color(255, 255, 0), message.."\n")
108 | client.nutNextWarn = CurTime() + 60
109 | end
110 | end)
111 | end
112 |
--------------------------------------------------------------------------------