////////////////////////////////////////////////////////////////////////////// // // File : chess_piece.skrit // Author(s): Mcarp, Brkopac // ////////////////////////////////////////////////////////////////////////////// // Include Libraries // Include Custom Component Tags Property Bool _server_only$ = FALSE; // Custom Functions // Global Variables Owner = GoSkritComponent; Goid m_Owner$; Go m_Actor$; Startup State STARTUP$ { Trigger OnGoHandleMessage$ ( WE_ENTERED_WORLD ) { // Declare the go that this skrit is attachted to m_Owner$ = Owner.Goid; // Switch states SetState ( Wait$ ); return; } } State Wait$ { //Report.Screen ( "Entered the Wait$ State" ); // Wait for a message to take place Event OnGoHandleMessage$ ( eWorldEvent e$, WorldMessage /*msg$*/ ) { // On which message, what should we do? if ( e$ == WE_REQ_USE ) { // We hovered the go in question, move states //Report.Screen ( "Mouse was hovered over the piece" ); // Declare the actor m_Actor$ = Server.ScreenHero; if ( m_Actor$ == NULL ) { //Report.Screen ( "[Chess_Piece] - m_Actor$ is NULL" ); // End the skrit return; } // Move states SetState ( Spawn$ ); return; } } } State Spawn$ { Event OnEnterState$ { //Report.Screen ( "Entered the Spawn$ state$" ); //my GoCloneReq Req$; //Req$.Init ( m_Owner$.Go.GetTemplateName() ); //Req$.SetPrepareToDrawNow = True; SiegePos pos$ = m_Actor$.Placement.Position; //Req$.SetStartingOrient = owner.Go.Placement.Orientation; //Req$.SnapToTerrain = true; //Goid p_Goid$ = GoDb.CloneLocalGo ( req$ ); //if ( p_Goid$ != NULL ) //{ //Report.Screen ( "[Chess_Piece] - p_Goid$ is valid!" ); // Delete the the object //PostWorldMessage ( WE_REQ_DELETE, m_Owner$, m_Owner$, 0.1 ); //} owner.Go.Mind.RSSetMovementOrders( MO_LIMITED ); owner.Go.Mind.RSMove( pos$, QP_CLEAR, AO_REFLEX, owner.Goid ); SetState ( Wait$ ); return; } }