Skip to content

Commit e6f8ded

Browse files
committed
Added a little bit more documentation
1 parent 19382f7 commit e6f8ded

1 file changed

Lines changed: 68 additions & 29 deletions

File tree

‎src/core/modules/engines/engines_server_wrap.cpp‎

Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -788,13 +788,16 @@ static void export_server_game_dll(scope _server)
788788
make_function(
789789
&IServerGameDLL::GetAllServerClasses,
790790
reference_existing_object_policy()
791-
)
791+
),
792+
"Return the first server class. This base can be used to iterate through all server classes.\n\n"
793+
":rtype: ServerClass"
792794
);
793795

794796
ServerGameDLL.add_property(
795797
"game_description",
796798
&IServerGameDLL::GetGameDescription,
797-
"Return the game's description."
799+
"Return the game's description.\n\n"
800+
":rtype: str"
798801
);
799802

800803
// Black Mesa and Orangebox specific methods...
@@ -831,135 +834,160 @@ static void export_iserver(scope _server)
831834
_IServer.add_property(
832835
"num_clients",
833836
&IServer::GetNumClients,
834-
"Return the current number of clients."
837+
"Return the current number of clients.\n\n"
838+
":rtype: int"
835839
);
836840

837841
_IServer.add_property(
838842
"num_proxies",
839843
&IServer::GetNumProxies,
840-
"Return the number of attached HLTV proxies."
844+
"Return the number of attached HLTV proxies.\n\n"
845+
":rtype: int"
841846
);
842847

843848
_IServer.add_property(
844849
"num_fake_clients",
845850
&IServer::GetNumFakeClients,
846-
"Return the number of fake clients."
851+
"Return the number of fake clients.\n\n"
852+
":rtype: int"
847853
);
848854

849855
_IServer.add_property(
850856
"max_clients",
851857
&IServer::GetMaxClients,
852-
"Return the current client limit."
858+
"Return the current client limit.\n\n"
859+
":rtype: int"
853860
);
854861

855862
_IServer.def(
856863
"get_client",
857864
&IServer::GetClient,
858-
"Return the interface to a client.",
865+
"Return the interface to a client.\n\n"
866+
":rtype: Client",
859867
reference_existing_object_policy()
860868
);
861869

862870
_IServer.add_property(
863871
"client_count",
864872
&IServer::GetClientCount,
865-
"Return the number of client slots (used and unused)."
873+
"Return the number of client slots (used and unused).\n\n"
874+
":rtype: int"
866875
);
867876

868877
_IServer.add_property(
869878
"udp_port",
870879
&IServer::GetUDPPort,
871-
"Return the currently used UDP port."
880+
"Return the currently used UDP port.\n\n"
881+
":rtype: int"
872882
);
873883

874884
_IServer.add_property(
875885
"time",
876886
&IServer::GetTime,
877-
"Return the game world time."
887+
"Return the game world time.\n\n"
888+
":rtype: float"
878889
);
879890

880891
_IServer.add_property(
881892
"tick",
882893
&IServer::GetTick,
883-
"Return the game world tick."
894+
"Return the game world tick.\n\n"
895+
":rtype: int"
884896
);
885897

886898
_IServer.add_property(
887899
"tick_interval",
888900
&IServer::GetTickInterval,
889-
"Return the tick interval in seconds."
901+
"Return the tick interval in seconds.\n\n"
902+
":rtype: float"
890903
);
891904

892905
_IServer.add_property(
893906
"name",
894907
&IServer::GetName,
895-
"Return the public server name"
908+
"Return the public server name.\n\n"
909+
":rtype: str"
896910
);
897911

898912
_IServer.add_property(
899913
"map_name",
900914
&IServer::GetMapName,
901-
"Return the current map name."
915+
"Return the current map name.\n\n"
916+
":rtype: str"
902917
);
903918

904919
_IServer.add_property(
905920
"spawn_count",
906-
&IServer::GetSpawnCount
921+
&IServer::GetSpawnCount,
922+
"Return the spawn count.\n\n"
923+
":rtype: int"
907924
);
908925

