Script:Files:script/structures/domihub.script
From Mod Wiki
object structure_domihub : structure_base { void init(); void InitRadarValues(); void ClearRadarValues(); void OnGuiMessage( entity p ); void OnSetTeam( object oldTeam, object newTeam ); float OnUpdateCrosshairInfo( entity p ); } void structure_domihub::init() { startSound( "snd_exterior", SND_STRUCTURE_IDLE ); } void structure_domihub::OnGuiMessage( entity p ) { if ( sys.argc() != 1 ) { return; } if ( sys.argv( 0 ) == "setspawn" ) { if ( getEntityAllegiance( p ) == TA_FRIEND ) { p.setSpawnPoint( $null_entity ); } } } void structure_domihub::InitRadarValues() { ClearRadarValues(); float radarLayer = allocRadarLayer(); radarSetLayerRange( radarLayer, getFloatKey( "radar_range" ) ); radarSetLayerMask( radarLayer, getFloatKey( "mask" ) ); } void structure_domihub::ClearRadarValues() { freeLayers(); } float structure_domihub::OnUpdateCrosshairInfo( entity p ) { if ( !sys.doClientSideStuff() ) { return 1.f; } float allegiance = getEntityAllegiance( p ); vector color = GetAllegianceColor( allegiance ); float distance = chGetDistance(); float range = InchesToMetres( distance ); float health = getHealth(); chSetNumLines( 0 ); float index; index = chAddLine(); chSetLineTextIndex( index, typeName ); chSetLineColor( index, color, 1.f ); chSetLineType( index, CI_TEXT ); chSetLineSize( index, 0, 0 ); if( range <= 100 ) { index = chAddLine(); chSetLineText( index, G_BuildRangeStr( range ) ); chSetLineColor( index, color, 1.f ); chSetLineType( index, CI_TEXT ); chSetLineSize( index, 0, 0 ); } return 1.f; } void structure_domihub::OnSetTeam( object oldTeam, object newTeam ) { InitRadarValues(); }