Skip to content

Commit

Permalink
Merge pull request #31 from emcifuntik/master
Browse files Browse the repository at this point in the history
Updated to v15
  • Loading branch information
emcifuntik authored Sep 15, 2023
2 parents 86efbf9 + c255126 commit 6f20865
Show file tree
Hide file tree
Showing 45 changed files with 7,635 additions and 2,658 deletions.
1 change: 1 addition & 0 deletions freeroam-extended/build-debug.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd client && yarn && yarn build && cd ../server && dotnet build --configuration Debug --output dist
1 change: 1 addition & 0 deletions freeroam-extended/build-release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd client && yarn && yarn build && cd ../server && dotnet build --configuration Release --output dist
122 changes: 122 additions & 0 deletions freeroam-extended/client/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
module.exports = {
env: {
es2021: true,
},
parser: '@typescript-eslint/parser',
extends: [
'standard',
'plugin:@typescript-eslint/recommended',
],
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
project: './tsconfig.eslint.json',
extraFileExtensions: ['.cjs']
},
rules: {
'no-new': 0,
semi: ['warn', 'never'],
'require-await': 'error',
quotes: ['warn', 'double'],
'prefer-const': ['error', {
ignoreReadBeforeAssign: true,
}],
'@typescript-eslint/member-delimiter-style': ['warn',
{
multiline: {
delimiter: 'none',
requireLast: false,
},
},
],
'@typescript-eslint/explicit-member-accessibility': ['error', {
ignoredMethodNames: ['constructor'],
}],
'eol-last': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-function-return-type': 0,
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['warn', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
enums: 'always-multiline',
generics: 'always-multiline',
tuples: 'always-multiline',
}],
'no-useless-constructor': 'off',
'@typescript-eslint/no-floating-promises': ['error', {
ignoreVoid: false,
ignoreIIFE: false,
}],
'@typescript-eslint/no-empty-interface': [
'error',
{
'allowSingleExtends': true
}
],
'@typescript-eslint/ban-ts-comment': ['warn', {
'ts-expect-error': 'allow-with-description',
'ts-ignore': 'allow-with-description',
'ts-nocheck': true,
'ts-check': false,
minimumDescriptionLength: 3,
}],
'node/handle-callback-err': 0,
'@typescript-eslint/type-annotation-spacing': ['error', {
'before': false,
'after': true,
'overrides': {
arrow: {
'before': true,
'after': true,
}
}
}],
'@typescript-eslint/await-thenable': 'error',
'func-call-spacing': 0,
'@typescript-eslint/func-call-spacing': 0,
'indent': 0,
'@typescript-eslint/indent': ['error', 2],
'no-useless-escape': 0,
'space-infix-ops': 0,
'@typescript-eslint/space-infix-ops': ['error'],
semi: 0,
'@typescript-eslint/semi': ['warn', 'never'],
'lines-between-class-members': 0,
'@typescript-eslint/lines-between-class-members': ['error', 'always', {
'exceptAfterSingleLine': true
}],
'no-use-before-define': 0,
'@typescript-eslint/no-use-before-define': ['error', {
'functions': false,
'classes': true,
'variables': true
}],
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'curly': ['error', 'multi-or-nest'],
'import/no-webpack-loader-syntax': 0,
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'brace-style': ['error', 'stroustrup'],
'dot-notation': 0,
'@typescript-eslint/dot-notation': ['error'],
'no-multi-str': 0,
},
ignorePatterns: [
'.eslintrc.cjs',
'*.js',
'dist',
'*.d.ts',
],
}
26 changes: 26 additions & 0 deletions freeroam-extended/client/build-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import esbuild from "esbuild"
import { altvEsbuild } from 'altv-esbuild'

const dev = process.argv[2] === '-dev'
console.log('dev:', dev)

const plugins = []

if (dev) {
plugins.push(altvEsbuild({
mode: 'server',
dev,
}))
}

esbuild.build({
watch: dev,
bundle: true,
format: 'esm',
target: "esnext",
logLevel: "info",
platform: 'node',
entryPoints: ['src-server/index.ts'],
outfile: 'dist/server.js',
plugins,
})
24 changes: 24 additions & 0 deletions freeroam-extended/client/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import esbuild from 'esbuild'
import { altvEsbuild } from 'altv-esbuild'

const dev = process.argv[2] === '-dev'

