From 3d55477c8b86ceea9d78072b4ea91db15fd9aea9 Mon Sep 17 00:00:00 2001 From: Adam Coggeshall Date: Wed, 15 Jul 2015 17:19:41 -0600 Subject: [PATCH] FIxed, I hope :/ --- entities/entities/ragcom_controller.lua | 27 ++++++++++++++--------- gamemode/cl_init.lua | 10 ++++----- gamemode/resource.lua | 29 +++++++++++++++---------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/entities/entities/ragcom_controller.lua b/entities/entities/ragcom_controller.lua index 001e552..eb3fbe7 100644 --- a/entities/entities/ragcom_controller.lua +++ b/entities/entities/ragcom_controller.lua @@ -40,6 +40,8 @@ function ENT:Initialize() self:DeleteOnRemove(ragdoll) + RAGCOM_CHARS[self:GetChar()].setup(ragdoll) + /*for i=1,100 do print(i,ragdoll:GetBoneName(i),ragdoll:TranslateBoneToPhysBone(i)) end*/ @@ -115,13 +117,18 @@ function ENT:Initialize() self:StepStart(SIDE_LEFT,self:GetStepPos(SIDE_LEFT,control),.1,5) self:StepStart(SIDE_RIGHT,self:GetStepPos(SIDE_RIGHT,control),.1,5) else - local ragdoll = self:GetRagdoll() - - RAGCOM_CHARS[self:GetChar()].setup(ragdoll) - - if self:GetController()==LocalPlayer() then - LocalPlayerController = self - end + //I would fix this gud but I am running out of time FAST + //timer.Simple(.1,function() + //if not IsValid(self) then return end + //local ragdoll = self:GetRagdoll() + + + //print(">>",self:GetChar()) + + if self:GetController()==LocalPlayer() then + LocalPlayerController = self + end + //end) end end @@ -206,7 +213,7 @@ function ENT:PhysicsSimulate(phys_body,dt) local phys_head = ragdoll:GetPhysicsObjectNum(10) - if self:GetController():KeyPressed(IN_JUMP) then + if self:GetController():KeyDown(IN_JUMP) then self:EmitSound("player/pl_pain5.wav") self.limp_timer = 2 local vel = Vector(0,0,900)+self.lean*self:GetEnergy()*10 @@ -245,11 +252,11 @@ function ENT:PhysicsSimulate(phys_body,dt) doControl(phys_fistl,phys_body:GetPos()+Vector(0,0,30)+self.yaw:Forward()*10+self.yaw:Right()*-3) doControl(phys_fistr,phys_body:GetPos()+Vector(0,0,30)+self.yaw:Forward()*10+self.yaw:Right()*3) else - if self:GetController():KeyPressed(IN_ATTACK) then + if self:GetController():KeyDown(IN_ATTACK) then self.punch_l=.4 self:EmitSound("npc/vort/claw_swing1.wav") end - if self:GetController():KeyPressed(IN_ATTACK2) then + if self:GetController():KeyDown(IN_ATTACK2) then self.punch_r=.4 self:EmitSound("npc/vort/claw_swing2.wav") end diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua index 6840273..beccd3c 100644 --- a/gamemode/cl_init.lua +++ b/gamemode/cl_init.lua @@ -191,7 +191,7 @@ function GM:HUDPaint() end if not IsValid(LocalPlayerController) then - draw.SimpleText("You are spectating. Press F1 for help. Press F2 to select a character.","Trebuchet24",ScrW()/2,ScrH()-100,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) + draw.SimpleText("You are spectating. Press F1 for help. Press F2 to select a character.","Trebuchet18",ScrW()/2,ScrH()-100,black,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) end end @@ -210,8 +210,8 @@ function GM:HUDDrawScoreBoard() surface.SetDrawColor(grey) surface.DrawRect(ScrW()/4,85,ScrW()/2,80) - draw.SimpleText(GetHostName(),"Trebuchet24",ScrW()/2,100,black,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) - draw.SimpleText("Ragdoll Combat II: Flatgrass Smash","Trebuchet24",ScrW()/2,125,black,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) + draw.SimpleText(GetHostName(),"Trebuchet18",ScrW()/2,100,black,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) + draw.SimpleText("Ragdoll Combat II: Flatgrass Smash","Trebuchet18",ScrW()/2,125,black,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) draw.SimpleText("Playing to "..RAGCOM_WINS.." wins.","Trebuchet18",ScrW()/2,150,black,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) local t = {} @@ -223,8 +223,8 @@ function GM:HUDDrawScoreBoard() for k,ply in pairs(player.GetAll()) do surface.SetDrawColor(t[ply] and getWeaknessColor(t[ply]) or grey) surface.DrawRect(ScrW()/4,135+k*35,ScrW()/2,30) - draw.SimpleText(ply:GetName(),"Trebuchet24",ScrW()/4+10,150+k*35,black,TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER) - draw.SimpleText(ply:Frags()..(ply:Frags()==1 and " Win" or " Wins"),"Trebuchet24",ScrW()/2,150+k*35,black,TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER) + draw.SimpleText(ply:GetName(),"Trebuchet18",ScrW()/4+10,150+k*35,Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER) + draw.SimpleText(ply:Frags()..(ply:Frags()==1 and " Win" or " Wins"),"Trebuchet18",ScrW()/2,150+k*35,Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER) end end //print(GetHostName()) diff --git a/gamemode/resource.lua b/gamemode/resource.lua index a8a00ec..f08654c 100644 --- a/gamemode/resource.lua +++ b/gamemode/resource.lua @@ -22,14 +22,14 @@ if SERVER then resource.AddSingleFile("sound/ragcom/shia_win.wav") resource.AddSingleFile("sound/ragcom/postal_win.wav") resource.AddSingleFile("sound/ragcom/postal_fall.wav") -else - RAGCOM_MATS = {} +end - for k,v in pairs(textures) do - local m = Material(v..".png") - CreateMaterial("ragcom_"..k,"VertexLitGeneric",{["$basetexture"] = v}) - RAGCOM_MATS[v] = "!ragcom_"..k - end +RAGCOM_MATS = {} + +for k,v in pairs(textures) do + local m = Material(v..".png") + if CLIENT then CreateMaterial("ragcom_"..k,"VertexLitGeneric",{["$basetexture"] = v}) end + RAGCOM_MATS[v] = "!ragcom_"..k end RAGCOM_CHARS = { @@ -145,11 +145,16 @@ RAGCOM_CHARS = { setup=function(ragdoll) ragdoll:SetMaterial("models/debug/debugwhite") ragdoll:SetColor(Color(100,255,50)) - local m = ClientsideModel("models/props_junk/watermelon01.mdl") - m:SetParent(ragdoll) - m:SetParentPhysNum(10) - m:SetLocalPos(Vector(0,0,0)) - ragdoll:CallOnRemove("mel", function() if IsValid(m) then m:Remove() end end) + + if SERVER then + local m = ents.Create("prop_dynamic") + m:SetModel("models/props_junk/watermelon01.mdl") + m:Spawn() + m:SetParent(ragdoll) + m:SetParentPhysNum(10) + m:SetLocalPos(Vector(0,0,0)) + ragdoll:DeleteOnRemove(m) + end end, neg="garrysmod/balloon_pop_cute.wav",