Skip to content

Commit

Permalink
53 (#132)
Browse files Browse the repository at this point in the history
* chore: update package.json for v53

* fix: non-verbose error for plugin imports

* docs: changelog

* feat: blip sprite types as string, blip color types as string

* feat: blip short range set to true by default

* Update weapon.ts (#135)

* Update weapon.ts

* Update weapon.ts

* Add new Function "getFocusedCustom" to Player.raycast (#133)

* Add "getFocusedCustom" to "raycasts.ts"

* Add "getFocusedCustom" to "raycast.ts"

* Add "getFocusedCustom" to "index.ts"

* feat: fix useWeapon

* feat: services, event rework, vehicle handling fix

* docs: useServices partial docs

* feat: change service names for registration

* feat: better interaction workflow for adding blips, markers, and labels

* feat: update document typings for module extension

* fix: remove dead bin files

* chore: update deps, fix gitignore

* feat: currency service

* docs: document services, and events

* feat: change event names to have 'rebar' prefix

* feat: remove old document events, replace with alt events

* docs: remove out-of-date docs

* feat: change item service to take entity

* fix: service validity check

* fix: remove extra time functions

* fix: set time meta

* Added stopAudio, added missing Volume arg (#139)

* adding missing volume arg to playSound

* added stop audio function

* added stop audio event

* add stop audio to useAudio

* POC: Enhanced permission system (#137)

* POC: Enhanced permission system

* Added getExpired permissions and function to remove all permissions that have been expired.

* Removed permission expiration, added enhanced permission check operators, added virtual document support

* make group 'inherits' property as not mandatory

* Remove just deleted group from online/offline characters/accounts

* Some fixes, added documentation

* Added target to proxy function

* Fix update function, some fixes for permissions

* Some fixes, added warning for incorrect type(deprecation)

* Fix markdown issue

* Functions for using named cronjobs (#138)

* Add node-cron to package.json

* Add cronjob function

* Add useCronJob to server -> index.ts

* Fix create -> check overwrite

* Add plugin api depencencies

* Update buildPluginImports.js

remove wrong commit

* Update src/main/server/cronjob/index.ts

Co-authored-by: Stuyk <[email protected]>

* Update src/main/server/cronjob/index.ts

Co-authored-by: Stuyk <[email protected]>

* Update src/main/server/cronjob/index.ts

Co-authored-by: Stuyk <[email protected]>

* Add Conjob Doc

* Update useCronJob.md

* Update docs/useRebar/useCronJob.md

---------

Co-authored-by: Stuyk <[email protected]>

* fix: object attachment removal, closes #140

* chore: switch to alt.getClosestEntities API, closes #141

* docs: update changelog

* feat: onTick

* chore: upgrade deps

* fix: event on for specific systems

* feat: use for item service

* feat: introduce base types for items, add item create, and item remove service functions

* feat: adjust base types for global usage

* feat: add isOverlayOpen, and isPersistentPageOpen

* fix: type decs

* Update useApi.md (#143)

* feat: hasSpace for item service

* docs: intro paragraph, code examples

* Add scrollable functionality to Dev Menu (#144)

This PR enhances the Dev Menu by adding a scrollable feature to improve usability when dealing with a large number of pages.

* docs: update changelog

* docs: add permissions changelog

* Added chmod for altv-server and altv-crash-handler for linux install process (#149)

* Improvment of the Documentation (#150)

* fix off by one error in comment

* disable controls during authentication

* reenable the controls at the end

* Add missing Argument (#151)

* feat: adjust weapons to allow number or string for models

* docs: changelog

* feat: add door synchronization for open / shut states when manually toggled

* docs: changelog

* POC: Added Plugin Categories. (Closes #142) (#145)

* POC: Added Plugin Categories. (Closes #142)

Only a Proof of Concept. I am pretty sure there are things to optimize or even something i have forgot.

* Fixing Webviews

* Fixed copyFiles

* Added doc comment back

* Sort plugins alphabetically

* Sort webview alphabetically

* chore: upgrade deps

* feat: make draggable vue emit onDragStart, and onDragStop

* feat: local storage mock

* Update Tuning to handle headlight colors (#153)

* Update Tuning to handle headlight colors

* Make it objects.

* Add blank space

* Add blank space

---------

Co-authored-by: Der Lord! <[email protected]>
Co-authored-by: KoronGIT <[email protected]>
Co-authored-by: Liam Robinson <[email protected]>
Co-authored-by: Vladyslav Halatskyi <[email protected]>
Co-authored-by: Landminen Tester <[email protected]>
Co-authored-by: Dav-Renz <[email protected]>
  • Loading branch information
7 people authored Sep 22, 2024
1 parent b431300 commit 60e7f60
Show file tree
Hide file tree
Showing 141 changed files with 5,777 additions and 2,924 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.server-crashes-cache/
cache/
./data/
data/**/*.bin
modules/
node_modules/
resources/main/
Expand Down
Binary file removed data/clothes.bin
Binary file not shown.
Binary file removed data/pedmodels.bin
Binary file not shown.
Binary file removed data/rpfdata.bin
Binary file not shown.
Binary file removed data/vehmodels.bin
Binary file not shown.
Binary file removed data/vehmods.bin
Binary file not shown.
Binary file removed data/weaponmodels.bin
Binary file not shown.
132 changes: 132 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,138 @@ order: 95

# Changelog

## Version 53

### Breaking Changes

- Removed `useVehicleEvents`, `useCharacterEvents`, and `useAccountEvents`
- Replaced with `alt.on('rebar:vehicleUpdated')`, `alt.on('rebar:playerCharacterUpdated')`, and `alt.on('rebar:playerAccountUpdated')`.
- Removed alt.getMeta for Rebar Imports
- This likely doesn't effect anyone
- Removed `useServerTime`
- Replaced with `useWorldService`
- Removed `useServerWeather`
- Replaced with `useWorldService`
- Removed `useMessenger.message.on`,
- Same functionality can be achieved through `alt.on` with `playerSendMessage`
- Removed `useRebarEvents` and moved all events to `alt.on` and `alt.emit`
- Custom delcarations are still possible.
- Replaced all `rebar-event-names` with `camelCased` events
- Event Name Changes:
- Renamed `message` event to `rebar:playerSendMessage`
- Renamed `on-command` event to `rebar:playerCommand`
- Renamed `on-rpc-restart` event to `rebar:rpcRestart`
- Renamed `account-bound` event to `rebar:playerAccountBound`
- Renamed `character-bound` event to `rebar:playerCharacterBound`
- Renamed `vehicle-bound` event to `rebar:vehicleBound`
- Renamed `page-opened` event to `rebar:playerPageOpened`
- Renamed `page-closed` event to `rebar:playerPageClosed`
- Renamed `time-changed` event to `rebar:timeChanged`
- Renamed `time-hour-changed` event to `rebar:timeHourChanged`
- Renamed `time-minute-changed` event to `rebar:timeMinuteChanged`
- Renamed `time-second-changed` event to `rebar:timeSecondChanged`
- Renamed `weather-changed` event to `rebar:weatherChanged`
- Renamed `weather-forecast-changed` event to `rebar:weatherForecastChanged`
- Renamed `doorLocked` event to `rebar:doorLocked`
- Renamed `doorUnlocked` event to `rebar:doorUnlocked`
- Reworked permission system:
- Removed `permission` and `groupPermissions` properties from `useAccount` and `useCharacter`.
- When you check for players' permissions, it will automatically check both groups and plain permissions.

### Code Changes

- Added more verbose error printing for plugin imports, should function like before again
- Added ability to use string union for blip sprite types
- Automatically converted to numerical
- Added ability to use string union for blip colors
- Automatically converted to numerical
- Made blips shortRange parameter optional, and default to true
- Updated `useWeapon` for `player` to properly save weapon data and ammo count
- **Removed** `ammo` from the database, and ammo is now stored on the individual weapon instead
- Fix vehicle handler so setting `{}` will actually clear the vehicle handling
- Fix issue where removing attachements was not working correctly
- Replaced in-house get closest entity function with `alt.getClosestEntities`
- Changed `Account` from `type` to `interface`
- Moved `Page Events` to `pageSystem` to keep functionality working
- Made it so emitting notifications from server-side defaults to a GTA:V Notification, until a library is added
- Added `useServiceRegister`
- Provides common APIs for common features to integrate custom functionality.
- Services do nothing until a library registers itself under a service.
- Added `useCurrencyService`
- All these functions do nothing until a library is registered\
- add (invoke adding currency)
- sub (invoke removing currency)
- has (check if has enough currency)
- emits events when currency added or subtracted
- Added `useDeathService`
- All these functions do nothing until a library is registered
- respawn (invoke a respawn)
- revive (invoke a revive, in place)
- emits events when respawned, or revived
- Added `useItemService`
- All these functions do nothing until a library is registered
- add (invoke an item add)
- sub (invoke an item subtraction)
- remove (invoke an item remove)
- has (invoke if player has an item)
- itemCreate (create an item to add to the database)
- itemRemove (remove an item from the database)
- emits events when items added, subtracted, or removed
- Added `useNotificationService`
- All these functions do nothing until a library is registered
- emit (invoke a notification send)
- broadcast (invoke a notification send, to all players)
- emits events when notification emitted, or broadcasted
- Added `useTimeService`
- All these functions do nothing until a library is registered
- setTime (set the time for the whole server)
- getTime (get the current time for the server)
- emits events when time updated by hour, minute, or second
- Added `useWeatherService`
- setWeather (set the weather for the server)
- setWeatherForecast (set weather forecast for the server)
- getWeather (get the current weather for the server)
- getWeatherForecast (get weather forecast for the server)
- emits events when weather updated, or forecast updated
- Added Custom alt.getMeta Keys for...
- serverTime
- serverWeather
- serverWeatherForecast
- Added support for interactions to
- addBlip
- addMarker
- addTextLabel
- getBlip
- getMarker
- getTextLabel
- getPos
- Destroy all of the above when interaction is destroyed
- Updated Document Typings for ... to better handle module extension
- Account
- Character
- Vehicle
- Added `rebar:onTick` which just emits a tick every 1 second for general usage
- Added `isOverlayOpen` and `isPersistentPageOpen` to client-side for checking if a page is open
- Made dev menu from the `webview:dev` command scrollable
- Groups are now created globally, and you can assign players' documents to the group.
- You can inherit a new group from another one; it will inherit all permissions from the parent.
- You can now access permissions/groups of character/account via `useVirtual`.
- Two new player-getters:
- `withPermission(documentType: 'account' | 'character' | 'any', permission: string)`
- `memberOfGroup(documentType: 'account' | 'character' | 'any', groupName: string)`
- Updated weapon helpers to allow for `hash` or `string` models
- Added `invokeWithResult` for player natives, to invoke a native and get a result
- Added vehicle door sync for open / shut states

### Docs Changes

- Document `getWeapons` and update documentation for `useWeapon` for the player
- Document all services under `useService`
- Document all event changes, and update events page
- Document the new permission system.

---

## Version 52

### Code Changes
Expand Down
126 changes: 119 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ order: 99

# What is Rebar?

Rebar is a plug-and-play base framework for the alternative GTA:V multiplayer client alt:V. Rebar is meant to act as a light framework that provides utility, and a basic standard for building plugins that can be compatible with other plugins.
Rebar is a plugin-based framework for GTA:V based on alt:V that focuses on server-side functionality to control almost all player aspects. Rebar provides a robust starting point for any game mode as you'll be able to choose from a wide variety of community plugins to install. Rebar thrives with its welcoming Discord community, community contributions, and plugins.

It has a heavy focus on simplifying building game modes and lowering the friction of building a server.

## Why Rebar?

Rebar is the foundational piece necessary to construct large concrete structures. Think of this framework as achieving the same from a game-mode standpoint.
Rebar stops server developers from spending years building boilerplate code, and instead gets them straight to writing their game mode.

## Tech Stack

Expand All @@ -19,6 +15,122 @@ Rebar is the foundational piece necessary to construct large concrete structures
- MongoDB
- Vue

## How do I get started?
## Why the name Rebar?

Rebar is the foundational piece necessary to construct large concrete structures. Think of this framework as achieving the same from a game mode standpoint.

## Rebar vs Fivem (ESX, QBCore)

While ESX, and QBCore have been around forever, Rebar handles all the heavy lifting for you.

+++ Keybind Example
||| FiveM

```lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)

if IsControlJustPressed(1, 51) then
print("E key was pressed!")
end
end
end)
```

||| Rebar

```ts
Keybinder.on(75, (player) => {
console.log('Pressed k');
});
```

|||
+++ Ped Example
||| FiveM

```lua
local pedModel = "a_m_y_hipster_01"
local spawnCoords = vector3(427.13, -806.46, 29.49)
local targetCoords = vector3(435.0, -800.0, 29.49)

function loadModel(model)
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(0)
end
end

Citizen.CreateThread(function()
loadModel(GetHashKey(pedModel))
local ped = CreatePed(4, GetHashKey(pedModel), spawnCoords.x, spawnCoords.y, spawnCoords.z, 0.0, true, false)
TaskGoStraightToCoord(ped, targetCoords.x, targetCoords.y, targetCoords.z, 1.0, -1, 0.0, 0.0)
SetEntityInvincible(ped, true)
end)
```

||| Rebar

```ts
const pedModel = 'a_m_y_hipster_01'; // The pedestrian model
const spawnCoords = { x: 427.13, y: -806.46, z: 29.49 }; // Spawn coordinates
const targetCoords = { x: 435.0, y: -800.0, z: 29.49 }; // Target coordinates

const ped = Rebar.controllers.usePed(new alt.Ped(pedModel, spawnCoords, alt.Vector3.zero));

ped.setOption('makeStupid', true);
ped.setOption('invincible', true);

ped.invoke('taskGoStraightToCoord', targetCoords.x, targetCoords.y, targetCoords.z, 1.0, -1, 0, 0);
```

|||

+++ Text Example
||| FiveM

```lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local x, y, z = 427.13, -806.46, 29.49
local text = "Hello, World!"
local scale = 0.5
local color = {255, 255, 255, 255}

SetTextFont(0)
SetTextProportional(1)
SetTextScale(scale, scale)
SetTextColour(color[1], color[2], color[3], color[4])
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x, y)
end
end)

```

||| Rebar

```ts
const label = Rebar.controllers.useD2DTextLabel({
text: 'Hello World',
pos: new alt.Vector3(427.13, -806.46, 29.49),
fontColor: new alt.RGBA(255, 255, 255, 255),
fontSize: 0.5,
});
```

|||
+++

## Getting Started

### Experienced Developers

Head on over to [Install & Upgrade](./install.md) to learn about the installation process.

### New Developers

Head on over to the [book on Rebar](./tutorials/rebar/chapter-01-preface.md) and how to utilize it. There's even a few small tutorials on programming.
2 changes: 1 addition & 1 deletion docs/info/webview/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { useWebview } from '@Server/player/webview.js';

// Show the page
function someShowFunction(somePlayer: alt.Player) {
useWebview(somePlayer).show('MyExampleView');
useWebview(somePlayer).show('MyExampleView', 'page');
}

// Hide the page
Expand Down
7 changes: 7 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ pnpm install
pnpm binaries
```

### Grant execute permissions

```bash
sudo chmod +x altv-server
sudo chmod +x altv-crash-handler
```

### Start

```
Expand Down
38 changes: 3 additions & 35 deletions docs/tutorials/general/code-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,6 @@ import * as alt from 'alt-server';
const Rebar = alt.getMeta('Rebar');
```

## Rebar Events

Rebar has a handful of events that can be used in tandem with alt:V events.

These become more useful when a character select, or auth plugins are installed.

```ts
import { useRebar } from '@Server/index.js';

const Rebar = useRebar();
const RebarEvents = Rebar.events.useEvents();

RebarEvents.on('character-bound', (player) => {
// do something when they've selected a character
});
```

```ts
RebarEvents.on('account-bound', (player) => {
// do something when they've logged into an account
});
```

```ts
RebarEvents.on('time-changed', (hour, minute, second) => {
// Do something when the time changes in-game
});
```

## Notifying a Player

Send a default GTA:V notification to the player.
Expand All @@ -65,9 +36,8 @@ Send a default GTA:V notification to the player.
import { useRebar } from '@Server/index.js';

const Rebar = useRebar();
const RebarEvents = Rebar.events.useEvents();

RebarEvents.on('character-bound', (player) => {
alt.on('playerConnect', (player) => {
const rPlayer = Rebar.usePlayer(player);
rPlayer.notify.showNotification('Welcome to the server!');
});
Expand All @@ -82,9 +52,8 @@ import * as alt from 'alt-server';
import { useRebar } from '@Server/index.js';

const Rebar = useRebar();
const RebarEvents = Rebar.events.useEvents();

RebarEvents.on('character-bound', (player) => {
alt.on('playerConnect', (player) => {
const rPlayer = Rebar.usePlayer(player);
rPlayer.notify.showShard({
title: 'Welcome to the Server',
Expand All @@ -102,9 +71,8 @@ import * as alt from 'alt-server';
import { useRebar } from '@Server/index.js';

const Rebar = useRebar();
const RebarEvents = Rebar.events.useEvents();

RebarEvents.on('character-bound', (player) => {
alt.on('playerConnect', (player) => {
const rPlayer = Rebar.usePlayer(player);
rPlayer.notify.showMissionText('Visit our website at https://rebarv.com');
});
Expand Down
Loading

0 comments on commit 60e7f60

Please sign in to comment.