diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d737b1a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.vmdl text eol=lf +*.vmat text eol=lf +*.cs text eol=lf diff --git a/README.md b/README.md index 5849812..8b6c1bd 100755 --- a/README.md +++ b/README.md @@ -5,35 +5,43 @@ Very early WIP (as is S&box itself). - Wiring Tool is equivalent to G-Wiremod's non-Adv version, with basic Debugger and Gate spawning functionalities too -- Outputs: Buttons and a Wire Keyboard (effectively a Pod Controller with a builtin vehicle) -- Inputs: Thrusters, Lights -- Gates: the basic arithmetic/logic +- Outputs: Buttons, GPS, Gyroscope, and a Wire Keyboard (effectively a Pod Controller with a builtin vehicle) +- Inputs: Thrusters, Lights, Constraint Controllers, HardLight Bridge +- Gates: the basic arithmetic/logic/constant + +Message Nebual on Discord with any questions about contributing! See [todos](https://github.com/wiremod/wirebox/projects/1) for ideas. ## Setup S&box is currently focused around 'Gamemodes', not modular addons, however [[A]lex is working on a modular Gamemode framework](https://github.com/Ceveos/minimal-extended) which might work for us. -Unfortunately, the base 'Sandbox' gamemode needs to be modified to be more extendable, so grabbing the latest Github Release with those changes already applied is easiest. +We also use [SandboxPlus](https://github.com/Nebual/sandbox-plus), an extension of FP's Sandbox gamemode, modified to be more extendable. +Thus, grabbing the latest Github Release with that already setup is easiest. ### Using the latest Github Release -1. Download it to `steamapps/common/sbox/addons/` -2. `cd wirebox/addons/code/wirebox && git pull` +1. Download it to `steamapps/common/sbox/workspace/` +2. `cd workspace/modules/wirebox && git pull` +3. `cd workspace/ && .\watcher.ps1 wirebox -build` ### Building from scratch -`wirebox-build-scratch.bat` will `git clone` the [modular Gamemode](https://github.com/Ceveos/minimal-extended), wirebox itself, and [sandbox-plus](https://github.com/Nebual/sandbox-plus), producing a new "gamemode" which should be placed in `steamapps/sbox/addons/` +1. `cd steamapps/common/sbox/` +2. `git clone https://github.com/Ceveos/minimal-extended.git workspace && cd workspace` +3. `.\watcher.ps1 -create`, say yes to prompt to download SandboxPlus +4. `git clone https://github.com/wiremod/wirebox.git modules/wirebox` +5. `.\watcher.ps1 wirebox -build` + +The watcher script will combine all modules/* (so you can throw extra mods there), and output a new "gamemode" into `steamapps/sbox/addons/wirebox/`, where S&Box is looking for it. ## Developing +Often the base Sandbox gamemode isn't extendable enough; direct PR's to enhance flexibility to [SandboxPlus](https://github.com/Nebual/sandbox-plus), +which is wire-agnostic, but obviously quite wire-friendly :D + Hotreloading is neat, and generally works well - limitations include: -- Base UI, such as the Spawnmenu's tools/spawnlists, don't reload without a map change - seems a bit less reliable for non-host players, though often works - some Model properties don't reload, such as Prop breakability -- You'll need `./asset-watcher.ps1` running for assets/ui - -### Assets Watcher -Some files need to be in the "root directory" of the gamemode (eg. `sbox/addons/minimal-extended/models/`). -`./asset-copier.bat` will delete old and copy in new files, or `./asset-watcher.ps1` will actively watch for new changes and copy them in as they occur. +- You'll need `./watcher.ps1 wirebox` running to copy changes from workspace/modules/* to sbox/addons/wirebox (the output gamemode); this lets us keep git repos separate while merging together assets from multiple modules into their respective top-level folders in the resulting gamemde. diff --git a/asset-copier.bat b/asset-copier.bat deleted file mode 100644 index dcaa5a3..0000000 --- a/asset-copier.bat +++ /dev/null @@ -1,6 +0,0 @@ -rmdir /q /s ..\..\..\models\wirebox -xcopy /E /Y models\wirebox\ ..\..\..\models\wirebox\ -rmdir /q /s ..\..\..\particles\wirebox -xcopy /E /Y particles\wirebox\ ..\..\..\particles\wirebox\ -rmdir /q /s ..\..\..\code\ui\wirebox\ -xcopy /E /Y code\ui\wirebox\ ..\..\..\code\ui\wirebox\ diff --git a/asset-watcher.ps1 b/asset-watcher.ps1 deleted file mode 100644 index c8deec9..0000000 --- a/asset-watcher.ps1 +++ /dev/null @@ -1,57 +0,0 @@ -# A watcher that, upon files changing, copies them from the addon subdirectories to the gamemode's ones - -cmd.exe /c asset-copier.bat - -$watcher = New-Object System.IO.FileSystemWatcher -$watcher.Path = (Get-Location) -$watcher.Filter = '*' -$watcher.IncludeSubdirectories = $true - -$action = { - $path = $event.SourceEventArgs.FullPath - $changeType = $event.SourceEventArgs.ChangeType - $logline = "$(Get-Date), $changeType, $path" - foreach ($subPath in @("code\ui\", "models\", "materials\")) { - if ($path.StartsWith("$(Get-Location)\$($subPath)")) { - $smallPath = "" - try { - push-location "$(Get-Location)\$($subPath)" - $smallPath = Resolve-Path -relative $path - } finally { - Pop-Location - } - $oldPath = "$($subPath)$($smallPath)" - $newPath = "..\..\..\$($subPath)$($smallPath)" - Write-Host "Copying $($oldPath) to $($newPath)" - New-Item -Type dir (split-path $newPath -Parent) - Copy-Item $oldPath $newPath - } - } -} - -$handlers = . { - Register-ObjectEvent -InputObject $watcher -EventName Changed -Action $action - Register-ObjectEvent -InputObject $watcher -EventName Created -Action $action - Register-ObjectEvent -InputObject $watcher -EventName Deleted -Action $action - Register-ObjectEvent -InputObject $watcher -EventName Renamed -Action $action -} -$watcher.EnableRaisingEvents = $true -Write-Host -Write-Host "Watching for changes to asset directories in $(Get-Location)..." - - -try { - do { - # Wait-Event waits for a second and stays responsive to events - Wait-Event -Timeout 1 - } while ($true) -} finally { - $watcher.EnableRaisingEvents = $false - - $handlers | ForEach-Object { - Unregister-Event -SourceIdentifier $_.Name - } - $handlers | Remove-Job - - $watcher.Dispose() -} diff --git a/wirebox-build-scratch.bat b/wirebox-build-scratch.bat deleted file mode 100644 index 48c9b0d..0000000 --- a/wirebox-build-scratch.bat +++ /dev/null @@ -1,16 +0,0 @@ -REM This will produce a wirebox-gamemode, which can be thrown in -REM sbox/addons/ - -git clone https://github.com/Ceveos/minimal-extended.git wirebox-gamemode -cd wirebox-gamemode/code/addons -rmdir /q /s sandbox - -git clone https://github.com/Nebual/sandbox-plus.git -cd sandbox-plus -call asset-copier.bat -cd .. - -git clone https://github.com/wiremod/wirebox.git -cd wirebox -call asset-copier.bat -cd ..