Skip to content
Open
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
65 changes: 29 additions & 36 deletions _includes/photon/usage.html
Original file line number Diff line number Diff line change
@@ -1,83 +1,76 @@
<h2>Using Photon</h2>
<h3>Keys/Controls</h3>
<ul>
<li><strong>Toggle Emergency Lighting</strong>
<li><strong>Lighting Toggle</strong>
<ul>
<li>Key: F</li>
<li><kbd data-bind="photon_key_primary_toggle">F</kbd></li>
<li><em>Turning off lights also deactivates the siren</em></li>
</ul>
</li>
<li><strong>Toggle Siren</strong>
<li><strong>Siren Toggle</strong>
<ul>
<li>Key: R</li>
<li><kbd data-bind="photon_key_siren_toggle">R</kbd></li>
<li><em>If the lights are not active, the siren will default to the hightest priority light mode and enable emergency lights.</em></li>
</ul>
</li>
<li><strong>Change Light Pattern</strong>
<li><strong>Lighting Mode</strong>
<ul>
<li>Key: Left Alt</li>
<li><kbd data-bind="photon_key_primary_alt">ALT</kbd></li>
</ul>
</li>
<li><strong>Illumination On/Off</strong>
<li><strong>Illumination</strong>
<ul>
<li>Key: X</li>
<li>Short press</li>
<li><em>New feature, capable vehicles will show "ILLUM" on HUD</em></li>
<li>Toggle: <kbd data-bind="photon_key_illum">X</kbd></li>
<li>Mode Switch: <kbd data-bind="photon_key_illum">X</kbd>🕑</li>
<li><em>Capable vehicles will show "ILLUM" on HUD</em></li>
</ul>
</li>
<li><strong>Illumination Toggle</strong>
<li><strong>Traffic Advisor</strong>
<ul>
<li>Key: X</li>
<li>Long press</li>
<li>Toggle: <kbd data-bind="photon_key_auxiliary">B</kbd></li>
<li>Mode Switch: <kbd data-bind="photon_key_auxiliary">B</kbd>🕑</li>
<li><em>Capable vehicles will show "AUXILIARY" on HUD</em></li>
</ul>
</li>
<li><strong>Traffic Advisor On/Off</strong>

