1. Lua / Говнокод #28828

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    -- add crafting exp
    function addCExp(amount)
    ...
    -- add cooking exp
    function addCexp(amount)

    если петух скопипастил твой код, и сделал две такие функции, то сколько раз за час интенсивного кодинга ты их перепутаешь?
    (язык изменён)

    kcalbCube, 28 Июля 2023

    Комментарии (23)
  2. Lua / Говнокод #28744

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    local function isEven(number)
        local code = "return "
        for i = 1, number do
            code = code .. "false"
            if i ~= number then
                code = code .. " =="
            end
        end
    
        return load(code)()
    end
    
    print("Enter number: ")
    if isEven(tonumber(io.read())) then
        print("Number is even")
    else
        print("Number is odd")
    end

    Определяет чётность числа. Работает для чисел >= 1 (Желательно <= 1000, чем лучше компьютер, тем больше)

    pidoras123, 16 Апреля 2023

    Комментарии (12)
  3. Lua / Говнокод #28288

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    local victim_say={"Конец мне приходит...", "Помираю я... Помоги...", "Браток, помоги!",
    "Аптечку! Дай аптечку!","Врача, батенька.", "Под пулю я попал.", "Я ранен!","Слышь, браток, помоги!","Хана мне приходит","Сегодня не мой день...","Заболел я."}
    local vs=#victim_say
    
    
    local actor_say={"Тебе плохо? Может, врача вызвать?", "Могу дать номер знакомого врача.", "Мда, скорая не успеет.",
    "Не беспокойся, все там будем!","Корми червей, падла.","Умри!","Дойдёшь до больницы?","Извини, я не доктор.","Выкручивайся сам","Мне некогда"}
    local ds=#actor_say	
    
    
    local victim_ans={"Ну и подонок же ты, Меченый.", "Проваливай!", "Обойдусь сам!", "Помощь от тебя была бы хуже смерти. Проваливай!","Я ещё доберусь до тебя!", "Подонок!", "Моя смерть будет на твоей совести.","Встретимся в аду.","Просто уходи.","Я ещё вернусь...","Это ещё не конец."}
    
    local va=#victim_ans
    
    local victim_tnk={"Спасибо! Ты меня спас!", "Благодарю! Признаться, не ожидал.", "Спасибо, Меченый!", "Спасибо за помощь!","Я ещё живой? Это благодаря тебе!", "Ты мой спаситель!", "Моя смерть была бы на твоей совести","Я твой должник!","Ты ждешь благодарности?","На твоем месте я бы тебя пристрелил","Мерси за помощь!"}
    
    local vt=#victim_tnk
    
    	
    function init_intro_dialogb(dlg)
    	local k,v = 0,0
    	local phr = dlg:AddPhrase("","0","",-10000)
    	phr = dlg:AddPhrase("","1","0",-10000)
    	
    	local id=math.random(vs)
    	local ph=dlg:AddPhrase(victim_say[id],"333","1",-10000)
    	local ps = ph:GetPhraseScript()
    	ps:AddPrecondition("dialogs.is_wounded")
    	ph = dlg:AddPhrase("(Лечение)","444","333",-10000)
    	ps = ph:GetPhraseScript()
    	ps:AddAction("doctor.heal")
    	
    	local id=math.random(vt)
    	ph = dlg:AddPhrase(victim_tnk[id],"555","444",-10000)
    	--ps = ph:GetPhraseScript()
    --	ps:AddAction("dialogs.break_dialog")
    
    	
    	
    	
    	local id=math.random(ds)
    	local ph=dlg:AddPhrase(actor_say[id],"666","333",-10000)
    	local id=math.random(va)
    	local ph=dlg:AddPhrase(victim_ans[id],"777","666",-10000)
    
    	
    	
    
    
    	
    	for k,v in pairs(phrase.intro) do
    		phr = dlg:AddPhrase(v.name, v.phr_id, "1", -10000)
    		if phr then
    		
    			
    		
    			local phrase_script = phr:GetPhraseScript()
    			phrase_script:AddPrecondition("dialog_manager.precondition_intro")
    			--' Этот экшн запоминает последнюю фразу, чтобы персонаж говорил одно и то же.
    			--' Для фразы просьбы о помощи его добавлять не надо.
    			if v.wounded == "false" then
    				phrase_script:AddAction("dialog_manager.phrase_action_intro")
    			end
    		end
    	end
    	
    end

    Лечения раненых в Сталкере ТЧН. В диалоге с ранен(н)ым показывается как пункт "вылечить" так и рандомное издевательство, вроде "могу дать номер своего врача"

    CBuHOKYP, 21 Июля 2022

    Комментарии (4)
  4. Lua / Говнокод #28273

    −3

    1. 1
    Блять, какое же lua говно блять...

    kcalbCube, 06 Июля 2022

    Комментарии (87)
  5. Lua / Говнокод #28063

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    Писать однострочный код это плохо? А если в одном файле совместить серверную и клиентскую часть? Пример аддона из Garry's Mod https://steamcommunity.com/sharedfiles/filedetails/?id=2754127067
    AddCSLua("cl_init.lua")
    if istable( xdestore ) then if xdestore.Menu then xdestore.Menu:Remove() end  if xdestore.Unlock then xdestore.Unlock:Remove() end
    if xdestore.Namer then xdestore.Namer:Remove() end  if xdestore.Lock then xdestore.Lock:Remove() end end xdestore = {} xdestore.Players = {}
    
    	util.AddNetworkString( "XDEST_MenuS2COpen" ) util.AddNetworkString( "XDEST_MenuS2CClose" ) util.AddNetworkString( "XDEST_SendRes" )
    	util.AddNetworkString( "XDEST_MenuS2CUpdate" ) util.AddNetworkString( "XDEST_MenuS2CResult" ) util.AddNetworkString( "XDEST_MenuC2SClose" )
    	util.AddNetworkString( "XDEST_LockReset" ) util.AddNetworkString( "XDEST_MenuC2SAction" ) util.AddNetworkString( "XDEST_SendSnd" ) util.AddNetworkString( "XDEST_SendHint" )
    
    xdestore.AmmoMdl = {
    	[ "AR2" ] = "models/items/combine_rifle_cartridge01.mdl",
    	[ "AR2AltFire" ] = "models/items/combine_rifle_ammo01.mdl",
    	[ "Pistol" ] = "models/items/boxsrounds.mdl",
    	[ "SMG1" ] = "models/items/boxmrounds.mdl",
    	[ "357" ] = "models/items/357ammo.mdl",
    	[ "XBowBolt" ] = "models/items/crossbowrounds.mdl",
    	[ "Buckshot" ] = "models/items/boxbuckshot.mdl",
    	[ "RPG_Round" ] = "models/weapons/w_missile_closed.mdl",
    	[ "SMG1_Grenade" ] = "models/items/ar2_grenade.mdl",
    	[ "Grenade" ] = "models/items/grenadeammo.mdl",
    	[ "slam" ] = "models/weapons/w_slam.mdl"
    }
    xdestore.NonSWEP = {
    	[ "weapon_357" ] = "models/weapons/w_357.mdl",
    	[ "weapon_pistol" ] = "models/weapons/w_pistol.mdl",
    	[ "weapon_bugbait" ] = "models/weapons/w_bugbait.mdl",
    	[ "weapon_crossbow" ] = "models/weapons/w_crossbow.mdl",
    	[ "weapon_crowbar" ] = "models/weapons/w_crowbar.mdl",
    	[ "weapon_frag" ] = "models/weapons/w_grenade.mdl",
    	[ "weapon_physcannon" ] = "models/weapons/w_physics.mdl",
    	[ "weapon_ar2" ] = "models/weapons/w_irifle.mdl",
    	[ "weapon_rpg" ] = "models/weapons/w_rocket_launcher.mdl",
    	[ "weapon_slam" ] = "models/weapons/w_slam.mdl",
    	[ "weapon_shotgun" ] = "models/weapons/w_shotgun.mdl",
    	[ "weapon_smg1" ] = "models/weapons/w_smg1.mdl",
    	[ "weapon_stunstick" ] = "models/weapons/w_stunbaton.mdl",
    	[ "weapon_alyxgun" ] = "models/weapons/w_alyx_gun.mdl",
    	[ "weapon_annabelle" ] = "models/weapons/w_annabelle.mdl",
    	[ "weapon_physgun" ] = "models/weapons/w_physics.mdl"
    }
    xdestore.ValidAct = { [ "Take" ] = true, [ "Move" ] = true, [ "Store" ] = true, [ "Rename" ] = true, [ "TakeAll" ] = true, [ "Split" ] = true, [ "Lock" ] = true, [ "Unlock" ] = true }
    xdestore.ActToNum = { "Take", "Move", "Store", "TakeAll", "Rename", "Split", "Lock", "Unlock" }
    xdestore.LockType = { "Simple", "Complex", "Question", "Key Weapon", "Group", "Personal" }
    net.Receive( "XDEST_MenuS2COpen", function() local int = net.ReadFloat()  local tab = net.ReadString()  local con = net.ReadString()
    local ent = net.ReadEntity() xdestore:OpenMenu( ply, int, tab, con, ent ) end )
    net.Receive( "XDEST_MenuS2CClose", function() if xdestore.Menu then xdestore.Menu:Remove() end  if xdestore.Namer then xdestore.Namer:Remove() end
    if xdestore.Lock then xdestore.Lock:Remove() end  if xdestore.Unlock then xdestore.Unlock:Remove() end end )
    net.Receive( "XDEST_MenuS2CUpdate", function()
    	local tab = util.JSONToTable( net.ReadString() )  local con = util.JSONToTable( net.ReadString() )  local aa = net.ReadBool()  local bb = net.ReadBool()
    	if IsValid( xdestore.Menu ) then xdestore.Menu.V_DataStat = tab  xdestore.Menu.V_DataCont = con  xdestore.Menu:UpdateItems( aa, bb ) end
    end )
    net.Receive( "XDEST_MenuC2SClose", function( len, ply ) if len > 32 or !IsValid( ply ) then return end
    	local int = net.ReadFloat() if IsValid( ply ) and ply:IsPlayer() and !ply:IsBot() and isnumber( int ) then xdestore:CloseMenu( ply, int ) end
    end )
    net.Receive( "XDEST_MenuC2SAction", function( len, ply ) if len >= 4096 or !IsValid( ply ) then return end
    	if isnumber( ply.XDEST_Cool ) and ply.XDEST_Cool > CurTime() then xdestore:SendHint( ply, "You are doing too fast!", "resource/warning.wav", 0 ) end
    	ply.XDEST_Cool = CurTime()+0.25  if !IsValid( ply:GetNWEntity( "XDEST_Ent" ) ) or ply:GetNWEntity( "XDEST_Ent" ) == Entity( 0 ) then return end local self = ply:GetNWEntity( "XDEST_Ent" )
    	if ( ( !isstring( self.Base ) or self.Base != "xdest_base" ) and self:GetClass() != "xdest_base" and self:GetClass() != "weapon_xdest" )
    	or !isstring( self.XDEST_Data ) or !isstring( self.XDEST_Contain ) then return end
    	local act = net.ReadFloat()  local str = net.ReadString() if !isnumber( act ) then return end act = math.Round( act )
    	if !isstring( str ) then str = "_" end if isstring( xdestore.ActToNum[ act ] ) then act = xdestore.ActToNum[ act ] else return end  xdestore:SlotAction( ply, self, act, str )
    end )
    net.Receive( "XDEST_MenuS2CResult", function() local ply = LocalPlayer() local yes = net.ReadBool()  if IsValid( xdestore.Unlock ) then xdestore.Unlock:XDE_Result( yes ) end end )
    net.Receive( "XDEST_LockReset", function() local ent = net.ReadEntity() if IsValid( ent ) and ent != Entity( 0 ) then ent.XDE_Pass = nil end end )
    net.Receive( "XDEST_SendSnd", function() local str = net.ReadString() if !isstring( str ) or str == "!V" then return end surface.PlaySound( str ) end )
    net.Receive( "XDEST_SendRes", function() local str = net.ReadString()  local ply = LocalPlayer()  local ent = net.ReadEntity() if !IsValid( ent )
    or ent == Entity( 0 ) or !isstring( str ) or str == "" then return end if !isstring( ent.XDE_Pass ) then xdestore:SendHint( nil, "Access granted.", "", 0 ) end ent.XDE_Pass = str end )
    net.Receive( "XDEST_SendHint", function() local txt = net.ReadString()  local snd = net.ReadString()  local typ = net.ReadFloat()  xdestore:SendHint( nil, txt, snd, typ ) end )

    Ivan_Evlasiev, 28 Февраля 2022

    Комментарии (1)
  6. Lua / Говнокод #27687

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    function throw_artefact(obj)
    	if obj==nil then
    		return
    	end
    	math.randomseed(time_global())
    	local rnd=math.random(10)
    	local sect = obj:section()
    	local lv = obj:level_vertex_id()
    	local gv = obj:game_vertex_id()
    	local pos = obj:position()
    	local off_x = 2
    	local off_y = 1.5
    	local off_z = 2
    	pos.x = pos.x + off_x
    	pos.y = pos.y + off_y
    	pos.z = pos.z + off_z	
    	if lv and gv and pos then
    		math.randomseed(time_global())
    		if string.find(sect, "witches") then			
    			if string.find(sect, "weak") then
    				math.randomseed(time_global())
    				if math.random(4) == 1 then alife():create("af_electra_sparkler", pos, lv, gv) end
    			elseif string.find(sect, "average") then
    				math.randomseed(time_global())
    				if math.random(6) == 1 then alife():create("af_electra_sparkler", pos, lv, gv) end
    				if math.random(4) == 1 then alife():create("af_electra_flash", pos, lv, gv) end
    			else
    				math.randomseed(time_global())
    				if math.random(4) == 1 then alife():create("af_electra_moonlight", pos, lv, gv) end
    				if math.random(5) == 1 then alife():create("af_electra_flash", pos, lv, gv) end
    				if math.random(5) == 1 then alife():create("af_electra_sparkler", pos, lv, gv) end
    			end
    			
    		elseif string.find(sect, "mosquito") then
    			math.randomseed(time_global())
    			if string.find(sect, "weak") then
    				if math.random(6) == 1 then alife():create("af_cristall_flower", pos, lv, gv) end
    			elseif string.find(sect, "average") then
    				if math.random(4) == 1 then alife():create("af_cristall_flower", pos, lv, gv) end
    				if math.random(5) == 1 then alife():create("af_medusa", pos, lv, gv) end
    			else
    				if math.random(6) 	== 1 then alife():create("af_night_star", pos, lv, gv) end
    				if math.random(4)  == 1 then alife():create("af_medusa", pos, lv, gv) end
    				if math.random(5)  == 1 then alife():create("af_cristall_flower", pos, lv, gv) end
    			end
    			
    		elseif string.find(sect, "mincer") then
    			math.randomseed(time_global())
    			if string.find(sect, "weak") then
    				if math.random(6)==1 then alife():create("af_blood", pos, lv, gv) end
    			elseif string.find(sect, "average") then
    				if math.random(5) == 1 then alife():create("af_blood", pos, lv, gv) end
    				if math.random(4) <= 1 then alife():create("af_mincer_meat", pos, lv, gv) end
    			else
    				if math.random(6) == 1 then alife():create("af_soul", pos, lv, gv) end
    				if math.random(4) == 1 then alife():create("af_mincer_meat", pos, lv, gv) end
    				if math.random(5) == 1 then alife():create("af_blood", pos, lv, gv) end
    			end
    			
    		elseif string.find(sect, "gravi") then
    			math.randomseed(time_global())
    			if string.find(sect, "weak") then
    				if math.random(6)==1 then alife():create("af_vyvert", pos, lv, gv) end
    			elseif string.find(sect, "average") then
    				if math.random(4) == 1 then alife():create("af_vyvert", pos, lv, gv) end
    				if math.random(5) <= 1 then alife():create("af_gravi", pos, lv, gv) end
    			else
    				if math.random(6) == 1 then alife():create("af_gold_fish", pos, lv, gv) end
    				if math.random(4) == 1 then alife():create("af_gravi", pos, lv, gv) end
    				if math.random(5) == 1 then alife():create("af_vyvert", pos, lv, gv) end
    			end
    			
    		elseif string.find(sect, "ameba") or string.find(sect, "burning_fuzz") or string.find(sect, "rusty") then
    				math.randomseed(time_global())
    				if math.random(2) == 1 then alife():create("af_rusty_sea-urchin", pos, lv, gv) end
    				if math.random(2) == 1 then alife():create("af_rusty_kristall", pos, lv, gv) end
    				if math.random(2) == 1 then alife():create("af_rusty_thorn", pos, lv, gv) end
    		elseif string.find(sect, "buzz") then
    			if string.find(sect, "weak") then
    				if math.random(6)==1 then alife():create("af_ameba_slug", pos, lv, gv) end
    			elseif string.find(sect, "average") then
    				if math.random(5) == 1 then alife():create("af_ameba_slime", pos, lv, gv) end
    				if math.random(4) <= 1 then alife():create("af_ameba_slug", pos, lv, gv) end
    			else
    				if math.random(5) == 1 then alife():create("af_ameba_mica", pos, lv, gv) end
    				if math.random(5) == 1 then alife():create("af_ameba_slug", pos, lv, gv) end
    				if math.random(4) == 1 then alife():create("af_ameba_slime", pos, lv, gv) end
    			end
    
    elseif string.find(sect, "doggy") then
    			local n=0
    			math.randomseed(time_global())
    			for n=1, math.random(3) do
    				alife():create("dog_weak", pos, lv, gv)
    			end

    Свиток перебирает аномалии на локации и по рандому спавнит в них артефакты.
    Да, блять - мне пришлось изучить луа. Теперь я тоже "золотой хуй".

    Нижние строки отвечают за функционирование самодельной аномалии, которая после полуночи (по ИВ) плодит гипнособак и прочую нечисть. Стаи собак вырезают целые поселения; таким образом, я стал поистине сталкером. Так как я давно фриплею, надо разнообразить ко-ко-корутину.

    CBuHOKYP, 27 Сентября 2021

    Комментарии (17)
  7. Lua / Говнокод #27079

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    ont = love.graphics.newFont("/font/RobotoMono-Regular.ttf",14);
    love.graphics.setFont(font);
    
    box = {
      draw = false;
      }
    function box:cr(d,variant)
      --self.draw = false;
      self.d = d;
      self.var = variant or {};
      table.insert(self.var,">> Quit");
      --table.insert(self.var,">> retry");
      self.str = 0;
      self.v = vector(0,(love.graphics.getHeight()/2)-150);
      self.h = 300;
      self.w = 800;
    end
    
    function box:up(dt)
      
    end
    
    function box:dr()
      if self.draw then
        love.graphics.setColor(0,0,0);
        love.graphics.rectangle("fill",self.v.x,self.v.y,self.w,self.h);
        love.graphics.setColor(1,1,1);
        love.graphics.print(self.d,self.v.x,self.v.y);
        love.graphics.print(self.str,self.v.x,self.v.y+20);
        for k,v in pairs(self.var) do
          if k == self.str then
            --love.graphics.setColor(1,1,1);
            love.graphics.draw(animmouse.img.RMB,self.v.x+font:getWidth(v),self.v.y+200+((k-1)*20))
            love.graphics.setColor(1,1,0);
          else
            love.graphics.setColor(1,1,1);
          end
          love.graphics.print(v,self.v.x,self.v.y+200+((k-1)*20));
         
        end
      end
    end
    
    function box:mw(y)
      if self.draw then
        local lt = #self.var;
        self.str = self.str - y;
        if 1 > self.str then
          self.str = lt;
        elseif lt < self.str then
          self.str = 1;
        end
      end
    end
    
    function box:mp(x,y,b)
      if self.draw then
        if b == 2 then
          if self.str == #self.var then
            self.draw = false
          end
        end
      end
    end

    lalalalallallalalalalallallalalalalallal lalalalalallallalalalalallallalalalalall allalalalalallallalalalalallallalalalala llallalalalalallallalalalalallallalalala lallallalalalalallallalalalalallallalala lalallallalalalalallallalalalalallallala lalalallallalalalalallallalalalalallalla lalalalallallalalalalallallalalalalallal lalalalalallallalalalalallallalalalalall allalalalalallallalalalalallallalalalala llallalalalalallallalalalalallallalalala lallallalalalalallallalalalalallallalala lalallallalalalalallallalalalalallallala lalalallallalalalalallalla

    3oJIoTou_xyu, 03 Ноября 2020

    Комментарии (220)
  8. Lua / Говнокод #26853

    +2

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    if thr < 0.1 then
    		one()
    	elseif thr > 0.1 and thr < 0.2 then
    		one()
    		two()
    	elseif thr > 0.2 and thr < 0.3 then
    		one()
    		two()
    		three()
    	elseif thr > 0.3 and thr < 0.4 then
    		one()
    		two()
    		three()
    		four()
    	elseif thr > 0.4 and thr < 0.5 then
    		one()
    		two()
    		three()
    		four()
    		five()
    	elseif thr > 0.5 and thr < 0.6 then
    		one()
    		two()
    		three()
    		four()
    		five()
    		six()
    	elseif thr > 0.6 and thr < 0.7 then
    		one()
    		two()
    		three()
    		four()
    		five()
    		six()
    		seven()
    	elseif thr > 0.7 and thr < 0.8 then
    		one()
    		two()
    		three()
    		four()
    		five()
    		six()
    		seven()
    		eight()
    	elseif thr > 0.8 and thr < 0.9 then
    		one()
    		two()
    		three()
    		four()
    		five()
    		six()
    		seven()
    		eight()
    		nine()
    	elseif thr > 0.9 and thr < 1 then
    		one()
    		two()
    		three()
    		four()
    		five()
    		six()
    		seven()
    		eight()
    		nine()
    		ten()
    	elseif thr == 1 then
    		one()
    		two()
    		three()
    		four()
    		five()
    		six()
    		seven()
    		eight()
    		nine()
    		ten()
    		eleven()
    	end
    
    ........
    
    function one()
    	screen.setColor(0, 255, 0)
    	screen.drawRectF(12, 53, 4, 5)
    end
    	
    function two()
    	screen.setColor(0, 255, 0)
    	screen.drawRectF(16, 53, 4, 5)
    end
    	
    function three()
    	screen.setColor(0, 255, 0)
    	screen.drawRectF(20, 53, 4, 5)
    end
    	
    function four()
    	screen.setColor(0, 255, 0)
    	screen.drawRectF(24, 53, 4, 5)
    end

    Говнокод для рисования полоски загрузки

    griffi1, 08 Августа 2020

    Комментарии (9)
  9. Lua / Говнокод #26683

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if number >= 0 and number <= 9 then
        string.format('00%d', number)
    end
    if number >= 10 and number <= 99 then
        string.format('0%d', number)
    end
    if number >= 100 and number <= 999 then
        string.format('%d', number)
    end

    imring, 22 Мая 2020

    Комментарии (1)
  10. Lua / Говнокод #26519

    0

    1. 1
    2. 2
    3. 3
    https://github.com/xexpanderx/conky-drawer-interactive/tree/master/lua
    
    а вы тоже храните автосейв файлы редактора на гитхабе?

    https://github.com/xexpanderx/conky-drawer-interactive/blob/master/lua/drawer.lua

    cairo_arc(cr,hdd_x+22, hdd_y-5,10,270*math.pi/180,360*math.pi/180)
    cairo_arc(cr, hdd_x+22, hdd_y-5+28,10,0*math.pi/180,90*math.pi/180)

    какая геометрия :))

    MAKAKA, 21 Марта 2020

    Комментарии (7)