mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-18 14:13:46 +03:00
62 lines
1.6 KiB
Lua
62 lines
1.6 KiB
Lua
--[[
|
||
| This file was obtained through the combined efforts
|
||
| of Madbluntz & Plymouth Antiquarian Society.
|
||
|
|
||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||
| Maloy, DrPepper10 @ RIP, Atle!
|
||
|
|
||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||
--]]
|
||
|
||
|
||
ITEM.name = "Lighter"
|
||
ITEM.base = "base_tools"
|
||
ITEM.model = Model("models/willardnetworks/cigarettes/lighter.mdl")
|
||
ITEM.width = 1
|
||
ITEM.height = 1
|
||
ITEM.description = "Handheld device designed to spark a flame to light things on fire."
|
||
|
||
function ITEM:OnRunLight()
|
||
local client = self.player
|
||
if !client then return end
|
||
if !client:Alive() then return end
|
||
|
||
if client.cigarette and IsEntity(client.cigarette) and client.cigarette.cigaretteItem and
|
||
client.cigarette.cigaretteItem.GetID and ix.item.instances[client.cigarette.cigaretteItem:GetID()] then
|
||
client.cigarette.isLit = true
|
||
netstream.Start(client, "CigaretteSetClientEntity", client.cigarette.cigaretteItem:GetID(), client.cigarette, true)
|
||
end
|
||
|
||
client:NotifyLocalized("You begin smoking the cigarette.")
|
||
client:EmitSound(self.useSound)
|
||
|
||
self:DamageDurability(1)
|
||
end
|
||
|
||
function ITEM:OnCanRunLight()
|
||
local client = self.player
|
||
if !client then return end
|
||
if !client:Alive() then return end
|
||
|
||
if client.cigarette and !client.cigarette.isLit then return true end
|
||
|
||
return false
|
||
end
|
||
|
||
ITEM.functions.light = {
|
||
name = "Sigara Yak",
|
||
tip = "Bir sigarayı yakar.",
|
||
icon = "icon16/brick_add.png",
|
||
OnRun = function(item)
|
||
item:OnRunLight()
|
||
|
||
return false
|
||
end,
|
||
|
||
OnCanRun = function(item)
|
||
if item:OnCanRunLight() then return true end
|
||
|
||
return false
|
||
end
|
||
}
|