909926
_IServer.add_property(
910927
"num_classes",
911-
&IServer::GetNumClasses
928+
&IServer::GetNumClasses,
929+
":rtype: int"
912930
);
913931

914932
_IServer.add_property(
915933
"class_bits",
916-
&IServer::GetClassBits
934+
&IServer::GetClassBits,
935+
":rtype: int"
917936
);
918937

919938
_IServer.add_property(
920939
"net_stats",
921940
&IServerExt::GetNetStats,
922-
"Return a tuple containing the total net in/out in bytes/sec."
941+
"Return a tuple containing the total net in/out in bytes/sec.\n\n"
942+
":rtype: tuple"
923943
);
924944

925945
_IServer.add_property(
926946
"num_players",
927-
&IServer::GetNumPlayers
947+
&IServer::GetNumPlayers,
948+
":rtype: int"
928949
);
929950

930951
_IServer.def(
931952
"get_player_info",
932-
&IServer::GetPlayerInfo
953+
&IServer::GetPlayerInfo,
954+
":rtype: bool"
933955
);
934956

935957
_IServer.def(
936958
"is_active",
937-
&IServer::IsActive
959+
&IServer::IsActive,
960+
":rtype: bool"
938961
);
939962

940963
_IServer.def(
941964
"is_loading",
942-
&IServer::IsLoading
965+
&IServer::IsLoading,
966+
":rtype: bool"
943967
);
944968

945969
_IServer.def(
946970
"is_dedicated",
947-
&IServer::IsDedicated
971+
&IServer::IsDedicated,
972+
":rtype: bool"
948973
);
949974

950975
_IServer.def(
951976
"is_multiplayer",
952-
&IServer::IsMultiplayer
977+
&IServer::IsMultiplayer,
978+
":rtype: bool"
953979
);
954980

955981
_IServer.def(
956982
"is_pausable",
957-
&IServer::IsPausable
983+
&IServer::IsPausable,
984+
":rtype: bool"
958985
);
959986

960987
_IServer.def(
961988
"is_hltv",
962-
&IServer::IsHLTV
989+
&IServer::IsHLTV,
990+
":rtype: bool"
963991
);
964992

965993
/*
@@ -973,13 +1001,15 @@ static void export_iserver(scope _server)
9731001
"password",
9741002
&IServer::GetPassword,
9751003
&IServer::SetPassword,
976-
"Return the server password."
1004+
"Return the server password.\n\n"
1005+
":rtype: str"
9771006
);
9781007

9791008
_IServer.add_property(
9801009
"paused",
9811010
&IServer::IsPaused,
982-
&IServer::SetPaused
1011+
&IServer::SetPaused,
1012+
":rtype: bool"
9831013
);
9841014

9851015
_IServer.def(
@@ -1009,13 +1039,22 @@ static void export_functions(scope _server)
10091039
def("execute_server_command",
10101040
raw_function(execute_server_command, 1)
10111041
);
1042+
// Passing the doc string in combination with raw_function causes compiler errors :(
1043+
_server.attr("execute_server_command").attr("__doc__") = "Execute a server command immediately.\n\n"
1044+
"Additional arguments can be passed.\n\n"
1045+
":param str command: Command to execute.\n"
1046+
":param *args: Additional arguments that should be passed to the command.\n"
1047+
":raise TypeError: Raised if keyword arguments have been passed.\n"
1048+
":raise ValueError: Raised if the command has not been found or if the command couldn't be tokenized.";
10121049

10131050
def("queue_server_command",
10141051
raw_function(queue_server_command, 1)
10151052
);
1053+
_server.attr("queue_server_command").attr("__doc__") = "Same as :func:`execute_server_command`, but does not execute the server command immediately. "
1054+
"Instead it is added to the server command queue. Thus, it can be executed with a little delay.";
10161055

10171056
def("queue_command_string",
10181057
&queue_command_string,
1019-
"Queue a string for execution."
1058+
"Adds a string to the server command queue. It's the same like typing something into the server console."
10201059
);
10211060
}

0 commit comments

Comments
 (0)