Garry's Mod

Garry's Mod

Town Of Terror - More roles for TTT (The Original Custom Roles mod for TTT)
Alf21 20 Mar, 2018 @ 3:04pm
Improved winchecks
I did some code cleanup and performance improvement. Should work, but its not tested.


in init.lua (in near of line 1277)

-- jester
if not jester_alive and jesterkilled == 1 and GetConVar("jesterwinstate"):GetInt() == 1 then
return WIN_JESTER -- if jester is dead
-- inno
elseif innocent_alive then
return WIN_INNOCENT -- if jester is alive and innocents as well
-- traitor / serial / infected
elseif not traitor_alive then
if not infected_alive then
if serialkiller_alive then
return WIN_SERIALKILLER -- just serial is alive
else
return WIN_BEES -- none alive
end
else
if not serialkiller_alive then
return WIN_INFECTED -- just infected are alive
else
return WIN_NONE -- infected and serial are alive
end
end
else -- traitors and jester alive, but not innocents
if not serialkiller_alive and not infected_alive then
return WIN_TRAITOR -- just traitors alive
end
return WIN_NONE -- traitors and (serial or infected) alive
end