Interface IComputer
Interface for a computer in the in-game world.
Namespace: SociallyDistant.Core.OS.Devices
Assembly: SociallyDistant.Framework.dll
Syntax
public interface IComputerProperties
IsPlayer
Gets a value indicating whether this is a player's computer.
Declaration
bool IsPlayer { get; }Property Value
| Type | Description | 
|---|---|
| bool | 
Name
Gets the computer's name.
Declaration
string Name { get; }Property Value
| Type | Description | 
|---|---|
| string | 
NarrativeId
Gets or sets a value indicating the narrative ID of this computer, if any.
Declaration
string? NarrativeId { get; }Property Value
| Type | Description | 
|---|---|
| string | 
Network
Gets an INetworkConnection instance for this computer. This can be used to manage the computer's connection to the Internet, or to connect to other devices.
Declaration
INetworkConnection? Network { get; }Property Value
| Type | Description | 
|---|---|
| INetworkConnection | 
SuperUser
Gets an instance of IUser representing this user's root (administrator) account.
Declaration
IUser SuperUser { get; }Property Value
| Type | Description | 
|---|---|
| IUser | 
Users
Gets a collection of all users on the system.
Declaration
IEnumerable<IUser> Users { get; }Property Value
| Type | Description | 
|---|---|
| IEnumerable<IUser> | 
WorldId
Declaration
ObjectId WorldId { get; }Property Value
| Type | Description | 
|---|---|
| ObjectId | 
Methods
CreateDaemonProcess(string)
Creates a named background process attached to this computer. Useful when setting up background tasks to control a Socially Distant computer, as these processes get killed automatically when the computer de-spawns.
Declaration
Task<ISystemProcess?> CreateDaemonProcess(string name)Parameters
| Type | Name | Description | 
|---|---|---|
| string | name | The name of the process. | 
Returns
| Type | Description | 
|---|---|
| Task<ISystemProcess> | An instance of the newly created process. | 
ExecuteProgram(ISystemProcess, IConsoleDriver, string, string[])
Forks the given process and executes the specified program with the given command-line arguments on the forked process.
Declaration
Task<ISystemProcess?> ExecuteProgram(ISystemProcess parentProcess, IConsoleDriver console, string programName, string[] arguments)Parameters
| Type | Name | Description | 
|---|---|---|
| ISystemProcess | parentProcess | The parent process to fork | 
| IConsoleDriver | console | A console device for the child process to use as its standard console. | 
| string | programName | The name of the program to run | 
| string[] | arguments | Command-line arguments to pass to the program to run | 
Returns
| Type | Description | 
|---|---|
| Task<ISystemProcess> | The forked child process for the program, or null if the program doesn't exist. | 
FindUserById(int, out IUser?)
Tries to look up a user by user ID.
Declaration
bool FindUserById(int id, out IUser? user)Parameters
| Type | Name | Description | 
|---|---|---|
| int | id | The numeric ID of the user. | 
| IUser | user | An instance of IUser representing the user, or null if none were found. | 
Returns
| Type | Description | 
|---|---|
| bool | True if a user was found, false otherwise. | 
See Also
FindUserByName(string, out IUser?)
Tries to look up a user by username.
Declaration
bool FindUserByName(string username, out IUser? user)Parameters
| Type | Name | Description | 
|---|---|---|
| string | username | The username of the user to be found. | 
| IUser | user | An instance of IUser representing the user, or null if none were found. | 
Returns
| Type | Description | 
|---|---|
| bool | True if the user was found, false otherwise. | 
See Also
GetFileSystem(IUser)
Gets an instance of the VirtualFileSystem class that interacts with this computer's root filesystem with the permissions of the given user.
Declaration
IVirtualFileSystem GetFileSystem(IUser user)Parameters
| Type | Name | Description | 
|---|---|---|
| IUser | user | The user to operate the filesystem with. Must belong to this computer. | 
Returns
| Type | Description | 
|---|---|
| IVirtualFileSystem | A view into the computer's file system from the perspective of the given user. | 
GetHackable(ushort)
Gets a hackable for a specified port on this device.
Declaration
IHackable? GetHackable(ushort port)Parameters
| Type | Name | Description | 
|---|---|---|
| ushort | port | The port for which the hackable should be created. | 
Returns
| Type | Description | 
|---|---|
| IHackable | An instance of IHackable for the given port, or null if the port isn't being listened on. |