mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
107 lines
2.7 KiB
Plaintext
107 lines
2.7 KiB
Plaintext
/**
|
|
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
|
|
* All Rights Reserved
|
|
*
|
|
* Title: magic_eight_ball.script
|
|
* DesCRiption: when examined displays a special message randomly picked
|
|
* from 50 predefined messages
|
|
* @author $AutHor: Matthew Kwid$
|
|
* @version $Revision:$
|
|
*/
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
|
|
include library.utils;
|
|
include library.colors;
|
|
include library.firework;
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
|
|
|
|
/***** TRIGGERS ********************************************************/
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
detachScript(self, firework.SCRIPT_PLAYER);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/***** SINGLE LAUNCH HANDLERS ********************************************************/
|
|
messageHandler handleFireworkPrepare()
|
|
{
|
|
if ( params == null || params.isEmpty() )
|
|
{
|
|
firework.dud(self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int posture = getPosture(self);
|
|
params.put("posture", posture);
|
|
|
|
float delay = 2f;
|
|
if ( posture != POSTURE_CROUCHED )
|
|
{
|
|
queueCommand(self, ##"kneel", null, "", COMMAND_PRIORITY_DEFAULT);
|
|
}
|
|
else
|
|
{
|
|
delay = 0f;
|
|
}
|
|
|
|
float yaw = getYaw(self);
|
|
params.put("yaw", yaw);
|
|
|
|
messageTo(self, firework.HANDLER_FIREWORK_LAUNCH, params, delay, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handleFireworkLaunch()
|
|
{
|
|
if ( params == null || params.isEmpty() )
|
|
{
|
|
firework.dud(self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
doAnimationAction(self, "manipulate_low");
|
|
|
|
location there = utils.findLocInFrontOfTarget(self, 0.75f);
|
|
if ( there == null )
|
|
there = getLocation(self);
|
|
|
|
params.put("loc", there);
|
|
|
|
string fx = params.getString("fx");
|
|
string template = dataTableGetString(firework.TBL_FX, fx, "template");
|
|
if ( template == null || template.equals("") )
|
|
template = dataTableGetString(firework.TBL_FX, "default", "template");
|
|
|
|
//debugSpeakMsg(self, "attempting to launch firework template: " + template);
|
|
obj_id ignition = createObject(template, there);
|
|
if ( isIdValid(ignition) )
|
|
attachScript(ignition, firework.SCRIPT_FIREWORK_CLEANUP);
|
|
|
|
messageTo(self, firework.HANDLER_FIREWORK_CLEANUP, params, 2f, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handleFireworkCleanup()
|
|
{
|
|
if ( params == null || params.isEmpty() )
|
|
{
|
|
firework.dud(self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int posture = params.getInt("posture");
|
|
if ( posture != POSTURE_CROUCHED )
|
|
queueCommand(self, ##"stand", null, "", COMMAND_PRIORITY_DEFAULT);
|
|
|
|
firework.decrementFireworkCount(self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/***** SHOW LAUNCH HANDLERS ********************************************************/
|