<!-- saved from url=(0026)http://www.naturaldocs.org -->
<divid=Content><divclass="CSection"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="Server_Hooks"></a>Server Hooks</h1><divclass=CBody><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#Server_Hooks">Server Hooks</a></td><tdclass=SDescription></td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mods_console_init"id=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">mods_console_init</a></td><tdclass=SDescription>TODO</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mods_init"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">mods_init</a></td><tdclass=SDescription>Called when the server is started.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mods_shutdown"id=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">mods_shutdown</a></td><tdclass=SDescription>Called when the server quits.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mods_client_enter"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">mods_client_enter</a></td><tdclass=SDescription>Called when a client has joined the game.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mods_client_drop"id=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">mods_client_drop</a></td><tdclass=SDescription>Called when a client drops from the server.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mods_client_direct_input"id=link6onMouseOver="ShowTip(event, 'tt6', 'link6')"onMouseOut="HideTip('tt6')">mods_client_direct_input</a></td><tdclass=SDescription>Called when the server recives new input from a client.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mods_client_predicted_input"id=link7onMouseOver="ShowTip(event, 'tt7', 'link7')"onMouseOut="HideTip('tt7')">mods_client_predicted_input</a></td><tdclass=SDescription>Called when the server applys the predicted input on the client.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mods_tick"id=link8onMouseOver="ShowTip(event, 'tt8', 'link8')"onMouseOut="HideTip('tt8')">mods_tick</a></td><tdclass=SDescription>Called with a regular interval to progress the gameplay.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mods_presnap"id=link9onMouseOver="ShowTip(event, 'tt9', 'link9')"onMouseOut="HideTip('tt9')">mods_presnap</a></td><tdclass=SDescription>Called before the server starts to construct snapshots for the clients.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mods_snap"id=link10onMouseOver="ShowTip(event, 'tt10', 'link10')"onMouseOut="HideTip('tt10')">mods_snap</a></td><tdclass=SDescription>Called to create the snapshot for a client.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mods_postsnap"id=link11onMouseOver="ShowTip(event, 'tt11', 'link11')"onMouseOut="HideTip('tt11')">mods_postsnap</a></td><tdclass=SDescription>Called after the server is done sending the snapshots.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mods_connected"id=link12onMouseOver="ShowTip(event, 'tt12', 'link12')"onMouseOut="HideTip('tt12')">mods_connected</a></td><tdclass=SDescription>TODO</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mods_net_version"id=link13onMouseOver="ShowTip(event, 'tt13', 'link13')"onMouseOut="HideTip('tt13')">mods_net_version</a></td><tdclass=SDescription>TODO</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mods_version"id=link14onMouseOver="ShowTip(event, 'tt14', 'link14')"onMouseOut="HideTip('tt14')">mods_version</a></td><tdclass=SDescription>TODO</t
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_init"></a>mods_init</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_init()</td></tr></table></blockquote><p>Called when the server is started.</p><h4class=CHeading>Remarks</h4><p>It’s called after the map is loaded so all map items are available.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_shutdown"></a>mods_shutdown</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_shutdown()</td></tr></table></blockquote><p>Called when the server quits.</p><h4class=CHeading>Remarks</h4><p>Should be used to clean up all resources used.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_client_enter"></a>mods_client_enter</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_client_enter(</td><tdclass=PTypenowrap>int </td><tdclass=PParameternowrap>cid</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Called when a client has joined the game.</p><h4class=CHeading>Arguments</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>cid</td><tdclass=CDLDescription>Client ID. Is 0 - MAX_CLIENTS.</td></tr></table><h4class=CHeading>Remarks</h4><p>It’s called when the client is finished loading and should enter gameplay.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_client_drop"></a>mods_client_drop</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_client_drop(</td><tdclass=PTypenowrap>int </td><tdclass=PParameternowrap>cid</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Called when a client drops from the server.</p><h4class=CHeading>Arguments</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>cid</td><tdclass=CDLDescription>Client ID. Is 0 - MAX_CLIENTS</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_client_direct_input"></a>mods_client_direct_input</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_client_direct_input(</td><tdclass=PTypenowrap>int </td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>cid,</td></tr><tr><td></td><tdclass=PTypenowrap>void </td><tdclass=PParameterPrefixnowrap>*</td><tdclass=PParameternowrap>input</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Called when the server recives new input from a client.</p><h4class=CHeading>Arguments</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>cid</td><tdclass=CDLDescription>Client ID. Is 0 - MAX_CLIENTS.</td></tr><tr><tdclass=CDLEntry>input</td><tdclass=CDLDescription>Pointer to the input data.</td></tr><tr><tdclass=CDLEntry>size</td><tdclass=CDLDescription>Size of the data. (NOT IMPLEMENTED YET)</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_client_predicted_input"></a>mods_client_predicted_input</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_client_predicted_input(</td><tdclass=PTypenowrap>int </td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>cid,</td></tr><tr><td></td><tdclass=PTypenowrap>void </td><tdclass=PParameterPrefixnowrap>*</td><tdclass=PParameternowrap>input</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Called when the server applys the predicted input on the client.</p><h4class=CHeading>Arguments</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>cid</td><tdclass=CDLDescription>Client ID. Is 0 - MAX_CLIENTS.</td></tr><tr><tdclass=CDLEntry>input</td><tdclass=CDLDescription>Pointer to the input data.</td></tr><tr><tdclass=CDLEntry>size</td><tdclass=CDLDescription>Size of the data. (NOT IMPLEMENTED YET)</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_tick"></a>mods_tick</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_tick()</td></tr></table></blockquote><p>Called with a regular interval to progress the gameplay.</p><h4class=CHeading>Remarks</h4><p>The SERVER_TICK_SPEED tells the number of ticks per second.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_presnap"></a>mods_presnap</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_presnap()</td></tr></table></blockquote><p>Called before the server starts to construct snapshots for the clients.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_snap"></a>mods_snap</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_snap(</td><tdclass=PTypenowrap>int </td><tdclass=PParameternowrap>cid</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Called to create the snapshot for a client.</p><h4class=CHeading>Arguments</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>cid</td><tdclass=CDLDescription>Client ID. Is 0 - MAX_CLIENTS.</td></tr></table><h4class=CHeading>Remarks</h4><p>The game should make a series of calls to <ahref="e_if_other-h.html#snap_new_item"class=LFunctionid=link16onMouseOver="ShowTip(event, 'tt16', 'link16')"onMouseOut="HideTip('tt16')">snap_new_item</a> to construct the snapshot for the client.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mods_postsnap"></a>mods_postsnap</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_postsnap()</td></tr></table></blockquote><p>Called after the server is done sending the snapshots.</p></div></div></div>
<divclass=CToolTipid="tt1"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_console_init()</td></tr></table></blockquote>TODO</div></div><divclass=CToolTipid="tt2"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_init()</td></tr></table></blockquote>Called when the server is started.</div></div><divclass=CToolTipid="tt3"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_shutdown()</td></tr></table></blockquote>Called when the server quits.</div></div><divclass=CToolTipid="tt4"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_client_enter(</td><tdclass=PTypenowrap>int </td><tdclass=PParameternowrap>cid</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Called when a client has joined the game.</div></div><divclass=CToolTipid="tt5"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_client_drop(</td><tdclass=PTypenowrap>int </td><tdclass=PParameternowrap>cid</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Called when a client drops from the server.</div></div><divclass=CToolTipid="tt6"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_client_direct_input(</td><tdclass=PTypenowrap>int </td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>cid,</td></tr><tr><td></td><tdclass=PTypenowrap>void </td><tdclass=PParameterPrefixnowrap>*</td><tdclass=PParameternowrap>input</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Called when the server recives new input from a client.</div></div><divclass=CToolTipid="tt7"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_client_predicted_input(</td><tdclass=PTypenowrap>int </td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>cid,</td></tr><tr><td></td><tdclass=PTypenowrap>void </td><tdclass=PParameterPrefixnowrap>*</td><tdclass=PParameternowrap>input</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Called when the server applys the predicted input on the client.</div></div><divclass=CToolTipid="tt8"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_tick()</td></tr></table></blockquote>Called with a regular interval to progress the gameplay.</div></div><divclass=CToolTipid="tt9"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_presnap()</td></tr></table></blockquote>Called before the server starts to construct snapshots for the clients.</div></div><divclass=CToolTipid="tt10"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>void mods_snap(</td><tdclass=PTypenowrap>int </td><tdclass=PParameternowrap>cid</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Called to create the snapshot for a client.</div></div><divclass=CToolTipid="tt11"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class=Prototype><tr><td>void mods_postsnap()</td></tr></table></blockquote>Called after the server is done sending the snapshots.</div></div><divclass=CToolTipid="tt12"><divclass