mirror of
https://github.com/reaaLx/nx1-gsc-dump.git
synced 2025-06-27 14:51:54 +00:00
Init
This commit is contained in:
171
common_scripts/_artcommon.gsc
Normal file
171
common_scripts/_artcommon.gsc
Normal file
@ -0,0 +1,171 @@
|
||||
#include common_scripts\utility;
|
||||
|
||||
artStartVisionFileExport()
|
||||
{
|
||||
fileprint_launcher_start_file();
|
||||
}
|
||||
|
||||
artEndVisionFileExport()
|
||||
{
|
||||
return fileprint_launcher_end_file( "\\share\\raw\\vision\\"+level._script+ ".vision", true );
|
||||
}
|
||||
|
||||
artStartFogFileExport()
|
||||
{
|
||||
fileprint_launcher_start_file();
|
||||
|
||||
}
|
||||
|
||||
artEndFogFileExport()
|
||||
{
|
||||
return fileprint_launcher_end_file( "\\share\\raw\\maps\\createart\\"+level._script+ "_art.gsc", true );
|
||||
}
|
||||
|
||||
artCommonfxprintln( string )
|
||||
{
|
||||
fileprint_launcher( string );
|
||||
}
|
||||
|
||||
|
||||
setfogsliders()
|
||||
{
|
||||
/#
|
||||
fogcolor = getdvarvector( "g_fogColorReadOnly" );
|
||||
maxOpacity = GetDvar( "g_fogMaxOpacityReadOnly" );
|
||||
halfplane = GetDvar( "g_fogHalfDistReadOnly" );
|
||||
nearplane = GetDvar( "g_fogStartDistReadOnly" );
|
||||
|
||||
sunFogEnabled = GetDvar( "g_sunFogEnabledReadOnly" );
|
||||
sunFogColor = getdvarvector( "g_sunFogColorReadOnly" );
|
||||
sunFogDir = getdvarvector( "g_sunFogDirReadOnly" );
|
||||
sunFogBeginFadeAngle = GetDvar( "g_sunFogBeginFadeAngleReadOnly" );
|
||||
sunFogEndFadeAngle = GetDvar( "g_sunFogEndFadeAngleReadOnly" );
|
||||
sunFogScale = GetDvar( "g_sunFogScaleReadOnly" );
|
||||
|
||||
mulFogBlend = GetDvar( "g_mulFogBlendReadOnly" );
|
||||
mulFogNearColor = GetDvar( "g_mulFogNearColorReadOnly" );
|
||||
mulFogFarColor = GetDvar( "g_mulFogFarColorReadOnly" );
|
||||
|
||||
if ( !isdefined( mulFogBlend )
|
||||
|| !isdefined( mulFogNearColor )
|
||||
|| !isdefined( mulFogFarColor )
|
||||
)
|
||||
{
|
||||
mulFogBlend = 0.0;
|
||||
mulFogNearColor = ( 1, 1, 1 );
|
||||
mulFogFarColor = ( 1, 1, 1 );
|
||||
}
|
||||
|
||||
if ( !isdefined( fogcolor )
|
||||
|| !isdefined( maxOpacity )
|
||||
|| !isdefined( halfplane )
|
||||
|| !isdefined( nearplane )
|
||||
|| !isdefined( sunFogEnabled )
|
||||
|| !isdefined( sunFogColor )
|
||||
|| !isdefined( sunFogDir )
|
||||
|| !isdefined( sunFogBeginFadeAngle )
|
||||
|| !isdefined( sunFogEndFadeAngle )
|
||||
|| !isdefined( sunFogScale )
|
||||
)
|
||||
{
|
||||
fogcolor = ( 1, 1, 1 );
|
||||
halfplane = 10000001;
|
||||
nearplane = 10000000;
|
||||
maxOpacity = 1;
|
||||
|
||||
sunFogEnabled = false;
|
||||
sunFogColor = ( 1, 1, 1 );
|
||||
sunFogDir = ( 1.0, 0.0, 0.0 );
|
||||
sunFogBeginFadeAngle = GetDvar( "g_sunFogBeginFadeAngle" );
|
||||
sunFogEndFadeAngle = GetDvar( "g_sunFogEndFadeAngle" );
|
||||
sunFogScale = GetDvar( "g_sunFogScaleReadOnly" );
|
||||
|
||||
}
|
||||
|
||||
SetDevDvar( "scr_fog_exp_halfplane", halfplane );
|
||||
SetDevDvar( "scr_fog_nearplane", nearplane );
|
||||
SetDevDvar( "scr_fog_color", fogcolor );
|
||||
SetDevDvar( "scr_fog_max_opacity", maxOpacity );
|
||||
|
||||
SetDevDvar( "scr_sunFogEnabled", sunFogEnabled );
|
||||
SetDevDvar( "scr_sunFogColor", sunFogColor );
|
||||
SetDevDvar( "scr_sunFogDir", sunFogDir );
|
||||
SetDevDvar( "scr_sunFogBeginFadeAngle", sunFogBeginFadeAngle );
|
||||
SetDevDvar( "scr_sunFogEndFadeAngle", sunFogEndFadeAngle );
|
||||
SetDevDvar( "scr_sunFogScale", sunFogScale );
|
||||
|
||||
SetDevDvar( "scr_mulFogBlend", mulFogBlend );
|
||||
SetDevDvar( "scr_mulFogNearColor", mulFogNearColor );
|
||||
SetDevDvar( "scr_mulFogFarColor", mulFogFarColor );
|
||||
#/
|
||||
}
|
||||
|
||||
|
||||
translateFogSlidersToScript()
|
||||
{
|
||||
level._fogexphalfplane = GetDvarFloat( "scr_fog_exp_halfplane" );
|
||||
level._fognearplane = GetDvarFloat( "scr_fog_nearplane" );
|
||||
level._fogcolor = getdvarvector( "scr_fog_color" );
|
||||
level._fogmaxopacity = GetDvarFloat( "scr_fog_max_opacity" );
|
||||
|
||||
level._sunFogEnabled = GetDvarInt( "scr_sunFogEnabled" );
|
||||
level._sunFogColor = getdvarvector( "scr_sunFogColor" );
|
||||
level._sunFogDir = getdvarvector( "scr_sunFogDir" );
|
||||
level._sunFogBeginFadeAngle = GetDvarFloat( "scr_sunFogBeginFadeAngle" );
|
||||
level._sunFogEndFadeAngle = GetDvarFloat( "scr_sunFogEndFadeAngle" );
|
||||
level._sunFogScale = GetDvarFloat( "scr_sunFogScale" );
|
||||
|
||||
level._mulFogBlend = GetDvarFloat( "scr_mulFogBlend" );
|
||||
level._mulFogNearColor = getdvarvector( "scr_mulFogNearColor" );
|
||||
level._mulFogFarColor = getdvarvector( "scr_mulFogFarColor" );
|
||||
}
|
||||
|
||||
|
||||
updateFogFromScript()
|
||||
{
|
||||
/#
|
||||
if ( GetDvarInt( "scr_cmd_plr_sun" ) )
|
||||
{
|
||||
SetDevDvar( "scr_sunFogDir", AnglesToForward( level._player GetPlayerAngles() ) );
|
||||
SetDevDvar( "scr_cmd_plr_sun", 0 );
|
||||
}
|
||||
|
||||
#/
|
||||
|
||||
if ( ! GetDvarInt( "scr_fog_disable" ) )
|
||||
{
|
||||
if ( level._sunFogEnabled )
|
||||
SetExpFog( level._fognearplane, level._fogexphalfplane, level._fogcolor[ 0 ], level._fogcolor[ 1 ], level._fogcolor[ 2 ], level._fogmaxopacity, 0,
|
||||
level._mulFogBlend, 0, level._mulFogNearColor[ 0 ], level._mulFogNearColor[ 1 ], level._mulFogNearColor[ 2 ], level._mulFogFarColor[ 0 ], level._mulFogFarColor[ 1 ], level._mulFogFarColor[ 2 ],
|
||||
level._sunFogColor[ 0 ], level._sunFogColor[ 1 ], level._sunFogColor[ 2 ], level._sunFogDir, level._sunFogBeginFadeAngle, level._sunFogEndFadeAngle, level._sunFogScale );
|
||||
else
|
||||
SetExpFog( level._fognearplane, level._fogexphalfplane, level._fogcolor[ 0 ], level._fogcolor[ 1 ], level._fogcolor[ 2 ], level._fogmaxopacity, 0,
|
||||
level._mulFogBlend, 0, level._mulFogNearColor[ 0 ], level._mulFogNearColor[ 1 ], level._mulFogNearColor[ 2 ], level._mulFogFarColor[ 0 ], level._mulFogFarColor[ 1 ], level._mulFogFarColor[ 2 ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetExpFog( 1000000000, 1000000001, 0, 0, 0, 0, 0 );// couldn't find discreet fog disabling other than to never set it in the first place
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
artfxprintlnFog()
|
||||
{
|
||||
fileprint_launcher( "" );
|
||||
fileprint_launcher( "\t//* Fog section * " );
|
||||
fileprint_launcher( "" );
|
||||
|
||||
fileprint_launcher( "\tsetDevDvar( \"scr_fog_disable\"" + ", " + "\"" + GetDvarInt( "scr_fog_disable" ) + "\"" + " );" );
|
||||
|
||||
fileprint_launcher( "" );
|
||||
if ( ! GetDvarInt( "scr_fog_disable" ) )
|
||||
{
|
||||
if ( level._sunFogEnabled )
|
||||
fileprint_launcher( "\tsetExpFog( " + level._fognearplane + ", " + level._fogexphalfplane + ", " + level._fogcolor[0] + ", " + level._fogcolor[1] + ", " + level._fogcolor[2] + ", " + level._fogmaxopacity + ", 0, " +
|
||||
level._mulFogBlend + ", 0, " + level._mulFogNearColor[0] + ", " + level._mulFogNearColor[1] + ", " + level._mulFogNearColor[2] + ", " + level._mulFogFarColor[0] + ", " + level._mulFogFarColor[1] + ", " + level._mulFogFarColor[2] + ", " +
|
||||
level._sunFogColor[0] + ", " + level._sunFogColor[1] + ", " + level._sunFogColor[2] + ", (" + level._sunFogDir[0] + ", " + level._sunFogDir[1] + ", " + level._sunFogDir[2] + "), " + level._sunFogBeginFadeAngle + ", " + level._sunFogEndFadeAngle + ", " + level._sunFogScale + " );" );
|
||||
else
|
||||
fileprint_launcher( "\tsetExpFog( " + level._fognearplane + ", " + level._fogexphalfplane + ", " + level._fogcolor[0] + ", " + level._fogcolor[1] + ", " + level._fogcolor[2] + ", " + level._fogmaxopacity + ", 0, " +
|
||||
level._mulFogBlend + ", 0, " + level._mulFogNearColor[0] + ", " + level._mulFogNearColor[1] + ", " + level._mulFogNearColor[2] + ", " + level._mulFogFarColor[0] + ", " + level._mulFogFarColor[1] + ", " + level._mulFogFarColor[2] + ");" );
|
||||
}
|
||||
}
|
1981
common_scripts/_createfx.gsc
Normal file
1981
common_scripts/_createfx.gsc
Normal file
File diff suppressed because it is too large
Load Diff
638
common_scripts/_createfxmenu.gsc
Normal file
638
common_scripts/_createfxmenu.gsc
Normal file
@ -0,0 +1,638 @@
|
||||
#include common_scripts\utility;
|
||||
#include common_scripts\_createfx;
|
||||
|
||||
menu( name )
|
||||
{
|
||||
return level._create_fx_menu == name;
|
||||
}
|
||||
|
||||
setmenu( name )
|
||||
{
|
||||
level._create_fx_menu = name;
|
||||
}
|
||||
|
||||
create_fx_menu()
|
||||
{
|
||||
if ( button_is_clicked( "escape", "x" ) )
|
||||
{
|
||||
exit_menu();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( menu( "creation" ) )
|
||||
{
|
||||
if ( button_is_clicked( "1" ) )
|
||||
{
|
||||
setmenu( "create_oneshot" );
|
||||
draw_effects_list();
|
||||
return;
|
||||
}
|
||||
else if ( button_is_clicked( "2" ) )
|
||||
{
|
||||
setmenu( "create_exploder" );
|
||||
ent = createNewExploder();
|
||||
finish_creating_entity( ent );
|
||||
return;
|
||||
}
|
||||
else if ( button_is_clicked( "3" ) )
|
||||
{
|
||||
setmenu( "create_loopsound" );
|
||||
ent = createLoopSound();
|
||||
finish_creating_entity( ent );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ( menu( "create_oneshot" ) || menu( "create_loopfx" ) || menu( "change_fxid" ) )
|
||||
{
|
||||
if ( button_is_clicked( "m" ) )
|
||||
{
|
||||
increment_list_offset();
|
||||
draw_effects_list();
|
||||
}
|
||||
|
||||
menu_fx_creation();
|
||||
}
|
||||
else if ( menu( "none" ) )
|
||||
{
|
||||
if ( button_is_clicked( "m" ) )
|
||||
increment_list_offset();
|
||||
|
||||
// change selected entities
|
||||
menu_change_selected_fx();
|
||||
|
||||
// if there's a selected ent then display the info on the last one to be selected
|
||||
if ( entities_are_selected() )
|
||||
{
|
||||
last_selected_ent = get_last_selected_entity();
|
||||
|
||||
// only update hudelems when we have new info
|
||||
// if ( !IsDefined( level._last_displayed_ent ) || last_selected_ent != level._last_displayed_ent )
|
||||
|
||||
// now we always update it
|
||||
if ( IsDefined( last_selected_ent ) )
|
||||
{
|
||||
display_fx_info( last_selected_ent );
|
||||
level._last_displayed_ent = last_selected_ent;
|
||||
}
|
||||
|
||||
if ( button_is_clicked( "a" ) )
|
||||
{
|
||||
clear_settable_fx();
|
||||
setMenu( "add_options" );
|
||||
}
|
||||
else if ( button_is_clicked( "t" ) )
|
||||
{
|
||||
display_fx_type_options();
|
||||
setMenu( "type_list" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( menu( "add_options" ) )
|
||||
{
|
||||
if ( !entities_are_selected() )
|
||||
{
|
||||
clear_fx_hudElements();
|
||||
setMenu( "none" );
|
||||
return;
|
||||
}
|
||||
|
||||
display_fx_add_options( get_last_selected_entity() );
|
||||
|
||||
if ( button_is_clicked( "m" ) )
|
||||
{
|
||||
increment_list_offset();
|
||||
// draw_effects_list();
|
||||
}
|
||||
}
|
||||
else if ( menu( "type_list" ) )
|
||||
{
|
||||
processed = 0;
|
||||
last_selected_ent = get_last_selected_entity();
|
||||
|
||||
if ( button_is_clicked( "1" ) )
|
||||
{
|
||||
// switch to Ambient/OneShot fx
|
||||
if ( last_selected_ent.v[ "type" ] != "oneshotfx" )
|
||||
{
|
||||
// build new entity
|
||||
new_ent = CreateOneShotEntity();
|
||||
clone_entity_oneshot( last_selected_ent, new_ent );
|
||||
|
||||
// remove old entity
|
||||
delete_selection();
|
||||
clear_entity_selection();
|
||||
select_last_entity();
|
||||
update_selected_entities();
|
||||
}
|
||||
|
||||
processed = 1;
|
||||
}
|
||||
else if ( button_is_clicked( "2" ) )
|
||||
{
|
||||
// switch to Scripted/Exploder fx
|
||||
if ( last_selected_ent.v[ "type" ] != "exploder" )
|
||||
{
|
||||
// build new entity
|
||||
new_ent = createNewExploder();
|
||||
clone_entity_exploder( last_selected_ent, new_ent );
|
||||
|
||||
// remove old entity
|
||||
delete_selection();
|
||||
clear_entity_selection();
|
||||
select_last_entity();
|
||||
update_selected_entities();
|
||||
}
|
||||
|
||||
processed = 1;
|
||||
}
|
||||
else if ( button_is_clicked( "x" ) )
|
||||
{
|
||||
processed = 1;
|
||||
}
|
||||
|
||||
last_selected_ent = get_last_selected_entity();
|
||||
|
||||
if ( processed == 1 )
|
||||
{
|
||||
clear_fx_hudElements();
|
||||
display_fx_info( last_selected_ent );
|
||||
setMenu( "none" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit_menu()
|
||||
{
|
||||
clear_fx_hudElements();
|
||||
clear_entity_selection();
|
||||
update_selected_entities();
|
||||
setmenu( "none" );
|
||||
}
|
||||
|
||||
get_last_selected_entity()
|
||||
{
|
||||
return level._selected_fx_ents[ level._selected_fx_ents.size - 1 ];
|
||||
}
|
||||
|
||||
menu_fx_creation()
|
||||
{
|
||||
count = 0;
|
||||
picked_fx = undefined;
|
||||
keys = func_get_level_fx();
|
||||
|
||||
for ( i = level._effect_list_offset; i < keys.size; i++ )
|
||||
{
|
||||
count = count + 1;
|
||||
button_to_check = count;
|
||||
if ( button_to_check == 10 )
|
||||
button_to_check = 0;
|
||||
if ( button_is_clicked( button_to_check + "" ) )
|
||||
{
|
||||
picked_fx = keys[ i ];
|
||||
break;
|
||||
}
|
||||
|
||||
if ( count > level._effect_list_offset_max )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !isdefined( picked_fx ) )
|
||||
return;
|
||||
|
||||
if ( menu( "change_fxid" ) )
|
||||
{
|
||||
apply_option_to_selected_fx( get_option( "fxid" ), picked_fx );
|
||||
level._effect_list_offset = 0;
|
||||
clear_fx_hudElements();
|
||||
setMenu( "none" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ent = undefined;
|
||||
if ( menu( "create_loopfx" ) )
|
||||
ent = createLoopEffect( picked_fx );
|
||||
if ( menu( "create_oneshot" ) )
|
||||
ent = createOneshotEffect( picked_fx );
|
||||
|
||||
finish_creating_entity( ent );
|
||||
}
|
||||
|
||||
clone_entity_oneshot( ent_src, ent_dst )
|
||||
{
|
||||
ent_dst.v = ent_src.v;
|
||||
ent_dst.v[ "type" ] = "oneshotfx";
|
||||
ent_dst.v[ "delay" ] = -15;
|
||||
|
||||
ent_dst post_entity_creation_function();
|
||||
}
|
||||
|
||||
clone_entity_exploder( ent_src, ent_dst )
|
||||
{
|
||||
ent_dst.v = ent_src.v;
|
||||
ent_dst.v[ "type" ] = "exploder";
|
||||
ent_dst.v[ "delay" ] = 0;
|
||||
ent_dst.v[ "exploder" ] = 1;
|
||||
ent_dst.v[ "exploder_type" ] = "normal";
|
||||
|
||||
ent_dst post_entity_creation_function();
|
||||
}
|
||||
|
||||
finish_creating_entity( ent )
|
||||
{
|
||||
ent.v[ "angles" ] = vectortoangles( ( ent.v[ "origin" ] + ( 0, 0, 100 ) ) - ent.v[ "origin" ] );
|
||||
assert( isdefined( ent ) );
|
||||
ent post_entity_creation_function();// for createfx dev purposes
|
||||
clear_entity_selection();
|
||||
select_last_entity();
|
||||
move_selection_to_cursor();
|
||||
update_selected_entities();
|
||||
setMenu( "none" );
|
||||
}
|
||||
|
||||
menu_init()
|
||||
{
|
||||
level._createFX_options = [];
|
||||
// each option has a type, a name its stored under, a description, a default, and a mask it uses to determine
|
||||
// which types of fx can have this option
|
||||
addOption( "string", "fxid", "The FX", "nil", "fx" );
|
||||
addOption( "float", "delay", "Repeat rate/start delay", 0.5, "fx" );
|
||||
addOption( "float", "fire_range", "Fire damage range", 0, "fx" );
|
||||
addOption( "string", "flag", "Flag", "nil", "exploder" );
|
||||
|
||||
addOption( "string", "firefx", "2nd FX id", "nil", "exploder" );
|
||||
addOption( "float", "firefxdelay", "2nd FX id repeat rate", 0.5, "exploder" );
|
||||
addOption( "float", "firefxtimeout", "2nd FX timeout", 5, "exploder" );
|
||||
addOption( "string", "firefxsound", "2nd FX soundalias", "nil", "exploder" );
|
||||
addOption( "float", "damage", "Radius damage", 150, "exploder" );
|
||||
addOption( "float", "damage_radius", "Radius of radius damage", 250, "exploder" );
|
||||
addOption( "float", "delay_min", "Minimimum time between repeats", 1, "exploder" );
|
||||
addOption( "float", "delay_max", "Maximum time between repeats", 2, "exploder" );
|
||||
addOption( "int", "repeat", "Number of times to repeat", 5, "exploder" );
|
||||
addOption( "string", "exploder", "Exploder", 1, "exploder" );
|
||||
addOption( "string", "earthquake", "Earthquake", "nil", "exploder" );
|
||||
|
||||
if( !level._mp_createfx )
|
||||
addOption( "string", "rumble", "Rumble", "nil", "exploder" );
|
||||
addOption( "string", "ender", "Level notify for ending 2nd FX", "nil", "exploder" );
|
||||
|
||||
addOption( "string", "soundalias", "Soundalias", "nil", "all" );
|
||||
addOption( "string", "loopsound", "Loopsound", "nil", "exploder" );
|
||||
|
||||
if( !level._mp_createfx )
|
||||
addOption( "int", "stoppable", "Can be stopped from script", 1, "all" );
|
||||
|
||||
level._effect_list_offset = 0;
|
||||
level._effect_list_offset_max = 10;
|
||||
|
||||
|
||||
// creates mask groups. For example if the above says its mask is "fx", then all the types under "fx" can use the option
|
||||
level._createfxMasks = [];
|
||||
level._createfxMasks[ "all" ] = [];
|
||||
level._createfxMasks[ "all" ][ "exploder" ] = true;
|
||||
level._createfxMasks[ "all" ][ "oneshotfx" ] = true;
|
||||
level._createfxMasks[ "all" ][ "loopfx" ] = true;
|
||||
level._createfxMasks[ "all" ][ "soundfx" ] = true;
|
||||
|
||||
level._createfxMasks[ "fx" ] = [];
|
||||
level._createfxMasks[ "fx" ][ "exploder" ] = true;
|
||||
level._createfxMasks[ "fx" ][ "oneshotfx" ] = true;
|
||||
level._createfxMasks[ "fx" ][ "loopfx" ] = true;
|
||||
|
||||
level._createfxMasks[ "exploder" ] = [];
|
||||
level._createfxMasks[ "exploder" ][ "exploder" ] = true;
|
||||
|
||||
level._createfxMasks[ "loopfx" ] = [];
|
||||
level._createfxMasks[ "loopfx" ][ "loopfx" ] = true;
|
||||
|
||||
level._createfxMasks[ "oneshotfx" ] = [];
|
||||
level._createfxMasks[ "oneshotfx" ][ "oneshotfx" ] = true;
|
||||
|
||||
level._createfxMasks[ "soundfx" ] = [];
|
||||
level._createfxMasks[ "soundfx" ][ "soundalias" ] = true;
|
||||
}
|
||||
|
||||
get_last_selected_ent()
|
||||
{
|
||||
return level._selected_fx_ents[ level._selected_fx_ents.size - 1 ];
|
||||
}
|
||||
|
||||
entities_are_selected()
|
||||
{
|
||||
return level._selected_fx_ents.size > 0;
|
||||
}
|
||||
|
||||
menu_change_selected_fx()
|
||||
{
|
||||
if ( !level._selected_fx_ents.size )
|
||||
return;
|
||||
|
||||
count = 0;
|
||||
drawnCount = 0;
|
||||
ent = get_last_selected_ent();
|
||||
|
||||
for ( i = 0; i < level._createFX_options.size; i++ )
|
||||
{
|
||||
option = level._createFX_options[ i ];
|
||||
if ( !isdefined( ent.v[ option[ "name" ] ] ) )
|
||||
continue;
|
||||
count++ ;
|
||||
if ( count < level._effect_list_offset )
|
||||
continue;
|
||||
|
||||
drawnCount++ ;
|
||||
button_to_check = drawnCount;
|
||||
if ( button_to_check == 10 )
|
||||
button_to_check = 0;
|
||||
|
||||
if ( button_is_clicked( button_to_check + "" ) )
|
||||
{
|
||||
prepare_option_for_change( option, drawnCount );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( drawnCount > level._effect_list_offset_max )
|
||||
{
|
||||
more = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prepare_option_for_change( option, drawnCount )
|
||||
{
|
||||
if ( option[ "name" ] == "fxid" )
|
||||
{
|
||||
setMenu( "change_fxid" );
|
||||
draw_effects_list();
|
||||
return;
|
||||
}
|
||||
|
||||
createfx_centerprint( "To change " + option[ "description" ] + " on selected entities, type /fx newvalue" );
|
||||
level._createfx_inputlocked = true;
|
||||
set_option_index( option[ "name" ] );
|
||||
setdvar( "fx", "nil" );
|
||||
// change color of text to look selected
|
||||
level._createFxHudElements[ drawnCount + 3 ][ 0 ].color = ( 1, 1, 0 );
|
||||
}
|
||||
|
||||
menu_fx_option_set()
|
||||
{
|
||||
if ( getdvar( "fx" ) == "nil" )
|
||||
return;
|
||||
|
||||
option = get_selected_option();
|
||||
setting = undefined;
|
||||
if ( option[ "type" ] == "string" )
|
||||
setting = getdvar( "fx" );
|
||||
if ( option[ "type" ] == "int" )
|
||||
setting = getdvarint( "fx" );
|
||||
if ( option[ "type" ] == "float" )
|
||||
setting = getdvarfloat( "fx" );
|
||||
|
||||
apply_option_to_selected_fx( option, setting );
|
||||
}
|
||||
|
||||
apply_option_to_selected_fx( option, setting )
|
||||
{
|
||||
for ( i = 0; i < level._selected_fx_ents.size; i++ )
|
||||
{
|
||||
ent = level._selected_fx_ents[ i ];
|
||||
|
||||
if ( mask( option[ "mask" ], ent.v[ "type" ] ) )
|
||||
ent.v[ option[ "name" ] ] = setting;
|
||||
}
|
||||
|
||||
level._last_displayed_ent = undefined; // needed to force a redraw of the last display ent
|
||||
update_selected_entities();
|
||||
clear_settable_fx();
|
||||
}
|
||||
|
||||
set_option_index( name )
|
||||
{
|
||||
for ( i = 0; i < level._createFX_options.size; i++ )
|
||||
{
|
||||
if ( level._createFX_options[ i ][ "name" ] != name )
|
||||
continue;
|
||||
|
||||
level._selected_fx_option_index = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
get_selected_option()
|
||||
{
|
||||
return level._createFX_options[ level._selected_fx_option_index ];
|
||||
}
|
||||
|
||||
mask( type, name )
|
||||
{
|
||||
return isdefined( level._createfxMasks[ type ][ name ] );
|
||||
}
|
||||
|
||||
addOption( type, name, description, defaultSetting, mask )
|
||||
{
|
||||
option = [];
|
||||
option[ "type" ] = type;
|
||||
option[ "name" ] = name;
|
||||
option[ "description" ] = description;
|
||||
option[ "default" ] = defaultSetting;
|
||||
option[ "mask" ] = mask;
|
||||
level._createFX_options[ level._createFX_options.size ] = option;
|
||||
}
|
||||
|
||||
get_option( name )
|
||||
{
|
||||
for ( i = 0; i < level._createFX_options.size; i++ )
|
||||
{
|
||||
if ( level._createFX_options[ i ][ "name" ] == name )
|
||||
return level._createFX_options[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
display_fx_info( ent )
|
||||
{
|
||||
// are we doing the create fx menu right now?
|
||||
if ( !menu( "none" ) )
|
||||
return;
|
||||
|
||||
clear_fx_hudElements();
|
||||
|
||||
set_fx_hudElement( "Name: " + ent.v[ "fxid" ] );
|
||||
set_fx_hudElement( "Type: " + ent.v[ "type" ] );
|
||||
set_fx_hudElement( "Origin: " + ent.v[ "origin" ] );
|
||||
set_fx_hudElement( "Angles: " + ent.v[ "angles" ] );
|
||||
|
||||
if ( entities_are_selected() )
|
||||
{
|
||||
// if entities are selected then we make the entity stats modifiable
|
||||
count = 0;
|
||||
drawnCount = 0;
|
||||
more = false;
|
||||
for ( i = 0; i < level._createFX_options.size; i++ )
|
||||
{
|
||||
option = level._createFX_options[ i ];
|
||||
if ( !isdefined( ent.v[ option[ "name" ] ] ) )
|
||||
continue;
|
||||
count++ ;
|
||||
if ( count < level._effect_list_offset )
|
||||
continue;
|
||||
|
||||
drawnCount++ ;
|
||||
|
||||
//set_fx_hudElement( drawnCount + ". " + option[ "description" ] + ": " + ent.v[ option[ "name" ] ] );
|
||||
set_fx_hudElement( "(" + drawnCount + ") " + option[ "description" ] + ": " + ent.v[ option[ "name" ] ] );
|
||||
|
||||
if ( drawnCount > level._effect_list_offset_max )
|
||||
{
|
||||
more = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count > level._effect_list_offset_max )
|
||||
set_fx_hudElement( "(m) More >" );
|
||||
|
||||
set_fx_hudElement( "(a) Add >" );
|
||||
set_fx_hudElement( "(t) Change Type >" );
|
||||
set_fx_hudElement( "(x) Exit >" );
|
||||
}
|
||||
else
|
||||
{
|
||||
count = 0;
|
||||
more = false;
|
||||
for ( i = 0; i < level._createFX_options.size; i++ )
|
||||
{
|
||||
option = level._createFX_options[ i ];
|
||||
if ( !isdefined( ent.v[ option[ "name" ] ] ) )
|
||||
continue;
|
||||
count++ ;
|
||||
set_fx_hudElement( option[ "description" ] + ": " + ent.v[ option[ "name" ] ] );
|
||||
if ( count > level._createFx_hudElements )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
display_fx_add_options( ent )
|
||||
{
|
||||
// are we doing the create fx menu right now?
|
||||
assert( menu( "add_options" ) );
|
||||
assert( entities_are_selected() );
|
||||
|
||||
clear_fx_hudElements();
|
||||
set_fx_hudElement( "Name: " + ent.v[ "fxid" ] );
|
||||
set_fx_hudElement( "Type: " + ent.v[ "type" ] );
|
||||
set_fx_hudElement( "Origin: " + ent.v[ "origin" ] );
|
||||
set_fx_hudElement( "Angles: " + ent.v[ "angles" ] );
|
||||
|
||||
// if entities are selected then we make the entity stats modifiable
|
||||
count = 0;
|
||||
drawnCount = 0;
|
||||
more = false;
|
||||
|
||||
if ( level._effect_list_offset >= level._createFX_options.size )
|
||||
level._effect_list_offset = 0;
|
||||
|
||||
for ( i = 0; i < level._createFX_options.size; i++ )
|
||||
{
|
||||
option = level._createFX_options[ i ];
|
||||
if ( isdefined( ent.v[ option[ "name" ] ] ) )
|
||||
continue;
|
||||
|
||||
// does this type of effect get this kind of option?
|
||||
if ( !mask( option[ "mask" ], ent.v[ "type" ] ) )
|
||||
continue;
|
||||
|
||||
count++ ;
|
||||
if ( count < level._effect_list_offset )
|
||||
continue;
|
||||
if ( drawnCount >= level._effect_list_offset_max )
|
||||
continue;
|
||||
|
||||
drawnCount++ ;
|
||||
button_to_check = drawnCount;
|
||||
if ( button_to_check == 10 )
|
||||
button_to_check = 0;
|
||||
if ( button_is_clicked( button_to_check + "" ) )
|
||||
{
|
||||
add_option_to_selected_entities( option );
|
||||
// prepare_option_for_change( option, drawnCount );
|
||||
menuNone();
|
||||
level._last_displayed_ent = undefined; // needed to force a redraw of the last display ent
|
||||
return;
|
||||
}
|
||||
|
||||
set_fx_hudElement( button_to_check + ". " + option[ "description" ] );
|
||||
}
|
||||
|
||||
if ( count > level._effect_list_offset_max )
|
||||
set_fx_hudElement( "(m) More >" );
|
||||
|
||||
set_fx_hudElement( "(x) Exit >" );
|
||||
}
|
||||
|
||||
display_fx_type_options()
|
||||
{
|
||||
clear_fx_hudElements();
|
||||
set_fx_hudElement( "(1) Ambient/OneShot fx" );
|
||||
set_fx_hudElement( "(2) Scripted/Exploder fx" );
|
||||
set_fx_hudElement( "(x) Exit" );
|
||||
}
|
||||
|
||||
add_option_to_selected_entities( option )
|
||||
{
|
||||
setting = undefined;
|
||||
for ( i = 0; i < level._selected_fx_ents.size; i++ )
|
||||
{
|
||||
ent = level._selected_fx_ents[ i ];
|
||||
|
||||
if ( mask( option[ "mask" ], ent.v[ "type" ] ) )
|
||||
ent.v[ option[ "name" ] ] = option[ "default" ];
|
||||
}
|
||||
}
|
||||
|
||||
menuNone()
|
||||
{
|
||||
level._effect_list_offset = 0;
|
||||
clear_fx_hudElements();
|
||||
setMenu( "none" );
|
||||
}
|
||||
|
||||
|
||||
draw_effects_list()
|
||||
{
|
||||
|
||||
clear_fx_hudElements();
|
||||
|
||||
set_fx_hudElement( "Pick an effect:" );
|
||||
count = 0;
|
||||
more = false;
|
||||
|
||||
keys = func_get_level_fx();
|
||||
|
||||
if ( level._effect_list_offset >= keys.size )
|
||||
level._effect_list_offset = 0;
|
||||
|
||||
for ( i = level._effect_list_offset; i < keys.size; i++ )
|
||||
{
|
||||
count = count + 1;
|
||||
set_fx_hudElement( count + ". " + keys[ i ] );
|
||||
if ( count >= level._effect_list_offset_max )
|
||||
{
|
||||
more = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( keys.size > level._effect_list_offset_max )
|
||||
set_fx_hudElement( "(m) More >" );
|
||||
}
|
||||
|
||||
increment_list_offset()
|
||||
{
|
||||
level._effect_list_offset += level._effect_list_offset_max;
|
||||
// keys = getarraykeys(level._effect);
|
||||
// if (level.effect_list_offset >= keys.size)
|
||||
// level.effect_list_offset = 0;
|
||||
}
|
3324
common_scripts/_destructible.gsc
Normal file
3324
common_scripts/_destructible.gsc
Normal file
File diff suppressed because it is too large
Load Diff
5211
common_scripts/_destructible_types.gsc
Normal file
5211
common_scripts/_destructible_types.gsc
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@
|
||||
#using_animtree( "destructibles" );
|
||||
main()
|
||||
{
|
||||
level._destructible_preanims[ "ex_airconditioner_fan" ] = %ex_airconditioner_fan;
|
||||
}
|
9
common_scripts/_destructible_types_anim_chicken.gsc
Normal file
9
common_scripts/_destructible_types_anim_chicken.gsc
Normal file
@ -0,0 +1,9 @@
|
||||
#using_animtree( "destructibles" );
|
||||
main()
|
||||
{
|
||||
level._destructible_preanims[ "chicken_cage_loop_01" ] = %chicken_cage_loop_01;
|
||||
level._destructible_preanims[ "chicken_cage_loop_02" ] = %chicken_cage_loop_02;
|
||||
level._destructible_preanims[ "chicken_cage_death" ] = %chicken_cage_death;
|
||||
level._destructible_preanims[ "chicken_cage_death_02" ] = %chicken_cage_death_02;
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#using_animtree( "destructibles" );
|
||||
main()
|
||||
{
|
||||
level._destructible_preanims[ "light_fluorescent_single_swing" ] = %light_fluorescent_single_swing;
|
||||
level._destructible_preanims[ "light_fluorescent_single_null" ] = %light_fluorescent_single_null;
|
||||
level._destructible_preanims[ "light_fluorescent_single_swing_02" ] = %light_fluorescent_single_swing_02;
|
||||
level._destructible_preanims[ "light_fluorescent_single_swing_03" ] = %light_fluorescent_single_swing_03;
|
||||
|
||||
level._effect[ "spotlight_fx" ] = loadfx( "misc/fluorescent_spotlight" );
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
#using_animtree( "destructibles" );
|
||||
main()
|
||||
{
|
||||
level._destructible_preanims[ "me_fanceil1_spin" ] = %me_fanceil1_spin;
|
||||
level._destructible_preanims[ "me_fanceil1_spin_stop" ] = %me_fanceil1_spin_stop;
|
||||
}
|
1548
common_scripts/_dynamic_world.gsc
Normal file
1548
common_scripts/_dynamic_world.gsc
Normal file
File diff suppressed because it is too large
Load Diff
1285
common_scripts/_elevator.gsc
Normal file
1285
common_scripts/_elevator.gsc
Normal file
File diff suppressed because it is too large
Load Diff
518
common_scripts/_fx.gsc
Normal file
518
common_scripts/_fx.gsc
Normal file
@ -0,0 +1,518 @@
|
||||
#include common_scripts\utility;
|
||||
#include common_scripts\_createfx;
|
||||
|
||||
initFX()
|
||||
{
|
||||
if ( !isdefined( level._func ) )
|
||||
{
|
||||
// this array will be filled with code commands that SP or MP may use but doesn't exist in the other.
|
||||
level._func = [];
|
||||
}
|
||||
if( !isdefined( level._func[ "create_triggerfx" ] ) )
|
||||
level._func[ "create_triggerfx" ] = ::create_triggerfx;
|
||||
|
||||
// wrapper for the exploder function so we dont have to use flags and do ifs/waittills on every exploder call
|
||||
level._exploderFunction = ::exploder_before_load;
|
||||
waittillframeend;// Wait one frame so the effects get setup by the maps fx thread
|
||||
waittillframeend;// Wait another frame so effects can be loaded based on start functions. Without this FX are initialiazed before they are defined by start functions.
|
||||
level._exploderFunction = ::exploder_after_load;
|
||||
|
||||
/# setDevDvarIfUninitialized( "scr_map_exploder_dump", 0 ); #/
|
||||
|
||||
for ( i = 0; i < level._createFXent.size; i++ )
|
||||
{
|
||||
ent = level._createFXent[ i ];
|
||||
ent set_forward_and_up_vectors();
|
||||
|
||||
if ( ent.v[ "type" ] == "loopfx" )
|
||||
ent thread loopfxthread();
|
||||
if ( ent.v[ "type" ] == "oneshotfx" )
|
||||
ent thread oneshotfxthread();
|
||||
if ( ent.v[ "type" ] == "soundfx" )
|
||||
ent thread create_loopsound();
|
||||
}
|
||||
}
|
||||
|
||||
print_org( fxcommand, fxId, fxPos, waittime )
|
||||
{
|
||||
if ( GetDvar( "debug" ) == "1" )
|
||||
{
|
||||
println( "{" );
|
||||
println( "\"origin\" \"" + fxPos[ 0 ] + " " + fxPos[ 1 ] + " " + fxPos[ 2 ] + "\"" );
|
||||
println( "\"classname\" \"script_model\"" );
|
||||
println( "\"model\" \"fx\"" );
|
||||
println( "\"script_fxcommand\" \"" + fxcommand + "\"" );
|
||||
println( "\"script_fxid\" \"" + fxId + "\"" );
|
||||
println( "\"script_delay\" \"" + waittime + "\"" );
|
||||
println( "}" );
|
||||
}
|
||||
}
|
||||
|
||||
OneShotfx( fxId, fxPos, waittime, fxPos2 )
|
||||
{
|
||||
// level thread print_org ("OneShotfx", fxId, fxPos, waittime);
|
||||
// level thread OneShotfxthread (fxId, fxPos, waittime, fxPos2);
|
||||
}
|
||||
|
||||
exploderfx( num, fxId, fxPos, waittime, fxPos2, fireFx, fireFxDelay, fireFxSound, fxSound, fxQuake, fxDamage, soundalias, repeat, delay_min, delay_max, damage_radius, fireFxTimeout, exploder_group )
|
||||
{
|
||||
if ( 1 )
|
||||
{
|
||||
ent = createExploder( fxId );
|
||||
ent.v[ "origin" ] = fxPos;
|
||||
ent.v[ "angles" ] = ( 0, 0, 0 );
|
||||
if ( isdefined( fxPos2 ) )
|
||||
ent.v[ "angles" ] = vectortoangles( fxPos2 - fxPos );
|
||||
ent.v[ "delay" ] = waittime;
|
||||
ent.v[ "exploder" ] = num;
|
||||
// deprecated
|
||||
return;
|
||||
}
|
||||
fx = spawn( "script_origin", ( 0, 0, 0 ) );
|
||||
// println ("total ", getentarray ("script_origin","classname").size);
|
||||
fx.origin = fxPos;
|
||||
fx.angles = vectortoangles( fxPos2 - fxPos );
|
||||
// fx.targetname = "exploder";
|
||||
fx.script_exploder = num;
|
||||
fx.script_fxid = fxId;
|
||||
fx.script_delay = waittime;
|
||||
|
||||
fx.script_firefx = fireFx;
|
||||
fx.script_firefxdelay = ( fireFxDelay );// for awhile the script exported strings for this value so we cast it to float
|
||||
fx.script_firefxsound = fireFxSound;
|
||||
|
||||
fx.script_sound = fxSound;
|
||||
fx.script_earthquake = fxQuake;
|
||||
fx.script_damage = ( fxDamage );
|
||||
fx.script_radius = ( damage_radius );
|
||||
fx.script_soundalias = soundalias;
|
||||
fx.script_firefxtimeout = ( fireFxTimeout );
|
||||
fx.script_repeat = ( repeat );
|
||||
fx.script_delay_min = ( delay_min );
|
||||
fx.script_delay_max = ( delay_max );
|
||||
fx.script_exploder_group = exploder_group;
|
||||
|
||||
forward = anglestoforward( fx.angles );
|
||||
forward = vector_multiply( forward, 150 );
|
||||
fx.targetPos = fxPos + forward;
|
||||
|
||||
if ( !isdefined( level._script_exploders ) )
|
||||
level._script_exploders = [];
|
||||
level._script_exploders[ level._script_exploders.size ] = fx;
|
||||
|
||||
createfx_showOrigin( fxid, fxPos, waittime, fxpos2, "exploderfx", fx, undefined, fireFx, fireFxDelay,
|
||||
fireFxSound, fxSound, fxQuake, fxDamage, soundalias, repeat, delay_min, delay_max, damage_radius, fireFxTimeout );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
loopfxRotate(fxId, fxPos, waittime, angle, fxStart, fxStop, timeout)
|
||||
{
|
||||
level thread print_org ("loopfx", fxId, fxPos, waittime);
|
||||
level thread loopfxthread (fxId, fxPos, waittime, fxPos2, fxStart, fxStop, timeout);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
loopfx( fxId, fxPos, waittime, fxPos2, fxStart, fxStop, timeout )
|
||||
{
|
||||
println( "Loopfx is deprecated!" );
|
||||
ent = createLoopEffect( fxId );
|
||||
ent.v[ "origin" ] = fxPos;
|
||||
ent.v[ "angles" ] = ( 0, 0, 0 );
|
||||
if ( isdefined( fxPos2 ) )
|
||||
ent.v[ "angles" ] = vectortoangles( fxPos2 - fxPos );
|
||||
ent.v[ "delay" ] = waittime;
|
||||
}
|
||||
|
||||
/*
|
||||
loopfx(fxId, fxPos, waittime, fxPos2, fxStart, fxStop, timeout)
|
||||
{
|
||||
level thread print_org ("loopfx", fxId, fxPos, waittime);
|
||||
level thread loopfxthread (fxId, fxPos, waittime, fxPos2, fxStart, fxStop, timeout);
|
||||
}
|
||||
*/
|
||||
|
||||
create_looper()
|
||||
{
|
||||
//assert (isdefined(self.looper));
|
||||
self.looper = playLoopedFx( level._effect[ self.v[ "fxid" ] ], self.v[ "delay" ], self.v[ "origin" ], 0, self.v[ "forward" ], self.v[ "up" ] );
|
||||
create_loopsound();
|
||||
}
|
||||
|
||||
create_loopsound()
|
||||
{
|
||||
self notify( "stop_loop" );
|
||||
if ( isdefined( self.v[ "soundalias" ] ) && ( self.v[ "soundalias" ] != "nil" ) )
|
||||
{
|
||||
// tagTP<INFO> - The createfx scripts don't appear to set the "stoppable" flag correctly after a node
|
||||
// tagTP<INFO> - is created, so when the entity was moved, there would be a leftover entity that continued
|
||||
// tagTP<INFO> - to play a copy of the looping sound. So, if createfx is enabled, allow it to be stopped.
|
||||
if (( isdefined( self.v[ "stoppable" ] ) && self.v[ "stoppable" ] ) || level._createFX_enabled )
|
||||
{
|
||||
if ( isdefined( self.looper ) )
|
||||
self.looper thread loop_fx_sound( self.v[ "soundalias" ], self.v[ "origin" ], "death" );
|
||||
else
|
||||
thread loop_fx_sound( self.v[ "soundalias" ], self.v[ "origin" ], "stop_loop" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isdefined( self.looper ) )
|
||||
self.looper thread loop_fx_sound( self.v[ "soundalias" ], self.v[ "origin" ] );
|
||||
else
|
||||
thread loop_fx_sound( self.v[ "soundalias" ], self.v[ "origin" ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loopfxthread()
|
||||
{
|
||||
waitframe();
|
||||
// println ( "fx testing running Id: ", fxId );
|
||||
// if ((isdefined (level.scr_sound)) && (isdefined (level.scr_sound[fxId])))
|
||||
// loopSound(level.scr_sound[fxId], fxPos);
|
||||
|
||||
if ( isdefined( self.fxStart ) )
|
||||
level waittill( "start fx" + self.fxStart );
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
/*
|
||||
if (isdefined (ent.org2))
|
||||
{
|
||||
fxAngle = vectorNormalize (ent.org2 - ent.org);
|
||||
looper = playLoopedFx( level._effect[fxId], ent.delay, ent.org, 0, fxAngle );
|
||||
}
|
||||
else
|
||||
looper = playLoopedFx( level._effect[fxId], ent.delay, ent.org, 0 );
|
||||
*/
|
||||
create_looper();
|
||||
|
||||
if ( isdefined( self.timeout ) )
|
||||
thread loopfxStop( self.timeout );
|
||||
|
||||
if ( isdefined( self.fxStop ) )
|
||||
level waittill( "stop fx" + self.fxStop );
|
||||
else
|
||||
return;
|
||||
|
||||
if ( isdefined( self.looper ) )
|
||||
self.looper delete();
|
||||
|
||||
if ( isdefined( self.fxStart ) )
|
||||
level waittill( "start fx" + self.fxStart );
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
loopfxChangeID( ent )
|
||||
{
|
||||
self endon( "death" );
|
||||
ent waittill( "effect id changed", change );
|
||||
}
|
||||
|
||||
loopfxChangeOrg( ent )
|
||||
{
|
||||
self endon( "death" );
|
||||
for ( ;; )
|
||||
{
|
||||
ent waittill( "effect org changed", change );
|
||||
self.origin = change;
|
||||
}
|
||||
}
|
||||
|
||||
loopfxChangeDelay( ent )
|
||||
{
|
||||
self endon( "death" );
|
||||
ent waittill( "effect delay changed", change );
|
||||
}
|
||||
|
||||
loopfxDeletion( ent )
|
||||
{
|
||||
self endon( "death" );
|
||||
ent waittill( "effect deleted" );
|
||||
self delete();
|
||||
}
|
||||
|
||||
loopfxStop( timeout )
|
||||
{
|
||||
self endon( "death" );
|
||||
wait( timeout );
|
||||
self.looper delete();
|
||||
}
|
||||
|
||||
loopSound( sound, Pos, waittime )
|
||||
{
|
||||
// level thread print_org ("loopSound", sound, Pos, waittime);
|
||||
level thread loopSoundthread( sound, Pos, waittime );
|
||||
}
|
||||
|
||||
loopSoundthread( sound, pos, waittime )
|
||||
{
|
||||
org = spawn( "sound_emitter", ( pos ) );
|
||||
|
||||
org.origin = pos;
|
||||
// println ("hello1 ", org.origin, sound);
|
||||
org playLoopSound( sound );
|
||||
}
|
||||
|
||||
gunfireloopfx( fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax )
|
||||
{
|
||||
thread gunfireloopfxthread( fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax );
|
||||
}
|
||||
|
||||
gunfireloopfxthread( fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax )
|
||||
{
|
||||
level endon( "stop all gunfireloopfx" );
|
||||
waitframe();
|
||||
|
||||
if ( betweenSetsMax < betweenSetsMin )
|
||||
{
|
||||
temp = betweenSetsMax;
|
||||
betweenSetsMax = betweenSetsMin;
|
||||
betweenSetsMin = temp;
|
||||
}
|
||||
|
||||
betweenSetsBase = betweenSetsMin;
|
||||
betweenSetsRange = betweenSetsMax - betweenSetsMin;
|
||||
|
||||
if ( shotdelayMax < shotdelayMin )
|
||||
{
|
||||
temp = shotdelayMax;
|
||||
shotdelayMax = shotdelayMin;
|
||||
shotdelayMin = temp;
|
||||
}
|
||||
|
||||
shotdelayBase = shotdelayMin;
|
||||
shotdelayRange = shotdelayMax - shotdelayMin;
|
||||
|
||||
if ( shotsMax < shotsMin )
|
||||
{
|
||||
temp = shotsMax;
|
||||
shotsMax = shotsMin;
|
||||
shotsMin = temp;
|
||||
}
|
||||
|
||||
shotsBase = shotsMin;
|
||||
shotsRange = shotsMax - shotsMin;
|
||||
|
||||
fxEnt = spawnFx( level._effect[ fxId ], fxPos );
|
||||
|
||||
if ( !level._createFX_enabled )
|
||||
fxEnt willNeverChange();
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
shotnum = shotsBase + randomint( shotsRange );
|
||||
for ( i = 0;i < shotnum;i++ )
|
||||
{
|
||||
triggerFx( fxEnt );
|
||||
|
||||
wait( shotdelayBase + randomfloat( shotdelayRange ) );
|
||||
}
|
||||
wait( betweenSetsBase + randomfloat( betweenSetsRange ) );
|
||||
}
|
||||
}
|
||||
|
||||
gunfireloopfxVec( fxId, fxPos, fxPos2, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax )
|
||||
{
|
||||
thread gunfireloopfxVecthread( fxId, fxPos, fxPos2, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax );
|
||||
}
|
||||
|
||||
gunfireloopfxVecthread( fxId, fxPos, fxPos2, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax )
|
||||
{
|
||||
level endon( "stop all gunfireloopfx" );
|
||||
waitframe();
|
||||
|
||||
if ( betweenSetsMax < betweenSetsMin )
|
||||
{
|
||||
temp = betweenSetsMax;
|
||||
betweenSetsMax = betweenSetsMin;
|
||||
betweenSetsMin = temp;
|
||||
}
|
||||
|
||||
betweenSetsBase = betweenSetsMin;
|
||||
betweenSetsRange = betweenSetsMax - betweenSetsMin;
|
||||
|
||||
if ( shotdelayMax < shotdelayMin )
|
||||
{
|
||||
temp = shotdelayMax;
|
||||
shotdelayMax = shotdelayMin;
|
||||
shotdelayMin = temp;
|
||||
}
|
||||
|
||||
shotdelayBase = shotdelayMin;
|
||||
shotdelayRange = shotdelayMax - shotdelayMin;
|
||||
|
||||
if ( shotsMax < shotsMin )
|
||||
{
|
||||
temp = shotsMax;
|
||||
shotsMax = shotsMin;
|
||||
shotsMin = temp;
|
||||
}
|
||||
|
||||
shotsBase = shotsMin;
|
||||
shotsRange = shotsMax - shotsMin;
|
||||
|
||||
fxPos2 = vectornormalize( fxPos2 - fxPos );
|
||||
|
||||
fxEnt = spawnFx( level._effect[ fxId ], fxPos, fxPos2 );
|
||||
|
||||
if ( !level._createFX_enabled )
|
||||
fxEnt willNeverChange();
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
shotnum = shotsBase + randomint( shotsRange );
|
||||
for ( i = 0;i < int( shotnum / level._fxfireloopmod );i++ )
|
||||
{
|
||||
triggerFx( fxEnt );
|
||||
delay = ( ( shotdelayBase + randomfloat( shotdelayRange ) ) * level._fxfireloopmod );
|
||||
if ( delay < .05 )
|
||||
delay = .05;
|
||||
wait delay;
|
||||
}
|
||||
wait( shotdelayBase + randomfloat( shotdelayRange ) );
|
||||
wait( betweenSetsBase + randomfloat( betweenSetsRange ) );
|
||||
}
|
||||
}
|
||||
|
||||
setfireloopmod( value )
|
||||
{
|
||||
level._fxfireloopmod = 1 / value;
|
||||
}
|
||||
|
||||
setup_fx()
|
||||
{
|
||||
if ( ( !isdefined( self.script_fxid ) ) || ( !isdefined( self.script_fxcommand ) ) || ( !isdefined( self.script_delay ) ) )
|
||||
{
|
||||
// println (self.script_fxid);
|
||||
// println (self.script_fxcommand);
|
||||
// println (self.script_delay);
|
||||
// println ("Effect at origin ", self.origin," doesn't have script_fxid/script_fxcommand/script_delay");
|
||||
// self delete();
|
||||
return;
|
||||
}
|
||||
|
||||
// println ("^a Command:", self.script_fxcommand, " Effect:", self.script_fxID, " Delay:", self.script_delay, " ", self.origin);
|
||||
if ( isdefined( self.model ) )
|
||||
if ( self.model == "toilet" )
|
||||
{
|
||||
self thread burnville_paratrooper_hack();
|
||||
return;
|
||||
}
|
||||
|
||||
org = undefined;
|
||||
if ( isdefined( self.target ) )
|
||||
{
|
||||
ent = getent( self.target, "targetname" );
|
||||
if ( isdefined( ent ) )
|
||||
org = ent.origin;
|
||||
}
|
||||
|
||||
fxStart = undefined;
|
||||
if ( isdefined( self.script_fxstart ) )
|
||||
fxStart = self.script_fxstart;
|
||||
|
||||
fxStop = undefined;
|
||||
if ( isdefined( self.script_fxstop ) )
|
||||
fxStop = self.script_fxstop;
|
||||
|
||||
if ( self.script_fxcommand == "OneShotfx" )
|
||||
OneShotfx( self.script_fxId, self.origin, self.script_delay, org );
|
||||
if ( self.script_fxcommand == "loopfx" )
|
||||
loopfx( self.script_fxId, self.origin, self.script_delay, org, fxStart, fxStop );
|
||||
if ( self.script_fxcommand == "loopsound" )
|
||||
loopsound( self.script_fxId, self.origin, self.script_delay );
|
||||
|
||||
self delete();
|
||||
}
|
||||
|
||||
burnville_paratrooper_hack()
|
||||
{
|
||||
normal = ( 0, 0, self.angles[ 1 ] );
|
||||
// println ("z: paratrooper fx hack: ", normal);
|
||||
id = level._effect[ self.script_fxId ];
|
||||
origin = self.origin;
|
||||
|
||||
// if (isdefined (self.script_delay))
|
||||
// wait (self.script_delay);
|
||||
|
||||
wait 1;
|
||||
level thread burnville_paratrooper_hack_loop( normal, origin, id );
|
||||
self delete();
|
||||
}
|
||||
|
||||
burnville_paratrooper_hack_loop( normal, origin, id )
|
||||
{
|
||||
while ( 1 )
|
||||
{
|
||||
// iprintln ("z: playing paratrooper fx", origin);
|
||||
|
||||
playfx( id, origin );
|
||||
wait( 30 + randomfloat( 40 ) );
|
||||
}
|
||||
}
|
||||
|
||||
create_triggerfx()
|
||||
{
|
||||
//assert (isdefined(self.looper));
|
||||
if( ! verify_effects_assignment( self.v[ "fxid" ] ) )
|
||||
return;
|
||||
|
||||
self.looper = spawnFx( level._effect[ self.v[ "fxid" ] ], self.v[ "origin" ], self.v[ "forward" ], self.v[ "up" ] );
|
||||
triggerFx( self.looper, self.v[ "delay" ] );
|
||||
|
||||
if ( !level._createFX_enabled )
|
||||
self.looper willNeverChange();
|
||||
|
||||
create_loopsound();
|
||||
}
|
||||
|
||||
verify_effects_assignment( effectID )
|
||||
{
|
||||
if( isdefined ( level._effect[ effectID ] ) )
|
||||
return true;
|
||||
if( ! isdefined( level._missing_FX ) )
|
||||
level._missing_FX = [];
|
||||
level._missing_FX[ self.v[ "fxid" ] ] = effectID;
|
||||
verify_effects_assignment_print( effectID );
|
||||
return false;
|
||||
}
|
||||
|
||||
verify_effects_assignment_print( effectID )
|
||||
{
|
||||
|
||||
level notify ( "verify_effects_assignment_print" );
|
||||
level endon ( "verify_effects_assignment_print" );
|
||||
wait .05; //allow errors on the same frame to que up before printing
|
||||
|
||||
println("Error:");
|
||||
println("Error:**********MISSING EFFECTS IDS**********");
|
||||
keys = getarraykeys( level._missing_FX );
|
||||
foreach( key in keys )
|
||||
{
|
||||
println( "Error: Missing Effects ID assignment for: "+ key );
|
||||
}
|
||||
println("Error:");
|
||||
|
||||
assertmsg( "Missing Effects ID assignments ( see console )" );
|
||||
}
|
||||
|
||||
OneShotfxthread()
|
||||
{
|
||||
waitframe();
|
||||
|
||||
if ( self.v[ "delay" ] > 0 )
|
||||
wait self.v[ "delay" ];
|
||||
|
||||
/*
|
||||
if ( isdefined( self.v[ "fire_range" ] ) )
|
||||
{
|
||||
thread fire_radius( self.v[ "origin" ], self.v[ "fire_range" ] );
|
||||
}
|
||||
*/
|
||||
|
||||
[[ level._func[ "create_triggerfx" ] ]]();
|
||||
}>
|
24
common_scripts/_moon.gsc
Normal file
24
common_scripts/_moon.gsc
Normal file
@ -0,0 +1,24 @@
|
||||
MOON_GLOBAL_GRAVITY_SCALE = 0.17;
|
||||
MOON_AIM_SCALE_TURN_RATE = 1.0;
|
||||
MOON_AIM_ADS_PITCH = 85;//1.5 x 55
|
||||
MOON_AIM_ADS_YAW = 135;//1.5 x 90
|
||||
|
||||
getMoonGlobalGravityScale()
|
||||
{
|
||||
return MOON_GLOBAL_GRAVITY_SCALE;
|
||||
}
|
||||
|
||||
getMoonGlobalTurnRateScale()
|
||||
{
|
||||
return MOON_AIM_SCALE_TURN_RATE;
|
||||
}
|
||||
|
||||
getMoonGlobalADSYaw()
|
||||
{
|
||||
return MOON_AIM_ADS_YAW;
|
||||
}
|
||||
|
||||
getMoonGlobalADSPitch()
|
||||
{
|
||||
return MOON_AIM_ADS_PITCH;
|
||||
}
|
1106
common_scripts/_painter.gsc
Normal file
1106
common_scripts/_painter.gsc
Normal file
File diff suppressed because it is too large
Load Diff
323
common_scripts/_pipes.gsc
Normal file
323
common_scripts/_pipes.gsc
Normal file
@ -0,0 +1,323 @@
|
||||
#include common_scripts\utility;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CONSTANTS //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
level_limit_pipe_fx = 8;
|
||||
max_fires_from_entity = 4;
|
||||
level_pipe_fx_chance = 33;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// LOGIC //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
main()
|
||||
{
|
||||
level._pipe_fx_time = 25;
|
||||
pipes = GetEntArray( "pipe_shootable", "targetname" );
|
||||
if ( !pipes.size )
|
||||
return;
|
||||
level._pipes = SpawnStruct();
|
||||
level._pipes.num_pipe_fx = 0;
|
||||
|
||||
pipes thread precacheFX();
|
||||
pipes thread methodsInit();
|
||||
|
||||
waittillframeend;// insure that structs are initialized
|
||||
array_thread( pipes, ::pipesetup );
|
||||
}
|
||||
|
||||
pipesetup()
|
||||
{
|
||||
self SetCanDamage( true );
|
||||
self SetCanRadiusDamage( false ); // optimization
|
||||
self.pipe_fx_array = [];
|
||||
|
||||
node = undefined;
|
||||
|
||||
if ( IsDefined( self.target ) )
|
||||
{
|
||||
node = getstruct( self.target, "targetname" );
|
||||
self.A = node.origin;
|
||||
vec = AnglesToForward( node.angles );
|
||||
vec = vector_multiply( vec, 128 );
|
||||
self.B = self.A + vec;
|
||||
}
|
||||
else
|
||||
{
|
||||
vec = AnglesToForward( self.angles );
|
||||
vec1 = vector_multiply( vec, 64 );
|
||||
self.A = self.origin + vec1;
|
||||
vec1 = vector_multiply( vec, -64 );
|
||||
self.B = self.origin + vec1;
|
||||
}
|
||||
|
||||
self thread pipe_wait_loop();
|
||||
}
|
||||
|
||||
pipe_wait_loop()
|
||||
{
|
||||
P = ( 0, 0, 0 );// just to initialize P as a vector
|
||||
|
||||
hasTakenDamage = false;
|
||||
remaining = max_fires_from_entity;
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
self waittill( "damage", damage, other, direction_vec, P, type );
|
||||
|
||||
// random so we don't get so many fx, but the very first time is guarenteed
|
||||
if ( hasTakenDamage )
|
||||
{
|
||||
if ( randomint( 100 ) <= level_pipe_fx_chance )
|
||||
continue;
|
||||
}
|
||||
hasTakenDamage = true;
|
||||
|
||||
result = self pipe_logic( direction_vec, P, type, other );
|
||||
if ( result )
|
||||
remaining--;
|
||||
|
||||
if ( remaining <= 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
self SetCanDamage( false );
|
||||
}
|
||||
|
||||
pipe_logic( direction_vec, P, type, damageOwner )
|
||||
{
|
||||
if ( level._pipes.num_pipe_fx > level_limit_pipe_fx )
|
||||
return false;
|
||||
|
||||
if ( !isDefined( level._pipes._pipe_methods[ type ] ) )
|
||||
P = self pipe_calc_nofx( P, type );
|
||||
else
|
||||
P = self [[ level._pipes._pipe_methods[ type ] ]]( P, type );
|
||||
|
||||
if ( !isdefined( P ) )
|
||||
return false;
|
||||
|
||||
if ( IsDefined( damageOwner.classname ) && damageOwner.classname == "worldspawn" )
|
||||
return false;
|
||||
|
||||
foreach ( value in self.pipe_fx_array )
|
||||
{
|
||||
if ( DistanceSquared( P, value.origin ) < 25 )
|
||||
return false;
|
||||
}
|
||||
|
||||
//calculate the vector derived from the center line of our pipe and the point of damage
|
||||
vec = VectorFromLineToPoint( self.A, self.B, P );
|
||||
self thread pipefx( P, vec, damageOwner );
|
||||
return true;
|
||||
}
|
||||
|
||||
pipefx( P, vec, damageOwner )
|
||||
{
|
||||
time = level._pipes.fx_time[ self.script_noteworthy ] ;
|
||||
intervals = Int( level._pipe_fx_time / time );// loops for 25 seconds
|
||||
hitsnd = level._pipes._sound[ self.script_noteworthy + "_hit" ];
|
||||
loopsnd = level._pipes._sound[ self.script_noteworthy + "_loop" ];
|
||||
endsnd = level._pipes._sound[ self.script_noteworthy + "_end" ];
|
||||
|
||||
snd = Spawn( "sound_emitter", P );
|
||||
snd Hide();
|
||||
snd PlaySound( hitsnd );
|
||||
snd PlayLoopSound( loopsnd );
|
||||
self.pipe_fx_array[ self.pipe_fx_array.size ] = snd;
|
||||
|
||||
level._pipes.num_pipe_fx++;
|
||||
|
||||
if ( isSP() || self.script_noteworthy != "steam" )
|
||||
self thread pipe_damage( P, vec, damageOwner, snd );
|
||||
|
||||
//do it once without checking for newer fx being played ( we're the newest )
|
||||
PlayFX( level._pipes._effect[ self.script_noteworthy ], P, vec );
|
||||
wait time;
|
||||
intervals--;
|
||||
|
||||
//now check for other fx and rest of intervals
|
||||
while ( level._pipes.num_pipe_fx <= level_limit_pipe_fx && intervals > 0 )
|
||||
{
|
||||
PlayFX( level._pipes._effect[ self.script_noteworthy ], P, vec );
|
||||
wait time;
|
||||
intervals--;
|
||||
}
|
||||
snd PlaySound( endsnd );
|
||||
wait( .5 );
|
||||
snd StopLoopSound( loopsnd );
|
||||
snd Delete();
|
||||
self.pipe_fx_array = array_removeUndefined( self.pipe_fx_array );
|
||||
|
||||
level._pipes.num_pipe_fx--;
|
||||
}
|
||||
|
||||
pipe_damage( P, vec, damageOwner, fx )
|
||||
{
|
||||
if ( !allow_pipe_damage() )
|
||||
return;
|
||||
|
||||
fx endon( "death" );
|
||||
|
||||
origin = fx.origin + vector_multiply( VectorNormalize( vec ), 40 );
|
||||
dmg = level._pipes._dmg[ self.script_noteworthy ];
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
// do not pass damage owner if they have disconnected before the barrels explode.. the barrels?
|
||||
if ( !isdefined( self.damageOwner ) )
|
||||
{
|
||||
// MOD_TRIGGER_HURT so they dont do dirt on the player's screen
|
||||
self RadiusDamage( origin, 36, dmg, dmg * 0.75, undefined, "MOD_TRIGGER_HURT" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// MOD_TRIGGER_HURT so they dont do dirt on the player's screen
|
||||
self RadiusDamage( origin, 36, dmg, dmg * 0.75, damageOwner, "MOD_TRIGGER_HURT" );
|
||||
}
|
||||
|
||||
wait( 0.4 );
|
||||
}
|
||||
}
|
||||
|
||||
allow_pipe_damage()
|
||||
{
|
||||
if( !isSP() )
|
||||
return false;
|
||||
|
||||
if ( !isDefined( level._pipesDamage ) )
|
||||
return true;
|
||||
|
||||
return ( level._pipesDamage );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CALCULATIONS / SETUP //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
methodsInit()
|
||||
{
|
||||
level._pipes._pipe_methods = [];
|
||||
level._pipes._pipe_methods[ "MOD_UNKNOWN" ] = ::pipe_calc_splash;
|
||||
level._pipes._pipe_methods[ "MOD_PISTOL_BULLET" ] = ::pipe_calc_ballistic;
|
||||
level._pipes._pipe_methods[ "MOD_RIFLE_BULLET" ] = ::pipe_calc_ballistic;
|
||||
level._pipes._pipe_methods[ "MOD_GRENADE" ] = ::pipe_calc_splash;
|
||||
level._pipes._pipe_methods[ "MOD_GRENADE_SPLASH" ] = ::pipe_calc_splash;
|
||||
level._pipes._pipe_methods[ "MOD_PROJECTILE" ] = ::pipe_calc_splash;
|
||||
level._pipes._pipe_methods[ "MOD_PROJECTILE_SPLASH" ] = ::pipe_calc_splash;
|
||||
level._pipes._pipe_methods[ "MOD_TRIGGER_HURT" ] = ::pipe_calc_splash;
|
||||
level._pipes._pipe_methods[ "MOD_EXPLOSIVE" ] = ::pipe_calc_splash;
|
||||
level._pipes._pipe_methods[ "MOD_EXPLOSIVE_BULLET" ] = ::pipe_calc_splash;
|
||||
}
|
||||
|
||||
pipe_calc_ballistic( P, type )
|
||||
{
|
||||
return P;
|
||||
}
|
||||
|
||||
pipe_calc_splash( P, type )
|
||||
{
|
||||
vec = VectorNormalize( VectorFromLineToPoint( self.A, self.B, P ) );
|
||||
P = PointOnSegmentNearestToPoint( self.A, self.B, P );
|
||||
return( P + vector_multiply( vec, 4 ) );
|
||||
}
|
||||
|
||||
pipe_calc_nofx( P, type )
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
|
||||
precacheFX()
|
||||
{
|
||||
steam = false;
|
||||
fire = false;
|
||||
fire_short = false;
|
||||
steam_moon = false;
|
||||
fire_moon = false;
|
||||
foreach ( value in self )
|
||||
{
|
||||
if ( value.script_noteworthy == "water" )
|
||||
value.script_noteworthy = "steam";
|
||||
|
||||
if ( value.script_noteworthy == "steam" )
|
||||
{
|
||||
value willNeverChange();
|
||||
steam = true;
|
||||
}
|
||||
else if ( value.script_noteworthy == "fire" )
|
||||
{
|
||||
value willNeverChange();
|
||||
fire = true;
|
||||
}
|
||||
else if ( value.script_noteworthy == "fire_short" )
|
||||
{
|
||||
value willNeverChange();
|
||||
fire_short = true;
|
||||
}
|
||||
else if ( value.script_noteworthy == "steam_moon" )
|
||||
{
|
||||
value willNeverChange();
|
||||
steam_moon = true;
|
||||
}
|
||||
else if ( value.script_noteworthy == "fire_moon" )
|
||||
{
|
||||
value willNeverChange();
|
||||
fire_moon = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
println( "Unknown 'pipe_shootable' script_noteworthy type '%s'\n", value.script_noteworthy );
|
||||
}
|
||||
}
|
||||
|
||||
if ( steam )
|
||||
{
|
||||
level._pipes._effect[ "steam" ] = LoadFX( "impacts/pipe_steam" );
|
||||
level._pipes._sound[ "steam_hit" ] = "mtl_steam_pipe_hit";
|
||||
level._pipes._sound[ "steam_loop" ] = "mtl_steam_pipe_hiss_loop";
|
||||
level._pipes._sound[ "steam_end" ] = "mtl_steam_pipe_hiss_loop_end";
|
||||
level._pipes.fx_time[ "steam" ] = 3;
|
||||
level._pipes._dmg[ "steam" ] = 5;
|
||||
}
|
||||
|
||||
if ( fire )
|
||||
{
|
||||
level._pipes._effect[ "fire" ] = LoadFX( "impacts/pipe_fire" );
|
||||
level._pipes._sound[ "fire_hit" ] = "mtl_gas_pipe_hit";
|
||||
level._pipes._sound[ "fire_loop" ] = "mtl_gas_pipe_flame_loop";
|
||||
level._pipes._sound[ "fire_end" ] = "mtl_gas_pipe_flame_end";
|
||||
level._pipes.fx_time[ "fire" ] = 3;
|
||||
level._pipes._dmg[ "fire" ] = 5;
|
||||
}
|
||||
|
||||
if ( fire_short )
|
||||
{
|
||||
level._pipes._effect[ "fire_short" ] = LoadFX( "nx/impacts/nx_pipe_fire" );
|
||||
level._pipes._sound[ "fire_short_hit" ] = "mtl_gas_pipe_hit";
|
||||
level._pipes._sound[ "fire_short_loop" ] = "mtl_gas_pipe_flame_loop";
|
||||
level._pipes._sound[ "fire_short_end" ] = "mtl_gas_pipe_flame_end";
|
||||
level._pipes.fx_time[ "fire_short" ] = 16;
|
||||
level._pipes._dmg[ "fire_short" ] = 5;
|
||||
}
|
||||
|
||||
if ( steam_moon )
|
||||
{
|
||||
level._pipes._effect[ "steam_moon" ] = LoadFX( "nx/lunar/impacts/nx_lunar_pipe_steam" );
|
||||
level._pipes._sound[ "steam_moon_hit" ] = "mtl_steam_pipe_hit";
|
||||
level._pipes._sound[ "steam_moon_loop" ] = "mtl_steam_pipe_hiss_loop";
|
||||
level._pipes._sound[ "steam_moon_end" ] = "mtl_steam_pipe_hiss_loop_end";
|
||||
level._pipes.fx_time[ "steam_moon" ] = 5;
|
||||
level._pipes._dmg[ "steam_moon" ] = 10;
|
||||
}
|
||||
|
||||
if ( fire_moon )
|
||||
{
|
||||
level._pipes._effect[ "fire_moon" ] = LoadFX( "nx/lunar/impacts/nx_lunar_pipe_fire" );
|
||||
level._pipes._sound[ "fire_moon_hit" ] = "mtl_gas_pipe_hit";
|
||||
level._pipes._sound[ "fire_moon_loop" ] = "mtl_gas_pipe_flame_loop";
|
||||
level._pipes._sound[ "fire_moon_end" ] = "mtl_gas_pipe_flame_end";
|
||||
level._pipes.fx_time[ "fire_moon" ] = 5;
|
||||
level._pipes._dmg[ "fire_moon" ] = 10;
|
||||
}
|
||||
}
|
175
common_scripts/_portable_radar.gsc
Normal file
175
common_scripts/_portable_radar.gsc
Normal file
@ -0,0 +1,175 @@
|
||||
#include maps\mp\_utility;
|
||||
#include common_scripts\utility;
|
||||
|
||||
setPortableRadar()
|
||||
{
|
||||
println( "called setPortableRadar" );
|
||||
|
||||
self _giveWeapon( "portable_radar_mp", 0 );
|
||||
self giveStartAmmo( "portable_radar_mp" );
|
||||
|
||||
self thread monitorPortableRadarUse();
|
||||
}
|
||||
|
||||
unsetPortableRadar()
|
||||
{
|
||||
self notify( "end_monitorPortableRadarUse" );
|
||||
}
|
||||
|
||||
deletePortableRadar( portable_radar )
|
||||
{
|
||||
if ( !isDefined( portable_radar ) )
|
||||
return;
|
||||
|
||||
portable_radar notify( "death" );
|
||||
portable_radar Delete();
|
||||
|
||||
self.deployedPortableRadar = undefined;
|
||||
}
|
||||
|
||||
monitorPortableRadarUse()
|
||||
{
|
||||
self endon ( "death" );
|
||||
self endon ( "disconnect" );
|
||||
level endon ( "game_ended" );
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
// grenade is the entity spawned by the G_FireGrenade() since we want this to be
|
||||
// script controlled, we won't actually use this entity
|
||||
self waittill( "grenade_fire", grenade, weapName );
|
||||
|
||||
if ( weapName != "portable_radar_mp" )
|
||||
continue;
|
||||
|
||||
println( "A portable radar has been fired" );
|
||||
|
||||
if( isDefined( self.deployedPortableRadar ) )
|
||||
{
|
||||
println( "Deleting the other portable radar you have deployed" );
|
||||
deletePortableRadar( self.deployedPortableRadar );
|
||||
}
|
||||
|
||||
grenade waittill( "missile_stuck" );
|
||||
println( "Portable radar is has missile_stuck" );
|
||||
|
||||
GroundPosition = grenade.origin;
|
||||
|
||||
grenade Delete();
|
||||
|
||||
portable_radar = spawn( "script_model", GroundPosition );
|
||||
portable_radar.health = 100;
|
||||
portable_radar.team = self.team;
|
||||
portable_radar.owner = self;
|
||||
|
||||
portable_radar setCanDamage( true );
|
||||
|
||||
portable_radar makePortableRadar( self );
|
||||
portable_radar portableRadarSetup( self );
|
||||
portable_radar thread maps\mp\gametypes\_weapons::createBombSquadModel( "weapon_c4_bombsquad", "tag_origin", self );
|
||||
|
||||
self.deployedPortableRadar = portable_radar;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
portableRadarSetup( owner )
|
||||
{
|
||||
// JCC temp until we get our model
|
||||
self setModel( "weapon_c4" );
|
||||
|
||||
// setup icons for item so friendlies see it
|
||||
if ( level._teamBased )
|
||||
self maps\mp\_entityheadIcons::setTeamHeadIcon( self.team , (0,0,20) );
|
||||
else
|
||||
self maps\mp\_entityheadicons::setPlayerHeadIcon( owner, (0,0,20) );
|
||||
|
||||
self thread portableRadarDamageListener( owner );
|
||||
self thread portableRadarUseListener( owner );
|
||||
owner thread portableRadarWatchOwner( self );
|
||||
self thread portableRadarBeepSounds();
|
||||
}
|
||||
|
||||
portableRadarWatchOwner( portable_radar )
|
||||
{
|
||||
portable_radar endon( "death" );
|
||||
level endon ( "game_ended" );
|
||||
|
||||
self waittill_any( "disconnect", "joined_team", "joined_spectators", "death" );
|
||||
|
||||
level thread deletePortableRadar( portable_radar );
|
||||
}
|
||||
|
||||
portableRadarBeepSounds()
|
||||
{
|
||||
self endon( "death" );
|
||||
level endon ( "game_ended" );
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
wait ( 2.0 );
|
||||
self playSound( "sentry_gun_beep" );
|
||||
}
|
||||
}
|
||||
|
||||
portableRadarDamageListener( owner )
|
||||
{
|
||||
self endon ( "death" );
|
||||
|
||||
// use a health buffer to prevent dying to friendly fire
|
||||
healthBuffer = 20000;
|
||||
self.health += healthbuffer;
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
self waittill ( "damage", amount, attacker );
|
||||
|
||||
if ( level._teambased && isDefined( attacker.team ) && attacker.team == self.team )
|
||||
{
|
||||
self.health += amount;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( self.health - healthbuffer < 0 )
|
||||
{
|
||||
if ( isDefined( owner ) && attacker != owner )
|
||||
{
|
||||
// JCC commented out
|
||||
//attacker notify ( "destroyed_insertion", owner );
|
||||
attacker notify( "destroyed_explosive" ); // count towards SitRep Pro challenge
|
||||
|
||||
// JCC commented out
|
||||
//owner thread leaderDialogOnPlayer( "ti_destroyed" );
|
||||
}
|
||||
|
||||
// JCC temp playing sounds and effects from other weapons until we have the right ones
|
||||
self playsound( "sentry_explode" );
|
||||
self.c4DeathEffect = playFX( level.c4Death, self.origin );
|
||||
attacker thread deletePortableRadar( self );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
portableRadarUseListener( owner )
|
||||
{
|
||||
self endon ( "death" );
|
||||
level endon ( "game_ended" );
|
||||
owner endon ( "disconnect" );
|
||||
|
||||
self setCursorHint( "HINT_NOICON" );
|
||||
self setHintString( &"MP_PICKUP_PORTABLE_RADAR" );
|
||||
self setSelfUsable( owner );
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
self waittill ( "trigger", player );
|
||||
|
||||
player playLocalSound( "scavenger_pack_pickup" );
|
||||
|
||||
// give item to user (only if they haven't restocked from scavenger pickup since dropping)
|
||||
if ( player getAmmoCount( "portable_radar_mp" ) == 0 )
|
||||
player setPortableRadar();
|
||||
|
||||
player thread deletePortableRadar( self );
|
||||
}
|
||||
}
|
93
common_scripts/testscripts.gsc
Normal file
93
common_scripts/testscripts.gsc
Normal file
@ -0,0 +1,93 @@
|
||||
// note: Test code added to this file should not be checked in!
|
||||
|
||||
//*******************************************************************
|
||||
// *
|
||||
// *
|
||||
//*******************************************************************
|
||||
testscript0()
|
||||
{
|
||||
/#
|
||||
IPrintLn( "testscript0 executed on gentity " + self GetEntNum() );
|
||||
#/
|
||||
}
|
||||
|
||||
//*******************************************************************
|
||||
// *
|
||||
// *
|
||||
//*******************************************************************
|
||||
testscript1()
|
||||
{
|
||||
/#
|
||||
IPrintLn( "testscript1 executed on gentity " + self GetEntNum() );
|
||||
#/
|
||||
}
|
||||
|
||||
//*******************************************************************
|
||||
// *
|
||||
// *
|
||||
//*******************************************************************
|
||||
testscript2()
|
||||
{
|
||||
/#
|
||||
IPrintLn( "testscript2 executed on gentity " + self GetEntNum() );
|
||||
#/
|
||||
}
|
||||
|
||||
//*******************************************************************
|
||||
// *
|
||||
// *
|
||||
//*******************************************************************
|
||||
testscript3()
|
||||
{
|
||||
/#
|
||||
IPrintLn( "testscript3 executed on gentity " + self GetEntNum() );
|
||||
#/
|
||||
}
|
||||
|
||||
//*******************************************************************
|
||||
// *
|
||||
// *
|
||||
//*******************************************************************
|
||||
testscript4()
|
||||
{
|
||||
/#
|
||||
IPrintLn( "testscript4 executed on gentity " + self GetEntNum() );
|
||||
#/
|
||||
}
|
||||
|
||||
//*******************************************************************
|
||||
// *
|
||||
// *
|
||||
//*******************************************************************
|
||||
testscript5()
|
||||
{
|
||||
/#
|
||||
IPrintLn( "testscript5 executed on gentity " + self GetEntNum() );
|
||||
#/
|
||||
}
|
||||
|
||||
//*******************************************************************
|
||||
// *
|
||||
// *
|
||||
//*******************************************************************
|
||||
testscript6()
|
||||
{
|
||||
/#
|
||||
IPrintLn( "testscript6 executed on gentity " + self GetEntNum() );
|
||||
#/
|
||||
}
|
||||
|
||||
//*******************************************************************
|
||||
// *
|
||||
// *
|
||||
//*******************************************************************
|
||||
testscript7()
|
||||
{
|
||||
/#
|
||||
IPrintLn( "testscript7 executed on gentity " + self GetEntNum() );
|
||||
#/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
4111
common_scripts/utility.gsc
Normal file
4111
common_scripts/utility.gsc
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user