<li><strong>Siren Mode</strong>
<ul>
<li>Key: B</li>
<li>Short press</li>
</ul>
</li>
<li><strong>Traffic Advisor Toggle Pattern</strong>
<ul>
<li>Key: B</li>
<li>Long press</li>
</ul>
</li>
<li><strong>Change Siren Tone</strong>
<ul>
<li>Key: Right-Click</li>
<li><kbd data-bind="photon_key_siren_alt">RMB</kbd></li>
</ul>
</li>
<li><strong>Manual Bullhorn</strong>
<ul>
<li>Key: G</li>
<li><kbd data-bind="photon_key_horn">G</kbd></li>
</ul>
</li>
<li><strong>Manual Siren</strong>
<ul>
<li>Key: T</li>
<li><kbd data-bind="photon_key_manual">T</kbd></li>
<li><em>Will sound the manual tone if it exists, otherwise it will use the wail tone.</em></li>
</ul>
</li>
<li><strong>Blackout</strong>
<ul>
<li>Key: H</li>
<li><kbd data-bind="photon_key_blackout">H</kbd></li>
<li><em>Disables head and marker lights for stealth work.</em></li>
</ul>
</li>
<li><strong>Signal Left</strong>
<li><strong>Turn Signals</strong>
<ul>
<li>Left-Click + A</li>
<li>Left: <kbd data-bind="photon_key_signal_activate">LMB</kbd> + <kbd data-bind="photon_key_signal_left">A</kbd></li>
<li>Right: <kbd data-bind="photon_key_signal_activate">LMB</kbd> + <kbd data-bind="photon_key_signal_right">D</kbd></li>
<li>Hazards: <kbd data-bind="photon_key_signal_activate">LMB</kbd> + <kbd data-bind="photon_key_signal_hazard">S</kbd></li>
</ul>
</li>
<li><strong>Signal Right</strong>
<li><strong>Select Siren Tone</strong>
<ul>
<li>Left-Click + D</li>
<li><kbd data-bind="photon_key_siren1">1</kbd>, <kbd data-bind="photon_key_siren2">2</kbd>, <kbd data-bind="photon_key_siren3">3</kbd>, <kbd data-bind="photon_key_siren4">4</kbd></li>
<li><em>Select the given siren tone.</em></li>
</ul>
</li>
<li><strong>Hazards</strong>
<li><strong>Toggle Radar HUD</strong>
<ul>
<li>Left-Click + S</li>
<li><kbd data-bind="photon_key_radar">O</kbd></li>
</ul>
</li>
</ul>
Expand Down
31 changes: 31 additions & 0 deletions assets/css/menu-photon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,34 @@ h4 {
code {
color: #9ba9b9
}

.long-press {
&::before {
font-family: "Font Awesome 5 Free";
color: black;
font-weight: 900;
left: -2em;
position: absolute;
text-align: center;
width: 2em;
line-height: inherit;
content: "\f017";
}
}

kbd {
border: #404040 solid 1px;
border-top-color: darken(#404040, 10%);
font-family: monospace;
font-weight: bolder;
box-shadow: darken(#404040, 10%);
background-color: lighten(#404040, 65%);
border-radius: 4px;
color: black;
display: inline-block;
margin: 0 .1em;
overflow-wrap: break-word;
padding: .1em .6em;
text-shadow: #404040;
}

184 changes: 184 additions & 0 deletions assets/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,189 @@ window.game = {

close: function(){
game.lua('ClosePhotonMenu()')
},

key_map: {
1: "0",
2: "1",
3: "2",
4: "3",
5: "4",
6: "5",
7: "6",
8: "7",
9: "8",
10: "9",
11: "A",
12: "B",
13: "C",
14: "D",
15: "E",
16: "F",
17: "G",
18: "H",
19: "I",
20: "J",
21: "K",
22: "L",
23: "M",
24: "N",
25: "O",
26: "P",
27: "Q",
28: "R",
29: "S",
30: "T",
31: "U",
32: "V",
33: "W",
34: "X",
35: "Y",
36: "Z",
37: "0",
38: "1",
39: "2",
40: "3",
41: "4",
42: "5",
43: "6",
44: "7",
45: "8",
46: "9",
47: "/",
48: "*",
49: "-",
50: "+",
51: "ENTER",
52: ".",
53: "[",
54: "]",
55: ";",
56: "'",
57: "`",
58: ",",
59: ".",
60: "/",
61: "\\",
62: "-",
63: "=",
64: "ENTER",
65: "SPACE",
66: "⌫",
67: "⭾",
68: "CAPS",
69: "NUMLOCK",
70: "ESC",
71: "SCRL_LOCK",
72: "INS",
73: "DEL",
74: "HOME",
75: "END",
76: "PGUP",
77: "PGDN",
78: "PAUSE",
79: "SHIFT",
80: "RSHIFT",
81: "ALT",
82: "RALT",
83: "CTRL",
84: "RCTRL",
85: "LWIN",
86: "RWIN",
87: "APP",
88: "↑",
89: "←",
90: "↓",
91: "→",
92: "F1",
93: "F2",
94: "F3",
95: "F4",
96: "F5",
97: "F6",
98: "F7",
99: "F8",
100: "F9",
101: "F10",
102: "F11",
103: "F12",
104: "CAPS_TOGGLE",
105: "NUM_LOCK_TOGGLE",
106: "SCROLL_TOGGLE",
107: "LMB",
108: "RMB",
109: "M3",
110: "M4",
111: "M5",
112: "SCROLL_UP",
113: "SCROLL_DOWN",
114: "JOY1",
115: "JOY2",
116: "JOY3",
117: "JOY4",
118: "JOY5",
119: "JOY6",
120: "JOY7",
121: "JOY8",
122: "JOY9",
123: "JOY10",
124: "JOY11",
125: "JOY12",
126: "JOY13",
127: "JOY14",
128: "JOY15",
129: "JOY16",
130: "JOY17",
131: "JOY18",
132: "JOY19",
133: "JOY20",
134: "JOY21",
135: "JOY22",
136: "JOY23",
137: "JOY24",
138: "JOY25",
139: "JOY26",
140: "JOY27",
141: "JOY28",
142: "JOY29",
143: "JOY30",
144: "JOY31",
145: "JOY32",
146: "JOY1",
147: "JOY2",
148: "JOY3",
149: "JOY4",
150: "JOY5",
151: "JOY6",
152: "JOY7",
153: "JOY8",
154: "JOY9",
155: "JOY10",
156: "JOY11",
157: "JOY12",
158: "JOY13",
159: "JOY14",
},

get_key: function(command){
game.lua('PhotonWebPage:QueueJavascript([[game.get_key_callback("' + command + '", ]] .. GetConVar("' + command + '"):GetInt() .. [[)]])')
},

get_key_callback: function(command, code){
if (code === "nil"){
return
}

code = parseInt(code)
$(`[data-bind="${command}"]`).each(function(_, element){
element.innerText = game.key_map[code]
$(element).attr('data-code', code)
})
}
}

$(document).ready(function(){
$("[data-bind]").each(function(_, element){
game.get_key(element.attributes['data-bind'].value)
})
})