Skip to content

Commit 83f58ab

Browse files
committed
Don't allow client side rotation when not in range
1 parent 6d6b301 commit 83f58ab

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

csqc/main.qc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ noref float(string cmd) CSQC_ConsoleCommand = {
348348
case PC_ENGINEER:
349349
if (previewing_sentry) {
350350
sentry_preview_offset = anglemod(sentry_preview_offset - 15);
351-
} else {
352-
update_sentry_angles = time + 0.5;
351+
} else if (vlen(PM_Org() - sentry_pos) < ENG_BUILDING_DISMANTLE_DISTANCE) {
352+
update_sentry_angles = time + 0.55;
353353
sentry_angles_y = anglemod(sentry_angles_y - 15);
354354
localcmd(sprintf("cmd sentry angle %f\n", sentry_angles_y));
355355
}
@@ -361,8 +361,8 @@ noref float(string cmd) CSQC_ConsoleCommand = {
361361
case PC_ENGINEER:
362362
if (previewing_sentry) {
363363
sentry_preview_offset = anglemod(sentry_preview_offset + 15);
364-
} else {
365-
update_sentry_angles = time + 0.5;
364+
} else if (vlen(PM_Org() - sentry_pos) < ENG_BUILDING_DISMANTLE_DISTANCE) {
365+
update_sentry_angles = time + 0.55;
366366
sentry_angles_y = anglemod(sentry_angles_y + 15);
367367
localcmd(sprintf("cmd sentry angle %f\n", sentry_angles_y));
368368
}

ssqc/engineer.qc

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,11 @@ void (float objtobuild, float offset) TeamFortress_Build = {
626626
}
627627

628628
UpdateClientBuilding(self);
629+
630+
if (objtobuild == BUILD_SENTRYGUN) {
631+
UpdateClient_Sentry(self, newmis);
632+
}
633+
629634
self.is_building = objtobuild;
630635
if (!engineer_move) {
631636
self.immune_to_check = time + 5;
@@ -929,18 +934,6 @@ void () DispenserThink = {
929934
self.nextthink = time + 0.3;
930935
};
931936

932-
void UpdateClient_Sentry(entity pl, entity sent) = {
933-
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
934-
return;
935-
msg_entity = pl;
936-
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
937-
WriteByte(MSG_MULTICAST, MSG_SENTRY_POS);
938-
WriteFloat(MSG_MULTICAST, sent.origin.x);
939-
WriteFloat(MSG_MULTICAST, sent.origin.y);
940-
WriteFloat(MSG_MULTICAST, sent.origin.z);
941-
multicast('0 0 0', MULTICAST_ONE_NOSPECS);
942-
}
943-
944937
void UpdateClient_Dispenser(entity pl, entity disp) = {
945938
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
946939
return;

ssqc/status.qc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,18 @@ void UpdateClientBuilding(entity pl) {
767767
multicast('0 0 0', MULTICAST_ONE_NOSPECS);
768768
}
769769

770+
void UpdateClient_Sentry(entity pl, entity sent) = {
771+
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
772+
return;
773+
msg_entity = pl;
774+
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
775+
WriteByte(MSG_MULTICAST, MSG_SENTRY_POS);
776+
WriteFloat(MSG_MULTICAST, sent.origin.x);
777+
WriteFloat(MSG_MULTICAST, sent.origin.y);
778+
WriteFloat(MSG_MULTICAST, sent.origin.z);
779+
multicast('0 0 0', MULTICAST_ONE_NOSPECS);
780+
}
781+
770782
void UpdateClientReloadSound(entity pl, float weapon) {
771783
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
772784
return;

0 commit comments

Comments
 (0)