]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/main.qc
Merge branch 'master' into Mario/status_effects_extended
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / main.qc
index 2546362af83ee9a1e03cd7a9a46b7097e14c2222..73f473ae979752c412265e06e3bf596daf66dee8 100644 (file)
@@ -1,37 +1,64 @@
 #include "main.qh"
 
-#include "anticheat.qh"
-#include "hook.qh"
-#include "damage.qh"
-#include "world.qh"
-#include "spawnpoints.qh"
-#include <server/ipban.qh>
-#include <server/gamelog.qh>
-
-#include "bot/api.qh"
-
-#include "command/common.qh"
-
-#include <server/mutators/_mod.qh>
-#include "weapons/csqcprojectile.qh"
-#include <server/weapons/common.qh>
-#include <server/compat/quake3.qh>
-
-#include "../common/constants.qh"
 #include <common/command/generic.qh>
-#include "../common/deathtypes/all.qh"
-#include "../common/debug.qh"
-#include "../common/mapinfo.qh"
-#include "../common/util.qh"
-
-#include "../common/vehicles/all.qh"
+#include <common/constants.qh>
+#include <common/deathtypes/all.qh>
+#include <common/debug.qh>
+#include <common/mapinfo.qh>
 #include <common/monsters/sv_monsters.qh>
+#include <common/util.qh>
+#include <common/vehicles/all.qh>
 #include <common/weapons/_all.qh>
+#include <lib/csqcmodel/sv_model.qh>
+#include <lib/warpzone/common.qh>
+#include <lib/warpzone/server.qh>
+#include <server/anticheat.qh>
+#include <server/bot/api.qh>
+#include <server/command/common.qh>
+#include <server/compat/quake3.qh>
+#include <server/damage.qh>
+#include <server/gamelog.qh>
+#include <server/hook.qh>
+#include <server/ipban.qh>
+#include <server/mutators/_mod.qh>
+#include <server/spawnpoints.qh>
+#include <server/weapons/common.qh>
+#include <server/weapons/csqcprojectile.qh>
+#include <server/world.qh>
 
-#include "../lib/csqcmodel/sv_model.qh"
-
-#include "../lib/warpzone/common.qh"
-#include "../lib/warpzone/server.qh"
+void dropclient_do(entity this)
+{
+       if (this.owner)
+               dropclient(this.owner);
+       delete(this);
+}
+/**
+ * Schedules dropclient for a player and returns true;
+ * if dropclient is already scheduled (for that player) it does nothing and returns false.
+ *
+ * NOTE: this function exists only to allow sending a message to the kicked player with
+ * Send_Notification, which doesn't work if called together with dropclient
+ */
+bool dropclient_schedule(entity this)
+{
+       bool scheduled = false;
+       FOREACH_ENTITY_CLASS("dropclient_handler", true,
+       {
+               if(it.owner == this)
+               {
+                       scheduled = true;
+                       break; // can't use return here, compiler shows a warning
+               }
+       });
+       if (scheduled)
+               return false;
+
+       entity e = new_pure(dropclient_handler);
+       setthink(e, dropclient_do);
+       e.owner = this;
+       e.nextthink = time + 0.1;
+       return true;
+}
 
 void CreatureFrame_hotliquids(entity this)
 {