Mostly Harmless

Legacy:ComputerPersonal (DX)

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 09:57, 10 October 2005 by Amazonas-1990.adsl.datanet.hu (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview of ComputerPersonal[edit]

ComputerPersonal is, of course, the personal computer in DX. All instructions for using them are available in the DX

This is what the editor doc says:

This is the desktop system of the DE world. Usually used only as a means of e-mail reception it has similar properties

of all of the computers and can activate special options triggering outside events (i.e. Shutting off the coolant to the

generator in the NYC warehouse and blowing it up, Signaling the NSF from the old NSF headquarters building, etc.)

Important functions (NB: these are all methods of the superclass, Computers)[edit]

string GetNodeName() 
Returns the title of the node (e.g. "UNATCO")
string GetNameDesc() 
Returns the node's long name (e.g. "United Nations Anti-Terrorist Coalition")
string GetNodeAddress() 
Returns the node's address
texture GetNodeTexture() 
Returns the texture that is the node's icon
string GetUserName(int userIndex) 
Returns the username from entry #userIndex in the userList array
string GetUserPassword(int userIndex) 
As GetUserName, but returns password
int GetAccessLevel(int userIndex) 
As GetUserName, but returns access level (question: was access level ever implemented?)
AdditionalActivation(DeusExPlayer ActivatingPlayer), AdditionalDeactivation(DeusExPlayer DeactivatingPlayer) 
Called for subclasses to do any additional activation steps. Empty in both Computers and ComputerPersonal.
BeginAlarm(), EndAlarm() 
Turns the alarm on and off, after a hacker runs out of time

Custom computer nodes[edit]

OK, this is my happy little contribution to this site. How to make custom nodes.

Now some people will have you make new subclasses of Computer, ComputerPersonal, and all the UI interface classes as well. This is not necessary! In fact, it is complete overkill.

I will not explore custom textures here, for info on that stuff you can visit tutorial sites like www.planetdeusex.com/tack.

As you may know, the computers have variables like TitleString and TitleTexture that were never implemented. We are now going to implement them.

There is no need to edit the UI. The UI classes get information like title string, description, etc. from functions in the computer class, specifically GetNodeName(), GetNameDesc(), GetNodeAddress(), and GetNodeTexture() (the values are returned by the functions). All we have to do is a little tweaking to get everything running smoothly.

The following code is what I used in my mod. There's a new enumeration. It has the following settings:

STANDARD_NODE_LIST 
Uses the regular list of nodes (e.g. UNATCO, NSF, MJ12), like a regular computer
CUSTOM_NODE 
Uses the nodeName, titleString, titleTexture, and (newly added) nodeAddress, that were present but not implemented in the standard computer
NN_MYNODETYPE 
This is an example of a preset node type. Many of these could be added to the list for convenience. I added several in my mod.
//--------------------------------------------------------
// MyComputerPersonal
// By TheSheep
// thesheepbaa@hotmail.com
//--------------------------------------------------------
class MyComputerPersonal extends ComputerPersonal;
 
//New options for node type
enum EAltNodeName
	{
	STANDARD_NODE_LIST, //taken from the normal list of nodes e.g. UNATCO, NSF, MJ12, etc.
	CUSTOM_NODE,        //custom node based on name, desc, addr, and texture settings
	NN_MYNODETYPE       //a preset custom configuration
	};
 
var() EAltNodeName AltNodeName;
 
//nodeAddress for CUSTOM_NODEs
var(Computers) localized string nodeAddress;
 
//These are the variables that settings are stored in
var localized string MyNodeName,MyNodeDesc,MyNodeAddress;
var texture MyNodeTexture;
 
function PostBeginPlay() //executed near start of game
{
switch(AltNodeName)
	{
	case STANDARD_NODE_LIST:
		MyNodeName=nodeInfo[Int(ComputerNode)].nodeName;
		MyNodeDesc=nodeInfo[Int(ComputerNode)].nodeDesc;
		MyNodeAddress=nodeInfo[Int(ComputerNode)].nodeAddress;
		MyNodeTexture=nodeInfo[Int(ComputerNode)].nodeTexture;
		break;
	case CUSTOM_NODE:
		MyNodeName=nodeName;
		MyNodeDesc=titleString;
		MyNodeAddress=nodeAddress;
		MyNodeTexture=titleTexture;
		break;
	case NN_MYNODETYPE:
		MyNodeName="Preset node";
		MyNodeDesc="My preset node type for my mod";
		MyNodeAddress="MY//NODE//TYPE//ADDRESS.0530.53";
		MyNodeTexture=Texture'MyPackage.MyTexture';
		break;
	}	
Super.PostBeginPlay();
}
 
// Functions to get info
// They are called to obtain information about the node, and pass the desired info as a return value.
function String GetNodeName()
{ return MyNodeName; }
 
function String GetNodeDesc()
{ return MyNodeDesc; }
 
function String GetNodeAddress()
{ return MyNodeAddress; }
 
function Texture GetNodeTexture()
{ return MyNodeTexture; }
 
//default properties - none of note
defaultproperties
{
}

No matter what type of node is set up, the name, description, address, and texture are stored in my variables MyNodeName, MyNodeDesc, MyNodeAddress, MyNodeTexture. Quick, clean, simple.

Although the class is

MyComputerPersonal extends ComputerPersonal

it could also work as

MyComputerSecurity extends ComputerSecurity

NB: I don't think you can easily subclass Computer itself as this will need a new UI class.

IAMME: I don't think so - if you want to make one with a new skin you can use it's super's UI.