From 78e40d9fd55b6ba23db4f459e2c7e9ae2109cf5a Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 24 Oct 2016 21:52:20 -0400 Subject: Allowed items to be dropped --- entities/entities/art_droppeditem/cl_init.lua | 99 ++++++++++++++++++++++ entities/entities/art_droppeditem/init.lua | 80 +++++++++++++++++ entities/entities/art_droppeditem/shared.lua | 17 ++++ entities/entities/npc_huntable/init.lua | 3 +- entities/weapons/hands.lua | 6 -- gamemode/shared/inventory.lua | 12 ++- gamemode/shared/itemsystem/exampleitem.lua | 5 ++ gamemode/shared/itemsystem/foodstuffs/ratmeat.lua | 44 ++++++++++ .../shared/itemsystem/foodstuffs/watermelon.lua | 4 + .../shared/itemsystem/weapons/knuckledclaw.lua | 47 +--------- gamemode/shared/itemsystem/weapons/rustyaxe.lua | 36 ++++---- gamemode/shared/itemsystem/weapons/scraphammer.lua | 71 ++++------------ .../shared/itemsystem/weapons/seratedknife.lua | 49 +---------- gamemode/shared/itemsystem/weapons_common.lua | 10 ++- gamemode/shared/sh_pac.lua | 1 + 15 files changed, 315 insertions(+), 169 deletions(-) create mode 100644 entities/entities/art_droppeditem/cl_init.lua create mode 100644 entities/entities/art_droppeditem/init.lua create mode 100644 entities/entities/art_droppeditem/shared.lua create mode 100644 gamemode/shared/itemsystem/foodstuffs/ratmeat.lua diff --git a/entities/entities/art_droppeditem/cl_init.lua b/entities/entities/art_droppeditem/cl_init.lua new file mode 100644 index 0000000..eb4b21f --- /dev/null +++ b/entities/entities/art_droppeditem/cl_init.lua @@ -0,0 +1,99 @@ +include('shared.lua') + +ENT.RenderGroup = RENDERGROUP_BOTH + +/*--------------------------------------------------------- + Name: Draw + Desc: Draw it! +---------------------------------------------------------*/ +function ENT:Draw() + self:SetAngles(Angle(180,(CurTime()*200)%360,0)) + if(self:GetColor().a == 255) then + self:DrawModel() + end +end + +local lp +local sentrequests = {} +hook.Add("Tick","pickupitemstick",function() + lp = lp or LocalPlayer() + local ae = ents.FindInSphere(lp:GetPos(),5) + for k,v in pairs(ae) do + local ei = v:EntIndex() + if (not sentrequests[ei]) and v.GetClass and v:GetClass() == "art_droppeditem" then + print("Sending request to pick up", ei) + net.Start("art_requestpickup") + net.WriteUInt(ei,16) + net.SendToServer() + sentrequests[ei] = true + timer.Simple(5,function() + sentrequests[ei] = nil + end) + end + end +end) + + +net.Receive("art_informmodel",function() + print("Player received model information") + local ei = net.ReadUInt(16) + local m = net.ReadString() + local e = Entity(ei) + e:SetModel(m) + e.newmodel = m +end) + +/*--------------------------------------------------------- + Name: DrawTranslucent + Desc: Draw translucent +---------------------------------------------------------*/ +function ENT:DrawTranslucent() + + // This is here just to make it backwards compatible. + // You shouldn't really be drawing your model here unless it's translucent + + self:Draw() + +end + +/*--------------------------------------------------------- + Name: BuildBonePositions + Desc: +---------------------------------------------------------*/ +function ENT:BuildBonePositions( NumBones, NumPhysBones ) + + // You can use this section to position the bones of + // any animated model using self:SetBonePosition( BoneNum, Pos, Angle ) + + // This will override any animation data and isn't meant as a + // replacement for animations. We're using this to position the limbs + // of ragdolls. + +end + + + +/*--------------------------------------------------------- + Name: SetRagdollBones + Desc: +---------------------------------------------------------*/ +function ENT:SetRagdollBones( bIn ) + + // If this is set to true then the engine will call + // DoRagdollBone (below) for each ragdoll bone. + // It will then automatically fill in the rest of the bones + + self.m_bRagdollSetup = bIn + +end + + +/*--------------------------------------------------------- + Name: DoRagdollBone + Desc: +---------------------------------------------------------*/ +function ENT:DoRagdollBone( PhysBoneNum, BoneNum ) + + // self:SetBonePosition( BoneNum, Pos, Angle ) + +end diff --git a/entities/entities/art_droppeditem/init.lua b/entities/entities/art_droppeditem/init.lua new file mode 100644 index 0000000..de27e6d --- /dev/null +++ b/entities/entities/art_droppeditem/init.lua @@ -0,0 +1,80 @@ +--[[ + This entity gives townies things to do +]] +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include("shared.lua") + +util.AddNetworkString("art_requestmodel") +util.AddNetworkString("art_informmodel") +util.AddNetworkString("art_requestpickup") + +function ENT:Initialize() + self:SetModel(self.Model or "models/error.mdl") + assert(self.Item ~= nil, "Attempted to drop something without .Item set!") + self.ItemName = self.Item.Name + self.ItemData = self.Item.Data + if self.Item.onDropped then + self:SetColor(Color(0,0,0,0)) + timer.Simple(1,function() + self.Item:onDropped(self) + end) + end + self:SetMoveType(MOVETYPE_NONE) + self:SetSolid(SOLID_NONE) + self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE) +end + +--A client is near enough to draw the item, tell them what to draw. +net.Receive("art_requestmodel",function(len,pl) + print(pl," requested a model") + local ei = net.ReadUInt(16) + local e = Entity(ei) + assert(e.Model ~= nil,"Attempted to request model for non-art_droppeditem entity") + net.Start("art_informmodel") + net.WriteUInt(ei,16) + net.WriteString(e.Model) + net.Send(pl) +end) + +net.Receive("art_requestpickup",function(len,pl) + local ei = net.ReadUInt(16) + local e = Entity(ei) + print("Got request to pick up", e) + local ep = e:GetPos() + print("got ep pos") + local plp = pl:GetPos() + print("got pl pos") + local d = ep:Distance(plp) + print("Got distance") + if d < 30 then + print("Inside if statement") + local i = ART.GetItemByName(e.ItemName):DeSerialize(e.ItemData) + print("Created item") + if pl:GiveItem(i) then + print("In if") + e:Remove() + end + print("Removed item") + else + print("Player not close enough!") + end +end) + +function ENT:Use(activator, caller, usetype) + print("a",activator,"c",caller,"u",usetype) +end + +print("Remove the concommand in art_droppeditem/init.lua") +concommand.Add("dropmellon",function(ply,cmd,args) + local e = ents.Create("art_droppeditem") + e.Model = "models/props_junk/Rock001a.mdl" + e.Item = ART.GetItemByName("Watermelon") + local hitpos = ply:GetEyeTrace().HitPos + Vector(0,0,10) + print("Traceresult was") + PrintTable(ply:GetEyeTrace()) + print("Hitpos was", hitpos) + e:SetPos(hitpos) + e:Spawn() +end) diff --git a/entities/entities/art_droppeditem/shared.lua b/entities/entities/art_droppeditem/shared.lua new file mode 100644 index 0000000..a72fcf8 --- /dev/null +++ b/entities/entities/art_droppeditem/shared.lua @@ -0,0 +1,17 @@ +ENT.Base = "base_entity" + +//WS stuff +ENT.Drops = nil +ENT.OnDammage = nil +ENT.Speed = 0 +ENT.Model = nil + +ENT.Behave = nil +ENT.Act = nil + +/*--------------------------------------------------------- + Name: OnRemove + Desc: Called just before entity is deleted +---------------------------------------------------------*/ +function ENT:OnRemove() +end diff --git a/entities/entities/npc_huntable/init.lua b/entities/entities/npc_huntable/init.lua index b136878..3adf3e2 100644 --- a/entities/entities/npc_huntable/init.lua +++ b/entities/entities/npc_huntable/init.lua @@ -48,7 +48,8 @@ function ENT:OnKilled(dmg) if (CLIENT) then return end if not self.Drops then return end --print("Looks like we have some drops") - error("You need to code how item drops work!") + --error("You need to code how item drops work!") + local itemstodrop = {} for k, v in pairs(self.Drops) do local rng = math.random(0, 100) diff --git a/entities/weapons/hands.lua b/entities/weapons/hands.lua index c97249a..e0b1ae6 100644 --- a/entities/weapons/hands.lua +++ b/entities/weapons/hands.lua @@ -36,12 +36,6 @@ function SWEP:ShouldDropOnDie() return false end -function SWEP:Think() -end - -function SWEP:Reload() -end - local Box = Vector(8,8,8) function SWEP:PrimaryAttack() diff --git a/gamemode/shared/inventory.lua b/gamemode/shared/inventory.lua index f83bb77..a8c1756 100644 --- a/gamemode/shared/inventory.lua +++ b/gamemode/shared/inventory.lua @@ -134,8 +134,14 @@ end -- @param item The item to give the player function pmeta:GiveItem(item) local x,y,b = self:FindSpotForItem(item) - self:PutInvItem(b,x,y,item) - self:SynchronizeInventory() + print("putting in ",x,y,b) + if x and y and b then + self:PutInvItem(b,x,y,item) + self:SynchronizeInventory() + return true + else + return false + end end --- Check if an item can fit in a position in a backpack @@ -196,7 +202,7 @@ end) -- @param fromcol The column to take the item from -- @param toslo The equipment slot to put the item into function pmeta:EquipItem(frombackpack, fromrow, fromcol, toslot) - local item = self.Inventory.Backpacks[frombackpack][1][fromrow[1]][fromcol[2]] + local item = self.Inventory.Backpacks[frombackpack][1][fromrow][fromcol] if item.Equipable ~= nil and item.Equipable == toslot then --Remove from the backpack for k = 1,#item.Shape do diff --git a/gamemode/shared/itemsystem/exampleitem.lua b/gamemode/shared/itemsystem/exampleitem.lua index d2d6ed8..fdc0e9c 100644 --- a/gamemode/shared/itemsystem/exampleitem.lua +++ b/gamemode/shared/itemsystem/exampleitem.lua @@ -75,6 +75,11 @@ item.onUnEquip = function(self,who) print("Aw, I'm being stored :(") end +--Technically optional, but item will display as a rock if you don't have it +item.onDropped = function(self,ent) + print("I've been dropped!(BUVVV WUB WUB WUB WUB WUB)") +end + print("Hello from exampleitem.lua") --Don't forget to register the item! ART.RegisterItem(item) diff --git a/gamemode/shared/itemsystem/foodstuffs/ratmeat.lua b/gamemode/shared/itemsystem/foodstuffs/ratmeat.lua new file mode 100644 index 0000000..8990a49 --- /dev/null +++ b/gamemode/shared/itemsystem/foodstuffs/ratmeat.lua @@ -0,0 +1,44 @@ +--[[ + An example item +]] +local item = {} + +--Required, a name, all item names must be unique +item.Name = "Rat Meat" + +--Optional, a tooltip to display when hovered over +item.Tooltip = "Disgusting, disease-ridden meat." + +--Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network +item.Serialize = function(self) + print("Trying to serailize!") + return "" +end + +--Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set. +item.DeSerialize = function(self,string) + print("Trying to deserialize!") + return self +end + +--Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file! +function item.GetOptions(self) + local options = {} + options["test"] = function() print("You pressed test!") end + options["toste"] = function() print("You pressed toste!") end + return options +end + +--Optional. Something run once when this item is drawn in a backpack +function item.DoOnPanel(dimagebutton) + --dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png") +end + +--Required, the shape of this item in a backpack. +item.Shape = { + {true} +} + + +--Don't forget to register the item! +ART.RegisterItem(item) diff --git a/gamemode/shared/itemsystem/foodstuffs/watermelon.lua b/gamemode/shared/itemsystem/foodstuffs/watermelon.lua index 76c0398..c79ba6c 100644 --- a/gamemode/shared/itemsystem/foodstuffs/watermelon.lua +++ b/gamemode/shared/itemsystem/foodstuffs/watermelon.lua @@ -46,6 +46,10 @@ item.Shape = { {true,true,true}, } +item.onDropped = function(self, ent) + ART.ApplyPAC(ent,"scraphammer") +end + print("Hello from exampleitem.lua") --Don't forget to register the item! ART.RegisterItem(item) diff --git a/gamemode/shared/itemsystem/weapons/knuckledclaw.lua b/gamemode/shared/itemsystem/weapons/knuckledclaw.lua index 467439e..2db8117 100644 --- a/gamemode/shared/itemsystem/weapons/knuckledclaw.lua +++ b/gamemode/shared/itemsystem/weapons/knuckledclaw.lua @@ -58,49 +58,6 @@ item.Shape = { --Optional, If this item can be equiped in any player slots, put them here. item.Equipable = "Right" ---[[ returns the direction the player swung]] -local function playermovedir(player) - local vel = player:GetVelocity():GetNormalized() - vel.z = 0 - local swings = { - {player:GetForward(),"forward"}, - {-player:GetForward(),"backward"}, - {player:GetRight(),"right"}, - {-player:GetRight(),"left"} - } - table.sort(swings,function(a,b) - return vel:Dot(a[1]) > vel:Dot(b[1]) - end) - return swings[1][2] -end - -local positionset = {} - -local function swingarc(player,times,positions,onhit) - local positionpoints = {} - table.insert(positionset,positionpoints) - local hitents = {} - for k,v in ipairs(times) do - timer.Simple(v,function() - local weaponpos = positions[k] + player:GetPos() - table.insert(positionpoints,weaponpos) - if #positionpoints > 1 then - local tr = util.TraceLine({ - start = positionpoints[#positionpoints-1], - endpos = positionpoints[#positionpoints], - }) - if tr.Hit then - onhit(tr) - end - end - end) - end - timer.Simple(times[#times],function() - print("Inserted swing, drawn positions are now:") - PrintTable(positionset) - end) -end - --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right @@ -197,6 +154,10 @@ item.onUnEquip = function(self,who) ART.RemovePAC(who,"knuckledclaws") end +item.onDropped = function(self, ent) + ART.ApplyPAC(ent,"knuckledclaws") +end + print("Hello from scrapgun.lua") --Don't forget to register the item! ART.RegisterItem(item) diff --git a/gamemode/shared/itemsystem/weapons/rustyaxe.lua b/gamemode/shared/itemsystem/weapons/rustyaxe.lua index 71d8603..f21500d 100644 --- a/gamemode/shared/itemsystem/weapons/rustyaxe.lua +++ b/gamemode/shared/itemsystem/weapons/rustyaxe.lua @@ -66,6 +66,7 @@ end local positionset = {} +--[[ local function swingarc(player,times,positions,onhit) local positionpoints = {} table.insert(positionset,positionpoints) @@ -102,6 +103,7 @@ hook.Add( "HUDPaint", "weaponswings", function() --render.DrawSprite( pos, 16, 16, white ) -- Draw the sprite in the middle of the map, at 16x16 in it's original colour with full alpha. cam.End3D() end ) +]] --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right item.lastSwing = {} @@ -117,13 +119,13 @@ item.onClick = function(self,owner) ["forward"] = function() owner:SetLuaAnimation("axe_swing_up") timer.Simple(2.33,function() owner:StopLuaAnimation("axe_swing_up") end) - local hits = swingarc(owner,{ + local hits = ART.swingarc(owner,{ 1,1.1,1.2,1.3 },{ - fow*20 + up*90, - fow*45 + up*70, - fow*35 + up*45, - fow*20 + up*30, + fow*20 + up*26, + fow*45 + up*6, + fow*35 + up*-13, + fow*20 + up*-34, },function(tr) if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon()) @@ -137,13 +139,13 @@ item.onClick = function(self,owner) ["left"] = function() owner:SetLuaAnimation("axe_swing_left") timer.Simple(2.33,function() owner:StopLuaAnimation("axe_swing_left") end) - local hits = swingarc(owner,{ + local hits = ART.swingarc(owner,{ 1,1.1,1.2,1.3 },{ - rig*30 + up*59, - rig*10 + fow*30 + up*55, - rig*-10 + fow*30 + up*54, - rig*-30 + up*50, + rig*30 + up*-5, + rig*10 + fow*30 + up*-9, + rig*-10 + fow*30 + up*-10, + rig*-30 + up*-15, },function(tr) if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon()) @@ -154,13 +156,13 @@ item.onClick = function(self,owner) ["right"] = function() owner:SetLuaAnimation("axe_swing_right") timer.Simple(2.33,function() owner:StopLuaAnimation("axe_swing_right") end) - local hits = swingarc(owner,{ + local hits = ART.swingarc(owner,{ 1,1.1,1.2,1.3 },{ - rig*-30 + up*59, - rig*-10 + fow*30 + up*55, - rig*10 + fow*30 + up*54, - rig*30 + up*50, + rig*-30 + up*-5, + rig*-10 + fow*30 + up*-9, + rig*10 + fow*30 + up*-10, + rig*30 + up*-15, },function(tr) if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon()) @@ -192,6 +194,10 @@ item.onUnEquip = function(self,who) ART.RemovePAC(who,"rustyaxe") end +item.onDropped = function(self, ent) + ART.ApplyPAC(ent,"rustyaxe") +end + print("Hello from scrapgun.lua") --Don't forget to register the item! ART.RegisterItem(item) diff --git a/gamemode/shared/itemsystem/weapons/scraphammer.lua b/gamemode/shared/itemsystem/weapons/scraphammer.lua index 978fde8..9ec7ac9 100644 --- a/gamemode/shared/itemsystem/weapons/scraphammer.lua +++ b/gamemode/shared/itemsystem/weapons/scraphammer.lua @@ -60,49 +60,6 @@ item.Shape = { --Optional, If this item can be equiped in any player slots, put them here. item.Equipable = "Right" ---[[ returns the direction the player swung]] -local function playermovedir(player) - local vel = player:GetVelocity():GetNormalized() - vel.z = 0 - local swings = { - {player:GetForward(),"forward"}, - {-player:GetForward(),"backward"}, - {player:GetRight(),"right"}, - {-player:GetRight(),"left"} - } - table.sort(swings,function(a,b) - return vel:Dot(a[1]) > vel:Dot(b[1]) - end) - return swings[1][2] -end - -local positionset = {} - -local function swingarc(player,times,positions,onhit) - local positionpoints = {} - table.insert(positionset,positionpoints) - local hitents = {} - for k,v in ipairs(times) do - timer.Simple(v,function() - local weaponpos = positions[k] + player:GetPos() - table.insert(positionpoints,weaponpos) - if #positionpoints > 1 then - local tr = util.TraceLine({ - start = positionpoints[#positionpoints-1], - endpos = positionpoints[#positionpoints], - }) - if tr.Hit then - onhit(tr) - end - end - end) - end - timer.Simple(times[#times],function() - print("Inserted swing, drawn positions are now:") - PrintTable(positionset) - end) -end - --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right @@ -123,10 +80,10 @@ item.onClick = function(self,owner) local hits = ART.swingarc(owner,{ 1,1.1,1.2,1.3 },{ - fow*20 + up*90, - fow*45 + up*70, - fow*35 + up*45, - fow*20 + up*30, + fow*40 + up*26, + fow*60 + up*6, + fow*55 + up*-13, + fow*40 + up*-34, },function(tr) if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon()) @@ -145,10 +102,10 @@ item.onClick = function(self,owner) local hits = ART.swingarc(owner,{ 1,1.1,1.2,1.3 },{ - rig*30 + up*59, - rig*10 + fow*30 + up*55, - rig*-10 + fow*30 + up*54, - rig*-30 + up*50, + rig*30 + up*-5, + rig*20 + fow*40 + up*-9, + rig*-20 + fow*40 + up*-10, + rig*-30 + up*-15, },function(tr) if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then tr.Entity:TakeDamage(10, owner, owner:GetActiveWeapon()) @@ -164,10 +121,10 @@ item.onClick = function(self,owner) local hits = ART.swingarc(owner,{ 1,1.1,1.2,1.3 },{ - rig*-30 + up*59, - rig*-10 + fow*30 + up*55, - rig*10 + fow*30 + up*54, - rig*30 + up*50, + rig*-30 + up*-5, + rig*-10 + fow*40 + up*-9, + rig*10 + fow*40 + up*-10, + rig*30 + up*-15, },function(tr) if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon()) @@ -199,6 +156,10 @@ item.onUnEquip = function(self,who) ART.RemovePAC(who,"scraphammer") end +item.onDropped = function(self, ent) + ART.ApplyPAC(ent,"scraphammer") +end + print("Hello from scrapgun.lua") --Don't forget to register the item! ART.RegisterItem(item) diff --git a/gamemode/shared/itemsystem/weapons/seratedknife.lua b/gamemode/shared/itemsystem/weapons/seratedknife.lua index a6d4c55..e57351d 100644 --- a/gamemode/shared/itemsystem/weapons/seratedknife.lua +++ b/gamemode/shared/itemsystem/weapons/seratedknife.lua @@ -58,51 +58,6 @@ item.Shape = { --Optional, If this item can be equiped in any player slots, put them here. item.Equipable = "Right" ---[[ returns the direction the player swung]] -local function playermovedir(player) - local vel = player:GetVelocity():GetNormalized() - vel.z = 0 - local swings = { - {player:GetForward(),"forward"}, - {-player:GetForward(),"backward"}, - {player:GetRight(),"right"}, - {-player:GetRight(),"left"} - } - table.sort(swings,function(a,b) - return vel:Dot(a[1]) > vel:Dot(b[1]) - end) - return swings[1][2] -end - -local positionset = {} - -local function swingarc(player,times,positions,onhit) - local positionpoints = {} - table.insert(positionset,positionpoints) - local hitents = {} - for k,v in ipairs(times) do - timer.Simple(v,function() - local weaponpos = positions[k] + player:GetPos() - table.insert(positionpoints,weaponpos) - if #positionpoints > 1 then - local tr = util.TraceLine({ - start = positionpoints[#positionpoints-1], - endpos = positionpoints[#positionpoints], - }) - if tr.Hit then - onhit(tr) - end - end - end) - end - timer.Simple(times[#times],function() - print("Inserted swing, drawn positions are now:") - PrintTable(positionset) - end) -end - - - --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right item.lastSwing = {} local animationtime = 1.833333 @@ -214,5 +169,9 @@ item.onUnEquip = function(self,who) ART.RemovePAC(who,"seratedknife") end +item.onDropped = function(self, ent) + ART.ApplyPAC(ent,"seratedknife") +end + --Don't forget to register the item! ART.RegisterItem(item) diff --git a/gamemode/shared/itemsystem/weapons_common.lua b/gamemode/shared/itemsystem/weapons_common.lua index 6e73318..a7679a9 100644 --- a/gamemode/shared/itemsystem/weapons_common.lua +++ b/gamemode/shared/itemsystem/weapons_common.lua @@ -29,11 +29,19 @@ local positionset = {} -- @param onhit A function to call on any entities that were hit in the swing of the weapon. function ART.swingarc(player,times,positions,onhit) local positionpoints = {} + --[[ + local ea = player:EyeAngles() + for k,v in pairs(positions) do + print("Position that was at ", positions[k]) + positions[k].z = positions[k].z * math.sin(ea.pitch+90) + print("Is now at",positions[k]) + end + ]] table.insert(positionset,positionpoints) local hitents = {} for k,v in ipairs(times) do timer.Simple(v,function() - local weaponpos = positions[k] + player:GetPos() + local weaponpos = positions[k] + player:GetPos() + Vector(0,0,64) table.insert(positionpoints,weaponpos) if #positionpoints > 1 then local tr = util.TraceLine({ diff --git a/gamemode/shared/sh_pac.lua b/gamemode/shared/sh_pac.lua index baa7f0b..1ab9f88 100644 --- a/gamemode/shared/sh_pac.lua +++ b/gamemode/shared/sh_pac.lua @@ -23,6 +23,7 @@ if CLIENT then local pactbl = CompileString("return {"..pactxt.."}",pacname)() print("pactbl is") PrintTable(pactbl) + print("who is",who) who:AttachPACPart(pactbl) print("Pac Equiped!") end -- cgit v1.2.3-70-g09d2