Advertisement
Caldryk

kira_items.lua

Mar 21st, 2025 (edited)
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.55 KB | Source Code | 0 0
  1. KiraScripts = KiraScripts or {}
  2.  
  3. include( "kira_modules.lua" )
  4.  
  5. function RaPD_MakeTimedHookBeforeDead(name, user, target, limb, endTime, tickTime, tickFunc, endFunc, conditionFunc)
  6.     local hookName = target:EntIndex().."_"..limb.."_Bandage_Think"
  7.     local limbName = limb
  8.    
  9.     local endVarName = "RaPD_"..name.."_EndTime_"..limb
  10.     local tickVarName = "RaPD_"..name.."_TickTime_"..limb
  11.    
  12.     target[endVarName] = CurTime() + endTime
  13.     target[tickVarName] = CurTime() + tickTime
  14.    
  15.     hook.Add( "Think", hookName, function()
  16.         local isValid = IsValid(target)
  17.         if !isValid or !target:Alive() or (target[endVarName] and target[endVarName] <= CurTime()) or (isfunction(conditionFunc) and conditionFunc()) then
  18.        
  19.             if isfunction(endFunc) then endFunc() end
  20.            
  21.             hook.Remove( "Think", hookName)
  22.            
  23.             target[endVarName] = nil
  24.             target[tickVarName] = nil
  25.            
  26.         elseif target[tickVarName] and target[tickVarName] <= CurTime() then
  27.        
  28.             if isfunction(tickFunc) then tickFunc() end
  29.            
  30.             target[tickVarName] = CurTime() + tickTime
  31.         end
  32.     end )
  33. end
  34.  
  35. local function healBandages(mult, target, limb)
  36.     target:RaPD_HealDamageLimb(2*mult, "piercing", limb)
  37.     target:RaPD_HealDamageLimb(1*mult, "slash", limb)
  38.     target:RaPD_HealDamageLimb(0.25*mult, "burn", limb)
  39.     target:RaPD_HealDamageLimb(1.5*mult, "blast", limb)
  40.     target:RaPD_HealDamageLimb(2*mult, "blunt", limb)
  41. end
  42.  
  43. local function healBurns(mult, target, limb)
  44.     target:RaPD_HealDamageLimb(1*mult, "burn", limb)
  45. end
  46.  
  47. local function injectReagentFromContainer(item, count, target, reagent)
  48.    
  49.     local reagents = target.RaPD_Organism.Stats.reagents
  50.     local count = count + (math.min(item.reagentCount - count, 0))
  51.    
  52.     item.reagentCount = item.reagentCount - count
  53.    
  54.     KiraScripts.RaPD_Reagents_FastCalc(reagents.Circulatory, reagent, count)
  55. end
  56. local function eatReagentFromContainer(item, count, target, reagent)
  57.    
  58.     local reagents = target.RaPD_Organism.Stats.reagents
  59.     local count = count + (math.min(item.reagentCount - count, 0))
  60.    
  61.     //print("В предмете вычтется: ", count)
  62.     //print("В предмете до: ", item.reagentCount)
  63.     item.reagentCount = item.reagentCount - count
  64.     //print("------")
  65.     //print("В предмете после: ", item.reagentCount)
  66.     //print("В организме до: ", reagents.Stomach[reagent])
  67.     KiraScripts.RaPD_Reagents_FastCalc(reagents.Stomach, reagent, count)
  68.     //print("В организме после: ", reagents.Stomach[reagent])
  69.     //print("---------------------------")
  70. end
  71.  
  72. local function takeOutItem(ply, item)
  73.     if SERVER then
  74.         local pos = util.TraceLine( {
  75.             start = ply:EyePos(),
  76.             endpos = ply:EyePos() + ply:EyeAngles():Forward()*60,
  77.             filter = function( ent ) return ent == ply end
  78.         } ).HitPos
  79.         local ent = ents.Create( item.entityForDrop or "rapd_inventory_item" )
  80.         ent:SetPos( pos )
  81.         item.owner = ent
  82.         ent.item = item
  83.         ent:SetAngles( Angle(0, ply:EyeAngles().y + 180,0) )
  84.         ent:Spawn()
  85.         ent:Activate()
  86.     end
  87. end
  88.  
  89. local function surgeryOpen(target, org, limb)
  90.     target:EmitSound("physics/flesh/flesh_squishy_impact_hard1.wav")
  91.     if !org[limb].surgeryOpenedScar then
  92.         target:RaPD_HealDamageLimb(-org[limb].MaxHP*0.25, "slash", limb)
  93.         org[limb].surgeryOpenedScar = true
  94.     end
  95. end
  96. local function surgeryClose(target, org, limb)
  97.     target:EmitSound("physics/flesh/flesh_squishy_impact_hard4.wav")
  98.     if org[limb].surgeryOpenedScar then
  99.         target:RaPD_HealDamageLimb(org[limb].MaxHP*0.25, "slash", limb)
  100.         org[limb].surgeryOpenedScar = false
  101.     end
  102.     target:RaPD_UpdateHealthInfoOnClientsNOW()
  103. end
  104.  
  105.  
  106.  
  107. RaPD_UniversalUses = {
  108.     TakeOut = {
  109.         Queue = 100,
  110.         Limbs = "All",
  111.         UseTime = 0.5,
  112.         conditions = function(user, target, limb)
  113.             return true
  114.         end,
  115.         onUseStart = function(user, target, limb)
  116.         end,
  117.         onUseEnd = function(user, target, limb, item)
  118.             takeOutItem(user, item)
  119.             return true
  120.         end,
  121.     },
  122.    
  123.     BloodSample = {
  124.         Queue = 2,
  125.         Limbs = {"RightArm", "LeftArm"},
  126.         UseTime = 1,
  127.         conditions = function(user, target, limb)
  128.             return true
  129.         end,
  130.         onUseStart = function(user, target, limb)
  131.            
  132.         end,
  133.         onUseEnd = function(user, target, limb, item)
  134.             local org = target.RaPD_Organism
  135.             local data = org[limb]
  136.             target:RaPD_TakeDamageLimb(1, "piercing", limb)
  137.             target:EmitSound("garrysmod/ui_click.wav")
  138.             target:EmitSound("physics/flesh/flesh_impact_bullet1.wav")
  139.             target:RaPD_SetBleeding(limb, true, 8, 20)
  140.             item.scanResultsMode = "Circulatory"
  141.             item.scanResultsLimb = limb
  142.             item.scanResults = table.Copy(org.Stats.reagents)
  143.             target:RaPD_UpdateHealthInfoOnClientsNOW()
  144.             return false
  145.         end,
  146.     },
  147.     SalivaSample = {
  148.         Queue = 3,
  149.         Limbs = "Head",
  150.         UseTime = 1,
  151.         conditions = function(user, target, limb)
  152.             return true
  153.         end,
  154.         onUseStart = function(user, target, limb)
  155.            
  156.         end,
  157.         onUseEnd = function(user, target, limb, item)
  158.             local org = target.RaPD_Organism
  159.             local data = org[limb]
  160.             target:EmitSound("garrysmod/ui_click.wav")
  161.             item.scanResultsMode = "Stomach"
  162.             item.scanResultsLimb = limb
  163.             item.scanResults = table.Copy(org.Stats.reagents)
  164.             target:RaPD_UpdateHealthInfoOnClientsNOW()
  165.             return false
  166.         end,
  167.     },
  168.     ScanLimbs = {
  169.         Queue = 1,
  170.         Limbs = "All",
  171.         UseTime = 1,
  172.         conditions = function(user, target, limb)
  173.             return true
  174.         end,
  175.         onUseStart = function(user, target, limb)
  176.            
  177.         end,
  178.         onUseEnd = function(user, target, limb, item)
  179.             local org = target.RaPD_Organism
  180.             local data = org[limb]
  181.             target:EmitSound("garrysmod/ui_click.wav")
  182.             item.scanResultsMode = "Limbs"
  183.             item.scanResultsLimb = limb
  184.             item.scanResults = table.Copy(data)
  185.             target:RaPD_UpdateHealthInfoOnClientsNOW()
  186.             return false
  187.         end,
  188.     },
  189.     ScanOrgans = {
  190.         Queue = 8,
  191.         Limbs = "All",
  192.         UseTime = 2,
  193.         conditions = function(user, target, limb)
  194.             local org = target.RaPD_Organism
  195.             local data = org[limb]
  196.             return data.Organs
  197.         end,
  198.         onUseStart = function(user, target, limb)
  199.            
  200.         end,
  201.         onUseEnd = function(user, target, limb, item)
  202.             local org = target.RaPD_Organism
  203.             local data = org[limb]
  204.             target:EmitSound("garrysmod/ui_click.wav")
  205.             item.scanResultsMode = "Organs"
  206.             item.scanResultsLimb = limb
  207.             item.scanResults = table.Copy(data.Organs)
  208.             target:RaPD_UpdateHealthInfoOnClientsNOW()
  209.             return false
  210.         end,
  211.     },
  212.    
  213. }
  214.  
  215. RaPD_Items = {
  216.     ["kira_bandage"] = {
  217.         model = "models/props_junk/PopCan01a.mdl",
  218.         material = "phoenix_storms/fender_white",
  219.         model_color = Color(255,200,130),
  220.        
  221.         icon = "materials/kira_rapd/items/bandage.png",
  222.         icon_color = Color(255,200,130),
  223.         icon_color_back = Color(0,0,0),
  224.        
  225.         useMethods = {
  226.             ["ApplyBandage"] = {
  227.                 Queue = 1,
  228.                 Limbs = "All",
  229.                 UseTime = 1.8,
  230.                 conditions = function(user, target, limb)
  231.                     local org = target.RaPD_Organism
  232.                     if !org then return end
  233.                     local limbData = org[limb]
  234.                     return true//!limbData.bandaged
  235.                 end,
  236.                 onUseStart = function(user, target, limb)
  237.                 end,
  238.                 onUseEnd = function(user, target, limb, item)
  239.                     if !item.uses then
  240.                         item.uses = 3
  241.                     end
  242.                     local org = target.RaPD_Organism
  243.                    
  244.                     if !org then return end
  245.                    
  246.                     local limbData = org[limb]
  247.                        
  248.                     if limbData.bleeding then limbData.bleeding = false end
  249.                    
  250.                     healBandages(2, target, limb)
  251.                    
  252.                     item.uses = item.uses - 1
  253.                    
  254.                     limbData.bandaged = true
  255.                     target:RaPD_UpdateHealthInfoOnClientsNOW()
  256.                    
  257.                     RaPD_MakeTimedHookBeforeDead("BandageHealing", user, target, limb, 30, 1, function()
  258.                        
  259.                         healBandages(0.5, target, limb)
  260.                        
  261.                     //  print("Исцеление от ",user," на ",target, "с конечностью ", limb)
  262.                     end, function()
  263.                     //  print("Завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  264.                         limbData.bandaged = false
  265.                         target:RaPD_UpdateHealthInfoOnClientsNOW()
  266.                     end)
  267.                     return item.uses <= 0
  268.                 end,
  269.             },
  270.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  271.         },
  272.     },
  273.    
  274.     ["kira_burn_ointment"] = {
  275.         model = "models/props_lab/jar01b.mdl",
  276.         model_color = Color(255,255,130),
  277.        
  278.         icon = "materials/kira_rapd/items/ointment.png",
  279.         icon_color = Color(255,255,130),
  280.         icon_color_back = Color(0,0,0),
  281.        
  282.         useMethods = {
  283.             ["ApplyOintment"] = {
  284.                 Queue = 1,
  285.                 Limbs = "All",
  286.                 UseTime = 2,
  287.                 conditions = function(user, target, limb)
  288.                     return !target:GetNW2Bool("Limb_BurnCure_"..limb, false)
  289.                 end,
  290.                 onUseStart = function(user, target, limb)
  291.                    
  292.                 end,
  293.                 onUseEnd = function(user, target, limb, item)
  294.                     if !item.uses then
  295.                         item.uses = 5
  296.                     end
  297.                     local org = target.RaPD_Organism
  298.                    
  299.                     if !org then return end
  300.                    
  301.                     local limbData = org[limb]
  302.                    
  303.                     if limbData.bleeding then limbData.bleeding = false end
  304.                    
  305.                     healBurns(2, target, limb)
  306.                    
  307.                     item.uses = item.uses - 1
  308.                    
  309.                     target:SetNW2Bool("Limb_BurnCure_"..limb, true)
  310.                     RaPD_MakeTimedHookBeforeDead("OintmentHealing", user, target, limb, 20, 1, function()
  311.                    
  312.                         healBurns(0.5, target, limb)
  313.                    
  314.                     //  print("Исцеление от ",user," на ",target, "с конечностью ", limb)
  315.                     end, function()
  316.                     //  print("Завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  317.                         target:SetNW2Bool("Limb_BurnCure_"..limb, false)
  318.                     end)
  319.                     return item.uses <= 0
  320.                 end,
  321.             },
  322.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  323.         },
  324.     },
  325.    
  326.     ["kira_syringe"] = {
  327.         model = "models/props_c17/TrapPropeller_Lever.mdl",
  328.         model_color = Color(0,0,0),
  329.         icon = "materials/kira_rapd/items/syringe.png",
  330.        
  331.         reagentsContainer = true,
  332.         reagentsLimit = 80,
  333.         icon_color = Color(180,180,200),
  334.         icon_color_back = Color(0,0,0),
  335.        
  336.         useMethods = {
  337.             ["Inject10"] = {
  338.                 Queue = 1,
  339.                 Limbs = "All",
  340.                 UseTime = 1.5,
  341.                 conditions = function(user, target, limb, item)
  342.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  343.                         return true
  344.                     end
  345.                     return false
  346.                 end,
  347.                 onUseStart = function(user, target, limb, item)
  348.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  349.                        
  350.                     end
  351.                 end,
  352.                 onUseEnd = function(user, target, limb, item)
  353.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  354.                         injectReagentFromContainer(item, 10, target, item.reagent)
  355.                     end
  356.                     return false
  357.                 end,
  358.             },
  359.             ["Inject20"] = {
  360.                 Queue = 2,
  361.                 Limbs = "All",
  362.                 UseTime = 2,
  363.                 conditions = function(user, target, limb, item)
  364.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  365.                         return true
  366.                     end
  367.                     return false
  368.                 end,
  369.                 onUseStart = function(user, target, limb, item)
  370.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  371.                        
  372.                     end
  373.                 end,
  374.                 onUseEnd = function(user, target, limb, item)
  375.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  376.                         injectReagentFromContainer(item, 20, target, item.reagent)
  377.                     end
  378.                     return false
  379.                 end,
  380.             },
  381.             ["Inject40"] = {
  382.                 Queue = 3,
  383.                 Limbs = "All",
  384.                 UseTime = 3,
  385.                 conditions = function(user, target, limb, item)
  386.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  387.                         return true
  388.                     end
  389.                     return false
  390.                 end,
  391.                 onUseStart = function(user, target, limb, item)
  392.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  393.                        
  394.                     end
  395.                 end,
  396.                 onUseEnd = function(user, target, limb, item)
  397.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  398.                         injectReagentFromContainer(item, 40, target, item.reagent)
  399.                     end
  400.                     return false
  401.                 end,
  402.             },
  403.             ["Inject80"] = {
  404.                 Queue = 4,
  405.                 Limbs = "All",
  406.                 UseTime = 6,
  407.                 conditions = function(user, target, limb, item)
  408.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  409.                         return true
  410.                     end
  411.                     return false
  412.                 end,
  413.                 onUseStart = function(user, target, limb, item)
  414.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  415.                        
  416.                     end
  417.                 end,
  418.                 onUseEnd = function(user, target, limb, item)
  419.                     if item.reagent and item.reagentCount and item.reagentCount > 0 then
  420.                         injectReagentFromContainer(item, 80, target, item.reagent)
  421.                     end
  422.                     return false
  423.                 end,
  424.             },
  425.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  426.         },
  427.     },
  428.    
  429.    
  430.     ["kira_bloodbag"] = {
  431.         model = "models/Items/HealthKit.mdl",
  432.         model_color = Color(200,70,70),
  433.         icon = "materials/kira_rapd/items/bloodbagbig.png",
  434.        
  435.         reagentsContainer = true,
  436.         reagentsLimit = 1000,
  437.         icon_color = Color(180,180,200),
  438.         icon_color_back = Color(0,0,0),
  439.        
  440.         useMethods = {
  441.             ["BloodBagInject"] = {
  442.                 Queue = 1,
  443.                 Limbs = "All",
  444.                 UseTime = 1.2,
  445.                 conditions = function(user, target, limb, item)
  446.                     if item.reagent and item.reagentCount and item.reagentCount > 0 and !target.RaPD_Organism[limb].bloodbagAttached and !item.opened then
  447.                         return true
  448.                     end
  449.                     return false
  450.                 end,
  451.                 onUseStart = function(user, target, limb, item)
  452.                 end,
  453.                 onUseEnd = function(user, target, limb, item)
  454.                     if item.reagent and item.reagentCount and item.reagentCount > 0 and !item.opened then
  455.                         target.RaPD_Organism[limb].bloodbagAttached = true
  456.                         item.opened = true
  457.                         local endInjection
  458.                         RaPD_MakeTimedHookBeforeDead("BloodBagInjectionThink_"..tostring(item), user, target, limb, 100, 0.4, function()
  459.                             if item.owner and IsValid(item.owner) and item.owner:GetPos():Distance(target:GetPos()) < 250 then
  460.                                 injectReagentFromContainer(item, 5, target, item.reagent)
  461.                                 if item.owner:IsPlayer() then item.owner:RaPD_UpdateInventory(2) end
  462.                             //  print("Исцеление от ",user," на ",target, "с конечностью ", limb)
  463.                             else
  464.                                 endInjection = true
  465.                                
  466.                                 target:RaPD_TakeDamageLimb(6, "piercing", limb)
  467.                                 target:EmitSound("physics/flesh/flesh_impact_bullet1.wav")
  468.                                 target:RaPD_SetBleeding(limb, true, 25, 65)
  469.                                
  470.                                 net.Start( "RaPD_SpreadBlood" )
  471.                                 net.WriteEntity(target)
  472.                                 net.WriteFloat( 1 )
  473.                                 net.Broadcast()
  474.                                
  475.                             //  print("Экстренное завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  476.                             end
  477.                         end, function()
  478.                         //  print("Завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  479.                             target.RaPD_Organism[limb].bloodbagAttached = false
  480.                             item.opened = false
  481.                         end, function()
  482.                             return endInjection or !item.opened or (!item.reagent or !item.reagentCount or item.reagentCount <= 0)
  483.                         end)
  484.                     end
  485.                 end,
  486.             },
  487.             ["BloodBagClose"] = {
  488.                 Queue = 2,
  489.                 Limbs = "All",
  490.                 UseTime = 0.7,
  491.                 conditions = function(user, target, limb, item)
  492.                     if item.opened then
  493.                         return true
  494.                     end
  495.                     return false
  496.                 end,
  497.                 onUseStart = function(user, target, limb, item)
  498.                 end,
  499.                 onUseEnd = function(user, target, limb, item)
  500.                     if item.opened then
  501.                         item.opened = false
  502.                     end
  503.                 end,
  504.             },
  505.             ["Drink"] = {
  506.                 Queue = 3,
  507.                 Limbs = "Head",
  508.                 UseTime = 1,
  509.                 conditions = function(user, target, limb)
  510.                     return true
  511.                 end,
  512.                 onUseStart = function(user, target, limb)
  513.                    
  514.                 end,
  515.                 onUseEnd = function(user, target, limb, item)
  516.                     local org = target.RaPD_Organism
  517.                     local stom = org.Stats.reagents.Stomach
  518.                    
  519.                     eatReagentFromContainer(item, 150, target, item.reagent)
  520.  
  521.                     return false
  522.                 end,
  523.             },
  524.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  525.         },
  526.     },
  527.    
  528.    
  529.    
  530.     ["kira_pill_charcoal"] = {
  531.         model = "models/props_lab/jar01b.mdl",
  532.         model_color = Color(80,155,80),
  533.        
  534.         icon = "materials/kira_rapd/items/pill.png",
  535.         icon_color = Color(80,155,80),
  536.         icon_color_back = Color(0,0,0),
  537.        
  538.         useMethods = {
  539.             ["Eat"] = {
  540.                 Queue = 1,
  541.                 Limbs = "Head",
  542.                 UseTime = 1,
  543.                 conditions = function(user, target, limb)
  544.                     return true
  545.                 end,
  546.                 onUseStart = function(user, target, limb)
  547.                    
  548.                 end,
  549.                 onUseEnd = function(user, target, limb)
  550.                     local org = target.RaPD_Organism
  551.                     local stom = org.Stats.reagents.Stomach
  552.                    
  553.                     stom.charcoal = (stom.charcoal or 0) + 20
  554.                     /*
  555.                     local org = target.RaPD_Organism
  556.                     local stom = org.Stats.reagents.Stomach
  557.                    
  558.                     target:SetNW2Bool("Limb_CharcoalCure_"..limb, true)
  559.                     RaPD_MakeTimedHookBeforeDead("CharcoalHealing", user, target, limb, 30, 1, function()
  560.                    
  561.                         target:RaPD_HealDamageAllLimbsPercent(0.005, "toxin")
  562.                    
  563.                         print("Исцеление от ",user," на ",target, "с конечностью ", limb)
  564.                     end, function()
  565.                         print("Завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  566.                         target:SetNW2Bool("Limb_CharcoalCure_"..limb, false)
  567.                     end)
  568.                     */
  569.                     return true
  570.                 end,
  571.             },
  572.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  573.         },
  574.     },
  575.    
  576.     ["kira_splint"] = {
  577.         model = "models/props_junk/garbage_bag001a.mdl",
  578.         material = "phoenix_storms/fender_white",
  579.  
  580.         icon = "materials/kira_rapd/items/splint.png",
  581.        
  582.         useMethods = {
  583.             ["ApplySplint"] = {
  584.                 Queue = 1,
  585.                 Limbs = {"LeftArm","LeftLeg","RightArm","RightLeg",},
  586.                 UseTime = 10,
  587.                 conditions = function(user, target, limb)
  588.                     local org = target.RaPD_Organism
  589.                     return org and org[limb] and org[limb].fracture
  590.                 end,
  591.                 onUseStart = function(user, target, limb)
  592.                    
  593.                 end,
  594.                 onUseEnd = function(user, target, limb)
  595.                
  596.                     local org = target.RaPD_Organism
  597.                     if !org then return end
  598.                     if org[limb].fracture then
  599.                         org[limb].fracture = false
  600.                         target:RaPD_UpdateHealthInfoOnClients()
  601.                         return true
  602.                     end
  603.                 end,
  604.             },
  605.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  606.         },
  607.     },
  608.    
  609.     ["kira_surgery_kit"] = {
  610.         model = "models/props_c17/BriefCase001a.mdl",
  611.        
  612.         icon = "materials/kira_rapd/items/medkit_surgery.png",
  613.         icon_color = Color(130,130,180),
  614.         icon_color_back = Color(0,0,0),
  615.  
  616.         useMethods = {
  617.             ["Surgery_FixOrgans"] = {
  618.                 Queue = 1,
  619.                 Limbs = {"Chest", "Head"},
  620.                 UseTime = 15,
  621.                 conditions = function(user, target, limb)
  622.                     local org = target.RaPD_Organism
  623.                     local data = org[limb]
  624.                     return data.Organs
  625.                 end,
  626.                 onUseStart = function(user, target, limb)
  627.                     local org = target.RaPD_Organism
  628.                     target:RaPD_UpdateHealthInfoOnClients()
  629.                     target:RaPD_SetBleeding(limb, true, 30, 120)
  630.                     surgeryOpen(target, org, limb)
  631.                 end,
  632.                 onUseEnd = function(user, target, limb)
  633.                     if (!target.RaPD_Organism) or !limb or !target.RaPD_Organism[limb] or !target.RaPD_Organism[limb].Organs then return end
  634.                     local organs = target.RaPD_Organism[limb].Organs
  635.                     for organ, data in pairs(organs) do
  636.                    
  637.                         if data.MaxHP and data.DMG and data.DMG > 0 then
  638.                             data.DMG = 0
  639.                             user:RaPD_Thought_Localized({"HealingOrgans", organ}, Color(250,250,250), 4, 1, 1, 1, 5, 8)
  640.                         end
  641.                     end
  642.                    
  643.                     local org = target.RaPD_Organism
  644.                    
  645.                     target:RaPD_SetBleeding(limb, false)
  646.                    
  647.                     surgeryClose(target, org, limb)
  648.                    
  649.                     target:RaPD_UpdateHealthInfoOnClients()
  650.                 end,
  651.             },
  652.             ["Surgery_FixBones"] = {
  653.                 Queue = 2,
  654.                 Limbs = {"LeftArm", "LeftLeg", "RightArm", "RightLeg", "Chest", "Head"},
  655.                 UseTime = 15,
  656.                 conditions = function(user, target, limb)
  657.                     local org = target.RaPD_Organism
  658.                     return org and org[limb] and org[limb].fracture
  659.                 end,
  660.                 onUseStart = function(user, target, limb)
  661.                     local org = target.RaPD_Organism
  662.                     target:RaPD_SetBleeding(limb, true, 30, 120)
  663.                     surgeryOpen(target, org, limb)
  664.                 end,
  665.                 onUseEnd = function(user, target, limb)
  666.                     local org = target.RaPD_Organism
  667.                     target:RaPD_SetBleeding(limb, false)
  668.                     surgeryClose(target, org, limb)
  669.                     if !org then return end
  670.                     if org[limb].fracture then
  671.                         org[limb].fracture = false
  672.                     end
  673.                 end,
  674.             },
  675.             ["Surgery_Close"] = {
  676.                 Queue = 3,
  677.                 Limbs = "All",
  678.                 UseTime = 2,
  679.                 conditions = function(user, target, limb)
  680.                     local org = target.RaPD_Organism
  681.                     return org and org[limb] and org[limb].surgeryOpenedScar
  682.                 end,
  683.                 onUseStart = function(user, target, limb)
  684.                     local org = target.RaPD_Organism
  685.                 end,
  686.                 onUseEnd = function(user, target, limb)
  687.                     local org = target.RaPD_Organism
  688.                     target:RaPD_SetBleeding(limb, false)
  689.                     surgeryClose(target, org, limb)
  690.                 end,
  691.             },
  692.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  693.         },
  694.     },
  695.    
  696.     ["kira_scanner_lite"] = {
  697.         model = "models/Items/battery.mdl",
  698.         model_color = Color(65,155,222),
  699.        
  700.         icon = "materials/kira_rapd/items/scanner_lite.png",
  701.         icon_color = Color(65,155,222),
  702.         icon_color_back = Color(0,0,0),
  703.        
  704.         useMethods = {
  705.             ["ScanReagents"] = RaPD_UniversalUses.BloodSample,
  706.             ["ScanReagentsStomach"] = RaPD_UniversalUses.SalivaSample,
  707.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  708.         },
  709.     },
  710.    
  711.     ["kira_scanner_full"] = {
  712.         model = "models/Items/battery.mdl",
  713.         model_color = Color(222,100,167),
  714.        
  715.         icon = "materials/kira_rapd/items/scanner.png",
  716.         icon_color = Color(222,100,167),
  717.         icon_color_back = Color(0,0,0),
  718.        
  719.         useMethods = {
  720.             ["ScanReagents"] = RaPD_UniversalUses.BloodSample,
  721.             ["ScanReagentsStomach"] = RaPD_UniversalUses.SalivaSample,
  722.             ["ScanLimbs"] = RaPD_UniversalUses.ScanLimbs,
  723.             ["ScanOrgans"] = RaPD_UniversalUses.ScanOrgans,
  724.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  725.         },
  726.     },
  727.     --------------------------------------------------
  728.     ---------------------- Food ----------------------
  729.     --------------------------------------------------
  730.     /*["kira_burger"] = {
  731.         model = "models/food/burger.mdl",
  732.         model_color = Color(255,255,255),
  733.        
  734.         icon = "materials/kira_rapd/items/burger.png",
  735.         icon_color = Color(210,172,87),
  736.         icon_color_back = Color(0,0,0),
  737.        
  738.         useMethods = {
  739.             ["Eat"] = {
  740.                 Queue = 1,
  741.                 Limbs = "Head",
  742.                 UseTime = 1,
  743.                 conditions = function(user, target, limb)
  744.                     return true
  745.                 end,
  746.                 onUseStart = function(user, target, limb)
  747.                    
  748.                 end,
  749.                 onUseEnd = function(user, target, limb)
  750.                     local org = target.RaPD_Organism
  751.                     local stom = org.Stats.reagents.Stomach
  752.                    
  753.                     stom.nutrients = (stom.nutrients or 0) + 1200
  754.                    
  755.                     return true
  756.                 end,
  757.             },
  758.             ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  759.         },
  760.     },*/
  761. }
  762.  
  763. function KiraScripts.RaPD_AddItem(name, data)
  764.     if !name or !data then
  765.         print("[RaPD] Error! Item ( "..tostring(name).." ) can not be added!")
  766.     return end
  767.     RaPD_Items[name] = data
  768.     print("[RaPD] Item "..tostring(name).." succesfully added.")
  769. end
  770.  
  771. print("[RaPD] - Items are loaded.")
  772.  
  773. KiraExpansions.InitializeAddons("RaPD_Items")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement