Skip to content

Commit da4eea1

Browse files
committed
add more entity slots on vscript hud
1 parent 2572204 commit da4eea1

4 files changed

Lines changed: 199 additions & 82 deletions

File tree

reactivedrop/content/traitors_challenge/scripts/vscripts/challenge_traitors.nut

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ function SetTraitorIcon(interval = 10) {
193193

194194

195195
local list = {};
196-
for (local i = 6; i < 21; i++) {
196+
for (local i = 1; i < 16; i++) {
197197
list[i] <- 0;
198198
}
199-
local i = 11;
199+
local i = 6;
200200
foreach(hMarine in g_marine_Traitor) {
201201
if (hMarine == null || !hMarine.IsValid()) {
202202
continue;
@@ -212,23 +212,23 @@ function SetTraitorIcon(interval = 10) {
212212
case ROLE.INFECTED_SNIPER:
213213
case ROLE.INFECTED_DEMO:
214214
case ROLE.INFECTED_DESERTER:
215-
list[i] = hMarine.entindex();
215+
list[i] = hMarine;
216216
i++;
217217
break;
218218
case ROLE.TRAITOR_LEADER:
219-
list[6] = hMarine.entindex();
219+
list[1] = hMarine;
220220
break;
221221
case ROLE.INFECTOR:
222-
list[7] = hMarine.entindex();
222+
list[2] = hMarine;
223223
break;
224224
case ROLE.BOOMER:
225-
list[8] = hMarine.entindex();
225+
list[3] = hMarine;
226226
break;
227227
case ROLE.SILENCER:
228-
list[9] = hMarine.entindex();
228+
list[4] = hMarine;
229229
break;
230230
case ROLE.MIMIC:
231-
list[10] = hMarine.entindex();
231+
list[5] = hMarine;
232232
}
233233
}
234234
foreach(hPlayer in g_player_TraitorHistory) {
@@ -237,8 +237,8 @@ function SetTraitorIcon(interval = 10) {
237237
}
238238

239239
local hHud2 = Entities.FindByName(null, hPlayer.GetScriptScope().strHudName2);
240-
for (local i = 6; i < 21; i++) {
241-
hHud2.SetInt(i, list[i]);
240+
for (local i = 1; i < 16; i++) {
241+
hHud2.SetEntity(i, list[i]);
242242
}
243243
}
244244
}
@@ -1472,8 +1472,8 @@ function CreatePlayerHud(hPlayer) {
14721472
hHud1.SetEntity(0, hPlayer);
14731473
local strHud1 = "HUD_" + UniqueString();
14741474
hHud1.SetName(strHud1);
1475-
for (local i = 6; i < 21; i++) {
1476-
hHud1.SetInt(i, 0);
1475+
for (local i = 1; i < 16; i++) {
1476+
hHud1.SetEntity(i, null);
14771477
}
14781478

14791479
hPlayer.GetScriptScope().strHudName1 <- strHud1;
@@ -1502,8 +1502,8 @@ function CreatePlayerHud(hPlayer) {
15021502
hHud2.SetEntity(0, hPlayer);
15031503
local strHud2 = "HUD_" + UniqueString();
15041504
hHud2.SetName(strHud2);
1505-
for (local i = 6; i < 21; i++) {
1506-
hHud2.SetInt(i, 0);
1505+
for (local i = 1; i < 16; i++) {
1506+
hHud2.SetEntity(i, null);
15071507
}
15081508

15091509
hPlayer.ValidateScriptScope();
@@ -1533,8 +1533,8 @@ function CreatePlayerHud(hPlayer) {
15331533
hHud4.SetEntity(0, hPlayer);
15341534
local strHud4 = "HUD_" + UniqueString();
15351535
hHud4.SetName(strHud4);
1536-
for (local i = 6; i < 21; i++) {
1537-
hHud4.SetInt(i, 0);
1536+
for (local i = 1; i < 16; i++) {
1537+
hHud4.SetEntity(i, null);
15381538
}
15391539

15401540
hPlayer.GetScriptScope().strHudName4 <- strHud4;
@@ -1563,8 +1563,8 @@ function CreatePlayerHud(hPlayer) {
15631563
hHud3.SetEntity(0, hPlayer);
15641564
local strhHud3 = "HUD_" + UniqueString();
15651565
hHud3.SetName(strhHud3);
1566-
for (local i = 6; i < 21; i++) {
1567-
hHud3.SetInt(i, 0);
1566+
for (local i = 1; i < 16; i++) {
1567+
hHud3.SetEntity(i, null);
15681568
}
15691569

15701570
hPlayer.ValidateScriptScope();

reactivedrop/content/traitors_challenge/scripts/vscripts/challenge_traitors_player_info.nut

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
int 3 - 投降,当前人数
66
int 4 - 投降,总人数
77
8-
int 6 - TRAITOR_LEADER 对应的marine index
9-
int 7 - INFECTOR 对应的marine index
10-
int 8 - BOOMER 对应的marine index
11-
int 9 - SILENCER 对应的marine index
12-
int 10 - MIMIC 对应的marine index
13-
int 11 - TRAITOR 对应的marine index
14-
...
15-
int 20 - TRAITOR 对应的marine index
16-
178
int 63 - 标识,1和2代表显示的是内鬼提示1和提示2。3代表显示的是内鬼开始投票,4代表投票中,5代表投票停止
189
1910
float 0 - HUD信息显示的起始时间
@@ -28,6 +19,14 @@
2819
2920
3021
entity 0 - marine
22+
entity 1 - TRAITOR_LEADER 对应的marine
23+
entity 2 - INFECTOR 对应的marine
24+
entity 3 - BOOMER 对应的marine
25+
entity 4 - SILENCER 对应的marine
26+
entity 5 - MIMIC 对应的marine
27+
entity 6 - TRAITOR 对应的marine
28+
...
29+
entity 15 - TRAITOR 对应的marine
3130
3231
DefaultVerySmall
3332
DefaultVerySmallBlur
@@ -57,29 +56,29 @@ FONT_DEFAULTLARGE <- self.LookupFont("DefaultMedium");
5756

5857
TEXTURE_TRAITOR <- self.LookupTexture("vgui/swarm/Emotes/EmoteTraitor");
5958
TEXTURE_TRAITORS <- {
60-
[6] = self.LookupTexture("vgui/swarm/Emotes/EmoteTraitorLeader"),
61-
[7] = self.LookupTexture("vgui/swarm/Emotes/EmoteInfector"),
62-
[8] = self.LookupTexture("vgui/swarm/Emotes/EmoteBoomer"),
63-
[9] = self.LookupTexture("vgui/swarm/Emotes/EmoteSilencer"),
64-
[10] = self.LookupTexture("vgui/swarm/Emotes/EmoteMimic"),
59+
[1] = self.LookupTexture("vgui/swarm/Emotes/EmoteTraitorLeader"),
60+
[2] = self.LookupTexture("vgui/swarm/Emotes/EmoteInfector"),
61+
[3] = self.LookupTexture("vgui/swarm/Emotes/EmoteBoomer"),
62+
[4] = self.LookupTexture("vgui/swarm/Emotes/EmoteSilencer"),
63+
[5] = self.LookupTexture("vgui/swarm/Emotes/EmoteMimic"),
64+
[6] = TEXTURE_TRAITOR,
65+
[7] = TEXTURE_TRAITOR,
66+
[8] = TEXTURE_TRAITOR,
67+
[9] = TEXTURE_TRAITOR,
68+
[10] = TEXTURE_TRAITOR,
6569
[11] = TEXTURE_TRAITOR,
6670
[12] = TEXTURE_TRAITOR,
6771
[13] = TEXTURE_TRAITOR,
6872
[14] = TEXTURE_TRAITOR,
6973
[15] = TEXTURE_TRAITOR,
70-
[16] = TEXTURE_TRAITOR,
71-
[17] = TEXTURE_TRAITOR,
72-
[18] = TEXTURE_TRAITOR,
73-
[19] = TEXTURE_TRAITOR,
74-
[20] = TEXTURE_TRAITOR,
7574
};
7675

7776
xMargin <- 0;
7877

7978
function Paint() {
8079
//如果正在控制士兵,显示信息。
8180
if (self.GetEntity(0) == GetLocalPlayer()) {
82-
for (local i = 6; i < 21; i++) {
81+
for (local i = 1; i < 16; i++) {
8382
PaintTraitorIcon(i);
8483
}
8584
local message = self.GetString(0);
@@ -130,11 +129,11 @@ function PaintMsg(point, role, font, message) {
130129

131130
function PaintTraitorIcon(idx) {
132131

133-
if (self.GetInt(idx) <= 0 || TEXTURE_TRAITORS[idx] == -1 || self.GetInt(0) <= ROLE.MAX_IAF_TEAM || self.GetInt(0) > ROLE.MAX_TRAITOR_TEAM) {
132+
if (!self.GetEntity(idx) || TEXTURE_TRAITORS[idx] == -1 || self.GetInt(0) <= ROLE.MAX_IAF_TEAM || self.GetInt(0) > ROLE.MAX_TRAITOR_TEAM) {
134133
return;
135134
}
136-
local screenPos = self.ClientGetEntityScreenPos(self.GetInt(idx));
137-
if (screenPos.z < 0.5) { //无效屏幕坐标
135+
local screenPos = self.ClientGetEntityScreenPos(self.GetEntity(idx), true);
136+
if (!screenPos) {
138137
return;
139138
}
140139

0 commit comments

Comments
 (0)