Skip to content

Commit

Permalink
Added Render Target CW 2.0 Gun Display (for shit wmodels)
Browse files Browse the repository at this point in the history
  • Loading branch information
rebel1324 committed Apr 2, 2018
1 parent 3798dff commit 06b2eca
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gamemodes/cityrp/entities/entities/nut_vnd_medical.lua
Expand Up @@ -128,7 +128,7 @@ if (SERVER) then
end end


local a, b = char:getInv():add(self.item) local a, b = char:getInv():add(self.item)
print(a, b)
if (a) then if (a) then
if (owner and owner:IsValid()) then if (owner and owner:IsValid()) then
char:addReserve(profit) char:addReserve(profit)
Expand Down
162 changes: 155 additions & 7 deletions gamemodes/cityrp/plugins/cwsupport/presets/sh_defcw.lua
Expand Up @@ -106,7 +106,7 @@ PLUGIN.gunData.cw_mac11 = {
}, },
slot = 2, slot = 2,
price = 2300, price = 2300,
width = 3, width = 2,
height = 2, height = 2,
exRender = true, exRender = true,
} }
Expand Down Expand Up @@ -149,9 +149,9 @@ PLUGIN.gunData.cw_m14 = {
} }
PLUGIN.gunData.cw_l115 = { PLUGIN.gunData.cw_l115 = {
holster = { holster = {
bone = "ValveBiped.Bip01_Spine2", bone = "ValveBiped.Bip01_Spine2",
ang = Angle(180, -10,10), ang = Angle(180, -10,10),
pos = Vector(4, 8, -3), pos = Vector(4, 8, -3),
}, },
slot = 2, slot = 2,
price = 9000, price = 9000,
Expand All @@ -161,9 +161,9 @@ PLUGIN.gunData.cw_l115 = {
} }
PLUGIN.gunData.cw_l85a2 = { PLUGIN.gunData.cw_l85a2 = {
holster = { holster = {
bone = "ValveBiped.Bip01_Spine2", bone = "ValveBiped.Bip01_Spine2",
ang = Angle(180, -10,10), ang = Angle(180, -10,10),
pos = Vector(9, 22, 6), pos = Vector(9, 22, 6),
}, },
slot = 2, slot = 2,
price = 6000, price = 6000,
Expand Down Expand Up @@ -254,4 +254,152 @@ PLUGIN.gunData.cw_m249_official = {
width = 4, width = 4,
height = 2, height = 2,
exRender = true, exRender = true,
}


PLUGIN.modelCam["models/weapons/cw2_super_shorty.mdl"] = {
pos = Vector(6.5172553062439, 204.1408996582, 1.3671083450317),
ang = Angle(0, 270, 0),
entAng = Angle(0, 54.890121459961, 0),
fov = 5.9490485491673,
}

PLUGIN.modelCam["models/weapons/w_pist_deagle.mdl"] = {
pos = Vector(3.0260665416718, 79.441215515137, 3.8735311031342),
ang = Angle(0, 270, 0),
entAng = Angle(0, 36.883327484131, 0),
fov = 11.301168142308,
}

PLUGIN.modelCam["models/weapons/w_snip_g3sg1.mdl"] = {
pos = Vector(-2.1924774646759, 205.65748596191, 6.0774712562561),
ang = Angle(0, 270, 0),
entAng = Angle(0, 36.883327484131, 0),
fov = 9.9362424901482,
}

PLUGIN.modelCam["models/weapons/w_cstm_m14.mdl"] = {
pos = Vector(9.6280202865601, 215.85713195801, 1.4841167926788),
ang = Angle(0, 270, 0),
entAng = Angle(0, 36.883327484131, 0),
fov = 8.7414882658742,
}

PLUGIN.modelCam["models/weapons/w_cstm_l96.mdl"] = {
pos = Vector(12.43835735321, 224.89477539063, 1.0015095472336),
ang = Angle(0, 270, 0),
entAng = Angle(0, 36.883327484131, 0),
fov = 10.421837319987,
}

PLUGIN.modelCam["models/weapons/w_cw20_l85a2.mdl"] = {
pos = Vector(19.428443908691, 202.55032348633, 9.1177797317505),
ang = Angle(0, 270, 0),
entAng = Angle(0, 36.883327484131, 0),
fov = 8.6216611514778,
}

PLUGIN.modelCam["models/weapons/w_pist_fiveseven.mdl"] = {
pos = Vector(2.1300146579742, 180.55000305176, 3.4476456642151),
ang = Angle(0, 270, 0),
entAng = Angle(0, 15.276277542114, 0),
fov = 4.5621007687203,
}

PLUGIN.modelCam["models/cw2/rifles/w_scarh.mdl"] = {
pos = Vector(8.6337070465088, 169.57571411133, 2.1013042926788),
ang = Angle(0, 270, 0),
entAng = Angle(0, 29.084047317505, 0),
fov = 12.965640196697,
}

PLUGIN.modelCam["models/weapons/w_smg_ump45.mdl"] = {
pos = Vector(-1.1694897413254, 160.07693481445, 4.4684619903564),
ang = Angle(0, 270, 0),
entAng = Angle(0, 38.736545562744, 0),
fov = 8.8235294117647,
}

PLUGIN.modelCam["models/weapons/w_pist_p228.mdl"] = {
pos = Vector(1.8668277263641, 196.29008483887, 0.028613615781069),
ang = Angle(-1.0672906637192, 270, 0),
entAng = Angle(0, 17.890325546265, 0),
fov = 4.1116059677759,
}

PLUGIN.modelCam["models/weapons/w_rif_ak47.mdl"] = {
pos = Vector(0.31035834550858, 213.80619812012, 3.976954460144),
ang = Angle(0, 270, 0),
entAng = Angle(0, 36.206592559814, 0),
fov = 9.812805906836,
}

PLUGIN.modelCam["models/cw2/rifles/w_vss.mdl"] = {
pos = Vector(0.82021301984787, 179.21702575684, 0),
ang = Angle(0, 270, 0),
entAng = Angle(0, -145.88235473633, 0),
fov = 11.945853603603,
}

PLUGIN.modelCam["models/weapons/w_cst_mac11.mdl"] = {
pos = Vector(6.7652416229248, 211.20362854004, 2.3867554664612),
ang = Angle(0, 270, 0),
entAng = Angle(-3.8190178871155, 42.352939605713, 0),
fov = 3.7250538846989,
}

PLUGIN.modelCam["models/cw2/pistols/w_makarov.mdl"] = {
pos = Vector(123.64306640625, 100.75135040283, 77.306968688965),
ang = Angle(25, 220, 0),
entAng = Angle(20.648195266724, -114.04077911377, 10.725868225098),
fov = 4.381269021042,
}

PLUGIN.modelCam["models/weapons/w_357.mdl"] = {
pos = Vector(6.5283980369568, 200.10697937012, -0.059172842651606),
ang = Angle(0.052244115620852, 270, 0),
entAng = Angle(4.044237613678, 0, 8.0715713500977),
fov = 4.9325098920262,
}

PLUGIN.modelCam["models/weapons/w_cstm_m3super90.mdl"] = {
pos = Vector(8.5331335067749, 202.66839599609, 2.0376529693604),
ang = Angle(0, 270, 0),
entAng = Angle(0, 38.723258972168, 0),
fov = 9.8763202691489,
}

PLUGIN.modelCam["models/weapons/w_smg_mp5.mdl"] = {
pos = Vector(2.964239358902, 152.63439941406, 6.1234111785889),
ang = Angle(0, 270, 0),
entAng = Angle(0, 38.723258972168, 0),
fov = 11.558437874162,
}

PLUGIN.modelCam["models/weapons/cw_pist_m1911.mdl"] = {
pos = Vector(4.9751634597778, 203.60511779785, 1.0891706943512),
ang = Angle(0, 270, 0),
entAng = Angle(0, 38.723258972168, 0),
fov = 4.0906703096891,
}

PLUGIN.modelCam["models/weapons/cw20_g36c.mdl"] = {
pos = Vector(5.5794100761414, 197.44989013672, 1.6380152702332),
ang = Angle(0, 270, 0),
entAng = Angle(0, 29.316911697388, 0),
fov = 8.5122821219794,
}

PLUGIN.modelCam["models/weapons/w_rif_m4a1.mdl"] = {
pos = Vector(-1.1262186765671, 191.17977905273, 5.1555094718933),
ang = Angle(0, 270, 0),
entAng = Angle(0, 34.68586730957, 0),
fov = 9.7495846580522,
}

PLUGIN.modelCam["models/weapons/cw2_0_mach_para.mdl"] = {
pos = Vector(7.4761252403259, 194.04393005371, 4.5161352157593),
ang = Angle(0, 270, 0),
entAng = Angle(-9.841007232666, 42.947208404541, 0),
fov = 11.384041473209,
} }
1 change: 1 addition & 0 deletions gamemodes/cityrp/plugins/cwsupport/sh_configs.lua
@@ -1,5 +1,6 @@
PLUGIN.gunData = {} PLUGIN.gunData = {}
PLUGIN.modelCam = {} PLUGIN.modelCam = {}

PLUGIN.slotCategory = { PLUGIN.slotCategory = {
[1] = "secondary", [1] = "secondary",
[2] = "primary", [2] = "primary",
Expand Down
97 changes: 96 additions & 1 deletion gamemodes/cityrp/plugins/cwsupport/sh_plugin.lua
Expand Up @@ -59,7 +59,6 @@ function PLUGIN:InitializedPlugins()
do do
-- ammunition -- ammunition
for name, data in pairs(self.ammoInfo) do for name, data in pairs(self.ammoInfo) do
print(name)
local uniqueID = "ammo_"..name:lower() local uniqueID = "ammo_"..name:lower()
local ammoInfo = data local ammoInfo = data


Expand Down Expand Up @@ -252,6 +251,49 @@ function PLUGIN:InitializedPlugins()
ITEM.height = dat.height or 1 ITEM.height = dat.height or 1
ITEM.weaponCategory = slot or "primary" ITEM.weaponCategory = slot or "primary"


function ITEM:onGetDropModel()
if (dat.width >= 3 and dat.height >= 2) then
return "models/props_junk/cardboard_box003a.mdl"
end

return "models/props_junk/cardboard_box004a.mdl"
end

function ITEM:drawEntity(entity)
local name = self.uniqueID
local exIcon = ikon:getIcon(name)
local type
if (self.width >= 3 and self.height >= 2) then
type = 0
else
type = 1
end

if (exIcon) then
if (!entity.initText and !entity.customText) then
entity.initText = true

itemRTTextrue.loadItemTex(entity, self, exIcon, type)
end

if (entity.customText) then
render.MaterialOverrideByIndex(0, entity.customText)
end

entity:DrawModel()

render.MaterialOverrideByIndex(1)
else
ikon:renderIcon(
self.uniqueID,
self.width,
self.height,
self.model,
self.iconCam
)
end
end

function ITEM:onEquipWeapon(client, weapon) function ITEM:onEquipWeapon(client, weapon)
end end


Expand Down Expand Up @@ -556,4 +598,57 @@ if (SERVER) then
end end
end end
end end
else
local function drawMaterial(exIcon, w, h, name, type)
surface.SetDrawColor(Color(187, 187, 187))
surface.DrawRect(0, 0, sizeGenerate, sizeGenerate)

--[[
surface.SetMaterial(temporalMaterial)
surface.SetDrawColor(color_white)
surface.DrawTexturedRect(0, 0, sizeGenerate, sizeGenerate)
]]--
if (type == 1) then
nut.util.drawText(name, sizeGenerate*.24, sizeGenerate*.03, color_white, 1, 1, "nutItemDisplayRT2", 255)

if (exIcon) then
local iw, ih = sizeGenerate/8*w/2, sizeGenerate/8*h/2
surface.SetMaterial(exIcon)
surface.SetDrawColor(color_black)
surface.DrawTexturedRect(sizeGenerate*.24 - iw/2, sizeGenerate*.085 - ih/2, iw, ih)
end
else
nut.util.drawText(name, sizeGenerate*.2, sizeGenerate*.23, color_white, 1, 1, "nutItemDisplayRT", 255)

if (exIcon) then
local iw, ih = sizeGenerate/8*w/1.5, sizeGenerate/8*h/1.5
surface.SetMaterial(exIcon)
surface.SetDrawColor(color_black)
surface.DrawTexturedRect(sizeGenerate*.2 - iw/2, sizeGenerate*.35 - ih/2, iw, ih)
end
end
end

function itemRTTextrue.loadItemTex(entity, itemTable, exIcon, type)
local oldRT = render.GetRenderTarget()
local newText

local tamp = entity:EntIndex() .. "_custoDiam"
itemRTTextrue.RT = GetRenderTarget(tamp, sizeGenerate, sizeGenerate, false)
render.PushRenderTarget(itemRTTextrue.RT)
cam.Start2D()
render.Clear(0,0,0,255)
render.ClearDepth()

surface.SetMaterial(Material("anslogo.png"))
surface.SetDrawColor(color_white)
surface.DrawTexturedRect(0, 0, 512, 512)
drawMaterial(exIcon, itemTable.width, itemTable.height, itemTable.name, type)
cam.End2D()
render.PopRenderTarget()

local wtf = CreateMaterial(RealTime() .. "_custodium", "VertexLitGeneric")
wtf:SetTexture("$basetexture", itemRTTextrue.RT)
entity.customText = wtf
end
end end
1 change: 0 additions & 1 deletion gamemodes/cityrp/schema/libs/sh_touch.lua
Expand Up @@ -156,7 +156,6 @@ if (CLIENT) then


-- Print the error. -- Print the error.
if !succ then if !succ then
print(err)
return err return err
end end
end end
Expand Down
2 changes: 0 additions & 2 deletions gamemodes/cityrp/schema/sh_commands.lua
Expand Up @@ -440,8 +440,6 @@ nut.command.add("buyentity", {
hook.Run("EntityPurchased", client, char, ent, entTable) hook.Run("EntityPurchased", client, char, ent, entTable)


client:notify(L("purchaseEntity", client, entTable.name, nut.currency.get(price))) client:notify(L("purchaseEntity", client, entTable.name, nut.currency.get(price)))
else
print("what the fuck mate")
end end
end end
else else
Expand Down
12 changes: 12 additions & 0 deletions gamemodes/cityrp/schema/sh_schema.lua
Expand Up @@ -29,6 +29,18 @@ nut.vote.list = nut.vote.list or {}
nut.bent = nut.bent or {} nut.bent = nut.bent or {}
nut.bent.list = {} nut.bent.list = {}


if (CLIENT) then
nut.playerInteract.addFunc("giveMoney", {
nameLocalized = "giveMoney",
callback = function(target)
print("hi")
end,
canSee = function(target)
return true
end
})
end

nut.util.include("sv_database.lua") nut.util.include("sv_database.lua")
nut.util.include("sh_configs.lua") nut.util.include("sh_configs.lua")
nut.util.include("cl_effects.lua") nut.util.include("cl_effects.lua")
Expand Down

0 comments on commit 06b2eca

Please sign in to comment.