A simple (I hope) modification to Trouble in Terrorist Town

Hi. I’ve been renting a gmod server for about a week now, and at this point I’m running Trouble In Terrorist Town on it. I’m looking for a way to reward donors. I don’t believe in selling administrative powers, and something as simple as an edited name color seems too little a reward. So I was thinking. One of the most frustrating parts of the game is sitting around while dead. In Terrorist town, you’re able to possess objects after death. Unfortunately, you can’t move them much due to a small and slow-to-fill “Punch-o-meter” that dictates how much you can move an object.

The idea came to me that perhaps I could give donors an infinite, or at least massively increased, punch-o-meter. After all, if they somehow use the props to kill people, I can always demote them from donor status. Unfortunately, I’m not much of a coder. I managed to find the lua file that controls all the punch-o-meter stuff, but I don’t really know what to do from here.

What I was hoping someone could do for me is edit it so that I could put in steam IDs to give those people increased punch-o-meters. The file is propspec.lua. Here is a download link to that file alone. In the terrorist town gamemode, it is under gamemodes/terrortown/gamemode/propspec.lua


---- Spectator prop meddling

local string = string
local math = math

PROPSPEC = {}

local propspec_toggle = CreateConVar("ttt_spec_prop_control", "1")

local propspec_base = CreateConVar("ttt_spec_prop_base", "8")
local propspec_min = CreateConVar("ttt_spec_prop_maxpenalty", "-6")
local propspec_max = CreateConVar("ttt_spec_prop_maxbonus", "16")

function PROPSPEC.Start(ply, ent)
   ply:Spectate(OBS_MODE_CHASE)
   ply:SpectateEntity(ent)

   local bonus = math.Clamp(math.ceil(ply:Frags() / 2), propspec_min:GetInt(), propspec_max:GetInt())

   ply.propspec = {ent=ent, t=0, retime=0, punches=0, max=propspec_base:GetInt() + bonus}

   ent:SetNWEntity("spec_owner", ply)
   ply:SetNWInt("bonuspunches", bonus)
end

local function IsBlacklistedClass(cls)
   return cls == "prop_ragdoll" or
      string.match(cls, "ttt_*") or
      string.match(cls, "weapon_*") or
      string.match(cls, "item_*") or
      string.match(cls, "prop_vehicle*") or
      string.match(cls, "prop_door*") or
      string.match(cls, "func_button*")
end

function PROPSPEC.Target(ply, ent)
   if not propspec_toggle:GetBool() then return end
   if not IsValid(ply) or not ply:IsSpec() or not IsValid(ent) then return end

   if IsValid(ent:GetNWEntity("spec_owner", nil)) then return end

   local phys = ent:GetPhysicsObject()

   if ent:GetName() != "" and not GAMEMODE.propspec_allow_named then return end
   if not ValidEntity(phys) or not phys:IsMoveable() then return end

   if IsBlacklistedClass(ent:GetClass()) then return end

   PROPSPEC.Start(ply, ent)
end

function PROPSPEC.End(ply)
   local ent = ply.propspec.ent or ply:GetObserverTarget()
   if IsValid(ent) then
      ent:SetNWEntity("spec_owner", nil)
   end

   ply.propspec = nil
   ply:SpectateEntity(nil)
   ply:Spectate(OBS_MODE_ROAMING)
   ply:ResetViewRoll()

   timer.Simple(0.1, function()
                        if IsValid(ply) then ply:ResetViewRoll() end
                     end)
end

local propspec_force = CreateConVar("ttt_spec_prop_force", "100")

function PROPSPEC.Key(ply, key)
   local ent = ply.propspec.ent
   local phys = IsValid(ent) and ent:GetPhysicsObject()
   if not IsValid(ent) or not IsValid(phys) then 
      PROPSPEC.End(ply)
      return false
   end

   if not phys:IsMoveable() then
      PROPSPEC.End(ply)
      return true
   elseif phys:HasGameFlag(FVPHYSICS_PLAYER_HELD) then
      -- we can stay with the prop while it's held, but not affect it
      if key == IN_DUCK then
         PROPSPEC.End(ply)
      end
      return true
   end

   local pr = ply.propspec
   if pr.t > CurTime() then return true end

   if pr.punches < 1 then return true end

   local m = math.min(150, phys:GetMass())
   local force = propspec_force:GetInt()
   local aim = ply:GetAimVector()

   local mf = m * force

   pr.t = CurTime() + 0.15

   if key == IN_JUMP then
      -- upwards bump
      phys:ApplyForceCenter(Vector(0,0, mf))
      pr.t = CurTime() + 0.05
   elseif key == IN_FORWARD then
      -- bump away from player
      phys:ApplyForceCenter(aim * mf)
   elseif key == IN_BACK then
      phys:ApplyForceCenter(aim * (mf * -1))
   elseif key == IN_MOVELEFT then
      phys:AddAngleVelocity(Angle(0, 0, 120))
      phys:ApplyForceCenter(Vector(0,0, mf / 3))
   elseif key == IN_MOVERIGHT then
      phys:AddAngleVelocity(Angle(0, 0, -120))
      phys:ApplyForceCenter(Vector(0,0, mf / 3))
   elseif key == IN_DUCK then
      PROPSPEC.End(ply)
      return true
   else
      return true -- eat other keys, and do not decrement punches
   end

   pr.punches = math.max(pr.punches - 1, 0)
   ply:SetNWFloat("specpunches", pr.punches / pr.max)

   return true
end

local propspec_retime = CreateConVar("ttt_spec_prop_rechargetime", "1.6")
function PROPSPEC.Recharge(ply)
   local pr = ply.propspec
   if pr.retime < CurTime() then
      pr.punches = math.min(pr.punches + 1, pr.max)
      ply:SetNWFloat("specpunches", pr.punches / pr.max)

      pr.retime = CurTime() + propspec_retime:GetFloat()
   end
end



Hm. Well, people have looked at it. If you’re stopping by and don’t mind answering a question, do you think this is too difficult a thing to ask, or just something boring that nobody wants to help with?

I think that most people just can’t be bothered to look at it. But give it a bit more time and maybe someone will.

Edit - Also the link doesn’t work.

Alright. Now that I know there’s a code format available, I used that.