# SFScoutBot.SFScoutBotRemote

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 |
    //=============================================================================
    // Spatial Fear
    // Class: SFScoutBotController
    // Description: A device that lets a player to take control of a ScoutBot.
    //              You have to set "event" of this to "tag" of ScoutBot that will
    //              be controlled. When a ScoutBot linked to a remote is
    //              destryed, remote is removed from inventory.
    //
    //
    // Code:  Jacek Zagrodzki
    // Model: Ivan Tanzuira
    //=============================================================================
    class SFScoutBotRemote expands SFPickup;

    #exec MESH IMPORT MESH=SFBotRemote ANIVFILE=MODELS\SFBotRemote_a.3d DATAFILE=MODELS\SFBotRemote_d.3d X=0 Y=0 Z=0
    #exec MESH ORIGIN MESH=SFBotRemote X=0 Y=0 Z=0

    #exec MESH SEQUENCE MESH=SFBotRemote SEQ=All         STARTFRAME=0 NUMFRAMES=1
    #exec MESH SEQUENCE MESH=SFBotRemote SEQ=SFBotRemote STARTFRAME=0 NUMFRAMES=1

    #exec TEXTURE IMPORT NAME=JSFBotRemote FILE=TEXTURES\SFBotRemote.PCX GROUP=Skins FLAGS=2

    #exec MESHMAP NEW   MESHMAP=SFBotRemote MESH=SFBotRemote
    #exec MESHMAP SCALE MESHMAP=SFBotRemote X=0.025 Y=0.025 Z=0.05

    #exec MESHMAP SETTEXTURE MESHMAP=SFBotRemote NUM=1 TEXTURE=JSFBotRemote

    var SFScoutBot		TargetBot;
    var SFPlayer		OwnerPlayer;		// transistent ot cos takiego :)  FIX ME

    var bool			bAdvancedTarget;		// if TRUE, TargetBot is pointing to SFAdvancedScoutBot, if FALSE - to SFScoutBot
    								// tez transistent or cos :))

    var travel name		AcrossLevelEvent;	//

    function PostBeginPlay()
    {
    	local vector	SpawnLoc;

    	// searching for the first ScoutBot with matching tag:
    	foreach AllActors(class'SFScoutBot', TargetBot)
    	{
    		if(TargetBot.tag == event)
    		{
    			if(TargetBot.IsA('SFAdvancedScoutBot'))
    				bAdvancedTarget = true;
    			else
    				bAdvancedTarget = false;

    			AcrossLevelEvent = Event;
    			TargetBot.RemoteControl = Self;
    			return;
    		}
    	}

    	// if matching ScoutBot was not found, a new one is spawned near owner player (if there's one):
    	if(OwnerPlayer != none)
    	{
    		SpawnLoc = OwnerPlayer.Location;
    		SpawnLoc.z += 80;

    		TargetBot = spawn(class'SFScoutBot', , , SpawnLoc);
    		TargetBot.RemoteControl = Self;
    	}
    }

    function Activate()
    {
    	if(TargetBot == None)
    		return;

    	Event = AcrossLevelEvent;
    	TargetBot.Tag = Event;
    	TargetBot.Trigger( Self, OwnerPlayer );
    }

    auto state Pickup
    {
    	// overiding this class to prevent auto triggering of a ScoutBot when a controlled is picked up
    	function bool ValidTouch( actor Other )
    	{
    		OwnerPlayer = SFPlayer(Other);	// setting OwnerPlayer when controller is picked up :))

    		if( Other.bIsPawn && Pawn(Other).bIsPlayer && (Pawn(Other).Health > 0) && Level.Game.PickupQuery(Pawn(Other), self) )
    			return true;
    		return false;
    	}
    }

    defaultproperties
    {
         ItemDescription="ScoutBot Remote Control:\nA controller device, used to gain access to the scout bot.\ATTENTION: Linking up to a bot will leaves the user in an unprotected state."
         ItemIcon=Texture'SfResource1.Icons.botremote'
         bIsActiveItem=True
         bManualPickup=True
         PickupViewMesh=LodMesh'SFScoutBot.SFBotRemote'
         Mesh=LodMesh'SFScoutBot.SFBotRemote'
    }

class file time: 12/7/2003 3:58:26 PM - creation time: 12/7/2003 4:03:45 PM
Created with UnCodeX