Script:Files:script/tasks/task.script
From Mod Wiki
object task { void preinit(); void destroy(); void Idle(); void OnTaskSelected(); void OnTaskDeselected(); void SetupWaypointIcon(); void FreeWaypointIcon(); float commandMapIcon; } void task::preinit() { commandMapIcon = -1; } void task::destroy() { FreeWaypointIcon(); } void task::Idle() { } void task::OnTaskSelected() { SetupWaypointIcon(); } void task::OnTaskDeselected() { FreeWaypointIcon(); } void task::FreeWaypointIcon() { if ( commandMapIcon == -1 ) { return; } entity ent = getTaskEntity(); if ( ent == $null_entity ) { // we lost the entity, use local player instead ent = sys.getLocalPlayer(); } sys.freeCMIcon( ent, commandMapIcon ); commandMapIcon = -1; } void task::SetupWaypointIcon() { FreeWaypointIcon(); player l = sys.getLocalPlayer(); if ( l != $null_entity ) { float materialIndex = GetMaterial( getKey( "mtr_cm_icon" ) ); if ( materialIndex != -1 ) { entity taskEntity = getTaskEntity(); if ( taskEntity != $null_entity ) { commandMapIcon = sys.allocCMIcon( taskEntity, getFloatKey( "icon_sort_cm_request" ) ); sys.setCMIconMaterial( commandMapIcon, materialIndex ); sys.setCMIconColorMode( commandMapIcon, CM_NORMAL ); sys.setCMIconSize( commandMapIcon, 20.0f ); sys.setCMIconColor( commandMapIcon, g_colorWhite, 1.0f ); sys.setCMIconFlag( commandMapIcon, CMF_ALWAYSKNOWN ); sys.flashCMIcon( commandMapIcon, -1, 1, -1 ); } } } } object task_dummy : task { } object task_deploy_base : task { } object task_deploy_object : task_deploy_base { } object task_deploy_mines : task_deploy_base { } object task_hack_objective : task { } object task_construct_objective : task { } object task_destroy_objective : task { } object task_deployable_disable : task { } object task_repair_deployable : task { } object task_escort_mcp : task { } object task_capture_spawn : task { } object task_liberate_spawn : task { } object task_defuse_object : task { } object task_defend : task { } object task_pickup : task { } object task_select_spawnhost : task { } object task_repair_vehicle : task { } object task_need_passenger : task { } object task_revive_player : task { } object task_heal_player : task { } object task_supply_player : task { } object task_create_spawnhost : task { } object task_kill_enemy : task { }