Skip to content

Commit

Permalink
Added all the documentation for \beamng\
Browse files Browse the repository at this point in the history
Added all the documentation for \beamng\
  • Loading branch information
AlexITA1100 authored and Starystars67 committed Jan 24, 2024
1 parent 3abbd03 commit 30af5e5
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/it/beamng/dev/content/maps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
!!! Attenzione "Questo sito è ancora in costruzione"

Questo sito è in fase di lavorazione.

Pensi di poter aiutare? Puoi farlo cliccando sulla pagina con la matita in alto a destra!

Puoi contribuire a qualsiasi pagina.

# Creazione di una mappa su BeamNG.drive

...

## Introduzione

...

## Primi passi

...
19 changes: 19 additions & 0 deletions docs/it/beamng/dev/content/props.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
!!! Attenzione "Questo sito è ancora in costruzione"

Questo sito è in fase di lavorazione.

Pensi di poter aiutare? Puoi farlo cliccando sulla pagina con la matita in alto a destra!

Puoi contribuire a qualsiasi pagina.

# Creazione di prop su BeamNG.drive

...

## Introduzione

...

## Primi passi

...
19 changes: 19 additions & 0 deletions docs/it/beamng/dev/content/vehicles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
!!! Attenzione "Questo sito è ancora in costruzione"

Questo sito è in fase di lavorazione.

Pensi di poter aiutare? Puoi farlo cliccando sulla pagina con la matita in alto a destra!

Puoi contribuire a qualsiasi pagina.

# Creazione di un veicolo su BeamNG.drive

...

## Introduzione

...

## Primi passi

...
9 changes: 9 additions & 0 deletions docs/it/beamng/dev/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!!! Attenzione "Questo sito è ancora in costruzione"

Questo sito è in fase di lavorazione.

Pensi di poter aiutare? Puoi farlo cliccando sulla pagina con la matita in alto a destra!

Puoi contribuire a qualsiasi pagina.

# Introduzione allo sviluppo per BeamNG.drive
2 changes: 2 additions & 0 deletions docs/it/beamng/dev/modding/imgui-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# imgui-windows.md
Questa pagina deve ancora essere creata.
2 changes: 2 additions & 0 deletions docs/it/beamng/dev/modding/lua-mods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# lua-mods.md
Questa pagina deve ancora essere creata.
1 change: 1 addition & 0 deletions docs/it/beamng/dev/modding/ui-apps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Creazione di app UI
10 changes: 10 additions & 0 deletions docs/it/beamng/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Benvenuto nella documentazione di BeamNG.drive
Questa documentazione non è ufficiale, ma è realizzata dal team di BeamMP e dalla comunità di BeamNG.

## Capire la struttura dei file
...


## Snippet

Degli snippet di codice possono essere trovati qui: [Snippets](snippets.md)
154 changes: 154 additions & 0 deletions docs/it/beamng/snippets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
!!! Attenzione "Questo sito è ancora in costruzione"

Questo sito è in fase di lavorazione.

Pensi di poter aiutare? Puoi farlo cliccando sulla pagina con la matita in alto a destra!

Puoi contribuire a qualsiasi pagina.

# Snippet per BeamNG.drive

## Snippet di codice Lua

### Creare un indicatore & rilevare un veicolo

Creare un indicatore (o marker) sulla mappa è uno dei modi migliori per far capire all'utente che può interagire con qualcosa in quel punto.

Creare un indicatore è relativamente semplice. Di seguito c'è un esempio di come è creato un indicatore per il percorso dei bus:

```Lua
local function createBusMarker(markerName)
local marker = createObject('TSStatic')
marker:setField('shapeName', 0, "art/shapes/interface/position_marker.dae")
marker:setPosition(vec3(0, 0, 0))
marker.scale = vec3(1, 1, 1)
marker:setField('rotation', 0, '1 0 0 0')
marker.useInstanceRenderData = true
marker:setField('instanceColor', 0, '1 1 1 0')
marker:setField('collisionType', 0, "Collision Mesh")
marker:setField('decalType', 0, "Collision Mesh")
marker:setField('playAmbient', 0, "1")
marker:setField('allowPlayerStep', 0, "1")
marker:setField('canSave', 0, "0")
marker:setField('canSaveDynamicFields', 0, "1")
marker:setField('renderNormals', 0, "0")
marker:setField('meshCulling', 0, "0")
marker:setField('originSort', 0, "0")
marker:setField('forceDetail', 0, "-1")
marker.canSave = false
marker:registerObject(markerName)
scenetree.MissionGroup:addObject(marker)
return marker
end

-- this can then be called in a loop to setup your markers.
-- NOTE: You should only do this once as part of your setup and not called on each frame.
if #markers == 0 then
for k,v in pairs(nameMarkers) do
local mk = scenetree.findObject(v)
if mk == nil then
log('I', logTag,'Creating marker '..tostring(v))
mk = createBusMarker(v)
ScenarioObjectsGroup:addObject(mk.obj)
end
table.insert(markers, mk)
end
end
```

