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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
UnlitGeneric
{
$basetexture "vgui\swarm\Emotes\EmoteBoomer"
$translucent 1
$surfaceprop metal
$vertexcolor 1
$vertexalpha 1
$no_fullbright 1
$ignorez 1
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
UnlitGeneric
{
$basetexture "vgui\swarm\Emotes\EmoteInfector"
$translucent 1
$surfaceprop metal
$vertexcolor 1
$vertexalpha 1
$no_fullbright 1
$ignorez 1
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
UnlitGeneric
{
$basetexture "vgui\swarm\Emotes\EmoteMimic"
$translucent 1
$surfaceprop metal
$vertexcolor 1
$vertexalpha 1
$no_fullbright 1
$ignorez 1
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
UnlitGeneric
{
$basetexture "vgui\swarm\Emotes\EmoteTraitor"
$translucent 1
$surfaceprop metal
$vertexcolor 1
$vertexalpha 1
$no_fullbright 1
$ignorez 1
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
UnlitGeneric
{
$basetexture "vgui\swarm\Emotes\EmoteTraitor"
$translucent 1
$surfaceprop metal
$vertexcolor 1
$vertexalpha 1
$no_fullbright 1
$ignorez 1
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
UnlitGeneric
{
$basetexture "vgui\swarm\Emotes\EmoteTraitorLeader"
$translucent 1
$surfaceprop metal
$vertexcolor 1
$vertexalpha 1
$no_fullbright 1
$ignorez 1
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"description" "#challenge_traitors_description"
"allowed_mode" "coop"
"convars" {
"_rd_traitors_challenge_enabled" "1"
"rd_player_bots_allowed" "0"
"cl_add_index_to_name" "1"
"rd_add_index_to_name" "1"
"rd_draw_restricted_rectangles_coop" "1"

"rd_auto_fast_restart" "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ function Update() {

//DebugKillAliens(20);

SetTraitorIcon();

DropWeapon();
RefreshSkillMenu();
DetectAndApplySkill(5);
Expand Down Expand Up @@ -184,6 +186,52 @@ function DebugKillAliens(interval = 1) {
}
}

function SetTraitorIcon(interval = 10) {
if (g_int_Counter % interval != 0) {
return;
}
foreach(hMarine in g_marine_Total) {
if (hMarine == null || !hMarine.IsValid()) {
continue;
}
hMarine.ValidateScriptScope();
switch (hMarine.GetScriptScope().Role) {
case ROLE.TRAITOR:
case ROLE.INFECTED_IAF:
case ROLE.INFECTED_SCANNER:
case ROLE.INFECTED_BIOCHEMIST:
case ROLE.INFECTED_IAF_LEADER:
case ROLE.INFECTED_SHIELD:
case ROLE.INFECTED_SNIPER:
case ROLE.INFECTED_DEMO:
case ROLE.INFECTED_DESERTER:
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 8));
break;
case ROLE.TRAITOR_LEADER:
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 9));
break;
case ROLE.INFECTOR:
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 10));
break;
case ROLE.BOOMER:
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 11));
break;
case ROLE.SILENCER:
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 12));
break;
case ROLE.MIMIC:
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 13));
break;
}
}
foreach(hPlayer in g_player_TraitorHistory) {
if (hPlayer == null || !hPlayer.IsValid()) {
continue;
}
NetProps.SetPropInt(hPlayer, "m_iFrags", 99);
}
}

