@@ -77,6 +77,8 @@ declare module "cs_script/point_script"
7777 SetThink(callback: () => void): void;
7878 /** Set when the OnThink callback should next be run. The exact time will be on the tick nearest to the specified time, which may be earlier or later. */
7979 SetNextThink(time: number): void;
80+ /** Returns a promise that resolves after `delay` number of seconds. The exact time will be on the tick nearest to the specified delay, which may be earlier or later. */
81+ Delay(delay: number): Promise<void>;
8082
8183 /**
8284 * Queue up a callback to be invoked once, after all entities have executed their think functions this tick (eg. player input has been handled, projectiles have moved).
@@ -111,10 +113,18 @@ declare module "cs_script/point_script"
111113 * Please send feedback to CSGOTeamFeedback@valvesoftware.com with "cs_script Feedback" in the subject line.
112114 */
113115 OnBeginRoundRestart(callback: () => void): void;
114- /** Called when a player plants the c4 */
115- OnBombPlant(callback: (event: { plantedC4: CSPlantedC4, planter: CSPlayerPawn }) => void): void;
116- /** Called when a player defuses the c4 */
117- OnBombDefuse(callback: (event: { plantedC4: CSPlantedC4, defuser: CSPlayerPawn }) => void): void;
116+ /** Called when a player starts planting their c4 */
117+ OnBombPlantStart(callback: (event: { planter: CSPlayerPawn }) => void): void;
118+ /** Called when a player aborts planting their c4 */
119+ OnBombPlantAbort(callback: (event: { planter: CSPlayerPawn }) => void): void;
120+ /** Called when a player plants their c4 */
121+ OnBombPlant(callback: (event: BombPlantEvent) => void): void;
122+ /** Called when a player starts defusing a c4 */
123+ OnBombDefuseStart(callback: (event: { plantedC4: CSPlantedC4 }) => void): void;
124+ /** Called when a player aborts defusing a c4 */
125+ OnBombDefuseAbort(callback: (event: { plantedC4: CSPlantedC4 }) => void): void;
126+ /** Called when a player defuses a c4 */
127+ OnBombDefuse(callback: (event: BombDefuseEvent) => void): void;
118128 /** Called when a c4 explodes */
119129 OnBombExplode(callback: (event: { plantedC4: CSPlantedC4 }) => void): void;
120130 /**
@@ -138,7 +148,7 @@ declare module "cs_script/point_script"
138148 /** Called when a player hits the ground while falling. */
139149 OnPlayerLand(callback: (event: { player: CSPlayerPawn }) => void): void;
140150 /** Called when a player sends a chat message. `team` will match they player's team if the message was sent to team chat. */
141- OnPlayerChat(callback: (event: { player: CSPlayerController | undefined, text: string, team: number }) => void): void;
151+ OnPlayerChat(callback: (event: { player?: CSPlayerController, text: string, team: number }) => void): void;
142152 /** Called when a player pings a location. */
143153 OnPlayerPing(callback: (event: { player: CSPlayerController, position: Vector }) => void): void;
144154 /** Called when a gun is reloaded. */
@@ -150,7 +160,7 @@ declare module "cs_script/point_script"
150160 * Penetrations can cause a single bullet to trigger multiple impacts.
151161 * This will be called for all impacts of a bullet before any player damage events are called.
152162 */
153- OnBulletImpact(callback: (event: { weapon: CSWeaponBase, position: Vector, hitEntity: Entity }) => void): void;
163+ OnBulletImpact(callback: (event: { weapon: CSWeaponBase, position: Vector, hitEntity?: Entity }) => void): void;
154164 /** Called when a weapon is dropped. */
155165 OnWeaponDrop(callback: (event: { weapon: CSWeaponBase, dropper: CSPlayerPawn }) => void): void;
156166 /** Called when a weapon is picked up. */
@@ -161,6 +171,8 @@ declare module "cs_script/point_script"
161171 OnGrenadeBounce(callback: (event: GrenadeBounceEvent) => void): void;
162172 /** Called when a knife attacks, even if it misses. */
163173 OnKnifeAttack(callback: (event: { weapon: CSWeaponBase, attackType: CSWeaponAttackType }) => void): void;
174+ /** Called when a button in a CustomHudLayout is clicked. */
175+ OnCustomHudClicked( callback: (event: {player: CSPlayerController, layout: CustomHudLayout, buttonId: string}) => void ): void;
164176
165177 /** Fire the input on all targets matching the specified names. */
166178 EntFireAtName(config: { name: string, input: string, value?: InputValue, caller?: Entity, activator?: Entity, delay?: number }): void;
@@ -195,6 +207,8 @@ declare module "cs_script/point_script"
195207 /** Trace as a bullet and detect hits and damage */
196208 TraceBullet(trace: BulletTrace): BulletTraceResult[];
197209
210+ /** Get if the server is a dedicated server. */
211+ IsDedicatedServer(): boolean;
198212 /** Get the game time in seconds. */
199213 GetGameTime(): number;
200214 /** Get if the game is currently in a Warmup period. */
@@ -253,6 +267,20 @@ declare module "cs_script/point_script"
253267 type Color = { r: number, g: number, b: number, a: number };
254268 type InputValue = boolean | number | string | Vector | Color | undefined;
255269
270+ export enum CSMoveType {
271+ INVALID = -1,
272+ NONE,
273+ WALK,
274+ FLY,
275+ FLYGRAVITY,
276+ VPHYSICS,
277+ PUSH,
278+ NOCLIP,
279+ OBSERVER,
280+ LADDER,
281+ CUSTOM,
282+ }
283+
256284 export enum CSRoundEndReason {
257285 UNKNOWN = -1,
258286 IN_PROGRESS,
@@ -467,6 +495,18 @@ declare module "cs_script/point_script"
467495 hitEntity?: Entity;
468496 }
469497
498+ interface BombPlantEvent {
499+ plantedC4: CSPlantedC4;
500+ /** @deprecated this field will be removed in a future update */
501+ planter?: CSPlayerPawn
502+ }
503+
504+ interface BombDefuseEvent {
505+ plantedC4: CSPlantedC4;
506+ /** @deprecated this field will be removed in a future update */
507+ defuser: CSPlayerPawn
508+ }
509+
470510 interface ModifyPlayerDamageEvent {
471511 /** The victim that is taking damage */
472512 player: CSPlayerPawn;
@@ -479,7 +519,7 @@ declare module "cs_script/point_script"
479519 /** The hit group where the damage occured. */
480520 hitGroup: CSHitGroup;
481521 /** The entity applying the damage. For bullets this is the owner of the gun. For grenades this is the exploding projectile. */
482- inflictor: Entity;
522+ inflictor?: Entity;
483523 /** The entity credited with causing the damage. For bullets this is the shooter. For grenades this is the thrower. */
484524 attacker?: Entity;
485525 /** The weapon used. For grenades this will not be present because the weapon is often removed before the projectile explodes. */
@@ -509,7 +549,7 @@ declare module "cs_script/point_script"
509549 /** The hit group where the damage occured. */
510550 hitGroup: CSHitGroup;
511551 /** The entity applying the damage. For bullets this is the owner of the gun. For grenades this is the exploding projectile. */
512- inflictor: Entity;
552+ inflictor?: Entity;
513553 /** The entity credited with causing the damage. For bullets this is the shooter. For grenades this is the thrower. */
514554 attacker?: Entity;
515555 /** The weapon used. For grenades this will not be present because the weapon is often removed before the projectile explodes. */
@@ -581,6 +621,10 @@ declare module "cs_script/point_script"
581621 GetEyePosition(): Vector;
582622 /** Update the physics state of this entity. */
583623 Teleport(newValues: { position?: Vector, angles?: QAngle, velocity?: Vector, angularVelocity?: RotationVector }): void;
624+ /** Move this entity without resetting the client's interpolation history. */
625+ Move(newValues: { position?: Vector, angles?: QAngle, velocity?: Vector, angularVelocity?: RotationVector }): void;
626+ GetMoveType(): CSMoveType;
627+ SetMoveType(moveType: CSMoveType): void;
584628 GetClassName(): string;
585629 GetEntityName(): string;
586630 SetEntityName(name: string): void;
@@ -647,6 +691,12 @@ declare module "cs_script/point_script"
647691 IsSilencerOn(): boolean;
648692 }
649693
694+ export class C4 extends CSWeaponBase {
695+ GetPlantStartTime(): number | undefined;
696+ GetPlantFinishTime(): number | undefined;
697+ AbortPlant(): void;
698+ }
699+
650700 export class CSWeaponData {
651701 GetName(): string;
652702 GetType(): CSWeaponType;
@@ -679,8 +729,8 @@ declare module "cs_script/point_script"
679729 IsDefused(): boolean;
680730 GetPlantTime(): number;
681731 GetExplodeTime(): number | undefined; // undefined if not active
682- GetDefuseStartTime(): number | undefined; // undefined if not defusing
683- GetDefuseFinishTime(): number | undefined; // undefined if not defusing
732+ GetDefuseStartTime(): number | undefined;
733+ GetDefuseFinishTime(): number | undefined;
684734 }
685735
686736 export class CSPlayerController extends Entity {
@@ -727,6 +777,7 @@ declare module "cs_script/point_script"
727777 FindWeapon(name: string): CSWeaponBase | undefined;
728778 FindWeaponBySlot(slot: CSGearSlot): CSWeaponBase | undefined;
729779 GetActiveWeapon(): CSWeaponBase | undefined;
780+ GetC4(): C4 | undefined;
730781 DestroyWeapon(target: CSWeaponBase): void;
731782 DestroyWeapons(): void;
732783 DropWeapon(target: CSWeaponBase): void;
@@ -738,21 +789,81 @@ declare module "cs_script/point_script"
738789 SetHasHelmet(hasHelmet: boolean): void;
739790 HasDefuser(): boolean;
740791 SetHasDefuser(hasDefuser: boolean): void;
792+ GetDefuseTarget(): CSPlantedC4 | undefined;
741793 IsDucking(): boolean;
742794 IsDucked(): boolean;
743795 IsScoped(): boolean;
744796 IsNoclipping(): boolean;
797+ IsBuyMenuOpen(): boolean;
798+ GetCamera(): CSPlayerCamera;
745799
746800 /** @deprecated This method will be removed in a future update */
747801 IsCrouching(): boolean;
748802 /** @deprecated This method will be removed in a future update */
749803 IsCrouched(): boolean;
750804 }
751805
806+ /**
807+ * CustomHudLayouts (custom_hud_layout) are the entry point for scripted maps to provide custom UI.
808+ * Supported panel types and attributes are:
809+ * * <Panel> with attributes id, class and hittest
810+ * * <Label> with attributes id, class, hittest, and text
811+ * * <Image> with attributes id, class, hittest, src, texturewidth, and textureheight
812+ * * <Button> with attributes id and class
813+ * Styling with css is supported.
814+ * Events and client side scripting are not supported.
815+ * @experimental This feature is experimental and may experience breaking changes.
816+ * Please send feedback to CSGOTeamFeedback@valvesoftware.com with "cs_script Feedback" in the subject line.
817+ */
818+ export class CustomHudLayout extends Entity {
819+ /**
820+ * Set if a panel has a class. Applies to all players.
821+ * Omit `hasClass` to revert to the original value.
822+ */
823+ SetHasClass(panelId: string, className: string, hasClass?: boolean): void;
824+ /**
825+ * Set if a panel has a class for a single player. Will override the all player value.
826+ * Omit `hasClass` to defer to the all player value.
827+ */
828+ SetHasClassForPlayer(playerSlot: number, panelId: string, className: string, hasClass?: boolean): void;
829+ /**
830+ * Set the value of a dialog variable. Applies to all players.
831+ */
832+ SetDialogVariableString(panelId: string, variableName: string, value: string): void;
833+ /**
834+ * Set the value of a dialog variable for a single player. Will override the all player value.
835+ * Omit `value` to defer to the all player value. If no all player value has been set, the value will be an empty string.
836+ */
837+ SetDialogVariableStringForPlayer(playerSlot: number, panelId: string, variableName: string, value?: string): void;
838+ /**
839+ * Set to true to force a player into cursor mode and enable click detection on the panels of this layout.
840+ * Set a callback with Instance.OnCustomHudClicked to listen for clicks.
841+ * Multiple CustomHudLayouts can have input captured at a time.
842+ * Players will get movement control back once all CustomHudLayouts have disabled input capture.
843+ */
844+ SetInputCaptureEnabled(playerSlot: number, enabled: boolean): void;
845+ /**
846+ * Get if this CustomHudLayout is capturing input for a player
847+ */
848+ IsInputCaptureEnabled(playerSlot: number): boolean;
849+ }
850+
752851 export class PointTemplate extends Entity {
753852 ForceSpawn(origin?: Vector, angle?: QAngle): Entity[] | undefined;
754853 }
755854
855+ /**
856+ * Move this to control a player's view without moving their pawn.
857+ * @experimental This feature is experimental and may experience breaking changes.
858+ * Please send feedback to CSGOTeamFeedback@valvesoftware.com with "cs_script Feedback" in the subject line.
859+ */
860+ export class CSPlayerCamera extends Entity {
861+ IsEnabled(): boolean;
862+ SetEnabled(enabled: boolean): void;
863+ /** Set to false let a player look around from the camera's position. */
864+ SetIsControllingAngles(controlling: boolean): void;
865+ }
866+
756867 /** @deprecated This enum will be removed in a future update */
757868 export enum CSDamageType { }
758869 }