mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
include('shared.lua')
|
||||
|
||||
surface.CreateFont("ixRationDispenser", {
|
||||
font = "Default",
|
||||
size = 32,
|
||||
antialias = false
|
||||
})
|
||||
|
||||
function ENT:Draw()
|
||||
local position, angles = self:GetPos(), self:GetAngles()
|
||||
local display = self:GetEnabled() and self.Displays[self:GetDisplay()] or self.Displays[6]
|
||||
|
||||
angles:RotateAroundAxis(angles:Forward(), 90)
|
||||
angles:RotateAroundAxis(angles:Right(), 270)
|
||||
|
||||
cam.Start3D2D(position + self:GetForward() * 8.4 + self:GetRight()* 8.5 + self:GetUp() * 3, angles, 0.1)
|
||||
render.PushFilterMin(TEXFILTER.NONE)
|
||||
render.PushFilterMag(TEXFILTER.NONE)
|
||||
|
||||
surface.SetDrawColor(color_black)
|
||||
surface.DrawRect(10, 16, 153, 40)
|
||||
|
||||
surface.SetDrawColor(60, 60, 60)
|
||||
surface.DrawOutlinedRect(9, 16, 155, 40)
|
||||
|
||||
local alpha = display[3] and 255 or math.abs(math.cos(RealTime() * 2) * 255)
|
||||
local color = ColorAlpha(display[2], alpha)
|
||||
|
||||
draw.SimpleText(display[1], "ixRationDispenser", 86, 36, color, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
||||
|
||||
render.PopFilterMin()
|
||||
render.PopFilterMag()
|
||||
cam.End3D2D()
|
||||
end
|
||||
|
||||
local function ExitCallback()
|
||||
netstream.Start("ClosePanelsDispenser", LocalPlayer().activeRationDispenser)
|
||||
LocalPlayer().activeRationDispenser = nil
|
||||
end
|
||||
local function SelectCallback(idCardID, cid, cidName, ent)
|
||||
netstream.Start("SelectIDCardDispenser", idCardID, cidName, ent)
|
||||
end
|
||||
|
||||
netstream.Hook("CIDSelectorDispenser", function(entity)
|
||||
LocalPlayer().activeRationDispenser = entity
|
||||
|
||||
local cidSelector = vgui.Create("CIDSelector")
|
||||
cidSelector.activeEntity = entity
|
||||
cidSelector.ExitCallback = ExitCallback
|
||||
cidSelector.SelectCallback = SelectCallback
|
||||
end)
|
||||
|
||||
local function SelectCallbackCoupon(idCardID, cid, cidName, ent)
|
||||
netstream.Start("SelectIDCardDispenserCoupon", idCardID, cidName, ent)
|
||||
end
|
||||
|
||||
netstream.Hook("CIDSelectorCoupon", function(entity, amount)
|
||||
LocalPlayer().activeRationDispenser = entity
|
||||
|
||||
local cidSelector = vgui.Create("CIDSelector")
|
||||
cidSelector.activeEntity = entity
|
||||
cidSelector.ExitCallback = ExitCallback
|
||||
cidSelector.SelectCallback = SelectCallbackCoupon
|
||||
end)
|
||||
@@ -0,0 +1,520 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
local INSERT_ID = 1
|
||||
local CHECKING = 2
|
||||
local DISPENSING = 3
|
||||
local FREQ_LIMIT = 4
|
||||
local WAIT = 5
|
||||
local OFFLINE = 6
|
||||
local INSERT_ID_RED = 7
|
||||
local PREPARING = 8
|
||||
local INVALID_CID = 9
|
||||
|
||||
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
|
||||
AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
|
||||
|
||||
include('shared.lua')
|
||||
|
||||
-- INSERT_ID |-> CHECKING |-> PREPARING -> DISPENSING -> WAIT -> INSERT_ID
|
||||
-- | |-> FREQ LIMIT -- used too quickly (ration interval)
|
||||
-- |-> INSERT_ID_RED -- no CID in inv
|
||||
-- |-> OFFLINE -- dispenser turned off
|
||||
-- INVALID_CID: selected CID not instanced server side; should never happen but sanity check
|
||||
|
||||
function ENT:SpawnFunction(client, trace)
|
||||
local dispenser = ents.Create("ix_rationdispenser")
|
||||
|
||||
dispenser:SetPos(trace.HitPos)
|
||||
dispenser:SetAngles(trace.HitNormal:Angle())
|
||||
dispenser:Spawn()
|
||||
dispenser:Activate()
|
||||
dispenser:SetEnabled(true)
|
||||
|
||||
ix.saveEnts:SaveEntity(dispenser)
|
||||
Schema:SaveRationDispensers()
|
||||
return dispenser
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/props_junk/watermelon01.mdl")
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:DrawShadow(false)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self:SetDisplay(INSERT_ID)
|
||||
self:SetEnabled(true)
|
||||
|
||||
self.dispenser = ents.Create("prop_dynamic")
|
||||
self.dispenser:SetModel("models/willardnetworks/props_combine/combine_dispenser.mdl")
|
||||
self.dispenser:SetPos(self:GetPos())
|
||||
self.dispenser:SetAngles(self:GetAngles())
|
||||
self.dispenser:SetParent(self)
|
||||
self.dispenser:Spawn()
|
||||
self.dispenser:Activate()
|
||||
self:DeleteOnRemove(self.dispenser)
|
||||
|
||||
self.dummy = ents.Create("prop_physics")
|
||||
self.dummy:SetModel("models/weapons/w_package.mdl")
|
||||
self.dummy:SetPos(self:GetPos())
|
||||
self.dummy:SetAngles(self:GetAngles())
|
||||
self.dummy:SetMoveType(MOVETYPE_NONE)
|
||||
self.dummy:SetNotSolid(true)
|
||||
self.dummy:SetNoDraw(true)
|
||||
self.dummy:SetParent(self.dispenser, 1)
|
||||
self.dummy:Spawn()
|
||||
self.dummy:Activate()
|
||||
self:DeleteOnRemove(self.dummy)
|
||||
|
||||
local physics = self.dispenser:GetPhysicsObject()
|
||||
physics:EnableMotion(false)
|
||||
physics:Sleep()
|
||||
|
||||
self.canUse = true
|
||||
self.nextUseTime = CurTime()
|
||||
end
|
||||
|
||||
function ENT:Use(client)
|
||||
if (!self.canUse or self.nextUseTime > CurTime()) then
|
||||
return
|
||||
end
|
||||
|
||||
if client.CantUseRation then
|
||||
client:NotifyLocalized("Vous devez attendre avant de pouvoir utiliser ça !")
|
||||
return false
|
||||
end
|
||||
|
||||
client.CantUseRation = true
|
||||
|
||||
timer.Simple(10.2, function()
|
||||
if IsValid(client) then
|
||||
client.CantUseRation = false
|
||||
end
|
||||
end)
|
||||
|
||||
if (ix.faction.Get(client:Team()).allowEnableRations or client:HasActiveCombineSuit()) then
|
||||
if (client:KeyDown(IN_SPEED)) then
|
||||
self:SetEnabled(!self:GetEnabled())
|
||||
self:EmitSound(self:GetEnabled() and "buttons/combine_button1.wav" or "buttons/combine_button2.wav")
|
||||
|
||||
ix.combineNotify:AddNotification("NTC:// Terminal de distribution de ration " .. (self:GetEnabled() and "activé" or "désactivé") .. " par " .. client:GetCombineTag(), Color(255, 0, 150, 255), client)
|
||||
|
||||
ix.saveEnts:SaveEntity(self)
|
||||
|
||||
self.nextUseTime = CurTime() + 2
|
||||
|
||||
ix.log.Add(client, "rationsToggleDispenser", self:GetEnabled())
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if (!self:GetEnabled()) then
|
||||
self:DisplayError(OFFLINE)
|
||||
return
|
||||
end
|
||||
|
||||
local character = client:GetCharacter()
|
||||
local isVort = character:IsVortigaunt()
|
||||
if isVort and character:GetBackground() == "Collaborator" then
|
||||
isVort = false
|
||||
end
|
||||
local idCards = !isVort and character:GetInventory():GetItemsByUniqueID("id_card")
|
||||
or character:GetInventory():HasItem("vortigaunt_slave_collar")
|
||||
or character:GetInventory():HasItem("vortigaunt_slave_collar_fake")
|
||||
if (!isVort and #idCards >= 1 or isVort and idCards) then
|
||||
-- display checking message
|
||||
self.canUse = false
|
||||
self:SetDisplay(CHECKING)
|
||||
self:EmitSound("ambient/machines/combine_terminal_idle2.wav")
|
||||
if isVort then
|
||||
self.CheckIdCard(idCards, character:GetGenericdata(), client, self)
|
||||
else
|
||||
-- Check for citizen id(s)
|
||||
if (#idCards == 1) then
|
||||
idCards[1]:LoadOwnerGenericData(self.CheckIdCard, self.CheckIdError, client, self)
|
||||
else
|
||||
netstream.Start(client, "CIDSelectorDispenser", self)
|
||||
end
|
||||
end
|
||||
else
|
||||
self:DisplayError(INSERT_ID_RED)
|
||||
end
|
||||
end
|
||||
|
||||
netstream.Hook("SelectIDCardDispenser", function(client, idCard, cidName, entity)
|
||||
if !client:GetCharacter():GetInventory():GetItemByID(idCard) then
|
||||
return false
|
||||
end
|
||||
|
||||
local idCardItem = ix.item.instances[idCard]
|
||||
if (idCardItem) then
|
||||
idCardItem:LoadOwnerGenericData(entity.CheckIdCard, entity.CheckIdError, client, entity)
|
||||
else
|
||||
entity:DisplayError(INVALID_CID)
|
||||
end
|
||||
end)
|
||||
|
||||
netstream.Hook("SelectIDCardDispenserCoupon", function(client, idCard, cidName, entity)
|
||||
local idCardItem = ix.item.instances[idCard]
|
||||
if (idCardItem and client.ixCouponUsed) then
|
||||
if client:GetCharacter() then
|
||||
if client:GetCharacter():GetInventory() then
|
||||
if client:GetCharacter():GetInventory():GetItemByID(client.ixCouponUsed) then
|
||||
local couponItem = ix.item.instances[client.ixCouponUsed]
|
||||
local couponAmount = couponItem.amount or 0
|
||||
idCardItem:LoadOwnerGenericData(entity.CheckIdCardCoupon, entity.CheckIdError, client, entity, couponAmount)
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
entity:DisplayError(INVALID_CID)
|
||||
end)
|
||||
|
||||
function ENT:IDCardCheck(idCard, genericData, client, entity)
|
||||
local character = client:GetCharacter()
|
||||
if client:IsVortigaunt() and character:GetBackground() != "Collaborator" then
|
||||
if -ix.config.Get("blacklistSCAmount", 40) <= idCard:GetData("sterilizedCredits", 0) then
|
||||
return true
|
||||
else
|
||||
entity:CreateCombineAlert(client, "WRN:// VORTIGAUNT SHACKLES ERROR DETECTED.", FREQ_LIMIT)
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if (idCard:GetData("active", false) == false) then
|
||||
entity:CreateCombineAlert(client, "WRN:// CID inactif #" .. idCard:GetData("cid", 00000) .. " : tentative d’utilisation détectée", FREQ_LIMIT)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local isBOL = genericData.bol
|
||||
local isAC = genericData.anticitizen
|
||||
|
||||
if (isBOL or isAC) then
|
||||
local text = isBOL and "Recherché" or "Anti-Citoyen"
|
||||
entity:CreateCombineAlert(client, "WRN:// " .. text .. " Activité de la carte CID détectée", isAC and FREQ_LIMIT)
|
||||
|
||||
-- only halt if isAC, allow it to continue for BOL
|
||||
if (isAC) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT.CheckIdCard(idCard, genericData, client, entity)
|
||||
if entity:IDCardCheck(idCard, genericData, client, entity) then
|
||||
entity:CheckRationTime(client, idCard, genericData)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT.CheckIdCardCoupon(idCard, genericData, client, entity, couponAmount)
|
||||
if entity:IDCardCheck(idCard, genericData, client, entity) then
|
||||
if (idCard:GetData("nextRationTime", 0) >= 60 * ix.config.Get("rationInterval")) then
|
||||
client:NotifyLocalized("Vous avez déjà une ration disponible !")
|
||||
return false
|
||||
end
|
||||
|
||||
entity:EmitSound("ambient/levels/labs/coinslot1.wav")
|
||||
if (ix.config.Get("creditsNoConnection")) then
|
||||
entity:SetDisplay(CHECKING)
|
||||
timer.Simple(10, function()
|
||||
if (!IsValid(entity)) then return end
|
||||
entity:DisplayError(OFFLINE, 5)
|
||||
timer.Simple(2, function()
|
||||
if (!IsValid(entity)) then return end
|
||||
entity:EmitSound("ambient/levels/labs/coinslot1.wav")
|
||||
end)
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
timer.Simple(1, function()
|
||||
if IsValid(entity) then
|
||||
entity:EmitSound("Friends/friend_online.wav")
|
||||
end
|
||||
end)
|
||||
|
||||
entity:SetDisplay(8)
|
||||
entity.canUse = false
|
||||
|
||||
timer.Simple(2, function()
|
||||
if IsValid(entity) then
|
||||
if ix.city.main:HasCredits(couponAmount) then
|
||||
entity:EmitSound("Friends/friend_join.wav")
|
||||
entity:SetDisplay(10)
|
||||
|
||||
idCard:GiveCredits(couponAmount, "Rations", "Ration Coupon")
|
||||
ix.city.main:TakeCredits(couponAmount)
|
||||
else
|
||||
entity:SetDisplay(5)
|
||||
entity.canUse = false
|
||||
timer.Simple(6, function()
|
||||
if (!IsValid(entity)) then return end
|
||||
|
||||
entity:SetDisplay(11)
|
||||
entity:EmitSound("buttons/combine_button_locked.wav")
|
||||
timer.Simple(4, function()
|
||||
if (!IsValid(entity)) then return end
|
||||
entity:SetDisplay(1)
|
||||
entity.canUse = true
|
||||
end)
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
if ix.item.instances[client.ixCouponUsed] then
|
||||
if !ix.item.instances[client.ixCouponUsed]:GetData("stack", false) then
|
||||
ix.meta.item.Remove(ix.item.instances[client.ixCouponUsed])
|
||||
else
|
||||
ix.item.instances[client.ixCouponUsed]:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
client.ixCouponUsed = nil
|
||||
|
||||
ix.log.Add(client, "rationsCoupon", couponAmount)
|
||||
|
||||
timer.Simple(2, function()
|
||||
if IsValid(entity) then
|
||||
entity.canUse = true
|
||||
entity:SetDisplay(1)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT.CheckIdError(idCard, client, entity)
|
||||
entity:DisplayError(INVALID_CID)
|
||||
client.ixCouponUsed = nil
|
||||
end
|
||||
|
||||
local function GetNumbersFromText(txt)
|
||||
local str = ""
|
||||
string.gsub( txt,"%d+",function(e)
|
||||
str = str .. e
|
||||
end)
|
||||
|
||||
return str
|
||||
end
|
||||
|
||||
function ENT:CheckRationTime(client, idCard, genericData)
|
||||
if (!idCard:GetData("nextRationTime")) then
|
||||
idCard:SetData("nextRationTime", 60 * ix.config.Get("rationInterval"))
|
||||
end
|
||||
local character = client:GetCharacter()
|
||||
timer.Simple(math.random(1.8, 2.2), function()
|
||||
if (idCard:GetData("nextRationTime", 0) >= 60 * ix.config.Get("rationInterval")) then
|
||||
if !client:GetCharacter():GetInventory():GetItemByID(idCard.id) then
|
||||
if !client:IsVortigaunt() or character:GetBackground() == "Collaborator" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
self:SetDisplay(PREPARING)
|
||||
self:EmitSound("ambient/machines/combine_terminal_idle3.wav")
|
||||
|
||||
local ration = "ration"
|
||||
local class = "Standard"
|
||||
local maxCredits = 15 -- Temp fix
|
||||
local rationCredits = 0 -- Temp fix for Ration Coupons vs abritary transfer
|
||||
local loyaltyCredits = maxCredits * 2
|
||||
local loyaltyStatus = genericData.loyaltyStatus
|
||||
local tier = tonumber(GetNumbersFromText(loyaltyStatus))
|
||||
|
||||
if (genericData.combine) then
|
||||
rationCredits = rationCredits + 0
|
||||
maxCredits = loyaltyCredits
|
||||
ration = "civil_protection_ration"
|
||||
class = "Functionary"
|
||||
elseif (genericData.socialCredits) then
|
||||
if (genericData.socialCredits >= 225) then
|
||||
maxCredits = loyaltyCredits
|
||||
ration = "trueloyal_ration"
|
||||
class = "Haut Collaborateurs"
|
||||
elseif (genericData.socialCredits >= 200) then
|
||||
maxCredits = loyaltyCredits
|
||||
ration = "priority_ration"
|
||||
class = "Collaborateurs"
|
||||
elseif (genericData.socialCredits >= 175) then
|
||||
maxCredits = loyaltyCredits
|
||||
ration = "loyalist_ration"
|
||||
class = "Collaborateurs"
|
||||
elseif (genericData.socialCredits >= 155) then
|
||||
maxCredits = loyaltyCredits
|
||||
ration = "loyalist_ration"
|
||||
class = "Partisan"
|
||||
elseif (genericData.socialCredits >= 90) then
|
||||
maxCredits = loyaltyCredits
|
||||
ration = "improved_ration"
|
||||
class = "Partisan"
|
||||
elseif (genericData.socialCredits > 40) then
|
||||
maxCredits = loyaltyCredits
|
||||
ration = "ration"
|
||||
class = "Standard"
|
||||
elseif (genericData.socialCredits <= 40) then
|
||||
ration = "underclass_ration"
|
||||
class = "Indésirable"
|
||||
end
|
||||
end
|
||||
|
||||
if !client:IsVortigaunt() or character:GetBackground() == "Collaborator" then
|
||||
if (!ix.config.Get("creditsNoConnection")) then
|
||||
|
||||
local cwuCard = character:GetInventory():HasItem("cwu_card")
|
||||
local budget = false
|
||||
if cwuCard then
|
||||
local bind = cwuCard:GetData("cardID", false)
|
||||
if !bind or bind != idCard:GetID() then
|
||||
cwuCard = false
|
||||
elseif cwuCard:GetData("faction", false) then
|
||||
budget = cwuCard:GetData("faction").id
|
||||
end
|
||||
end
|
||||
|
||||
local credits = idCard:GetCredits()
|
||||
local newCredits = math.max(credits, math.min(maxCredits, credits + 0))
|
||||
local giveCredits = (newCredits > credits and newCredits - credits or 0) + (genericData.wages or 0)
|
||||
|
||||
if budget then
|
||||
if ix.factionBudget:HasCredits(budget, giveCredits) then
|
||||
idCard:GiveCredits(giveCredits, "Income", "Rations/Wages")
|
||||
ix.factionBudget:TakeFBCredits(budget, giveCredits)
|
||||
else
|
||||
return client:NotifyLocalized("Your faction's budget don't have enough credits.")
|
||||
end
|
||||
else
|
||||
if ix.city.main:HasCredits(giveCredits) then
|
||||
idCard:GiveCredits(giveCredits, "Income", "Rations/Wages")
|
||||
ix.city.main:TakeCredits(giveCredits)
|
||||
else
|
||||
return client:NotifyLocalized("City fund don't have enough credits.")
|
||||
end
|
||||
end
|
||||
|
||||
if (newCredits <= credits) then
|
||||
if (genericData.wages and genericData.wages > 0) then
|
||||
client:NotifyLocalized("creditCapWages", genericData.wages)
|
||||
else
|
||||
client:NotifyLocalized("creditCapReached")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ix.log.Add(client, "rationsDispensing", newCredits and newCredits - credits or 0, genericData.wages or 0, ration)
|
||||
|
||||
if (character:IsVortigaunt()) then
|
||||
if (genericData.cid or character:GetBackground() == "Collaborator") then
|
||||
ix.combineNotify:AddNotification("LOG:// Sujet " .. string.upper("Carte d'identification des biotiques actifs:") .. " #" .. genericData.cid .. " recupérer " .. class .. "-Class Ration Package from Dispenser", nil, client)
|
||||
else
|
||||
ix.combineNotify:AddNotification("LOG:// Sujet " .. string.upper("Collier des biotiques actifs:") .. " #" .. character:GetCollarID() .. " recupérer " .. class .. "-Class Ration Package from Dispenser", nil, client)
|
||||
end
|
||||
else
|
||||
ix.combineNotify:AddNotification("LOG:// Sujet '" .. genericData.name .. "' recupérer " .. class .. "-Class Ration Package from Dispenser", nil, client)
|
||||
end
|
||||
|
||||
timer.Simple(10.2, function()
|
||||
idCard:SetData("nextRationTime", 0)
|
||||
self:SpawnRation(ration)
|
||||
end)
|
||||
|
||||
local uniqueID = "ixDispenserTimer" .. client:SteamID64()
|
||||
if (!timer.Exists(uniqueID)) then
|
||||
PLUGIN:CreateRationTimer(client)
|
||||
end
|
||||
else
|
||||
self:DisplayError(FREQ_LIMIT)
|
||||
client:NotifyLocalized("Votre prochaine ration est disponible dans "..math.Round( ((ix.config.Get("rationInterval", 0) * 60) - idCard:GetData("nextRationTime", 0)) / 60, 2).." heures.")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:SpawnRation(rationType)
|
||||
self:SetDisplay(DISPENSING)
|
||||
|
||||
rationType = rationType or "ration"
|
||||
local releaseDelay = 1.2
|
||||
local itemTable = ix.item.Get(rationType)
|
||||
|
||||
self.dummy:SetModel(itemTable:GetModel())
|
||||
self.dummy:SetNoDraw(false)
|
||||
self.dummy:Fire("SetParentAttachment", "package_attachment")
|
||||
|
||||
self.dispenser:Fire("SetAnimation", "dispense_package")
|
||||
self:EmitSound("ambient/machines/combine_terminal_idle4.wav")
|
||||
|
||||
timer.Simple(releaseDelay, function()
|
||||
ix.item.Spawn(rationType, self.dummy:GetPos(), function(item, entity)
|
||||
self.dummy:SetNoDraw(true)
|
||||
end, self.dummy:GetAngles())
|
||||
|
||||
-- display cooldown notice
|
||||
timer.Simple(releaseDelay, function()
|
||||
self:SetDisplay(WAIT)
|
||||
end)
|
||||
|
||||
-- make dispenser usable
|
||||
timer.Simple(releaseDelay + 4, function()
|
||||
self.canUse = true
|
||||
self:SetDisplay(INSERT_ID)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:CreateCombineAlert(client, message, error)
|
||||
ix.combineNotify:AddImportantNotification(message, nil, client, self:GetPos())
|
||||
if (error) then
|
||||
self:DisplayError(error)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:DisplayError(id, length)
|
||||
id = id or 6
|
||||
length = length or 2
|
||||
|
||||
self:SetDisplay(id)
|
||||
self:EmitSound("buttons/combine_button_locked.wav")
|
||||
self.canUse = false
|
||||
|
||||
timer.Simple(length, function()
|
||||
self:SetDisplay(INSERT_ID)
|
||||
self.canUse = true
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if (!ix.shuttingDown) then
|
||||
Schema:SaveRationDispensers()
|
||||
end
|
||||
end
|
||||
|
||||
netstream.Hook("ClosePanelsDispenser", function(client, entity)
|
||||
timer.Simple(1, function()
|
||||
if entity then
|
||||
entity.canUse = true
|
||||
end
|
||||
end)
|
||||
|
||||
if entity then
|
||||
entity:SetDisplay(INSERT_ID)
|
||||
entity:EmitSound("ambient/machines/combine_terminal_idle1.wav")
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,39 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Distributeur de rations"
|
||||
ENT.Category = "HL2 RP"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
|
||||
ENT.Displays = {
|
||||
[1] = {"INSERER CID", color_white, true},
|
||||
[2] = {"VÉRIFICATION", Color(255, 200, 0)},
|
||||
[3] = {"DISTRIBUTION", Color(0, 255, 0)},
|
||||
[4] = {"FREQ. LIMITE", Color(255, 0, 0)},
|
||||
[5] = {"ATTENDEZ", Color(255, 200, 0)},
|
||||
[6] = {"HORS LIGNE", Color(255, 0, 0), true},
|
||||
[7] = {"INSERER CID", Color(255, 0, 0)},
|
||||
[8] = {"PRÉPARATION", Color(0, 255, 0)},
|
||||
[9] = {"CID INVALIDE", Color(255, 0, 0)},
|
||||
[10] = {"COMPLÉTÉ", Color(0, 255, 0)},
|
||||
[11] = {"PAS DE CRÉDITS", Color(255, 0, 0), true},
|
||||
}
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Int", 0, "Display")
|
||||
self:NetworkVar("Bool", 1, "Enabled")
|
||||
end
|
||||
@@ -0,0 +1,67 @@
|
||||
--[[
|
||||
| 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 = "Coupon de ration"
|
||||
ITEM.model = Model("models/willardnetworks/misc/idcard.mdl")
|
||||
ITEM.description = "Un coupon de rationnement à utiliser en échange de crédits."
|
||||
ITEM.amount = 5
|
||||
ITEM.category = "Ration Coupons"
|
||||
ITEM.maxStackSize = 5
|
||||
|
||||
ITEM.base = "base_stackable"
|
||||
ITEM.bInstanceMaxstack = false
|
||||
|
||||
ITEM.functions.Use = {
|
||||
name = "Utiliser",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local character = client:GetCharacter()
|
||||
local errorMsg = "Vous devez être près d’un distributeur de rations ou d’un terminal citoyen pour le faire !"
|
||||
local entity = client:GetEyeTraceNoCursor().Entity
|
||||
|
||||
if (IsValid(entity)) then
|
||||
if (entity:GetClass() != "ix_rationdispenser" and entity:GetClass() != "ix_terminal") then
|
||||
client:NotifyLocalized(errorMsg)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if (client:GetShootPos():Distance(entity:GetPos()) > 50) then
|
||||
client:NotifyLocalized(errorMsg)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if ((!entity.canUse or (entity.nextUseTime and entity.nextUseTime > CurTime())) or (entity:GetClass() == "ix_rationdispenser" and !entity:GetEnabled())) then
|
||||
client:NotifyLocalized("Ce terminal est hors ligne ou est entrain d'être utilisé.")
|
||||
|
||||
return false
|
||||
else
|
||||
client.ixCouponUsed = itemTable.id
|
||||
|
||||
-- Check for citizen id(s)
|
||||
local idCards = character:GetInventory():GetItemsByUniqueID("id_card")
|
||||
|
||||
if (#idCards == 1) then
|
||||
idCards[1]:LoadOwnerGenericData(entity.CheckIdCardCoupon, entity.CheckIdError, client, entity, itemTable.amount)
|
||||
else
|
||||
netstream.Start(client, "CIDSelectorCoupon", entity)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
client:NotifyLocalized(errorMsg)
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| 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 = "Coupon - 100 Crédits"
|
||||
ITEM.model = Model("models/willardnetworks/props/rationcoupon3.mdl")
|
||||
ITEM.amount = 100
|
||||
ITEM.category = "Combine"
|
||||
ITEM.maxStackSize = 5
|
||||
ITEM.colorAppendix = {["blue"] = "Ce coupon génère 100 crédits lorsqu'il est échangé à un distributeur de ration ou à un terminal citoyen."}
|
||||
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| 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 = "Coupon - 10 Crédits"
|
||||
ITEM.model = Model("models/willardnetworks/props/rationcoupon.mdl")
|
||||
ITEM.amount = 10
|
||||
ITEM.category = "Combine"
|
||||
ITEM.maxStackSize = 5
|
||||
ITEM.colorAppendix = {["blue"] = "Ce coupon génère 10 crédits lorsqu'il est échangé à un distributeur de ration ou à un terminal citoyen."}
|
||||
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| 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 = "Coupon - 25 Crédits"
|
||||
ITEM.model = Model("models/willardnetworks/props/rationcoupon2.mdl")
|
||||
ITEM.amount = 25
|
||||
ITEM.category = "Combine"
|
||||
ITEM.maxStackSize = 5
|
||||
ITEM.colorAppendix = {["blue"] = "Ce coupon génère 25 crédits lorsqu'il est échangé à un distributeur de ration ou à un terminal citoyen."}
|
||||
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| 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 = "Coupon - 50 Crédits"
|
||||
ITEM.model = Model("models/willardnetworks/props/rationcoupon3.mdl")
|
||||
ITEM.amount = 50
|
||||
ITEM.category = "Combine"
|
||||
ITEM.maxStackSize = 5
|
||||
ITEM.colorAppendix = {["blue"] = "Ce coupon génère 50 crédits lorsqu'il est échangé à un distributeur de ration ou à un terminal citoyen."}
|
||||
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| 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 = "Coupon - 5 Crédits"
|
||||
ITEM.model = Model("models/willardnetworks/props/rationcoupon.mdl")
|
||||
ITEM.amount = 5
|
||||
ITEM.category = "Combine"
|
||||
ITEM.maxStackSize = 5
|
||||
ITEM.colorAppendix = {["blue"] = "Ce coupon génère 5 crédits lorsqu'il est échangé à un distributeur de ration ou à un terminal citoyen."}
|
||||
@@ -0,0 +1,16 @@
|
||||
--[[
|
||||
| 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 = "Coupon de crédits - Tier 1"
|
||||
ITEM.model = Model("models/willardnetworks/props/rationcoupon.mdl")
|
||||
ITEM.amount = 20
|
||||
ITEM.category = "Combine"
|
||||
ITEM.colorAppendix = {["blue"] = "Ce coupon génère 20 crédits lorsqu'il est échangé à un distributeur de rations ou à un terminal citoyen."}
|
||||
@@ -0,0 +1,16 @@
|
||||
--[[
|
||||
| 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 = "Coupon de crédits - Tier 2"
|
||||
ITEM.model = Model("models/willardnetworks/props/rationcoupon2.mdl")
|
||||
ITEM.amount = 35
|
||||
ITEM.category = "Combine"
|
||||
ITEM.colorAppendix = {["blue"] = "Ce coupon génère 35 crédits lorsqu'il est utilisé dans un distributeur de rations ou un terminal citoyen."}
|
||||
@@ -0,0 +1,16 @@
|
||||
--[[
|
||||
| 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 = "Coupon de crédits - Tier 3"
|
||||
ITEM.model = Model("models/willardnetworks/props/rationcoupon3.mdl")
|
||||
ITEM.amount = 50
|
||||
ITEM.category = "Combine"
|
||||
ITEM.colorAppendix = {["blue"] = "Ce coupon génère 50 crédits lorsqu'il est utilisé dans un distributeur de rations ou un terminal citoyen."}
|
||||
@@ -0,0 +1,37 @@
|
||||
--[[
|
||||
| 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 = "Ration - Protection civile"
|
||||
ITEM.model = Model("models/willardnetworks/rations/wn_new_ration.mdl")
|
||||
ITEM.skin = 4
|
||||
ITEM.description = "Un paquet sous film rétractable contenant de la nourriture et de l'eau. Elle est fabriquée par le Cartel."
|
||||
ITEM.items = {"metropolicesupplements", "nutrientdrink", "coupon_medium"}
|
||||
ITEM.category = "Combine"
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400.56, 0),
|
||||
fov = 1.27
|
||||
}
|
||||
ITEM.functions.Open = {
|
||||
name = "Diviser",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local character = client:GetCharacter()
|
||||
|
||||
for _, v in ipairs(itemTable.items) do
|
||||
if (!character:GetInventory():Add(v)) then
|
||||
ix.item.Spawn(v, client)
|
||||
end
|
||||
end
|
||||
|
||||
client:EmitSound("ambient/fire/mtov_flame2.wav", 75, math.random(160, 180), 0.35)
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
--[[
|
||||
| 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 = "Ration - Amélioré"
|
||||
ITEM.model = Model("models/willardnetworks/rations/wn_new_ration.mdl")
|
||||
ITEM.skin = 6
|
||||
ITEM.description = "Un paquet sous film plastique contenant de la nourriture qui semble plus volumineuse que votre ration standard."
|
||||
ITEM.items = {"fruit_apple", "proc_paste", "drink_breen_water", "10_coupon", "10_coupon"}
|
||||
ITEM.category = "Combine"
|
||||
ITEM.functions.Open = {
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local character = client:GetCharacter()
|
||||
|
||||
for _, v in ipairs(itemTable.items) do
|
||||
if (!character:GetInventory():Add(v)) then
|
||||
ix.item.Spawn(v, client)
|
||||
end
|
||||
end
|
||||
|
||||
client:EmitSound("ambient/fire/mtov_flame2.wav", 75, math.random(160, 180), 0.35)
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
--[[
|
||||
| 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 = "Ration - Loyaliste"
|
||||
ITEM.model = Model("models/willardnetworks/food/ration_box.mdl")
|
||||
ITEM.skin = 0
|
||||
ITEM.description = "Un paquet sous film rétractable contenant de la nourriture et de l'eau. Fabriquée par l'Union."
|
||||
ITEM.items = {"fruit_watermelon_slice", "fruit_apple", "baking_bread", "drink_sparkling_water", "25_coupon"}
|
||||
ITEM.category = "Combine"
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400.56, 0),
|
||||
fov = 1.27
|
||||
}
|
||||
ITEM.functions.Open = {
|
||||
name = "Diviser",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local character = client:GetCharacter()
|
||||
|
||||
for _, v in ipairs(itemTable.items) do
|
||||
if (!character:GetInventory():Add(v)) then
|
||||
ix.item.Spawn(v, client)
|
||||
end
|
||||
end
|
||||
|
||||
client:EmitSound("ambient/fire/mtov_flame2.wav", 75, math.random(160, 180), 0.35)
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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 = "Ration - Loyaliste prioritaire"
|
||||
ITEM.model = Model("models/willardnetworks/food/ration_box.mdl")
|
||||
ITEM.skin = 2
|
||||
ITEM.description = "Une boîte en carton qui semble assez raffinée, transportant quelques fournitures. Elle comporte des logos combinés avec de petites citations inspirantes sur ses côtés."
|
||||
ITEM.items = {"luxury_choc", "fruit_banana", "baking_bread", "drink_sparkling_water", "25_coupon" ,"5_coupon"}
|
||||
ITEM.category = "Combine"
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400.56, 0),
|
||||
fov = 1.27
|
||||
}
|
||||
ITEM.functions.Open = {
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local character = client:GetCharacter()
|
||||
|
||||
for _, v in ipairs(itemTable.items) do
|
||||
if (!character:GetInventory():Add(v)) then
|
||||
ix.item.Spawn(v, client)
|
||||
end
|
||||
end
|
||||
|
||||
client:EmitSound("ambient/fire/mtov_flame2.wav", 75, math.random(160, 180), 0.35)
|
||||
end
|
||||
}
|
||||
31
gamemodes/darkrp/plugins/rationdispenser/items/sh_ration.lua
Normal file
31
gamemodes/darkrp/plugins/rationdispenser/items/sh_ration.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
--[[
|
||||
| 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 = "Ration - Standard"
|
||||
ITEM.model = Model("models/willardnetworks/rations/wn_new_ration.mdl")
|
||||
ITEM.description = "Un paquet sous film rétractable contenant de la nourriture et de l'eau. Elle est fabriquée par l'Union."
|
||||
ITEM.items = {"proc_paste", "drink_breen_water", "10_coupon", "5_coupon"}
|
||||
ITEM.category = "Combine"
|
||||
ITEM.functions.Open = {
|
||||
name = "Diviser",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local character = client:GetCharacter()
|
||||
|
||||
for _, v in ipairs(itemTable.items) do
|
||||
if (!character:GetInventory():Add(v)) then
|
||||
ix.item.Spawn(v, client)
|
||||
end
|
||||
end
|
||||
|
||||
client:EmitSound("ambient/fire/mtov_flame2.wav", 75, math.random(160, 180), 0.35)
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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 = "Ration - Véritable loyaliste"
|
||||
ITEM.model = Model("models/willardnetworks/food/ration_box.mdl")
|
||||
ITEM.skin = 1
|
||||
ITEM.description = "Une petite boîte en carton contenant de la nourriture. Elle arbore un élégant logo Combine. Pour une raison quelconque, elle semble plus luxueuse."
|
||||
ITEM.items = {"luxury_choc", "baking_bread", "comfort_fish", "drink_sparkling_water", "25_coupon", "10_coupon"}
|
||||
ITEM.category = "Combine"
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400.56, 0),
|
||||
fov = 1.27
|
||||
}
|
||||
ITEM.functions.Open = {
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local character = client:GetCharacter()
|
||||
|
||||
for _, v in ipairs(itemTable.items) do
|
||||
if (!character:GetInventory():Add(v)) then
|
||||
ix.item.Spawn(v, client)
|
||||
end
|
||||
end
|
||||
|
||||
client:EmitSound("ambient/fire/mtov_flame2.wav", 75, math.random(160, 180), 0.35)
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
--[[
|
||||
| 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 = "Ration - Indésirable"
|
||||
ITEM.model = Model("models/willardnetworks/rations/wn_new_ration.mdl")
|
||||
ITEM.description = "Un paquet plastifié déchiré et usé contenant de la nourriture... si on peut même l'appeler ainsi."
|
||||
ITEM.skin = 3
|
||||
ITEM.items = {"proc_paste", "drink_breen_water"}
|
||||
ITEM.category = "Combine"
|
||||
ITEM.functions.Open = {
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local character = client:GetCharacter()
|
||||
|
||||
for _, v in ipairs(itemTable.items) do
|
||||
if (!character:GetInventory():Add(v)) then
|
||||
ix.item.Spawn(v, client)
|
||||
end
|
||||
end
|
||||
|
||||
client:EmitSound("ambient/fire/mtov_flame2.wav", 75, math.random(160, 180), 0.35)
|
||||
end
|
||||
}
|
||||
33
gamemodes/darkrp/plugins/rationdispenser/sh_plugin.lua
Normal file
33
gamemodes/darkrp/plugins/rationdispenser/sh_plugin.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Ration Dispenser Replacer"
|
||||
PLUGIN.author = "Fruity"
|
||||
PLUGIN.description = "Makes ration dispenser work the way we want."
|
||||
PLUGIN.TIMER_DELAY = 60 -- tick every minute
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
|
||||
ix.lang.AddTable("english", {
|
||||
creditCapReached = "A ration coupon may be found in your ration.",
|
||||
creditCapWages = "You gained a coupon in your ration, and were given %d credits in wages."
|
||||
})
|
||||
|
||||
ix.lang.AddTable("french", {
|
||||
creditCapReached = "Vous avez atteint le plafond de crédit, aucun crédit de rationnement n'a été accordé.",
|
||||
creditCapWages = "Vous avez atteint le plafond de crédits, mais vous avez reçu %d crédits."
|
||||
})
|
||||
|
||||
ix.lang.AddTable("spanish", {
|
||||
creditCapReached = "Has alcanzado el límite de créditos, no se han dado créditos de ración.",
|
||||
creditCapWages = "Has alcanzado el límite de créditos, pero te han dado %d créditos por tu salario."
|
||||
})
|
||||
60
gamemodes/darkrp/plugins/rationdispenser/sv_plugin.lua
Normal file
60
gamemodes/darkrp/plugins/rationdispenser/sv_plugin.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
ix.log.AddType("rationsToggleDispenser", function(client, bOn)
|
||||
return string.format("%s a mis un distributeur de rations %s.", client:Name(), bOn and "actif" or "non-actif")
|
||||
end)
|
||||
|
||||
ix.log.AddType("rationsCoupon", function(client, amount)
|
||||
return string.format("%s a utilisé un coupon dans un distributeur de rations, gagnant %d crédits.", client:Name(), amount)
|
||||
end)
|
||||
|
||||
ix.log.AddType("rationsDispensing", function(client, amount, wages, ration)
|
||||
return string.format("%s a acquis sa ration, gagnant %d crédits, %d salaires et une %s ration.", client:Name(), amount, wages, ration)
|
||||
end)
|
||||
|
||||
function PLUGIN:ClientNextUsageTick(client)
|
||||
local character = client:GetCharacter()
|
||||
if (!character) then return end
|
||||
if (client:IsAFK()) then return end
|
||||
|
||||
for _, v in ipairs(character:GetInventory():GetItemsByUniqueID("id_card")) do
|
||||
if (v:GetData("active") == false) then continue end
|
||||
|
||||
local progress = v:GetData("nextRationTime", 60 * ix.config.Get("rationInterval"))
|
||||
v:SetData("nextRationTime", progress + 1)
|
||||
end
|
||||
|
||||
if (!client:IsVortigaunt()) then return end
|
||||
for _, v in pairs(character:GetInventory():GetItems()) do
|
||||
if (v.uniqueID != "vortigaunt_slave_collar" and v.uniqueID != "vortigaunt_slave_collar_fake") then continue end
|
||||
local progress = v:GetData("nextRationTime", 60 * ix.config.Get("rationInterval"))
|
||||
v:SetData("nextRationTime", progress + 1)
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerLoadedCharacter(client, character)
|
||||
local uniqueID = "ixDispenserTimer" .. client:SteamID64()
|
||||
|
||||
if timer.Exists(uniqueID) then
|
||||
timer.Remove(uniqueID)
|
||||
end
|
||||
|
||||
timer.Create(uniqueID, PLUGIN.TIMER_DELAY, 0, function()
|
||||
if (IsValid(client)) then
|
||||
PLUGIN:ClientNextUsageTick(client)
|
||||
else
|
||||
timer.Remove(uniqueID)
|
||||
end
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user