function DropWeapon() {
local idx_end = g_int_Counter % 31;
for (local i = 0; i * 31 + idx_end < g_int_MarineCount; i++) {
Expand Down Expand Up @@ -408,19 +456,18 @@ function RefreshMenu(hMarine) {
foreach(tempMarine in g_marine_Total_Unshuffled) {
i++;
local strVGuiRefresh = "VGui_Refresh" + i.tostring();
local hVGuiRefresh = Entities.FindByName(null, strVGuiRefresh);
if (hVGuiRefresh != null) {
hVGuiRefresh.Destroy();
}
hVGuiRefresh = Entities.CreateByClassname("rd_vgui_vscript");
hVGuiRefresh.__KeyValueFromString("client_vscript", "challenge_traitors_client_refresh_menu.nut");
hVGuiRefresh.ValidateScriptScope();
hVGuiRefresh.GetScriptScope().Input <- Input;
hVGuiRefresh.Spawn();
hVGuiRefresh.SetName(strVGuiRefresh);
hVGuiRefresh.Activate();
hVGuiRefresh.SetEntity(0, hMarine);
hVGuiRefresh.SetInteracter(null);
local hVGuiRefresh = null;
if (!(hVGuiRefresh = Entities.FindByName(hVGuiRefresh, strVGuiRefresh))) {
hVGuiRefresh = Entities.CreateByClassname("rd_vgui_vscript");
hVGuiRefresh.__KeyValueFromString("client_vscript", "challenge_traitors_client_refresh_menu.nut");
hVGuiRefresh.ValidateScriptScope();
hVGuiRefresh.GetScriptScope().Input <- Input;
hVGuiRefresh.Spawn();
hVGuiRefresh.SetName(strVGuiRefresh);
hVGuiRefresh.Activate();
hVGuiRefresh.SetEntity(0, hMarine);
hVGuiRefresh.SetInteracter(null);
}

hVGuiRefresh.SetInt(0, i);
hVGuiRefresh.SetInt(1, (g_lst_MenuProps[i].scannerIsRevealed) ? g_lst_MenuProps[i].role : ROLE.NONE);
Expand Down Expand Up @@ -563,8 +610,7 @@ function DetectAndApplySkill(interval = 1) {
}

if (hMarine != g_marine_Deserter) {
hMarine.SetHealth(1);
hMarine.TakeDamage(999, DAMAGE_TYPE.DMG_FALL, null);
hMarine.Die();
} else {
if (Time() > g_marine_Deserter.GetScriptScope().RevealTime + 30.0) {
hMarine.SetHealth(1);
Expand Down Expand Up @@ -749,7 +795,7 @@ function RemoveBot(interval) {
if (hMarine.GetHealth() > 15) {
hMarine.SetHealth(15);
}
// hMarine.TakeDamage( 256, 64, hMarine );// 修复了机器人不死的bug,但是微了保留之前的体验,这里不杀死机器人,这样意外掉出地图,还有希望丝血传送回来。This will kill bot, but it would be beter to set bot health to 1 so that one can have a chance to teleport back if they fall outside of the map, also preventing players from abuse bot tp.
// hMarine.Die();// 这里不杀死机器人,这样意外掉出地图,还有希望丝血传送回来。This will kill bot, but it would be beter to set bot health to 1 so that one can have a chance to teleport back if they fall outside of the map, also preventing players from abuse bot tp.
}
}
}
Expand Down Expand Up @@ -848,12 +894,6 @@ function WriteMatchResultToFile(winner) {
StringToFile("Challenge_Traitor_Result_" + GetLocalTime().tostring() + ".txt", g_str_GameResult);
}

function GetLocalTime() {
local localTime = {};
LocalTime(localTime);
return localTime.dayofyear * 86400 + localTime.hour * 3600 + localTime.minute * 60 + localTime.second;
}

function ShowSpeciallRolesList() {
local hPlayer = null;
while (hPlayer = Entities.FindByClassname(hPlayer, "player")) {
Expand Down Expand Up @@ -964,8 +1004,7 @@ function InitializeMarineList() {
hMarine.RemoveWeapon(1);
hMarine.RemoveWeapon(2);
hMarine.SetOrigin(hMarine.GetOrigin() + Vector(0, -5000, 0));
hMarine.SetHealth(1);
hMarine.TakeDamage(999, DAMAGE_TYPE.DMG_FALL, null);
hMarine.Die();
} else {
g_marine_Total.append(hMarine); // 将所有士兵句柄存入列表,句柄作为士兵的唯一标识
g_lst_MenuProps.append(InitializeMenuProps(hMarine));
Expand Down Expand Up @@ -1222,6 +1261,9 @@ function DelayFunctionCall(function_name, function_params, delay) {

function ClientPrintRoles() {
foreach(hMarine in g_marine_Total) {
if (!hMarine || !hMarine.IsValid() || !hMarine.IsInhabited()) {
continue;
}
local hPlayer = hMarine.GetCommander();
local strLanguage = GetClientLanguage(hPlayer.entindex());

Expand All @@ -1238,6 +1280,9 @@ function ClientPrintRoles() {
}

foreach(hMarine in g_marine_TraitorAlive) {
if (!hMarine || !hMarine.IsValid() || !hMarine.IsInhabited()) {
continue;
}
local hPlayer = hMarine.GetCommander();
local role = hMarine.GetScriptScope().Role;
local strRole = GetRoleString(role);
Expand All @@ -1247,6 +1292,9 @@ function ClientPrintRoles() {
LocalizedClientPrint(hPlayer, 3, g_str_TraitorNameList, "#challenge_traitors_traitor_list", "#challenge_traitors_traitor_player_unavailable");
}
foreach(hMarine in g_marine_IafAlive) {
if (!hMarine || !hMarine.IsValid() || !hMarine.IsInhabited()) {
continue;
}
local hPlayer = hMarine.GetCommander();
local role = hMarine.GetScriptScope().Role;
local strRole = GetRoleString(role);
Expand All @@ -1273,7 +1321,6 @@ function FixMapIssueOnStart() {
if (hMarine == null || !hMarine.IsValid()) {
continue;
}
//printl(hMarine.GetOrigin());
// 防止acc32-4中玩家出生在隧道里
if (g_enum_CurrentMap == MAP.ACC_4 && hMarine.GetOrigin().y > -5000) {
hMarine.SetOrigin(Vector(-1012 + RandomInt(0, 30), -6204 + RandomInt(0, 30), 569 + RandomInt(0, 30)));
Expand Down Expand Up @@ -1355,7 +1402,7 @@ function CreatePlayerHudAndVGuiEntities() {
}

function SetHudForIafPlayer(hMarine, role) {
if (hMarine == null) {
if (!hMarine || !hMarine.IsValid() || !hMarine.IsInhabited()) {
return;
}
local strRole = GetRoleString(role);
Expand All @@ -1372,7 +1419,7 @@ function SetHudForIafPlayer(hMarine, role) {
}

function SetHudForTraitorPlayer(hMarine, role, timeOffset = 2.0) {
if (hMarine == null) {
if (hMarine == null || !hMarine.IsValid() || !hMarine.IsInhabited()) {
return;
}
local strRole = GetRoleString(role);
Expand Down Expand Up @@ -2316,8 +2363,12 @@ function SelectRoles() {

//生成内鬼历史列表和当前内鬼玩家列表
foreach(idx, hMarine in g_marine_Traitor) {
g_player_TraitorHistory.append(hMarine.GetCommander());
g_player_Traitor[idx] = hMarine.GetCommander();
if (hMarine && hMarine.IsValid() && hMarine.IsInhabited()) {
g_player_TraitorHistory.append(hMarine.GetCommander());
g_player_Traitor[idx] = hMarine.GetCommander();
} else {
g_player_Traitor[idx] = null;
}
}

//选择特殊角色
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function Paint() {}
function Control(tbl) {}

function OnUpdate() {
self.ForceSync();
local idx = self.GetInt(0);
if (!("marine_info" in getconsttable())) {
getconsttable()["marine_info"] <- [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ g_ModeScript.OnGameEvent_marine_selected <- function(params) {
if (tempPlayer == hPlayer) // 如果曾经做过内鬼,直接处死反骨仔
{
hMarine.SetHealth(1);
hMarine.TakeDamage(999, DAMAGE_TYPE.DMG_FALL, null);
hMarine.Die();
LocalizedClientPrint(tempPlayer, 3, "%s1", "#challenge_traitors_iaf_bot_killed_notify");

local strLanguage = GetClientLanguage(hMarine.GetCommander().entindex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,24 @@ function SetBomb() {
g_bool_BombActivited = true;
if (g_marine_Boomer != g_marine_SilencedMarine) {
local delay = RandomHQUniformIntDistribution(0, 5);
DelayFunctionCall("BomberAlert", "", delay + 0.01);
DelayFunctionCall("BoomerAlert", "", delay + 0.01);

g_marine_Boomer.PrecacheSoundScript(BOOMER_SOUND.COUNT_DOWN[delay]);
g_marine_Boomer.EmitSound(BOOMER_SOUND.COUNT_DOWN[delay]);
DelayFunctionCall("BomberSelfExplode", "", 5.0); // 5秒后自爆
DelayFunctionCall("BoomerSelfExplode", "", 5.0); // 5秒后自爆
} else {
LocalizedClientPrint(hSender, 3, TextColor(250, 250, 250) + "%s1", "#challenge_traitors_marine_silenced_notify");
}
}

function BomberAlert() {
function BoomerAlert() {
if (g_marine_Boomer != null && g_marine_Boomer.IsValid()) {
g_marine_Boomer.PrecacheSoundScript(BOOMER_SOUND.ALERT);
g_marine_Boomer.EmitSound(BOOMER_SOUND.ALERT);
}
}

function BomberSelfExplode() {
function BoomerSelfExplode() {
if (g_marine_Boomer == null || !g_marine_Boomer.IsValid()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function SetMapHandler() {
hMarine.GetScriptScope().DamageMapModifier = 1.0;
local temp = hMarine.GetOrigin();
if ((temp.x > 400 && temp.x < 800 && temp.y > 1500 && temp.y < 1900) || (temp.x < 100 && temp.y < 1600)) {
hMarine.TakeDamage(999, DAMAGE_TYPE.DMG_FALL, null);
hMarine.Die();
} else if (temp.x < 0 && temp.z > 720) {
hMarine.TakeDamage(10, DAMAGE_TYPE.DMG_FALL, null);
}
Expand Down
5 changes: 3 additions & 2 deletions src/game/client/c_playerresource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const float PLAYER_RESOURCE_THINK_INTERVAL = 0.2f;
#define PLAYER_DEBUG_NAME "WWWWWWWWWWWWWWW"

ConVar cl_names_debug( "cl_names_debug", "0", FCVAR_DEVELOPMENTONLY );
ConVar cl_add_index_to_name("cl_add_index_to_name", "0", FCVAR_REPLICATED);
extern ConVar rd_add_index_to_name;

void RecvProxy_ChangedTeam( const CRecvProxyData *pData, void *pStruct, void *pOut )
{
Expand Down Expand Up @@ -157,8 +157,9 @@ void C_PlayerResource::UpdatePlayerName( int slot )
g_RDTextFiltering.FilterTextName( sPlayerInfo.name, g_RDTextFiltering.GetClientSteamID( slot ) );
pchPlayerName = sPlayerInfo.name;
V_snprintf(szNameTemp[slot], MAX_PLAYER_NAME_LENGTH - 1, "%d-%s", slot, pchPlayerName);
UTIL_SafeUtf8Truncate(szNameTemp[slot], MAX_PLAYER_NAME_LENGTH);
}
if (cl_add_index_to_name.GetBool()) {
if (rd_add_index_to_name.GetBool()) {
if (!m_szName[slot] || Q_stricmp(m_szName[slot], szNameTemp[slot]))
{
m_szName[slot] = AllocPooledString(szNameTemp[slot]);
Expand Down
7 changes: 5 additions & 2 deletions src/game/client/swarm/c_asw_aoegrenade_projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

// saved in video.txt, not config.cfg
ConVar rd_simple_beacons( "rd_simple_beacons", "0", FCVAR_NONE, "If 1 heal beacon and damage amplifier will be rendered simple to improve performance" );
extern ConVar _rd_traitors_challenge_enabled;

//Precahce the effects
PRECACHE_REGISTER_BEGIN( GLOBAL, ASWPrecacheEffectAOEGrenades )
Expand Down Expand Up @@ -284,7 +285,8 @@ void C_ASW_AOEGrenade_Projectile::UpdateParticleAttachments( CNewParticleEffect

void C_ASW_AOEGrenade_Projectile::UpdatePingEffects( void )
{
if ( rd_simple_beacons.GetBool() )
// Turn off the beacon effects if the traitor's challenge is enabled to prevent fps drops on the client
if ( rd_simple_beacons.GetBool() || _rd_traitors_challenge_enabled.GetBool())
return;

if ( m_bSettled && m_pPulseEffect.GetObject() == NULL )
Expand Down Expand Up @@ -374,7 +376,8 @@ void C_ASW_AOEGrenade_Projectile::ClientThink( void )
m_fStartLightTime = gpGlobals->curtime;
}

if ( !rd_simple_beacons.GetBool() )
// Turn off the beacon effects if the traitor's challenge is enabled to prevent fps drops on the client
if ( !rd_simple_beacons.GetBool() || _rd_traitors_challenge_enabled.GetBool() )
{
if ( !m_pDLight )
{
Expand Down
Loading