console.log('dev:', dev)

esbuild.build({
watch: dev,
bundle: true,
format: 'esm',
target: "esnext",
logLevel: "info",
entryPoints: ['src/index.ts'],
outfile: 'dist/client.js',

plugins: [
altvEsbuild({
mode: 'client',
dev,
altvEnums: true,
})
]
})
Binary file added freeroam-extended/client/html/Inter-Bold.ttf
Binary file not shown.
Binary file added freeroam-extended/client/html/Inter-Medium.ttf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,44 @@ function addString(text) {
highlightChat();
}

function updatePlayersOnline(number) {
document.querySelector(".players-online-number").textContent = `${number}`;
}

function setPlayerId(id) {
document.querySelector(".player-id-number").textContent = `${id}`;
}

function setWeaponsDisabled(disabled) {
const el = document.querySelector(".weapons-enabled").children[0];

if (disabled) {
el.classList.remove("weapons-enabled-on");
el.classList.add("weapons-enabled-off");
el.textContent = "OFF";
}
else {
el.classList.remove("weapons-enabled-off");
el.classList.add("weapons-enabled-on");
el.textContent = "ON";
}
}

function focusChatInput() {
msgInputLine.focus();
}

function setStreamedEntities(players, vehicles) {
document.querySelector(".streamed-in-players").textContent = players
document.querySelector(".streamed-in-vehicles").textContent = vehicles
}

alt.on("addString", (text) => addString(colorify(text)));
alt.on("addMessage", (name, text) => addString("<b>" + name + ": </b>" + colorify(text)));
alt.on("openChat", openChat);
alt.on("closeChat", closeChat);
alt.on("updatePlayersOnline", updatePlayersOnline);
alt.on("setPlayerId", setPlayerId);
alt.on("setWeaponsDisabled", setWeaponsDisabled);
alt.on("focusChatInput", focusChatInput);
alt.on("setStreamedEntities", setStreamedEntities)
63 changes: 63 additions & 0 deletions freeroam-extended/client/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>alt:V Chat</title>
<link rel="stylesheet" href="style.css" />
</head>

<body>
<div class="stress-test-label">
Public Stress Test - xx.xx.2022
</div>
<div class="info">
<div class="players-online">
Players online <div class="info-number players-online-number">xxxx</div>
</div>
<div class="player-id">
Your ID <div class="info-number player-id-number">xxxx</div>
</div>
<div class="weapons-enabled">
Weapons <div class="info-number weapons-enabled-on">ON</div>
</div>
<div class="streamed-in">
Streamed players <div class="info-number streamed-in-players">0</div>
</div>
<div class="streamed-in">
Streamed vehicles <div class="info-number streamed-in-vehicles">0</div>
</div>
</div>
<div class="help-keys">
<ol>
<li><span class="help-keys-command">F2:</span> toggle HUD</li>
<li><span class="help-keys-command">T / Enter:</span> open chat</li>

<li><span class="help-keys-command">/tp</span> &lt;1 to 22&gt; (Teleport)</li>
<li><span class="help-keys-command">/model</span> (Change your model between male and female)</li>
<li><span class="help-keys-command">/outfit [outfit_name]</span> (Change outfit to random or entered value)</li>
<li><span class="help-keys-command">/veh</span> &lt;modelName&gt; (Spawn a vehicle)</li>
<li><span class="help-keys-command">/clearvehicles</span> (Clear your vehicles)</li>
<li><span class="help-keys-command">/tune</span> &lt;index> &lt;value&gt; (Tune vehicle)</li>
<li><span class="help-keys-command">/weapons</span> (Give yourself weapons)</li>
<li><span class="help-keys-command">/addcomponent</span> &lt;name&gt; (Add weapon component)</li>
<li><span class="help-keys-command">/removecomponent</span> &lt;name&gt; (Remove weapon component)</li>
<li><span class="help-keys-command">/dm</span> (Toggle respawning in death match zone)</li>
<li><span class="help-keys-command">/revive</span> (Revive player)</li>
</ol>
</div>
<div class="content">
<div class="chatbox">
<div class="msglist">
<div class="messages"></div>
</div>
<div class="msginput">
<form id="message">
<input type="text" spellcheck="false" />
</form>
</div>
</div>
</div>
<script src="app.js"></script>
</body>
</html>
Loading

0 comments on commit 6f20865

Please sign in to comment.