Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions entities/entities/nut_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ ENT.RenderGroup = RENDERGROUP_BOTH

if (SERVER) then
function ENT:Initialize()
self:SetModel("models/props_junk/watermelon01.mdl")
self:SetSolid(SOLID_VPHYSICS)
self:PhysicsInit(SOLID_VPHYSICS)
--self:SetModel("models/props_junk/watermelon01.mdl")
--self:SetSolid(SOLID_VPHYSICS)
--self:PhysicsInit(SOLID_VPHYSICS)
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
self.health = 50

Expand Down Expand Up @@ -51,14 +51,20 @@ if (SERVER) then
and "models/props_junk/cardboard_box004a.mdl"
or itemTable.worldModel
end

self:SetModel(model or "models/props_junk/watermelon01.mdl")
self:SetSkin(itemTable.skin or 0)
self:SetModel(model)

if itemTable.groups then -- this has to be done after the model is set, hence why it looks a little messy
for k, v in pairs(itemTable.groups) do
if isstring(k) then k = self:FindBodygroupByName(k) end
self:SetBodygroup(k, v)
end
end

self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:setNetVar("id", itemTable.uniqueID)
self.nutItemID = itemID

if (table.Count(itemTable.data) > 0) then
self:setNetVar("data", itemTable.data)
end
Expand Down Expand Up @@ -205,4 +211,4 @@ function ENT:getData(key, default)
return default
end
return data[key]
end
end
4 changes: 2 additions & 2 deletions gamemode/core/meta/item/sv_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ function ITEM:spawn(position, angles)

-- Spawn the actual item entity.
local entity = ents.Create("nut_item")
entity:Spawn()
entity:SetPos(position)
entity:SetAngles(angles or Angle(0, 0, 0))
-- Make the item represent this item.
entity:setItem(self.id)
entity:Spawn()
instance.entity = entity

if (IsValid(client)) then
Expand Down Expand Up @@ -284,4 +284,4 @@ function ITEM:interact(action, client, entity, data)
self.player = oldPlayer
self.entity = oldEntity
return true
end
end
4 changes: 2 additions & 2 deletions gamemode/core/sh_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function nut.util.includeDir(directory, fromLua, recursive)
baseDir = SCHEMA.folder.."/schema/"
else
baseDir = baseDir.."/gamemode/"
end
end

if recursive then
local function AddRecursive(folder)
local files, folders = file.Find(folder.."/*", "LUA")
Expand Down