Di seguito un esempio di indicatore personalizzato preso da [BeamNG-FuelStations](https://github.com/BeamMP/BeamNG-FuelStations/tree/master):

```Lua
local stations = [
{ "location": [ -778.813, 485.973, 23.46 ], "type":"gas" },
{ "location": [ 617.164, -192.107, 53.2 ], "type":"ev" },
]

local function IsEntityInsideArea(pos1, pos2, radius)
return pos1:distance(pos2) < radius
end

local onUpdate = function (dt)
for k, spot in pairs(stations) do -- loop through all spots on the current map
local bottomPos = vec3(spot.location[1], spot.location[2], spot.location[3])
local topPos = bottomPos + vec3(0,0,2) -- offset vec to get top position (2m tall)

local spotInRange = false -- is this spot in range? used for color
local spotCompatible = false -- is this spot compatible?

if activeVeh then -- we have a car and its ours (if in mp)
local vehPos = activeVeh:getPosition()

spotInRange = IsEntityInsideArea(vec3(vehPos.x, vehPos.y,vehPos.z), bottomPos, 1.5)

spotCompatible = activeFuelType == "any" or spot.type == "any" or activeFuelType == spot.type
end

local spotColor = (spotInRange and spotCompatible) and activeColorMap[spot.type] or inactiveColorMap[spot.type] or ColorF(1,1,1,0.5)

debugDrawer:drawCylinder(bottomPos:toPoint3F(), topPos:toPoint3F(), 1, spotColor) --bottom, top, radius, color
end
end
```

### Esempi guihook
#### Notifiche Toast, in alto a destra dello schermo
![image](https://github.com/StanleyDudek/Docs/assets/49531350/c8a87842-b95a-4eca-84dc-93072ecc9158)

```lua
--guihooks.trigger('toastrMsg', {type, title, msg, config = {timeOut}})
guihooks.trigger('toastrMsg', {type = "info", title = "Info Message:", msg = "Info Message Text Here", config = {timeOut = 5000}})
guihooks.trigger('toastrMsg', {type = "warning", title = "Warning Message:", msg = "Warning Message Text Here", config = {timeOut = 5000}})
guihooks.trigger('toastrMsg', {type = "error", title = "Error Message:", msg = "Error Message Text Here", config = {timeOut = 5000}})
```

#### Notifiche come messaggi, in alto a sinistra dello schermo di norma nell'app Messages
![image](https://github.com/StanleyDudek/Docs/assets/49531350/6baef813-50cb-43c3-9c59-0de550b014b6)

```lua
--guihooks.trigger('Message', {msg, ttl, category, icon}) --requires Messages app
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "arrow_upward", icon = "arrow_upward"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "arrow_downward", icon = "arrow_downward"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "flag", icon = "flag"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "check", icon = "check"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "check_circle", icon = "check_circle"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "warning", icon = "warning"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "error", icon = "error"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "directions_car", icon = "directions_car"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "star", icon = "star"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "timeline", icon = "timeline"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "save", icon = "save"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "settings", icon = "settings"})
```
#### Messaggio centrale temporaneo grande o piccolo
![image](https://github.com/StanleyDudek/Docs/assets/49531350/d0cf754f-83f8-4d15-9159-27350da127de)
![image](https://github.com/StanleyDudek/Docs/assets/49531350/1df6fc9b-756f-484e-b8d9-5df346dc4c26)

```lua
--guihooks.trigger('ScenarioFlashMessage', {{msg, ttl, sound, big}} ) -- requires RaceCountdown ui app
guihooks.trigger('ScenarioFlashMessage', {{"Message", 5.0, 0, true}} )
guihooks.trigger('ScenarioFlashMessage', {{"Message Text Here", 5.0, 0, false}} )

--countdown example, when all executed at once, the items are queued and will follow eachother after the previous ttl expires
guihooks.trigger('ScenarioFlashMessage', {{"3", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown1')", true}})
guihooks.trigger('ScenarioFlashMessage', {{"2", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown2')", true}})
guihooks.trigger('ScenarioFlashMessage', {{"1", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown3')", true}})
guihooks.trigger('ScenarioFlashMessage', {{"GO!", 3.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_CountdownGo')", true}})

--another sound example
guihooks.trigger('ScenarioFlashMessage', {{"Teleported!", 3.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Checkpoint')", false}})
```

#### Messaggio centrale persistente
![image](https://github.com/StanleyDudek/Docs/assets/49531350/6290e018-6b3d-4674-98f2-34282a723258)
```lua
--guihooks.trigger('ScenarioRealtimeDisplay', {msg = msg} ) -- requires Race Realtime Display ui app
guihooks.trigger('ScenarioRealtimeDisplay', {msg = "Message Text Here"} )
--these messages persist, clear with a blank string
--if you are running live data, this is a good one to update rapidly (think timers, distance calcs, et cetera)
guihooks.trigger('ScenarioRealtimeDisplay', {msg = ""} )
```

## Snippet di codice IMGUI

## Snippet di codice CEF UI

0 comments on commit 30af5e5

Please sign in to comment.