# SE Event Handler

A comprehensive Space Engineers plugin system for managing game events, encounters, factions, and custom spawning across Client, Dedicated Server, and Torch environments.
## Overview
SE Event Handler is a multi-platform plugin designed to enhance the gameplay experience in **Space Engineers**. It provides advanced game management capabilities through a unified system composed of three main components:
- **ClientPlugin**: Offers client-side functionality, including a configurable user interface.
- **DedicatedPlugin**: Manages server-side functionalities for dedicated servers.
- **TorchPlugin**: Integrates with the Torch server, providing an advanced management interface for server administrators.
## Features
### Core Features
- **Event Management**: Efficiently monitor and control global events within Space Engineers.
- **Encounter Management**: Track and manage global encounters, including the ability to remove them as necessary.
- **Faction Management**: Access detailed information regarding factions, including member lists and reputation systems.
- **Station Management**: Monitor trading stations, manage inventory, and configure settings effectively.
- **Custom Spawning**: Implement an advanced ship spawning system with targeted player spawning.
- **Real-time Monitoring**: Receive live updates of the game state and statistics for better management.
### TorchPlugin Specific Features
- **Interactive GUI**: A multi-tab interface that allows for comprehensive management of game elements.
- **Faction Reputation Editor**: Directly modify player-faction relationships to adjust gameplay dynamics.
- **Station Store Management**: Monitor and manage inventories of trading stations seamlessly.
- **Active Encounter Tracking**: Real-time tracking of active global encounters enhances gameplay control.
- **Custom Ship Spawner**: An enhanced cargo ship spawning mechanism that incorporates custom logic.
- **Admin Commands**: Console commands for efficient faction and station management.
### Shared Components
- **Harmony Patching**: A runtime modification system that allows for advanced code alterations without changing the original game files.
- **Configuration Management**: Persistent configuration that spans all components, ensuring seamless operation.
- **Logging System**: A comprehensive logging system that supports multiple severity levels for easier debugging and monitoring.
- **Cross-Platform Compatibility**: Ensures functionality across Client, Dedicated, and Torch environments.
## Architecture
The SE Event Handler employs a shared codebase architecture, which promotes reusability and efficiency across components. The project structure is as follows:
├── ClientPlugin/ # Client-side plugin
├── DedicatedPlugin/ # Dedicated server plugin
├── TorchPlugin/ # Torch server plugin with GUI
└── Shared/ # Common functionality
├── Config/ # Configuration management
├── Logging/ # Logging system
├── Patches/ # Harmony patches
└── Plugin/ # Core plugin interfaces
## Requirements
### Development Environment
- **Visual Studio 2017+** or **Visual Studio 2022**
- **.NET Framework 4.8.1**
- **Space Engineers** (for Client/Dedicated builds)
- **Torch Server** (for Torch builds)
### Dependencies
- **Lib.Harmony 2.3.3** - A runtime patching framework facilitating the modification of code at runtime.
- **Newtonsoft.Json 13.0.2** - A powerful JSON serialization library (used primarily in Torch/Dedicated environments).
- **All Space Engineers assemblies** - Required for game integration.
## Initial Setup
**Important**: This project requires manual assembly reference setup as automated dependency resolution is not yet implemented.
### 1. Configure Directory Paths
Edit `Directory.Build.props` to update paths that correspond to your local installation of Space Engineers and Torch:
```xml
<Project>
<PropertyGroup>
<!-- Path to Space Engineers client installation -->
<Bin64>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64</Bin64>
<!-- Path to Space Engineers Dedicated Server -->
<Dedicated64>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineersDedicatedServer\DedicatedServer64</Dedicated64>
<!-- Path to Torch Server installation -->
<Torch>C:\Path\To\Your\Torch\Server</Torch>
</PropertyGroup>
</Project>
Each project requires specific assemblies from their respective installations. The projects are pre-configured to reference assemblies based on the paths defined in Directory.Build.props.
The ClientPlugin requires 100+ assemblies from the Space Engineers client installation, including:
- Core VRage assemblies (e.g.,
VRage.dll,VRage.Game.dll) - Sandbox assemblies (e.g.,
Sandbox.Game.dll,Sandbox.Common.dll) - Space Engineers specific assemblies (e.g.,
SpaceEngineers.Game.dll) - Other necessary system assemblies and dependencies
Similar to ClientPlugin, but using assemblies from the Dedicated Server installation.
Requires assemblies from both Torch and Dedicated Server installations:
- All necessary Torch-specific assemblies (e.g.,
Torch.dll,Torch.API.dll) - Dedicated Server assemblies
- WPF assemblies for the management interface.
After configuring paths, confirm that all assembly references are correctly resolved:
- Open the solution in Visual Studio.
- Check for any missing references in each project.
- Ensure that the paths in
Directory.Build.propsare accurate. - Rebuild the solution to verify that all dependencies are resolved.
The solution supports two build configurations:
- Debug: For development and debugging purposes.
- Release: For production use, optimized for performance.
To build the project, select the desired configuration in Visual Studio and initiate the build process.
To utilize the SE Event Handler, load the appropriate plugins into your Space Engineers environment (Client, Dedicated, or Torch). Each plugin offers unique functionalities tailored to its platform:
- ClientPlugin: Load in the Space Engineers client for UI management and event handling.
- DedicatedPlugin: Deploy on a dedicated server for robust event and faction management.
- TorchPlugin: Integrate with your Torch server to leverage the advanced GUI and command features.
We welcome contributions to the SE Event Handler! To contribute, please follow these guidelines:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For additional information, please refer to the project's documentation or submit an issue in the repository if you encounter any problems or have questions.
This enhanced README provides a comprehensive description and structure, alongside additional sections like installation, usage, contributing, and license information, all while preserving the original content's integrity and intent.