Advertisement
Caldryk

rapd_inventory_item.lua

Mar 21st, 2025
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.98 KB | None | 0 0
  1. AddCSLuaFile()
  2.  
  3. ENT.Type = "anim"
  4. ENT.PrintName = "Item"
  5. ENT.Category = "Kiraki"
  6.  
  7. ENT.Spawnable = true
  8. ENT.AdminSpawnable = true
  9.  
  10. ENT.AutomaticFrameAdvance = true
  11.  
  12.  
  13.  
  14. if CLIENT then
  15.  
  16. surface.CreateFont( "RaPD_WorldItem_Text", {
  17. font = "CloseCaption_Bold",
  18. size = 50,
  19. extended = false,
  20. blursize = 0.5,
  21. antialias = true,
  22. shadow = true,
  23. } )
  24. local namesDist = 300
  25. function ENT:Draw()
  26. self:DrawModel()
  27. local id = self:GetNW2String("RaPD_Item_Id", false)
  28. if id then
  29. local data = RaPD_Items[id]
  30. if data then
  31. local localize = KiraScripts.Localization.RaPD[KiraScripts.Localization.Language]
  32. if localize.Items[id] then
  33. local angs = (EyePos() - self:GetPos()):GetNormal():Angle()
  34. local ang = Angle(0,angs.y+90,angs.r+90)
  35.  
  36. local ply = LocalPlayer()
  37. local pos = self:GetPos()
  38.  
  39. local tr = util.TraceLine( {
  40. start = pos + self:OBBCenter(),
  41. endpos = ply:EyePos(),
  42. filter = {self, ply}
  43. } )
  44.  
  45. local diff = pos - EyePos()
  46. local isLooking = ply:GetAimVector():Dot(diff) / diff:Length() >= 0.97
  47.  
  48. local shouldFade = !isLooking or (tr.Hit or pos:DistToSqr(ply:GetPos()) >= namesDist*namesDist)
  49.  
  50. self.NameAlpha = math.Approach(self.NameAlpha or 1, shouldFade and 0 or 1, 2*FrameTime())
  51. if self.NameAlpha >= 0.01 then
  52. if !self.spawnedTime then
  53. self.spawnedTime = 0
  54. end
  55. self.spawnedTime = self.spawnedTime + FrameTime()
  56. cam.Start3D2D( pos + Vector(0,0,math.sin(self.spawnedTime*2)*0.5+10) + angs:Forward()*10, ang, 0.05 )
  57. cam.IgnoreZ( true )
  58. local lighting = render.GetLightColor( pos )
  59. local col = data.icon_color or Color( 255, 255, 255 )
  60. local lightedColor = (Color( col.r, col.g, col.b, 255*self.NameAlpha ))
  61. //lightedColor.r = lightedColor.r*1-lightedColor.r*lighting.r
  62. //lightedColor.g = lightedColor.g*1-lightedColor.g*lighting.g
  63. //lightedColor.b = lightedColor.b*1-lightedColor.b*lighting.b
  64.  
  65. draw.DrawText( localize.Items[id].Name or "ERROR", "RaPD_WorldItem_Text", 0, 0, lightedColor, 1 )
  66. cam.IgnoreZ( false )
  67. cam.End3D2D()
  68. end
  69. end
  70. end
  71. end
  72. end
  73. end
  74.  
  75. function ENT:SpawnedParams( tbl )
  76. end
  77.  
  78. function ENT:SpawnFunction( ply, tr, class )
  79. local tr,trace = {},{}
  80. tr.start = ply:GetShootPos()
  81. tr.endpos = tr.start + ply:GetAimVector() * 2000
  82. tr.filter = ply
  83. tr.mask = MASK_WATER + MASK_SOLID
  84. trace = util.TraceLine( tr )
  85. local SpawnPos = trace.HitPos + trace.HitNormal * 1
  86. local ent = ents.Create( class )
  87. ent:SetPos( SpawnPos )
  88. ent.Owner = ply
  89. ent.item = {id = self.SpawnableID or "kira_bandage"}
  90. ent:SetAngles( Angle(0, ply:EyeAngles().y + 180,0) )
  91. ent:Spawn()
  92. ent:Activate()
  93. return ent
  94. end
  95. if SERVER then
  96. function ENT:OnRemove()
  97.  
  98. end
  99.  
  100. function ENT:Think()
  101.  
  102. end
  103.  
  104. function ENT:Use(ply)
  105. if ply:RaPD_AddToInventory(self.item) then
  106. self.item.owner = ply
  107. self:Remove()
  108. ply:EmitSound("items/ammo_pickup.wav")
  109. end
  110. end
  111.  
  112. function ENT:Initialize()
  113. local item = self.item
  114. if SERVER then
  115.  
  116. if !item then
  117. self.item = {id = self.SpawnableID or "kira_bandage"}
  118. item = self.item
  119. end
  120. if item and !item.entityForDrop then
  121. item.entityForDrop = self:GetClass()
  122. end
  123. if item and item.id and item.id != "" then
  124. self.data = RaPD_Items[item.id]
  125. self:SetNW2String("RaPD_Item_Id", item.id)
  126. end
  127.  
  128. local data = self.data
  129. self:SetModel(data.model or "models/hunter/blocks/cube025x025x025.mdl")
  130. self:SetMaterial(data.material or "")
  131. self:SetColor(data.model_color or Color(255,255,255))
  132. self:PhysicsInit(SOLID_VPHYSICS)
  133. self:SetMoveType(MOVETYPE_VPHYSICS)
  134. self:SetSolid(SOLID_VPHYSICS)
  135. self:SetUseType(SIMPLE_USE)
  136. if self.SpawnedParams then
  137. self:SpawnedParams( item )
  138. end
  139. end
  140. local phys = self:GetPhysicsObject()
  141. if (phys:IsValid()) then
  142. phys:Wake()
  143. end
  144.  
  145. self:SetPlaybackRate(1)
  146. end
  147. end
  148. /*
  149. function RaPD_MakeTimedHookBeforeDead(name, user, target, limb, endTime, tickTime, tickFunc, endFunc, conditionFunc)
  150. local hookName = target:EntIndex().."_"..limb.."_Bandage_Think"
  151. local limbName = limb
  152.  
  153. local endVarName = "RaPD_"..name.."_EndTime_"..limb
  154. local tickVarName = "RaPD_"..name.."_TickTime_"..limb
  155.  
  156. target[endVarName] = CurTime() + endTime
  157. target[tickVarName] = CurTime() + tickTime
  158.  
  159. hook.Add( "Think", hookName, function()
  160. local isValid = IsValid(target)
  161. if !isValid or !target:Alive() or (target[endVarName] and target[endVarName] <= CurTime()) or (isfunction(conditionFunc) and conditionFunc()) then
  162.  
  163. if isfunction(endFunc) then endFunc() end
  164.  
  165. hook.Remove( "Think", hookName)
  166.  
  167. target[endVarName] = nil
  168. target[tickVarName] = nil
  169.  
  170. elseif target[tickVarName] and target[tickVarName] <= CurTime() then
  171.  
  172. if isfunction(tickFunc) then tickFunc() end
  173.  
  174. target[tickVarName] = CurTime() + tickTime
  175. end
  176. end )
  177. end
  178.  
  179. local function healBandages(mult, target, limb)
  180. target:RaPD_HealDamageLimb(2*mult, "piercing", limb)
  181. target:RaPD_HealDamageLimb(1*mult, "slash", limb)
  182. target:RaPD_HealDamageLimb(0.25*mult, "burn", limb)
  183. target:RaPD_HealDamageLimb(1.5*mult, "blast", limb)
  184. target:RaPD_HealDamageLimb(2*mult, "blunt", limb)
  185. end
  186.  
  187. local function healBurns(mult, target, limb)
  188. target:RaPD_HealDamageLimb(1*mult, "burn", limb)
  189. end
  190.  
  191. local function injectReagentFromContainer(item, count, target, reagent)
  192.  
  193. local reagents = target.RaPD_Organism.Stats.reagents
  194. local count = count + (math.min(item.reagentCount - count, 0))
  195.  
  196. item.reagentCount = item.reagentCount - count
  197.  
  198.  
  199. KiraScripts.RaPD_Reagents_FastCalc(reagents.Circulatory, reagent, count)
  200. end
  201. local function eatReagentFromContainer(item, count, target, reagent)
  202.  
  203. local reagents = target.RaPD_Organism.Stats.reagents
  204. local count = count + (math.min(item.reagentCount - count, 0))
  205.  
  206. print("В предмете вычтется: ", count)
  207. print("В предмете до: ", item.reagentCount)
  208. item.reagentCount = item.reagentCount - count
  209. print("------")
  210. print("В предмете после: ", item.reagentCount)
  211. print("В организме до: ", reagents.Stomach[reagent])
  212. KiraScripts.RaPD_Reagents_FastCalc(reagents.Stomach, reagent, count)
  213. print("В организме после: ", reagents.Stomach[reagent])
  214. print("---------------------------")
  215. end
  216.  
  217. local function takeOutItem(ply, item)
  218. if SERVER then
  219. local pos = util.TraceLine( {
  220. start = ply:EyePos(),
  221. endpos = ply:EyePos() + ply:EyeAngles():Forward()*60,
  222. filter = function( ent ) return ent == ply end
  223. } ).HitPos
  224. local ent = ents.Create( "rapd_inventory_item" )
  225. ent:SetPos( pos )
  226. item.owner = ent
  227. ent.item = item
  228. ent:SetAngles( Angle(0, ply:EyeAngles().y + 180,0) )
  229. ent:Spawn()
  230. ent:Activate()
  231. end
  232. end
  233.  
  234. local function surgeryOpen(target, org, limb)
  235. target:EmitSound("physics/flesh/flesh_squishy_impact_hard1.wav")
  236. if !org[limb].surgeryOpenedScar then
  237. target:RaPD_HealDamageLimb(-org[limb].MaxHP*0.45, "slash", limb)
  238. org[limb].surgeryOpenedScar = true
  239. end
  240. end
  241. local function surgeryClose(target, org, limb)
  242. target:EmitSound("physics/flesh/flesh_squishy_impact_hard4.wav")
  243. if org[limb].surgeryOpenedScar then
  244. target:RaPD_HealDamageLimb(org[limb].MaxHP*0.3, "slash", limb)
  245. org[limb].surgeryOpenedScar = false
  246. end
  247. target:RaPD_UpdateHealthInfoOnClientsNOW()
  248. end
  249.  
  250.  
  251.  
  252. RaPD_UniversalUses = {
  253. TakeOut = {
  254. Queue = 100,
  255. Limbs = "All",
  256. UseTime = 0.5,
  257. conditions = function(user, target, limb)
  258. return true
  259. end,
  260. onUseStart = function(user, target, limb)
  261. end,
  262. onUseEnd = function(user, target, limb, item)
  263. takeOutItem(user, item)
  264. return true
  265. end,
  266. },
  267.  
  268. BloodSample = {
  269. Queue = 2,
  270. Limbs = {"RightArm", "LeftArm"},
  271. UseTime = 1,
  272. conditions = function(user, target, limb)
  273. return true
  274. end,
  275. onUseStart = function(user, target, limb)
  276.  
  277. end,
  278. onUseEnd = function(user, target, limb, item)
  279. local org = target.RaPD_Organism
  280. local data = org[limb]
  281. target:RaPD_TakeDamageLimb(1, "piercing", limb)
  282. target:EmitSound("garrysmod/ui_click.wav")
  283. target:EmitSound("physics/flesh/flesh_impact_bullet1.wav")
  284. target:RaPD_SetBleeding(limb, true, 8, 20)
  285. item.scanResultsMode = "Circulatory"
  286. item.scanResults = table.Copy(org.Stats.reagents)
  287. target:RaPD_UpdateHealthInfoOnClientsNOW()
  288. return false
  289. end,
  290. },
  291. SalivaSample = {
  292. Queue = 3,
  293. Limbs = "Head",
  294. UseTime = 1,
  295. conditions = function(user, target, limb)
  296. return true
  297. end,
  298. onUseStart = function(user, target, limb)
  299.  
  300. end,
  301. onUseEnd = function(user, target, limb, item)
  302. local org = target.RaPD_Organism
  303. local data = org[limb]
  304. target:EmitSound("garrysmod/ui_click.wav")
  305. item.scanResultsMode = "Stomach"
  306. item.scanResults = table.Copy(org.Stats.reagents)
  307. target:RaPD_UpdateHealthInfoOnClientsNOW()
  308. return false
  309. end,
  310. },
  311. ScanLimbs = {
  312. Queue = 1,
  313. Limbs = "All",
  314. UseTime = 1,
  315. conditions = function(user, target, limb)
  316. return true
  317. end,
  318. onUseStart = function(user, target, limb)
  319.  
  320. end,
  321. onUseEnd = function(user, target, limb, item)
  322. local org = target.RaPD_Organism
  323. local data = org[limb]
  324. target:EmitSound("garrysmod/ui_click.wav")
  325. item.scanResultsMode = "Limbs"
  326. item.scanResults = table.Copy(data)
  327. target:RaPD_UpdateHealthInfoOnClientsNOW()
  328. return false
  329. end,
  330. },
  331. ScanOrgans = {
  332. Queue = 8,
  333. Limbs = "All",
  334. UseTime = 2,
  335. conditions = function(user, target, limb)
  336. local org = target.RaPD_Organism
  337. local data = org[limb]
  338. return data.Organs
  339. end,
  340. onUseStart = function(user, target, limb)
  341.  
  342. end,
  343. onUseEnd = function(user, target, limb, item)
  344. local org = target.RaPD_Organism
  345. local data = org[limb]
  346. target:EmitSound("garrysmod/ui_click.wav")
  347. item.scanResultsMode = "Organs"
  348. item.scanResults = table.Copy(data.Organs)
  349. target:RaPD_UpdateHealthInfoOnClientsNOW()
  350. return false
  351. end,
  352. },
  353.  
  354. }
  355.  
  356. RaPD_Items = {
  357. ["kira_bandage"] = {
  358. model = "models/props_junk/PopCan01a.mdl",
  359. material = "phoenix_storms/fender_white",
  360. model_color = Color(255,200,130),
  361.  
  362. icon = "materials/kira_rapd/items/bandage.png",
  363. icon_color = Color(255,200,130),
  364. icon_color_back = Color(0,0,0),
  365.  
  366. useMethods = {
  367. ["ApplyBandage"] = {
  368. Queue = 1,
  369. Limbs = "All",
  370. UseTime = 1.8,
  371. conditions = function(user, target, limb)
  372. local org = target.RaPD_Organism
  373. if !org then return end
  374. local limbData = org[limb]
  375. return !limbData.bandaged
  376. end,
  377. onUseStart = function(user, target, limb)
  378. end,
  379. onUseEnd = function(user, target, limb, item)
  380. if !item.uses then
  381. item.uses = 3
  382. end
  383. print("Перевязка от ",user," на ",target, "с конечностью ", limb)
  384.  
  385. local org = target.RaPD_Organism
  386.  
  387. if !org then return end
  388.  
  389. local limbData = org[limb]
  390.  
  391. if limbData.bleeding then limbData.bleeding = false end
  392.  
  393. healBandages(2, target, limb)
  394.  
  395. item.uses = item.uses - 1
  396.  
  397. limbData.bandaged = true
  398. target:RaPD_UpdateHealthInfoOnClientsNOW()
  399.  
  400. RaPD_MakeTimedHookBeforeDead("BandageHealing", user, target, limb, 30, 1, function()
  401.  
  402. healBandages(0.5, target, limb)
  403.  
  404. print("Исцеление от ",user," на ",target, "с конечностью ", limb)
  405. end, function()
  406. print("Завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  407. limbData.bandaged = false
  408. target:RaPD_UpdateHealthInfoOnClientsNOW()
  409. end)
  410. return item.uses <= 0
  411. end,
  412. },
  413. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  414. },
  415. },
  416.  
  417. ["kira_burn_ointment"] = {
  418. model = "models/props_lab/jar01b.mdl",
  419. model_color = Color(255,255,130),
  420.  
  421. icon = "materials/kira_rapd/items/ointment.png",
  422. icon_color = Color(255,255,130),
  423. icon_color_back = Color(0,0,0),
  424.  
  425. useMethods = {
  426. ["ApplyOintment"] = {
  427. Queue = 1,
  428. Limbs = "All",
  429. UseTime = 2,
  430. conditions = function(user, target, limb)
  431. return !target:GetNW2Bool("Limb_BurnCure_"..limb, false)
  432. end,
  433. onUseStart = function(user, target, limb)
  434.  
  435. end,
  436. onUseEnd = function(user, target, limb)
  437. print("Перевязка от ",user," на ",target, "с конечностью ", limb)
  438.  
  439. local org = target.RaPD_Organism
  440.  
  441. if !org then return end
  442.  
  443. local limbData = org[limb]
  444.  
  445. if limbData.bleeding then limbData.bleeding = false end
  446.  
  447. healBurns(2, target, limb)
  448.  
  449. target:SetNW2Bool("Limb_BurnCure_"..limb, true)
  450. RaPD_MakeTimedHookBeforeDead("OintmentHealing", user, target, limb, 20, 1, function()
  451.  
  452. healBurns(0.5, target, limb)
  453.  
  454. print("Исцеление от ",user," на ",target, "с конечностью ", limb)
  455. end, function()
  456. print("Завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  457. target:SetNW2Bool("Limb_BurnCure_"..limb, false)
  458. end)
  459. return true
  460. end,
  461. },
  462. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  463. },
  464. },
  465.  
  466. ["kira_syringe"] = {
  467. model = "models/props_c17/TrapPropeller_Lever.mdl",
  468. model_color = Color(0,0,0),
  469. icon = "materials/kira_rapd/items/syringe.png",
  470.  
  471. reagentsContainer = true,
  472. reagentsLimit = 80,
  473. icon_color = Color(180,180,200),
  474. icon_color_back = Color(0,0,0),
  475.  
  476. useMethods = {
  477. ["Inject10"] = {
  478. Queue = 1,
  479. Limbs = "All",
  480. UseTime = 1.5,
  481. conditions = function(user, target, limb, item)
  482. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  483. return true
  484. end
  485. return false
  486. end,
  487. onUseStart = function(user, target, limb, item)
  488. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  489.  
  490. end
  491. end,
  492. onUseEnd = function(user, target, limb, item)
  493. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  494. injectReagentFromContainer(item, 10, target, item.reagent)
  495. end
  496. return false
  497. end,
  498. },
  499. ["Inject20"] = {
  500. Queue = 2,
  501. Limbs = "All",
  502. UseTime = 2,
  503. conditions = function(user, target, limb, item)
  504. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  505. return true
  506. end
  507. return false
  508. end,
  509. onUseStart = function(user, target, limb, item)
  510. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  511.  
  512. end
  513. end,
  514. onUseEnd = function(user, target, limb, item)
  515. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  516. injectReagentFromContainer(item, 20, target, item.reagent)
  517. end
  518. return false
  519. end,
  520. },
  521. ["Inject40"] = {
  522. Queue = 3,
  523. Limbs = "All",
  524. UseTime = 3,
  525. conditions = function(user, target, limb, item)
  526. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  527. return true
  528. end
  529. return false
  530. end,
  531. onUseStart = function(user, target, limb, item)
  532. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  533.  
  534. end
  535. end,
  536. onUseEnd = function(user, target, limb, item)
  537. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  538. injectReagentFromContainer(item, 40, target, item.reagent)
  539. end
  540. return false
  541. end,
  542. },
  543. ["Inject80"] = {
  544. Queue = 4,
  545. Limbs = "All",
  546. UseTime = 6,
  547. conditions = function(user, target, limb, item)
  548. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  549. return true
  550. end
  551. return false
  552. end,
  553. onUseStart = function(user, target, limb, item)
  554. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  555.  
  556. end
  557. end,
  558. onUseEnd = function(user, target, limb, item)
  559. if item.reagent and item.reagentCount and item.reagentCount > 0 then
  560. injectReagentFromContainer(item, 80, target, item.reagent)
  561. end
  562. return false
  563. end,
  564. },
  565. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  566. },
  567. },
  568.  
  569.  
  570. ["kira_bloodbag"] = {
  571. model = "models/Items/HealthKit.mdl",
  572. model_color = Color(200,70,70),
  573. icon = "materials/kira_rapd/items/bloodbagbig.png",
  574.  
  575. reagentsContainer = true,
  576. reagentsLimit = 1000,
  577. icon_color = Color(180,180,200),
  578. icon_color_back = Color(0,0,0),
  579.  
  580. useMethods = {
  581. ["BloodBagInject"] = {
  582. Queue = 1,
  583. Limbs = "All",
  584. UseTime = 1.2,
  585. conditions = function(user, target, limb, item)
  586. if item.reagent and item.reagentCount and item.reagentCount > 0 and !target.RaPD_Organism[limb].bloodbagAttached and !item.opened then
  587. return true
  588. end
  589. return false
  590. end,
  591. onUseStart = function(user, target, limb, item)
  592. end,
  593. onUseEnd = function(user, target, limb, item)
  594. if item.reagent and item.reagentCount and item.reagentCount > 0 and !item.opened then
  595. target.RaPD_Organism[limb].bloodbagAttached = true
  596. item.opened = true
  597. local endInjection
  598. RaPD_MakeTimedHookBeforeDead("BloodBagInjectionThink_"..tostring(item), user, target, limb, 100, 0.4, function()
  599. if item.owner and IsValid(item.owner) and item.owner:GetPos():Distance(target:GetPos()) < 250 then
  600. injectReagentFromContainer(item, 5, target, item.reagent)
  601. if item.owner:IsPlayer() then item.owner:RaPD_UpdateInventory(2) end
  602. print("Исцеление от ",user," на ",target, "с конечностью ", limb)
  603. else
  604. endInjection = true
  605.  
  606. target:RaPD_TakeDamageLimb(6, "piercing", limb)
  607. target:EmitSound("physics/flesh/flesh_impact_bullet1.wav")
  608. target:RaPD_SetBleeding(limb, true, 25, 65)
  609.  
  610. net.Start( "RaPD_SpreadBlood" )
  611. net.WriteEntity(target)
  612. net.WriteFloat( 1 )
  613. net.Broadcast()
  614.  
  615. print("Экстренное завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  616. end
  617. end, function()
  618. print("Завершение исцеления от ",user," на ",target, "с конечностью ", limb)
  619. target.RaPD_Organism[limb].bloodbagAttached = false
  620. item.opened = false
  621. end, function()
  622. return endInjection or !item.opened or (!item.reagent or !item.reagentCount or item.reagentCount <= 0)
  623. end)
  624. end
  625. end,
  626. },
  627. ["BloodBagClose"] = {
  628. Queue = 2,
  629. Limbs = "All",
  630. UseTime = 0.7,
  631. conditions = function(user, target, limb, item)
  632. if item.opened then
  633. return true
  634. end
  635. return false
  636. end,
  637. onUseStart = function(user, target, limb, item)
  638. end,
  639. onUseEnd = function(user, target, limb, item)
  640. if item.opened then
  641. item.opened = false
  642. end
  643. end,
  644. },
  645. ["Drink"] = {
  646. Queue = 3,
  647. Limbs = "Head",
  648. UseTime = 1,
  649. conditions = function(user, target, limb)
  650. return true
  651. end,
  652. onUseStart = function(user, target, limb)
  653.  
  654. end,
  655. onUseEnd = function(user, target, limb, item)
  656. local org = target.RaPD_Organism
  657. local stom = org.Stats.reagents.Stomach
  658.  
  659. eatReagentFromContainer(item, 150, target, item.reagent)
  660.  
  661. return false
  662. end,
  663. },
  664. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  665. },
  666. },
  667.  
  668.  
  669.  
  670. ["kira_pill_charcoal"] = {
  671. model = "models/props_lab/jar01b.mdl",
  672. model_color = Color(80,155,80),
  673.  
  674. icon = "materials/kira_rapd/items/pill.png",
  675. icon_color = Color(80,155,80),
  676. icon_color_back = Color(0,0,0),
  677.  
  678. useMethods = {
  679. ["Eat"] = {
  680. Queue = 1,
  681. Limbs = "Head",
  682. UseTime = 1,
  683. conditions = function(user, target, limb)
  684. return true
  685. end,
  686. onUseStart = function(user, target, limb)
  687.  
  688. end,
  689. onUseEnd = function(user, target, limb)
  690. local org = target.RaPD_Organism
  691. local stom = org.Stats.reagents.Stomach
  692.  
  693. stom.charcoal = (stom.charcoal or 0) + 20
  694. return true
  695. end,
  696. },
  697. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  698. },
  699. },
  700.  
  701. ["kira_splint"] = {
  702. model = "models/props_junk/garbage_bag001a.mdl",
  703. material = "phoenix_storms/fender_white",
  704.  
  705. icon = "materials/kira_rapd/items/splint.png",
  706.  
  707. useMethods = {
  708. ["ApplySplint"] = {
  709. Queue = 1,
  710. Limbs = {"LeftArm","LeftLeg","RightArm","RightLeg",},
  711. UseTime = 10,
  712. conditions = function(user, target, limb)
  713. local org = target.RaPD_Organism
  714. return org and org[limb] and org[limb].fracture
  715. end,
  716. onUseStart = function(user, target, limb)
  717.  
  718. end,
  719. onUseEnd = function(user, target, limb)
  720.  
  721. local org = target.RaPD_Organism
  722. if !org then return end
  723. if org[limb].fracture then
  724. org[limb].fracture = false
  725. target:RaPD_UpdateHealthInfoOnClients()
  726. return true
  727. end
  728. end,
  729. },
  730. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  731. },
  732. },
  733.  
  734. ["kira_surgery_kit"] = {
  735. model = "models/props_c17/BriefCase001a.mdl",
  736.  
  737. icon = "materials/kira_rapd/items/medkit_surgery.png",
  738. icon_color = Color(130,130,180),
  739. icon_color_back = Color(0,0,0),
  740.  
  741. useMethods = {
  742. ["Surgery_FixOrgans"] = {
  743. Queue = 1,
  744. Limbs = {"Chest", "Head"},
  745. UseTime = 15,
  746. conditions = function(user, target, limb)
  747. local org = target.RaPD_Organism
  748. local data = org[limb]
  749. return data.Organs
  750. end,
  751. onUseStart = function(user, target, limb)
  752. local org = target.RaPD_Organism
  753. target:RaPD_UpdateHealthInfoOnClients()
  754. target:RaPD_SetBleeding(limb, true, 30, 50)
  755. surgeryOpen(target, org, limb)
  756. end,
  757. onUseEnd = function(user, target, limb)
  758. if (!target.RaPD_Organism) or !limb or !target.RaPD_Organism[limb] or !target.RaPD_Organism[limb].Organs then return end
  759. local organs = target.RaPD_Organism[limb].Organs
  760. for organ, data in pairs(organs) do
  761.  
  762. print("1")
  763. PrintTable(data)
  764. if data.MaxHP and data.DMG and data.DMG > 0 then
  765. print("2")
  766. data.DMG = 0
  767. user:RaPD_Thought_Localized({"HealingOrgans", organ}, Color(250,250,250), 4, 1, 1, 1, 5, 8)
  768.  
  769. print("3")
  770.  
  771. print("-----------------------------------")
  772. end
  773. end
  774.  
  775. local org = target.RaPD_Organism
  776.  
  777. target:RaPD_SetBleeding(limb, false)
  778.  
  779. surgeryClose(target, org, limb)
  780.  
  781. target:RaPD_UpdateHealthInfoOnClients()
  782. end,
  783. },
  784. ["Surgery_FixBones"] = {
  785. Queue = 2,
  786. Limbs = {"LeftArm", "LeftLeg", "RightArm", "RightLeg", "Chest", "Head"},
  787. UseTime = 18,
  788. conditions = function(user, target, limb)
  789. local org = target.RaPD_Organism
  790. return org and org[limb] and org[limb].fracture
  791. end,
  792. onUseStart = function(user, target, limb)
  793. local org = target.RaPD_Organism
  794. target:RaPD_SetBleeding(limb, true, 30, 50)
  795. surgeryOpen(target, org, limb)
  796. end,
  797. onUseEnd = function(user, target, limb)
  798. local org = target.RaPD_Organism
  799. target:RaPD_SetBleeding(limb, false)
  800. surgeryClose(target, org, limb)
  801. if !org then return end
  802. if org[limb].fracture then
  803. org[limb].fracture = false
  804. end
  805. end,
  806. },
  807. ["Surgery_Close"] = {
  808. Queue = 3,
  809. Limbs = "All",
  810. UseTime = 2,
  811. conditions = function(user, target, limb)
  812. local org = target.RaPD_Organism
  813. return org and org[limb] and org[limb].surgeryOpenedScar
  814. end,
  815. onUseStart = function(user, target, limb)
  816. local org = target.RaPD_Organism
  817. end,
  818. onUseEnd = function(user, target, limb)
  819. local org = target.RaPD_Organism
  820. target:RaPD_SetBleeding(limb, false)
  821. surgeryClose(target, org, limb)
  822. end,
  823. },
  824. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  825. },
  826. },
  827.  
  828. ["kira_scanner_lite"] = {
  829. model = "models/Items/battery.mdl",
  830. model_color = Color(65,155,222),
  831.  
  832. icon = "materials/kira_rapd/items/scanner_lite.png",
  833. icon_color = Color(65,155,222),
  834. icon_color_back = Color(0,0,0),
  835.  
  836. useMethods = {
  837. ["ScanReagents"] = RaPD_UniversalUses.BloodSample,
  838. ["ScanReagentsStomach"] = RaPD_UniversalUses.SalivaSample,
  839. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  840. },
  841. },
  842.  
  843. ["kira_scanner_full"] = {
  844. model = "models/Items/battery.mdl",
  845. model_color = Color(222,100,167),
  846.  
  847. icon = "materials/kira_rapd/items/scanner.png",
  848. icon_color = Color(222,100,167),
  849. icon_color_back = Color(0,0,0),
  850.  
  851. useMethods = {
  852. ["ScanReagents"] = RaPD_UniversalUses.BloodSample,
  853. ["ScanReagentsStomach"] = RaPD_UniversalUses.SalivaSample,
  854. ["ScanLimbs"] = RaPD_UniversalUses.ScanLimbs,
  855. ["ScanOrgans"] = RaPD_UniversalUses.ScanOrgans,
  856. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  857. },
  858. },
  859.  
  860. ["kira_scanner_debug"] = {
  861. model = "models/Items/battery.mdl",
  862. model_color = Color(255,191,63),
  863.  
  864. icon = "materials/kira_rapd/items/scanner_debug.png",
  865. icon_color = Color(255,191,63),
  866. icon_color_back = Color(0,0,0),
  867.  
  868. useMethods = {
  869. ["ScanCoded"] = {
  870. Queue = 1,
  871. Limbs = "All",
  872. UseTime = 1,
  873. conditions = function(user, target, limb)
  874. return true
  875. end,
  876. onUseStart = function(user, target, limb)
  877.  
  878. end,
  879. onUseEnd = function(user, target, limb, item)
  880. local org = target.RaPD_Organism
  881.  
  882. item.scanResults = "Реагенты в организме:\n\n"
  883. for k,v in pairs(org.Stats.reagents) do
  884. item.scanResults = item.scanResults..k.."\n"
  885. for k,v in pairs(v) do
  886. item.scanResults = item.scanResults.." "..k.." - "..v.."\n"
  887. end
  888. item.scanResults = item.scanResults.."\n"
  889. end
  890.  
  891. if org[limb].bleeding then
  892. item.scanResults = "Кровотёк:\n\n"
  893. item.scanResults = item.scanResults.." "..tostring(org[limb].bleedingHeal).."/"..tostring(org[limb].bleedingHealNeed).."\n"
  894. else
  895. item.scanResults = "Кровотёк: Нет\n\n"
  896. end
  897. return false
  898. end,
  899. },
  900. ["TakeOut"] = RaPD_UniversalUses.TakeOut,
  901. },
  902. },
  903.  
  904. }
  905. */
  906.  
  907. print("[RaPD] Items are loaded!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement