Cleanup common mutators: remove IMPLEMENTATION macro
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 20 Aug 2016 13:44:16 +0000 (23:44 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 20 Aug 2016 13:44:16 +0000 (23:44 +1000)
388 files changed:
qcsrc/client/commands/_mod.inc
qcsrc/client/commands/_mod.qh
qcsrc/client/view.qc
qcsrc/common/campaign_file.qh [new file with mode: 0644]
qcsrc/common/campaign_setup.qh [new file with mode: 0644]
qcsrc/common/effects/effectinfo.qh [new file with mode: 0644]
qcsrc/common/effects/qc/casings.qh [new file with mode: 0644]
qcsrc/common/effects/qc/damageeffects.qh [new file with mode: 0644]
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/gamemodes/_all.inc
qcsrc/common/gamemodes/_all.qh
qcsrc/common/gamemodes/_mod.inc
qcsrc/common/gamemodes/_mod.qh
qcsrc/common/gamemodes/all.inc [deleted file]
qcsrc/common/gamemodes/all.qc [deleted file]
qcsrc/common/gamemodes/all.qh [deleted file]
qcsrc/common/gamemodes/gamemode/_all.inc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/_all.qh [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/nexball/module.inc [deleted file]
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/nexball/nexball.qh
qcsrc/common/gamemodes/gamemode/nexball/weapon.qc
qcsrc/common/gamemodes/gamemode/nexball/weapon.qh [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/_mod.inc
qcsrc/common/gamemodes/gamemode/onslaught/_mod.qh
qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qh
qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qh
qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qh [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/generator.qc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/generator.qh [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/module.inc [deleted file]
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qh
qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qh
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh [new file with mode: 0644]
qcsrc/common/items/item/jetpack.qh [new file with mode: 0644]
qcsrc/common/minigames/_mod.inc
qcsrc/common/minigames/_mod.qh
qcsrc/common/minigames/minigame/bd.qh [new file with mode: 0644]
qcsrc/common/minigames/minigame/c4.qh [new file with mode: 0644]
qcsrc/common/minigames/minigame/nmm.qh [new file with mode: 0644]
qcsrc/common/minigames/minigame/pong.qh [new file with mode: 0644]
qcsrc/common/minigames/minigame/pp.qh [new file with mode: 0644]
qcsrc/common/minigames/minigame/ps.qh [new file with mode: 0644]
qcsrc/common/minigames/minigame/snake.qh [new file with mode: 0644]
qcsrc/common/minigames/minigame/ttt.qh [new file with mode: 0644]
qcsrc/common/monsters/_mod.inc
qcsrc/common/monsters/_mod.qh
qcsrc/common/monsters/monster/mage.qh [new file with mode: 0644]
qcsrc/common/monsters/monster/shambler.qh [new file with mode: 0644]
qcsrc/common/monsters/monster/spider.qh [new file with mode: 0644]
qcsrc/common/monsters/monster/wyvern.qh [new file with mode: 0644]
qcsrc/common/monsters/monster/zombie.qh [new file with mode: 0644]
qcsrc/common/mutators/_all.inc
qcsrc/common/mutators/_all.qh
qcsrc/common/mutators/_mod.inc
qcsrc/common/mutators/_mod.qh
qcsrc/common/mutators/all.inc [deleted file]
qcsrc/common/mutators/all.qc [deleted file]
qcsrc/common/mutators/all.qh [deleted file]
qcsrc/common/mutators/mutator/_all.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/_all.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/_mod.inc
qcsrc/common/mutators/mutator/_mod.qh
qcsrc/common/mutators/mutator/bloodloss/_mod.inc
qcsrc/common/mutators/mutator/bloodloss/_mod.qh
qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc [deleted file]
qcsrc/common/mutators/mutator/bloodloss/module.inc [deleted file]
qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/breakablehook/_mod.inc
qcsrc/common/mutators/mutator/breakablehook/_mod.qh
qcsrc/common/mutators/mutator/breakablehook/breakablehook.qc [deleted file]
qcsrc/common/mutators/mutator/breakablehook/module.inc [deleted file]
qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/_mod.inc
qcsrc/common/mutators/mutator/buffs/_mod.qh
qcsrc/common/mutators/mutator/buffs/all.qc [deleted file]
qcsrc/common/mutators/mutator/buffs/all.qh [deleted file]
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/buffs/buffs.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/cl_buffs.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/cl_buffs.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/module.inc [deleted file]
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/sv_buffs.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc
qcsrc/common/mutators/mutator/bugrigs/bugrigs.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/bugrigs/module.inc [deleted file]
qcsrc/common/mutators/mutator/campcheck/_mod.inc
qcsrc/common/mutators/mutator/campcheck/_mod.qh
qcsrc/common/mutators/mutator/campcheck/campcheck.qc
qcsrc/common/mutators/mutator/campcheck/campcheck.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/campcheck/module.inc [deleted file]
qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/cloaked/_mod.inc
qcsrc/common/mutators/mutator/cloaked/_mod.qh
qcsrc/common/mutators/mutator/cloaked/cloaked.qc [deleted file]
qcsrc/common/mutators/mutator/cloaked/module.inc [deleted file]
qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/damagetext/damagetext.qc
qcsrc/common/mutators/mutator/damagetext/damagetext.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/damagetext/module.inc [deleted file]
qcsrc/common/mutators/mutator/dodging/_mod.inc
qcsrc/common/mutators/mutator/dodging/_mod.qh
qcsrc/common/mutators/mutator/dodging/dodging.qc [deleted file]
qcsrc/common/mutators/mutator/dodging/module.inc [deleted file]
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/dodging/sv_dodging.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/doublejump/doublejump.qc
qcsrc/common/mutators/mutator/doublejump/doublejump.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/doublejump/module.inc [deleted file]
qcsrc/common/mutators/mutator/globalforces/_mod.inc
qcsrc/common/mutators/mutator/globalforces/_mod.qh
qcsrc/common/mutators/mutator/globalforces/globalforces.qc [deleted file]
qcsrc/common/mutators/mutator/globalforces/module.inc [deleted file]
qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/hook/_mod.inc
qcsrc/common/mutators/mutator/hook/_mod.qh
qcsrc/common/mutators/mutator/hook/hook.qc [deleted file]
qcsrc/common/mutators/mutator/hook/module.inc [deleted file]
qcsrc/common/mutators/mutator/hook/sv_hook.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/hook/sv_hook.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/instagib/_mod.inc
qcsrc/common/mutators/mutator/instagib/_mod.qh
qcsrc/common/mutators/mutator/instagib/instagib.qc [deleted file]
qcsrc/common/mutators/mutator/instagib/items.qc
qcsrc/common/mutators/mutator/instagib/items.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/instagib/module.inc [deleted file]
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/instagib/sv_instagib.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/invincibleproj/_mod.inc
qcsrc/common/mutators/mutator/invincibleproj/_mod.qh
qcsrc/common/mutators/mutator/invincibleproj/invincibleproj.qc [deleted file]
qcsrc/common/mutators/mutator/invincibleproj/module.inc [deleted file]
qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/itemstime.qc [deleted file]
qcsrc/common/mutators/mutator/itemstime/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/itemstime/_mod.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/itemstime/itemstime.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/itemstime/itemstime.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/melee_only/_mod.inc
qcsrc/common/mutators/mutator/melee_only/_mod.qh
qcsrc/common/mutators/mutator/melee_only/melee_only.qc [deleted file]
qcsrc/common/mutators/mutator/melee_only/module.inc [deleted file]
qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/midair/_mod.inc
qcsrc/common/mutators/mutator/midair/_mod.qh
qcsrc/common/mutators/mutator/midair/midair.qc [deleted file]
qcsrc/common/mutators/mutator/midair/module.inc [deleted file]
qcsrc/common/mutators/mutator/midair/sv_midair.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/midair/sv_midair.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/multijump/module.inc [deleted file]
qcsrc/common/mutators/mutator/multijump/multijump.qc
qcsrc/common/mutators/mutator/multijump/multijump.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/nades/module.inc [deleted file]
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/nades/nades.qh
qcsrc/common/mutators/mutator/nades/net.qc
qcsrc/common/mutators/mutator/nades/net.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/new_toys/_mod.inc
qcsrc/common/mutators/mutator/new_toys/_mod.qh
qcsrc/common/mutators/mutator/new_toys/module.inc [deleted file]
qcsrc/common/mutators/mutator/new_toys/new_toys.qc [deleted file]
qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/nix/_mod.inc
qcsrc/common/mutators/mutator/nix/_mod.qh
qcsrc/common/mutators/mutator/nix/module.inc [deleted file]
qcsrc/common/mutators/mutator/nix/nix.qc [deleted file]
qcsrc/common/mutators/mutator/nix/sv_nix.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/nix/sv_nix.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/_mod.inc
qcsrc/common/mutators/mutator/overkill/_mod.qh
qcsrc/common/mutators/mutator/overkill/cl_overkill.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/cl_overkill.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/hmg.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/module.inc [deleted file]
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/mutators/mutator/overkill/overkill.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/overkill/rpc.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/sv_overkill.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/physical_items/_mod.inc
qcsrc/common/mutators/mutator/physical_items/_mod.qh
qcsrc/common/mutators/mutator/physical_items/module.inc [deleted file]
qcsrc/common/mutators/mutator/physical_items/physical_items.qc [deleted file]
qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/pinata/_mod.inc
qcsrc/common/mutators/mutator/pinata/_mod.qh
qcsrc/common/mutators/mutator/pinata/module.inc [deleted file]
qcsrc/common/mutators/mutator/pinata/pinata.qc [deleted file]
qcsrc/common/mutators/mutator/pinata/sv_pinata.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/pinata/sv_pinata.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/random_gravity/_mod.inc
qcsrc/common/mutators/mutator/random_gravity/_mod.qh
qcsrc/common/mutators/mutator/random_gravity/module.inc [deleted file]
qcsrc/common/mutators/mutator/random_gravity/random_gravity.qc [deleted file]
qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/rocketflying/_mod.inc
qcsrc/common/mutators/mutator/rocketflying/_mod.qh
qcsrc/common/mutators/mutator/rocketflying/module.inc [deleted file]
qcsrc/common/mutators/mutator/rocketflying/rocketflying.qc [deleted file]
qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/rocketminsta/_mod.inc
qcsrc/common/mutators/mutator/rocketminsta/_mod.qh
qcsrc/common/mutators/mutator/rocketminsta/module.inc [deleted file]
qcsrc/common/mutators/mutator/rocketminsta/rocketminsta.qc [deleted file]
qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/running_guns/_mod.inc
qcsrc/common/mutators/mutator/running_guns/_mod.qh
qcsrc/common/mutators/mutator/running_guns/module.inc [deleted file]
qcsrc/common/mutators/mutator/running_guns/running_guns.qc [deleted file]
qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/sandbox/_mod.inc
qcsrc/common/mutators/mutator/sandbox/_mod.qh
qcsrc/common/mutators/mutator/sandbox/module.inc [deleted file]
qcsrc/common/mutators/mutator/sandbox/sandbox.qc [deleted file]
qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.inc
qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.qh
qcsrc/common/mutators/mutator/spawn_near_teammate/module.inc [deleted file]
qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc [deleted file]
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/superspec/_mod.inc
qcsrc/common/mutators/mutator/superspec/_mod.qh
qcsrc/common/mutators/mutator/superspec/module.inc [deleted file]
qcsrc/common/mutators/mutator/superspec/superspec.qc [deleted file]
qcsrc/common/mutators/mutator/superspec/sv_superspec.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/superspec/sv_superspec.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/touchexplode/_mod.inc
qcsrc/common/mutators/mutator/touchexplode/_mod.qh
qcsrc/common/mutators/mutator/touchexplode/module.inc [deleted file]
qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/touchexplode/touchexplode.qc [deleted file]
qcsrc/common/mutators/mutator/vampire/_mod.inc
qcsrc/common/mutators/mutator/vampire/_mod.qh
qcsrc/common/mutators/mutator/vampire/module.inc [deleted file]
qcsrc/common/mutators/mutator/vampire/sv_vampire.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/vampire/sv_vampire.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/vampire/vampire.qc [deleted file]
qcsrc/common/mutators/mutator/vampirehook/_mod.inc
qcsrc/common/mutators/mutator/vampirehook/_mod.qh
qcsrc/common/mutators/mutator/vampirehook/module.inc [deleted file]
qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/vampirehook/vampirehook.qc [deleted file]
qcsrc/common/mutators/mutator/waypoints/all.qh
qcsrc/common/mutators/mutator/waypoints/module.inc [deleted file]
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/weaponarena_random/_mod.inc
qcsrc/common/mutators/mutator/weaponarena_random/_mod.qh
qcsrc/common/mutators/mutator/weaponarena_random/module.inc [deleted file]
qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/weaponarena_random/weaponarena_random.qc [deleted file]
qcsrc/common/physics/movetypes/follow.qh [new file with mode: 0644]
qcsrc/common/physics/movetypes/step.qh [new file with mode: 0644]
qcsrc/common/physics/movetypes/toss.qh [new file with mode: 0644]
qcsrc/common/physics/movetypes/walk.qh [new file with mode: 0644]
qcsrc/common/stats.qh
qcsrc/common/triggers/func/bobbing.qh [new file with mode: 0644]
qcsrc/common/triggers/func/button.qh [new file with mode: 0644]
qcsrc/common/triggers/func/conveyor.qh [new file with mode: 0644]
qcsrc/common/triggers/func/door_rotating.qh [new file with mode: 0644]
qcsrc/common/triggers/func/door_secret.qh [new file with mode: 0644]
qcsrc/common/triggers/func/fourier.qh [new file with mode: 0644]
qcsrc/common/triggers/func/pendulum.qh [new file with mode: 0644]
qcsrc/common/triggers/func/plat.qh [new file with mode: 0644]
qcsrc/common/triggers/func/pointparticles.qh [new file with mode: 0644]
qcsrc/common/triggers/func/rainsnow.qh [new file with mode: 0644]
qcsrc/common/triggers/func/rotating.qh [new file with mode: 0644]
qcsrc/common/triggers/func/stardust.qh [new file with mode: 0644]
qcsrc/common/triggers/func/vectormamamam.qh [new file with mode: 0644]
qcsrc/common/triggers/misc/corner.qh [new file with mode: 0644]
qcsrc/common/triggers/misc/follow.qh [new file with mode: 0644]
qcsrc/common/triggers/misc/include.qh [new file with mode: 0644]
qcsrc/common/triggers/misc/laser.qh [new file with mode: 0644]
qcsrc/common/triggers/misc/teleport_dest.qh [new file with mode: 0644]
qcsrc/common/triggers/target/changelevel.qh [new file with mode: 0644]
qcsrc/common/triggers/target/location.qh [new file with mode: 0644]
qcsrc/common/triggers/target/spawn.qh [new file with mode: 0644]
qcsrc/common/triggers/target/speaker.qh [new file with mode: 0644]
qcsrc/common/triggers/target/voicescript.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/counter.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/delay.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/disablerelay.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/flipflop.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/gamestart.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/gravity.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/heal.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/hurt.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/magicear.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/monoflop.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/multivibrator.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/relay.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/relay_activators.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/relay_if.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/relay_teamcheck.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/teleport.qh [new file with mode: 0644]
qcsrc/common/turrets/_mod.inc
qcsrc/common/turrets/_mod.qh
qcsrc/common/turrets/checkpoint.qh [new file with mode: 0644]
qcsrc/common/turrets/cl_turrets.qh [new file with mode: 0644]
qcsrc/common/turrets/targettrigger.qh [new file with mode: 0644]
qcsrc/common/turrets/turrets.qc [new file with mode: 0644]
qcsrc/common/turrets/turrets.qh [new file with mode: 0644]
qcsrc/common/vehicles/_mod.inc
qcsrc/common/vehicles/_mod.qh
qcsrc/common/vehicles/vehicles.qc [new file with mode: 0644]
qcsrc/common/vehicles/vehicles.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/arc.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/blaster.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/crylink.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/devastator.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/electro.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/fireball.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/hagar.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/hlac.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/hook.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/machinegun.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/minelayer.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/mortar.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/porto.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/rifle.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/seeker.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/shockwave.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/shotgun.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/tuba.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/vaporizer.qh [new file with mode: 0644]
qcsrc/common/weapons/weapon/vortex.qh [new file with mode: 0644]
qcsrc/lib/angle.qh [new file with mode: 0644]
qcsrc/lib/csqcmodel/_mod.inc
qcsrc/lib/csqcmodel/_mod.qh
qcsrc/lib/csqcmodel/model.qc [new file with mode: 0644]
qcsrc/lib/csqcmodel/model.qh [new file with mode: 0644]
qcsrc/lib/csqcmodel/player.qc [new file with mode: 0644]
qcsrc/lib/csqcmodel/player.qh [new file with mode: 0644]
qcsrc/lib/json.qh [new file with mode: 0644]
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/bot/default/bot.qc
qcsrc/server/cl_client.qc [deleted file]
qcsrc/server/cl_client.qh [deleted file]
qcsrc/server/cl_impulse.qc [deleted file]
qcsrc/server/cl_impulse.qh [deleted file]
qcsrc/server/cl_player.qc [deleted file]
qcsrc/server/cl_player.qh [deleted file]
qcsrc/server/client.qc [new file with mode: 0644]
qcsrc/server/client.qh [new file with mode: 0644]
qcsrc/server/command/_mod.qh
qcsrc/server/command/banning.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/g_hook.qc
qcsrc/server/g_world.qc
qcsrc/server/impulse.qc [new file with mode: 0644]
qcsrc/server/impulse.qh [new file with mode: 0644]
qcsrc/server/matrix.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode.qh
qcsrc/server/mutators/mutator.qh
qcsrc/server/player.qc [new file with mode: 0644]
qcsrc/server/player.qh [new file with mode: 0644]
qcsrc/server/race.qc
qcsrc/server/scores_rules.qc
qcsrc/server/teamplay.qc
qcsrc/server/tests.qh
qcsrc/tools/genmod.sh

index 49fd90b..dcfc6ec 100644 (file)
@@ -1,2 +1,4 @@
 // generated file; do not modify
-#include <client/commands/cl_cmd.qc>
+#ifdef CSQC
+    #include <client/commands/cl_cmd.qc>
+#endif
index 9e5aa99..7829965 100644 (file)
@@ -1,2 +1,4 @@
 // generated file; do not modify
-#include <client/commands/cl_cmd.qh>
+#ifdef CSQC
+    #include <client/commands/cl_cmd.qh>
+#endif
index 8070d0c..86b2db1 100644 (file)
@@ -15,7 +15,7 @@
 #include <common/constants.qh>
 #include <common/debug.qh>
 #include <common/mapinfo.qh>
-#include <common/gamemodes/all.qh>
+#include <common/gamemodes/_all.qh>
 #include <common/physics/player.qh>
 #include <common/stats.qh>
 #include <common/triggers/target/music.qh>
diff --git a/qcsrc/common/campaign_file.qh b/qcsrc/common/campaign_file.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/campaign_setup.qh b/qcsrc/common/campaign_setup.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/effects/effectinfo.qh b/qcsrc/common/effects/effectinfo.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/effects/qc/casings.qh b/qcsrc/common/effects/qc/casings.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/effects/qc/damageeffects.qh b/qcsrc/common/effects/qc/damageeffects.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 573b52f..d60b2e8 100644 (file)
@@ -6,7 +6,7 @@
        #include <common/animdecide.qh>
 
        #ifdef SVQC
-               #include <server/cl_player.qh>
+               #include <server/player.qh>
        #endif
 
        REGISTER_NET_TEMP(globalsound)
index 8bc63f7..21f512a 100644 (file)
@@ -1,2 +1,4 @@
 #include "_all.qh"
 #include "_mod.inc"
+
+#include "gamemode/_all.inc"
index 947026d..8aed6ca 100644 (file)
@@ -1,2 +1,4 @@
 #pragma once
 #include "_mod.qh"
+
+#include "gamemode/_all.qh"
index 0b77949..98fb481 100644 (file)
@@ -1,2 +1 @@
 // generated file; do not modify
-#include <common/gamemodes/all.qc>
index a7b7a54..98fb481 100644 (file)
@@ -1,2 +1 @@
 // generated file; do not modify
-#include <common/gamemodes/all.qh>
diff --git a/qcsrc/common/gamemodes/all.inc b/qcsrc/common/gamemodes/all.inc
deleted file mode 100644 (file)
index bcdcd7c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "gamemode/nexball/module.inc"
-#include "gamemode/onslaught/module.inc"
diff --git a/qcsrc/common/gamemodes/all.qc b/qcsrc/common/gamemodes/all.qc
deleted file mode 100644 (file)
index f0fc719..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "all.qh"
-
-#define IMPLEMENTATION
-#include "all.inc"
-#undef IMPLEMENTATION
diff --git a/qcsrc/common/gamemodes/all.qh b/qcsrc/common/gamemodes/all.qh
deleted file mode 100644 (file)
index 62ba616..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef GAMEMODES_ALL_H
-#define GAMEMODES_ALL_H
-
-#include "all.inc"
-
-#endif
diff --git a/qcsrc/common/gamemodes/gamemode/_all.inc b/qcsrc/common/gamemodes/gamemode/_all.inc
new file mode 100644 (file)
index 0000000..7c51f95
--- /dev/null
@@ -0,0 +1,5 @@
+#include "_all.qh"
+#include "_mod.inc"
+
+#include "nexball/_mod.inc"
+#include "onslaught/_mod.inc"
diff --git a/qcsrc/common/gamemodes/gamemode/_all.qh b/qcsrc/common/gamemodes/gamemode/_all.qh
new file mode 100644 (file)
index 0000000..dd16f04
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+#include "_mod.qh"
+
+#include "nexball/_mod.qh"
+#include "onslaught/_mod.qh"
diff --git a/qcsrc/common/gamemodes/gamemode/nexball/module.inc b/qcsrc/common/gamemodes/gamemode/nexball/module.inc
deleted file mode 100644 (file)
index 0d80962..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "nexball.qc"
-#include "weapon.qc"
index 0f0ecb4..9c6c9f0 100644 (file)
@@ -1,6 +1,5 @@
 #include "nexball.qh"
 
-#ifdef IMPLEMENTATION
 #ifdef CSQC
 int autocvar_cl_eventchase_nexball = 1;
 
@@ -1157,4 +1156,3 @@ REGISTER_MUTATOR(nb, g_nexball)
 }
 
 #endif
-#endif
index 9dd8042..53797d2 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef GAMEMODE_NEXBALL_H
-#define GAMEMODE_NEXBALL_H
+#pragma once
 
 #ifdef SVQC
 //EF_BRIGHTFIELD|EF_BRIGHTLIGHT|EF_DIMLIGHT|EF_BLUE|EF_RED|EF_FLAME
@@ -35,4 +34,3 @@ float nb_teams;
 
 .float teamtime;
 #endif
-#endif
index c6aa4be..f207263 100644 (file)
@@ -1,12 +1 @@
-#ifndef GAMEMODE_NEXBALL_WEAPON_H
-#define GAMEMODE_NEXBALL_WEAPON_H
-
-CLASS(BallStealer, PortoLaunch)
-/* flags     */ ATTRIB(BallStealer, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(BallStealer, impulse, int, 0);
-/* refname   */ ATTRIB(BallStealer, netname, string, "ballstealer");
-/* wepname   */ ATTRIB(BallStealer, m_name, string, _("Ball Stealer"));
-ENDCLASS(BallStealer)
-REGISTER_WEAPON(NEXBALL, NEW(BallStealer));
-
-#endif
+#include "weapon.qh"
diff --git a/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh
new file mode 100644 (file)
index 0000000..73b8872
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(BallStealer, PortoLaunch)
+/* flags     */ ATTRIB(BallStealer, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(BallStealer, impulse, int, 0);
+/* refname   */ ATTRIB(BallStealer, netname, string, "ballstealer");
+/* wepname   */ ATTRIB(BallStealer, m_name, string, _("Ball Stealer"));
+ENDCLASS(BallStealer)
+REGISTER_WEAPON(NEXBALL, NEW(BallStealer));
index 334eb56..ca8c83c 100644 (file)
@@ -1,6 +1,19 @@
 // generated file; do not modify
-#include <common/gamemodes/gamemode/onslaught/cl_controlpoint.qc>
-#include <common/gamemodes/gamemode/onslaught/cl_generator.qc>
+#include <common/gamemodes/gamemode/onslaught/controlpoint.qc>
+#ifdef CSQC
+    #include <common/gamemodes/gamemode/onslaught/cl_controlpoint.qc>
+#endif
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/onslaught/sv_controlpoint.qc>
+#endif
+#include <common/gamemodes/gamemode/onslaught/generator.qc>
+#ifdef CSQC
+    #include <common/gamemodes/gamemode/onslaught/cl_generator.qc>
+#endif
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/onslaught/sv_generator.qc>
+#endif
 #include <common/gamemodes/gamemode/onslaught/onslaught.qc>
-#include <common/gamemodes/gamemode/onslaught/sv_controlpoint.qc>
-#include <common/gamemodes/gamemode/onslaught/sv_generator.qc>
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/onslaught/sv_onslaught.qc>
+#endif
index e895495..bb95416 100644 (file)
@@ -1,6 +1,19 @@
 // generated file; do not modify
-#include <common/gamemodes/gamemode/onslaught/cl_controlpoint.qh>
-#include <common/gamemodes/gamemode/onslaught/cl_generator.qh>
+#include <common/gamemodes/gamemode/onslaught/controlpoint.qh>
+#ifdef CSQC
+    #include <common/gamemodes/gamemode/onslaught/cl_controlpoint.qh>
+#endif
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/onslaught/sv_controlpoint.qh>
+#endif
+#include <common/gamemodes/gamemode/onslaught/generator.qh>
+#ifdef CSQC
+    #include <common/gamemodes/gamemode/onslaught/cl_generator.qh>
+#endif
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/onslaught/sv_generator.qh>
+#endif
 #include <common/gamemodes/gamemode/onslaught/onslaught.qh>
-#include <common/gamemodes/gamemode/onslaught/sv_controlpoint.qh>
-#include <common/gamemodes/gamemode/onslaught/sv_generator.qh>
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/onslaught/sv_onslaught.qh>
+#endif
index 15586ea..d543733 100644 (file)
@@ -1,10 +1,7 @@
-#ifndef CLIENT_CONTROLPOINT_H
-#define CLIENT_CONTROLPOINT_H
+#pragma once
 
 const vector CPICON_MIN = '-32 -32 -9';
 const vector CPICON_MAX = '32 32 25';
 
 const int CPSF_STATUS = 4;
 const int CPSF_SETUP = 8;
-
-#endif
index 3c0cf28..4952468 100644 (file)
@@ -1,9 +1,7 @@
-#ifndef CLIENT_GENERATOR_H
-#define CLIENT_GENERATOR_H
+#pragma once
+
 const vector GENERATOR_MIN = '-52 -52 -14';
 const vector GENERATOR_MAX = '52 52 75';
 
 const int GSF_STATUS = 4;
 const int GSF_SETUP = 8;
-
-#endif
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qc
new file mode 100644 (file)
index 0000000..b21f5fd
--- /dev/null
@@ -0,0 +1 @@
+#include "controlpoint.qh"
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qh b/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/generator.qc
new file mode 100644 (file)
index 0000000..f9415f6
--- /dev/null
@@ -0,0 +1 @@
+#include "generator.qh"
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/generator.qh b/qcsrc/common/gamemodes/gamemode/onslaught/generator.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/module.inc b/qcsrc/common/gamemodes/gamemode/onslaught/module.inc
deleted file mode 100644 (file)
index fee33b1..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef ONS_CONSTANTS
-       #define ONS_CONSTANTS
-       REGISTER_NET_LINKED(ENT_CLIENT_GENERATOR)
-       REGISTER_NET_LINKED(ENT_CLIENT_CONTROLPOINT_ICON)
-#endif
-
-#if defined(SVQC)
-       #include "onslaught.qc"
-       #ifndef IMPLEMENTATION
-               #include "sv_controlpoint.qh"
-               #include "sv_generator.qh"
-       #else
-               #include "sv_controlpoint.qc"
-               #include "sv_generator.qc"
-       #endif
-#elif defined(CSQC)
-       #ifndef IMPLEMENTATION
-               #include "cl_controlpoint.qh"
-               #include "cl_generator.qh"
-       #else
-               #include "cl_controlpoint.qc"
-               #include "cl_generator.qc"
-       #endif
-#endif
index 713c5d7..36926b7 100644 (file)
@@ -1,2258 +1 @@
-#ifndef GAMEMODE_ONSLAUGHT_H
-#define GAMEMODE_ONSLAUGHT_H
-
-float autocvar_g_onslaught_point_limit;
-void ons_Initialize();
-
-REGISTER_MUTATOR(ons, false)
-{
-       MUTATOR_ONADD
-       {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               ons_Initialize();
-
-               ActivateTeamplay();
-               SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
-               have_team_spawns = -1; // request team spawns
-       }
-
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back ons_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
-       }
-
-       return false;
-}
-
-#ifdef SVQC
-
-.entity ons_toucher; // player who touched the control point
-
-// control point / generator constants
-const float ONS_CP_THINKRATE = 0.2;
-const float GEN_THINKRATE = 1;
-#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
-const vector CPGEN_WAYPOINT_OFFSET = ('0 0 128');
-const vector CPICON_OFFSET = ('0 0 96');
-
-// list of generators on the map
-entity ons_worldgeneratorlist;
-.entity ons_worldgeneratornext;
-.entity ons_stalegeneratornext;
-
-// list of control points on the map
-entity ons_worldcplist;
-.entity ons_worldcpnext;
-.entity ons_stalecpnext;
-
-// list of links on the map
-entity ons_worldlinklist;
-.entity ons_worldlinknext;
-.entity ons_stalelinknext;
-
-// definitions
-.entity sprite;
-.string target2;
-.int iscaptured;
-.int islinked;
-.int isshielded;
-.float lasthealth;
-.int lastteam;
-.int lastshielded;
-.int lastcaptured;
-
-.bool waslinked;
-
-bool ons_stalemate;
-
-.float teleport_antispam;
-
-.bool ons_roundlost = _STAT(ROUNDLOST);
-
-// waypoint sprites
-.entity bot_basewaypoint; // generator waypointsprite
-
-.bool isgenneighbor[17];
-.bool iscpneighbor[17];
-float ons_notification_time[17];
-
-.float ons_overtime_damagedelay;
-
-.vector ons_deathloc;
-
-.entity ons_spawn_by;
-
-// declarations for functions used outside gamemode_onslaught.qc
-void ons_Generator_UpdateSprite(entity e);
-void ons_ControlPoint_UpdateSprite(entity e);
-bool ons_ControlPoint_Attackable(entity cp, int teamnumber);
-
-// CaptureShield: Prevent capturing or destroying control point/generator if it is not available yet
-float ons_captureshield_force; // push force of the shield
-
-// bot player logic
-const int HAVOCBOT_ONS_ROLE_NONE               = 0;
-const int HAVOCBOT_ONS_ROLE_DEFENSE    = 2;
-const int HAVOCBOT_ONS_ROLE_ASSISTANT  = 4;
-const int HAVOCBOT_ONS_ROLE_OFFENSE    = 8;
-
-.entity havocbot_ons_target;
-
-.int havocbot_role_flags;
-.float havocbot_attack_time;
-
-void havocbot_role_ons_defense(entity this);
-void havocbot_role_ons_offense(entity this);
-void havocbot_role_ons_assistant(entity this);
-
-void havocbot_ons_reset_role(entity this);
-void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius);
-void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius);
-
-// score rule declarations
-const int ST_ONS_CAPS = 1;
-
-#endif
-#endif
-
-#ifdef IMPLEMENTATION
-
-#include "sv_controlpoint.qh"
-#include "sv_generator.qh"
-
-bool g_onslaught;
-
-float autocvar_g_onslaught_teleport_wait;
-bool autocvar_g_onslaught_spawn_at_controlpoints;
-bool autocvar_g_onslaught_spawn_at_generator;
-float autocvar_g_onslaught_cp_proxydecap;
-float autocvar_g_onslaught_cp_proxydecap_distance = 512;
-float autocvar_g_onslaught_cp_proxydecap_dps = 100;
-float autocvar_g_onslaught_spawn_at_controlpoints_chance = 0.5;
-float autocvar_g_onslaught_spawn_at_controlpoints_random;
-float autocvar_g_onslaught_spawn_at_generator_chance;
-float autocvar_g_onslaught_spawn_at_generator_random;
-float autocvar_g_onslaught_cp_buildhealth;
-float autocvar_g_onslaught_cp_buildtime;
-float autocvar_g_onslaught_cp_health;
-float autocvar_g_onslaught_cp_regen;
-float autocvar_g_onslaught_gen_health;
-float autocvar_g_onslaught_shield_force = 100;
-float autocvar_g_onslaught_allow_vehicle_touch;
-float autocvar_g_onslaught_round_timelimit;
-float autocvar_g_onslaught_warmup;
-float autocvar_g_onslaught_teleport_radius;
-float autocvar_g_onslaught_spawn_choose;
-float autocvar_g_onslaught_click_radius;
-
-void FixSize(entity e);
-
-// =======================
-// CaptureShield Functions
-// =======================
-
-bool ons_CaptureShield_Customize(entity this, entity client)
-{
-       entity e = WaypointSprite_getviewentity(client);
-
-       if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, e.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return false; }
-       if(SAME_TEAM(this, e)) { return false; }
-
-       return true;
-}
-
-void ons_CaptureShield_Touch(entity this, entity toucher)
-{
-       if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, toucher.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; }
-       if(!IS_PLAYER(toucher)) { return; }
-       if(SAME_TEAM(toucher, this)) { return; }
-
-       vector mymid = (this.absmin + this.absmax) * 0.5;
-       vector theirmid = (toucher.absmin + toucher.absmax) * 0.5;
-
-       Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ons_captureshield_force);
-
-       if(IS_REAL_CLIENT(toucher))
-       {
-               play2(toucher, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
-
-               if(this.enemy.classname == "onslaught_generator")
-                       Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED);
-               else
-                       Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED);
-       }
-}
-
-void ons_CaptureShield_Reset(entity this)
-{
-       this.colormap = this.enemy.colormap;
-       this.team = this.enemy.team;
-}
-
-void ons_CaptureShield_Spawn(entity generator, bool is_generator)
-{
-       entity shield = new(ons_captureshield);
-
-       shield.enemy = generator;
-       shield.team = generator.team;
-       shield.colormap = generator.colormap;
-       shield.reset = ons_CaptureShield_Reset;
-       settouch(shield, ons_CaptureShield_Touch);
-       setcefc(shield, ons_CaptureShield_Customize);
-       shield.effects = EF_ADDITIVE;
-       set_movetype(shield, MOVETYPE_NOCLIP);
-       shield.solid = SOLID_TRIGGER;
-       shield.avelocity = '7 0 11';
-       shield.scale = 1;
-       shield.model = ((is_generator) ? "models/onslaught/generator_shield.md3" : "models/onslaught/controlpoint_shield.md3");
-
-       precache_model(shield.model);
-       setorigin(shield, generator.origin);
-       _setmodel(shield, shield.model);
-       setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs);
-}
-
-
-// ==========
-// Junk Pile
-// ==========
-
-void setmodel_fixsize(entity e, Model m)
-{
-       setmodel(e, m);
-       FixSize(e);
-}
-
-void onslaught_updatelinks()
-{
-       entity l;
-       // first check if the game has ended
-       LOG_DEBUG("--- updatelinks ---");
-       // mark generators as being shielded and networked
-       for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
-       {
-               if (l.iscaptured)
-                       LOG_DEBUG(etos(l), " (generator) belongs to team ", ftos(l.team));
-               else
-                       LOG_DEBUG(etos(l), " (generator) is destroyed");
-               l.islinked = l.iscaptured;
-               l.isshielded = l.iscaptured;
-               l.sprite.SendFlags |= 16;
-       }
-       // mark points as shielded and not networked
-       for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
-       {
-               l.islinked = false;
-               l.isshielded = true;
-               int i;
-               for(i = 0; i < 17; ++i) { l.isgenneighbor[i] = false; l.iscpneighbor[i] = false; }
-               LOG_DEBUG(etos(l), " (point) belongs to team ", ftos(l.team));
-               l.sprite.SendFlags |= 16;
-       }
-       // flow power outward from the generators through the network
-       bool stop = false;
-       while (!stop)
-       {
-               stop = true;
-               for(l = ons_worldlinklist; l; l = l.ons_worldlinknext)
-               {
-                       // if both points are captured by the same team, and only one of
-                       // them is powered, mark the other one as powered as well
-                       if (l.enemy.iscaptured && l.goalentity.iscaptured)
-                               if (l.enemy.islinked != l.goalentity.islinked)
-                                       if(SAME_TEAM(l.enemy, l.goalentity))
-                                       {
-                                               if (!l.goalentity.islinked)
-                                               {
-                                                       stop = false;
-                                                       l.goalentity.islinked = true;
-                                                       LOG_DEBUG(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)");
-                                               }
-                                               else if (!l.enemy.islinked)
-                                               {
-                                                       stop = false;
-                                                       l.enemy.islinked = true;
-                                                       LOG_DEBUG(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)");
-                                               }
-                                       }
-               }
-       }
-       // now that we know which points are powered we can mark their neighbors
-       // as unshielded if team differs
-       for(l = ons_worldlinklist; l; l = l.ons_worldlinknext)
-       {
-               if (l.goalentity.islinked)
-               {
-                       if(DIFF_TEAM(l.goalentity, l.enemy))
-                       {
-                               LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)");
-                               l.enemy.isshielded = false;
-                       }
-                       if(l.goalentity.classname == "onslaught_generator")
-                               l.enemy.isgenneighbor[l.goalentity.team] = true;
-                       else
-                               l.enemy.iscpneighbor[l.goalentity.team] = true;
-               }
-               if (l.enemy.islinked)
-               {
-                       if(DIFF_TEAM(l.goalentity, l.enemy))
-                       {
-                               LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)");
-                               l.goalentity.isshielded = false;
-                       }
-                       if(l.enemy.classname == "onslaught_generator")
-                               l.goalentity.isgenneighbor[l.enemy.team] = true;
-                       else
-                               l.goalentity.iscpneighbor[l.enemy.team] = true;
-               }
-       }
-       // now update the generators
-       for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
-       {
-               if (l.isshielded)
-               {
-                       LOG_DEBUG(etos(l), " (generator) is shielded");
-                       l.takedamage = DAMAGE_NO;
-                       l.bot_attack = false;
-               }
-               else
-               {
-                       LOG_DEBUG(etos(l), " (generator) is not shielded");
-                       l.takedamage = DAMAGE_AIM;
-                       l.bot_attack = true;
-               }
-
-               ons_Generator_UpdateSprite(l);
-       }
-       // now update the takedamage and alpha variables on control point icons
-       for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
-       {
-               if (l.isshielded)
-               {
-                       LOG_DEBUG(etos(l), " (point) is shielded");
-                       if (l.goalentity)
-                       {
-                               l.goalentity.takedamage = DAMAGE_NO;
-                               l.goalentity.bot_attack = false;
-                       }
-               }
-               else
-               {
-                       LOG_DEBUG(etos(l), " (point) is not shielded");
-                       if (l.goalentity)
-                       {
-                               l.goalentity.takedamage = DAMAGE_AIM;
-                               l.goalentity.bot_attack = true;
-                       }
-               }
-               ons_ControlPoint_UpdateSprite(l);
-       }
-       FOREACH_ENTITY_CLASS("ons_captureshield", true,
-       {
-               it.team = it.enemy.team;
-               it.colormap = it.enemy.colormap;
-       });
-}
-
-
-// ===================
-// Main Link Functions
-// ===================
-
-bool ons_Link_Send(entity this, entity to, int sendflags)
-{
-       WriteHeader(MSG_ENTITY, ENT_CLIENT_RADARLINK);
-       WriteByte(MSG_ENTITY, sendflags);
-       if(sendflags & 1)
-       {
-               WriteCoord(MSG_ENTITY, this.goalentity.origin_x);
-               WriteCoord(MSG_ENTITY, this.goalentity.origin_y);
-               WriteCoord(MSG_ENTITY, this.goalentity.origin_z);
-       }
-       if(sendflags & 2)
-       {
-               WriteCoord(MSG_ENTITY, this.enemy.origin_x);
-               WriteCoord(MSG_ENTITY, this.enemy.origin_y);
-               WriteCoord(MSG_ENTITY, this.enemy.origin_z);
-       }
-       if(sendflags & 4)
-       {
-               WriteByte(MSG_ENTITY, this.clientcolors); // which is goalentity's color + enemy's color * 16
-       }
-       return true;
-}
-
-void ons_Link_CheckUpdate(entity this)
-{
-       // TODO check if the two sides have moved (currently they won't move anyway)
-       float cc = 0, cc1 = 0, cc2 = 0;
-
-       if(this.goalentity.islinked || this.goalentity.iscaptured) { cc1 = (this.goalentity.team - 1) * 0x01; }
-       if(this.enemy.islinked || this.enemy.iscaptured) { cc2 = (this.enemy.team - 1) * 0x10; }
-
-       cc = cc1 + cc2;
-
-       if(cc != this.clientcolors)
-       {
-               this.clientcolors = cc;
-               this.SendFlags |= 4;
-       }
-
-       this.nextthink = time;
-}
-
-void ons_DelayedLinkSetup(entity this)
-{
-       this.goalentity = find(NULL, targetname, this.target);
-       this.enemy = find(NULL, targetname, this.target2);
-       if(!this.goalentity) { objerror(this, "can not find target\n"); }
-       if(!this.enemy) { objerror(this, "can not find target2\n"); }
-
-       LOG_DEBUG(etos(this.goalentity), " linked with ", etos(this.enemy));
-       this.SendFlags |= 3;
-       setthink(this, ons_Link_CheckUpdate);
-       this.nextthink = time;
-}
-
-
-// =============================
-// Main Control Point Functions
-// =============================
-
-int ons_ControlPoint_CanBeLinked(entity cp, int teamnumber)
-{
-       if(cp.isgenneighbor[teamnumber]) { return 2; }
-       if(cp.iscpneighbor[teamnumber]) { return 1; }
-
-       return 0;
-}
-
-int ons_ControlPoint_Attackable(entity cp, int teamnumber)
-       // -2: SAME TEAM, attackable by enemy!
-       // -1: SAME TEAM!
-       // 0: off limits
-       // 1: attack it
-       // 2: touch it
-       // 3: attack it (HIGH PRIO)
-       // 4: touch it (HIGH PRIO)
-{
-       int a;
-
-       if(cp.isshielded)
-       {
-               return 0;
-       }
-       else if(cp.goalentity)
-       {
-               // if there's already an icon built, nothing happens
-               if(cp.team == teamnumber)
-               {
-                       a = ons_ControlPoint_CanBeLinked(cp, teamnumber);
-                       if(a) // attackable by enemy?
-                               return -2; // EMERGENCY!
-                       return -1;
-               }
-               // we know it can be linked, so no need to check
-               // but...
-               a = ons_ControlPoint_CanBeLinked(cp, teamnumber);
-               if(a == 2) // near our generator?
-                       return 3; // EMERGENCY!
-               return 1;
-       }
-       else
-       {
-               // free point
-               if(ons_ControlPoint_CanBeLinked(cp, teamnumber))
-               {
-                       a = ons_ControlPoint_CanBeLinked(cp, teamnumber); // why was this here NUM_TEAM_1 + NUM_TEAM_2 - t
-                       if(a == 2)
-                               return 4; // GET THIS ONE NOW!
-                       else
-                               return 2; // TOUCH ME
-               }
-       }
-       return 0;
-}
-
-void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
-       if(damage <= 0) { return; }
-
-       if (this.owner.isshielded)
-       {
-               // this is protected by a shield, so ignore the damage
-               if (time > this.pain_finished)
-                       if (IS_PLAYER(attacker))
-                       {
-                               play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
-                               this.pain_finished = time + 1;
-                               attacker.typehitsound += 1; // play both sounds (shield is way too quiet)
-                       }
-
-               return;
-       }
-
-       if(IS_PLAYER(attacker))
-       if(time - ons_notification_time[this.team] > 10)
-       {
-               play2team(this.team, SND(ONS_CONTROLPOINT_UNDERATTACK));
-               ons_notification_time[this.team] = time;
-       }
-
-       this.health = this.health - damage;
-       if(this.owner.iscaptured)
-               WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
-       else
-               WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - this.health) / (this.count / ONS_CP_THINKRATE));
-       this.pain_finished = time + 1;
-       // particles on every hit
-       pointparticles(EFFECT_SPARKS, hitloc, force*-1, 1);
-       //sound on every hit
-       if (random() < 0.5)
-               sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM);
-       else
-               sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM);
-
-       if (this.health < 0)
-       {
-               sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
-               pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
-               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname);
-
-               PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
-               PlayerScore_Add(attacker, SP_SCORE, 10);
-
-               this.owner.goalentity = NULL;
-               this.owner.islinked = false;
-               this.owner.iscaptured = false;
-               this.owner.team = 0;
-               this.owner.colormap = 1024;
-
-               WaypointSprite_UpdateMaxHealth(this.owner.sprite, 0);
-
-               onslaught_updatelinks();
-
-               // Use targets now (somebody make sure this is in the right place..)
-               SUB_UseTargets(this.owner, this, NULL);
-
-               this.owner.waslinked = this.owner.islinked;
-               if(this.owner.model != "models/onslaught/controlpoint_pad.md3")
-                       setmodel_fixsize(this.owner, MDL_ONS_CP_PAD1);
-               //setsize(this, '-32 -32 0', '32 32 8');
-
-               delete(this);
-       }
-
-       this.SendFlags |= CPSF_STATUS;
-}
-
-void ons_ControlPoint_Icon_Think(entity this)
-{
-       this.nextthink = time + ONS_CP_THINKRATE;
-
-       if(autocvar_g_onslaught_cp_proxydecap)
-       {
-               int _enemy_count = 0;
-               int _friendly_count = 0;
-
-               FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
-                       if(vdist(it.origin - this.origin, <, autocvar_g_onslaught_cp_proxydecap_distance))
-                       {
-                               if(SAME_TEAM(it, this))
-                                       ++_friendly_count;
-                               else
-                                       ++_enemy_count;
-                       }
-               });
-
-               _friendly_count = _friendly_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
-               _enemy_count = _enemy_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
-
-               this.health = bound(0, this.health + (_friendly_count - _enemy_count), this.max_health);
-               this.SendFlags |= CPSF_STATUS;
-               if(this.health <= 0)
-               {
-                       ons_ControlPoint_Icon_Damage(this, this, this, 1, 0, this.origin, '0 0 0');
-                       return;
-               }
-       }
-
-       if (time > this.pain_finished + 5)
-       {
-               if(this.health < this.max_health)
-               {
-                       this.health = this.health + this.count;
-                       if (this.health >= this.max_health)
-                               this.health = this.max_health;
-                       WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
-               }
-       }
-
-       if(this.owner.islinked != this.owner.waslinked)
-       {
-               // unteam the spawnpoint if needed
-               int t = this.owner.team;
-               if(!this.owner.islinked)
-                       this.owner.team = 0;
-
-               SUB_UseTargets(this.owner, this, NULL);
-
-               this.owner.team = t;
-
-               this.owner.waslinked = this.owner.islinked;
-       }
-
-       // damaged fx
-       if(random() < 0.6 - this.health / this.max_health)
-       {
-               Send_Effect(EFFECT_ELECTRIC_SPARKS, this.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
-
-               if(random() > 0.8)
-                       sound(this, CH_PAIN, SND_ONS_SPARK1, VOL_BASE, ATTEN_NORM);
-               else if (random() > 0.5)
-                       sound(this, CH_PAIN, SND_ONS_SPARK2, VOL_BASE, ATTEN_NORM);
-       }
-}
-
-void ons_ControlPoint_Icon_BuildThink(entity this)
-{
-       int a;
-
-       this.nextthink = time + ONS_CP_THINKRATE;
-
-       // only do this if there is power
-       a = ons_ControlPoint_CanBeLinked(this.owner, this.owner.team);
-       if(!a)
-               return;
-
-       this.health = this.health + this.count;
-
-       this.SendFlags |= CPSF_STATUS;
-
-       if (this.health >= this.max_health)
-       {
-               this.health = this.max_health;
-               this.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on
-               setthink(this, ons_ControlPoint_Icon_Think);
-               sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM);
-               this.owner.iscaptured = true;
-               this.solid = SOLID_BBOX;
-
-               Send_Effect(EFFECT_CAP(this.owner.team), this.owner.origin, '0 0 0', 1);
-
-               WaypointSprite_UpdateMaxHealth(this.owner.sprite, this.max_health);
-               WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
-
-               if(IS_PLAYER(this.owner.ons_toucher))
-               {
-                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message);
-                       Send_Notification(NOTIF_ALL_EXCEPT, this.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(this.owner.ons_toucher.team, CENTER_ONS_CAPTURE), this.owner.message);
-                       Send_Notification(NOTIF_ONE, this.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, this.owner.message);
-                       PlayerScore_Add(this.owner.ons_toucher, SP_ONS_CAPS, 1);
-                       PlayerTeamScore_AddScore(this.owner.ons_toucher, 10);
-               }
-
-               this.owner.ons_toucher = NULL;
-
-               onslaught_updatelinks();
-
-               // Use targets now (somebody make sure this is in the right place..)
-               SUB_UseTargets(this.owner, this, NULL);
-
-               this.SendFlags |= CPSF_SETUP;
-       }
-       if(this.owner.model != MDL_ONS_CP_PAD2.model_str())
-               setmodel_fixsize(this.owner, MDL_ONS_CP_PAD2);
-
-       if(random() < 0.9 - this.health / this.max_health)
-               Send_Effect(EFFECT_RAGE, this.origin + 10 * randomvec(), '0 0 -1', 1);
-}
-
-void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc);
-
-void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
-{
-       entity e = new(onslaught_controlpoint_icon);
-
-       setsize(e, CPICON_MIN, CPICON_MAX);
-       setorigin(e, cp.origin + CPICON_OFFSET);
-
-       e.owner = cp;
-       e.max_health = autocvar_g_onslaught_cp_health;
-       e.health = autocvar_g_onslaught_cp_buildhealth;
-       e.solid = SOLID_NOT;
-       e.takedamage = DAMAGE_AIM;
-       e.bot_attack = true;
-       e.event_damage = ons_ControlPoint_Icon_Damage;
-       e.team = player.team;
-       e.colormap = 1024 + (e.team - 1) * 17;
-       e.count = (e.max_health - e.health) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
-
-       sound(e, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILD, VOL_BASE, ATTEN_NORM);
-
-       cp.goalentity = e;
-       cp.team = e.team;
-       cp.colormap = e.colormap;
-
-       Send_Effect(EFFECT_FLAG_TOUCH(player.team), e.origin, '0 0 0', 1);
-
-       WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - e.health) / (e.count / ONS_CP_THINKRATE));
-       WaypointSprite_UpdateRule(cp.sprite,cp.team,SPRITERULE_TEAMPLAY);
-       cp.sprite.SendFlags |= 16;
-
-       onslaught_controlpoint_icon_link(e, ons_ControlPoint_Icon_BuildThink);
-}
-
-entity ons_ControlPoint_Waypoint(entity e)
-{
-       if(e.team)
-       {
-               int a = ons_ControlPoint_Attackable(e, e.team);
-
-               if(a == -2) { return WP_OnsCPDefend; } // defend now
-               if(a == -1 || a == 1 || a == 2) { return WP_OnsCP; } // touch
-               if(a == 3 || a == 4) { return WP_OnsCPAttack; } // attack
-       }
-       else
-               return WP_OnsCP;
-
-       return WP_Null;
-}
-
-void ons_ControlPoint_UpdateSprite(entity e)
-{
-       entity s1 = ons_ControlPoint_Waypoint(e);
-       WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1);
-
-       bool sh;
-       sh = !(ons_ControlPoint_CanBeLinked(e, NUM_TEAM_1) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_2) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_3) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_4));
-
-       if(e.lastteam != e.team + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured)
-       {
-               if(e.iscaptured) // don't mess up build bars!
-               {
-                       if(sh)
-                       {
-                               WaypointSprite_UpdateMaxHealth(e.sprite, 0);
-                       }
-                       else
-                       {
-                               WaypointSprite_UpdateMaxHealth(e.sprite, e.goalentity.max_health);
-                               WaypointSprite_UpdateHealth(e.sprite, e.goalentity.health);
-                       }
-               }
-               if(e.lastshielded)
-               {
-                       if(e.team)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, false));
-                       else
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5');
-               }
-               else
-               {
-                       if(e.team)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, false));
-                       else
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75');
-               }
-               WaypointSprite_Ping(e.sprite);
-
-               e.lastteam = e.team + 2;
-               e.lastshielded = sh;
-               e.lastcaptured = e.iscaptured;
-       }
-}
-
-void ons_ControlPoint_Touch(entity this, entity toucher)
-{
-       int attackable;
-
-       if(IS_VEHICLE(toucher) && toucher.owner)
-       if(autocvar_g_onslaught_allow_vehicle_touch)
-               toucher = toucher.owner;
-       else
-               return;
-
-       if(!IS_PLAYER(toucher)) { return; }
-       if(STAT(FROZEN, toucher)) { return; }
-       if(IS_DEAD(toucher)) { return; }
-
-       if ( SAME_TEAM(this,toucher) )
-       if ( this.iscaptured )
-       {
-               if(time <= toucher.teleport_antispam)
-                       Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT_ANTISPAM, rint(toucher.teleport_antispam - time));
-               else
-                       Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
-       }
-
-       attackable = ons_ControlPoint_Attackable(this, toucher.team);
-       if(attackable != 2 && attackable != 4)
-               return;
-       // we've verified that this player has a legitimate claim to this point,
-       // so start building the captured point icon (which only captures this
-       // point if it successfully builds without being destroyed first)
-       ons_ControlPoint_Icon_Spawn(this, toucher);
-
-       this.ons_toucher = toucher;
-
-       onslaught_updatelinks();
-}
-
-void ons_ControlPoint_Think(entity this)
-{
-       this.nextthink = time + ONS_CP_THINKRATE;
-       CSQCMODEL_AUTOUPDATE(this);
-}
-
-void ons_ControlPoint_Reset(entity this)
-{
-       if(this.goalentity)
-               delete(this.goalentity);
-
-       this.goalentity = NULL;
-       this.team = 0;
-       this.colormap = 1024;
-       this.iscaptured = false;
-       this.islinked = false;
-       this.isshielded = true;
-       setthink(this, ons_ControlPoint_Think);
-       this.ons_toucher = NULL;
-       this.nextthink = time + ONS_CP_THINKRATE;
-       setmodel_fixsize(this, MDL_ONS_CP_PAD1);
-
-       WaypointSprite_UpdateMaxHealth(this.sprite, 0);
-       WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
-
-       onslaught_updatelinks();
-
-       SUB_UseTargets(this, this, NULL); // to reset the structures, playerspawns etc.
-
-       CSQCMODEL_AUTOUPDATE(this);
-}
-
-void ons_DelayedControlPoint_Setup(entity this)
-{
-       onslaught_updatelinks();
-
-       // captureshield setup
-       ons_CaptureShield_Spawn(this, false);
-
-       CSQCMODEL_AUTOINIT(this);
-}
-
-void ons_ControlPoint_Setup(entity cp)
-{
-       // main setup
-       cp.ons_worldcpnext = ons_worldcplist; // link control point into ons_worldcplist
-       ons_worldcplist = cp;
-
-       cp.netname = "Control point";
-       cp.team = 0;
-       cp.solid = SOLID_BBOX;
-       set_movetype(cp, MOVETYPE_NONE);
-       settouch(cp, ons_ControlPoint_Touch);
-       setthink(cp, ons_ControlPoint_Think);
-       cp.nextthink = time + ONS_CP_THINKRATE;
-       cp.reset = ons_ControlPoint_Reset;
-       cp.colormap = 1024;
-       cp.iscaptured = false;
-       cp.islinked = false;
-       cp.isshielded = true;
-
-       if(cp.message == "") { cp.message = "a"; }
-
-       // appearence
-       setmodel_fixsize(cp, MDL_ONS_CP_PAD1);
-
-       // control point placement
-       if((cp.spawnflags & 1) || cp.noalign) // don't drop to floor, just stay at fixed location
-       {
-               cp.noalign = true;
-               set_movetype(cp, MOVETYPE_NONE);
-       }
-       else // drop to floor, automatically find a platform and set that as spawn origin
-       {
-               setorigin(cp, cp.origin + '0 0 20');
-               cp.noalign = false;
-               droptofloor(cp);
-               set_movetype(cp, MOVETYPE_TOSS);
-       }
-
-       // waypointsprites
-       WaypointSprite_SpawnFixed(WP_Null, cp.origin + CPGEN_WAYPOINT_OFFSET, cp, sprite, RADARICON_NONE);
-       WaypointSprite_UpdateRule(cp.sprite, cp.team, SPRITERULE_TEAMPLAY);
-
-       InitializeEntity(cp, ons_DelayedControlPoint_Setup, INITPRIO_SETLOCATION);
-}
-
-
-// =========================
-// Main Generator Functions
-// =========================
-
-entity ons_Generator_Waypoint(entity e)
-{
-       if (e.isshielded)
-               return WP_OnsGenShielded;
-       return WP_OnsGen;
-}
-
-void ons_Generator_UpdateSprite(entity e)
-{
-       entity s1 = ons_Generator_Waypoint(e);
-       WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1);
-
-       if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded)
-       {
-               e.lastteam = e.team + 2;
-               e.lastshielded = e.isshielded;
-               if(e.lastshielded)
-               {
-                       if(e.team)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, false));
-                       else
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5');
-               }
-               else
-               {
-                       if(e.team)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, false));
-                       else
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75');
-               }
-               WaypointSprite_Ping(e.sprite);
-       }
-}
-
-void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
-       if(damage <= 0) { return; }
-       if(warmup_stage || gameover) { return; }
-       if(!round_handler_IsRoundStarted()) { return; }
-
-       if (attacker != this)
-       {
-               if (this.isshielded)
-               {
-                       // this is protected by a shield, so ignore the damage
-                       if (time > this.pain_finished)
-                               if (IS_PLAYER(attacker))
-                               {
-                                       play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
-                                       attacker.typehitsound += 1;
-                                       this.pain_finished = time + 1;
-                               }
-                       return;
-               }
-               if (time > this.pain_finished)
-               {
-                       this.pain_finished = time + 10;
-                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, this), Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK));
-                       play2team(this.team, SND(ONS_GENERATOR_UNDERATTACK));
-               }
-       }
-       this.health = this.health - damage;
-       WaypointSprite_UpdateHealth(this.sprite, this.health);
-       // choose an animation frame based on health
-       this.frame = 10 * bound(0, (1 - this.health / this.max_health), 1);
-       // see if the generator is still functional, or dying
-       if (this.health > 0)
-       {
-               this.lasthealth = this.health;
-       }
-       else
-       {
-               if (attacker == this)
-                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME));
-               else
-               {
-                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED));
-                       PlayerScore_Add(attacker, SP_SCORE, 100);
-               }
-               this.iscaptured = false;
-               this.islinked = false;
-               this.isshielded = false;
-               this.takedamage = DAMAGE_NO; // can't be hurt anymore
-               this.event_damage = func_null; // won't do anything if hurt
-               this.count = 0; // reset counter
-               setthink(this, func_null);
-               this.nextthink = 0;
-               //this.think(); // do the first explosion now
-
-               WaypointSprite_UpdateMaxHealth(this.sprite, 0);
-               WaypointSprite_Ping(this.sprite);
-               //WaypointSprite_Kill(this.sprite); // can't do this yet, code too poor
-
-               onslaught_updatelinks();
-       }
-
-       // Throw some flaming gibs on damage, more damage = more chance for gib
-       if(random() < damage/220)
-       {
-               sound(this, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-       }
-       else
-       {
-               // particles on every hit
-               Send_Effect(EFFECT_SPARKS, hitloc, force * -1, 1);
-
-               //sound on every hit
-               if (random() < 0.5)
-                       sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM);
-               else
-                       sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM);
-       }
-
-       this.SendFlags |= GSF_STATUS;
-}
-
-void ons_GeneratorThink(entity this)
-{
-       this.nextthink = time + GEN_THINKRATE;
-       if (!gameover)
-       {
-               if(!this.isshielded && this.wait < time)
-               {
-                       this.wait = time + 5;
-                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
-                               if(SAME_TEAM(it, this))
-                               {
-                                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_ONS_NOTSHIELDED_TEAM);
-                                       soundto(MSG_ONE, it, CHAN_AUTO, SND(KH_ALARM), VOL_BASE, ATTEN_NONE);    // FIXME: unique sound?
-                               }
-                               else
-                                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(this.team, CENTER_ONS_NOTSHIELDED));
-                       });
-               }
-       }
-}
-
-void ons_GeneratorReset(entity this)
-{
-       this.team = this.team_saved;
-       this.lasthealth = this.max_health = this.health = autocvar_g_onslaught_gen_health;
-       this.takedamage = DAMAGE_AIM;
-       this.bot_attack = true;
-       this.iscaptured = true;
-       this.islinked = true;
-       this.isshielded = true;
-       this.event_damage = ons_GeneratorDamage;
-       setthink(this, ons_GeneratorThink);
-       this.nextthink = time + GEN_THINKRATE;
-
-       Net_LinkEntity(this, false, 0, generator_send);
-
-       this.SendFlags = GSF_SETUP; // just incase
-       this.SendFlags |= GSF_STATUS;
-
-       WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
-       WaypointSprite_UpdateHealth(this.sprite, this.health);
-       WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
-
-       onslaught_updatelinks();
-}
-
-void ons_DelayedGeneratorSetup(entity this)
-{
-       // bot waypoints
-       waypoint_spawnforitem_force(this, this.origin);
-       this.nearestwaypointtimeout = 0; // activate waypointing again
-       this.bot_basewaypoint = this.nearestwaypoint;
-
-       // captureshield setup
-       ons_CaptureShield_Spawn(this, true);
-
-       onslaught_updatelinks();
-
-       Net_LinkEntity(this, false, 0, generator_send);
-}
-
-
-void onslaught_generator_touch(entity this, entity toucher)
-{
-       if ( IS_PLAYER(toucher) )
-       if ( SAME_TEAM(this,toucher) )
-       if ( this.iscaptured )
-       {
-               Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
-       }
-}
-
-void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc
-{
-       // declarations
-       int teamnumber = gen.team;
-
-       // main setup
-       gen.ons_worldgeneratornext = ons_worldgeneratorlist; // link generator into ons_worldgeneratorlist
-       ons_worldgeneratorlist = gen;
-
-       gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnumber));
-       gen.classname = "onslaught_generator";
-       gen.solid = SOLID_BBOX;
-       gen.team_saved = teamnumber;
-       set_movetype(gen, MOVETYPE_NONE);
-       gen.lasthealth = gen.max_health = gen.health = autocvar_g_onslaught_gen_health;
-       gen.takedamage = DAMAGE_AIM;
-       gen.bot_attack = true;
-       gen.event_damage = ons_GeneratorDamage;
-       gen.reset = ons_GeneratorReset;
-       setthink(gen, ons_GeneratorThink);
-       gen.nextthink = time + GEN_THINKRATE;
-       gen.iscaptured = true;
-       gen.islinked = true;
-       gen.isshielded = true;
-       settouch(gen, onslaught_generator_touch);
-
-       // appearence
-       // model handled by CSQC
-       setsize(gen, GENERATOR_MIN, GENERATOR_MAX);
-       setorigin(gen, (gen.origin + CPGEN_SPAWN_OFFSET));
-       gen.colormap = 1024 + (teamnumber - 1) * 17;
-
-       // generator placement
-       droptofloor(gen);
-
-       // waypointsprites
-       WaypointSprite_SpawnFixed(WP_Null, gen.origin + CPGEN_WAYPOINT_OFFSET, gen, sprite, RADARICON_NONE);
-       WaypointSprite_UpdateRule(gen.sprite, gen.team, SPRITERULE_TEAMPLAY);
-       WaypointSprite_UpdateMaxHealth(gen.sprite, gen.max_health);
-       WaypointSprite_UpdateHealth(gen.sprite, gen.health);
-
-       InitializeEntity(gen, ons_DelayedGeneratorSetup, INITPRIO_SETLOCATION);
-}
-
-
-// ===============
-//  Round Handler
-// ===============
-
-int total_generators;
-void Onslaught_count_generators()
-{
-       entity e;
-       total_generators = redowned = blueowned = yellowowned = pinkowned = 0;
-       for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext)
-       {
-               ++total_generators;
-               redowned += (e.team == NUM_TEAM_1 && e.health > 0);
-               blueowned += (e.team == NUM_TEAM_2 && e.health > 0);
-               yellowowned += (e.team == NUM_TEAM_3 && e.health > 0);
-               pinkowned += (e.team == NUM_TEAM_4 && e.health > 0);
-       }
-}
-
-int Onslaught_GetWinnerTeam()
-{
-       int winner_team = 0;
-       if(redowned > 0)
-               winner_team = NUM_TEAM_1;
-       if(blueowned > 0)
-       {
-               if(winner_team) return 0;
-               winner_team = NUM_TEAM_2;
-       }
-       if(yellowowned > 0)
-       {
-               if(winner_team) return 0;
-               winner_team = NUM_TEAM_3;
-       }
-       if(pinkowned > 0)
-       {
-               if(winner_team) return 0;
-               winner_team = NUM_TEAM_4;
-       }
-       if(winner_team)
-               return winner_team;
-       return -1; // no generators left?
-}
-
-void nades_Clear(entity e);
-
-#define ONS_OWNED_GENERATORS() ((redowned > 0) + (blueowned > 0) + (yellowowned > 0) + (pinkowned > 0))
-#define ONS_OWNED_GENERATORS_OK() (ONS_OWNED_GENERATORS() > 1)
-bool Onslaught_CheckWinner()
-{
-       if ((autocvar_timelimit && time > game_starttime + autocvar_timelimit * 60) || (round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0))
-       {
-               ons_stalemate = true;
-
-               if (!wpforenemy_announced)
-               {
-                       Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT);
-                       sound(NULL, CH_INFO, SND_ONS_GENERATOR_DECAY, VOL_BASE, ATTEN_NONE);
-
-                       wpforenemy_announced = true;
-               }
-
-               entity tmp_entity; // temporary entity
-               float d;
-               for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) if(time >= tmp_entity.ons_overtime_damagedelay)
-               {
-                       // tmp_entity.max_health / 300 gives 5 minutes of overtime.
-                       // control points reduce the overtime duration.
-                       d = 1;
-                       entity e;
-                       for(e = ons_worldcplist; e; e = e.ons_worldcpnext)
-                       {
-                               if(DIFF_TEAM(e, tmp_entity))
-                               if(e.islinked)
-                                       d = d + 1;
-                       }
-
-                       if(autocvar_g_campaign && autocvar__campaign_testrun)
-                               d = d * tmp_entity.max_health;
-                       else
-                               d = d * tmp_entity.max_health / max(30, 60 * autocvar_timelimit_suddendeath);
-
-                       Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER.m_id, tmp_entity.origin, '0 0 0');
-
-                       tmp_entity.sprite.SendFlags |= 16;
-
-                       tmp_entity.ons_overtime_damagedelay = time + 1;
-               }
-       }
-       else { wpforenemy_announced = false; ons_stalemate = false; }
-
-       Onslaught_count_generators();
-
-       if(ONS_OWNED_GENERATORS_OK())
-               return 0;
-
-       int winner_team = Onslaught_GetWinnerTeam();
-
-       if(winner_team > 0)
-       {
-               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
-               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN));
-               TeamScore_AddToTeam(winner_team, ST_ONS_CAPS, +1);
-       }
-       else if(winner_team == -1)
-       {
-               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_TIED);
-               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED);
-       }
-
-       ons_stalemate = false;
-
-       play2all(SND(CTF_CAPTURE(winner_team)));
-
-       round_handler_Init(7, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit);
-
-       FOREACH_CLIENT(IS_PLAYER(it), {
-               it.ons_roundlost = true;
-               it.player_blocked = true;
-
-               nades_Clear(it);
-       });
-
-       return 1;
-}
-
-bool Onslaught_CheckPlayers()
-{
-       return 1;
-}
-
-void Onslaught_RoundStart()
-{
-       entity tmp_entity;
-       FOREACH_CLIENT(IS_PLAYER(it), it.player_blocked = false);
-
-       for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext)
-               tmp_entity.sprite.SendFlags |= 16;
-
-       for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
-               tmp_entity.sprite.SendFlags |= 16;
-}
-
-
-// ================
-// Bot player logic
-// ================
-
-// NOTE: LEGACY CODE, needs to be re-written!
-
-void havocbot_goalrating_ons_offenseitems(entity this, float ratingscale, vector org, float sradius)
-{
-       bool needarmor = false, needweapons = false;
-
-       // Needs armor/health?
-       if(this.health<100)
-               needarmor = true;
-
-       // Needs weapons?
-       int c = 0;
-       FOREACH(Weapons, it != WEP_Null, {
-               if(this.weapons & (it.m_wepset))
-               if(++c >= 4)
-                       break;
-       });
-
-       if(c<4)
-               needweapons = true;
-
-       if(!needweapons && !needarmor)
-               return;
-
-       LOG_DEBUG(this.netname, " needs weapons ", ftos(needweapons));
-       LOG_DEBUG(this.netname, " needs armor ", ftos(needarmor));
-
-       // See what is around
-       FOREACH_ENTITY_FLOAT(bot_pickup, true,
-       {
-               // gather health and armor only
-               if (it.solid)
-               if ( ((it.health || it.armorvalue) && needarmor) || (it.weapons && needweapons ) )
-               if (vdist(it.origin - org, <, sradius))
-               {
-                       int t = it.bot_pickupevalfunc(this, it);
-                       if (t > 0)
-                               navigation_routerating(this, it, t * ratingscale, 500);
-               }
-       });
-}
-
-void havocbot_role_ons_setrole(entity this, int role)
-{
-       LOG_DEBUG(this.netname," switched to ");
-       switch(role)
-       {
-               case HAVOCBOT_ONS_ROLE_DEFENSE:
-                       LOG_DEBUG("defense");
-                       this.havocbot_role = havocbot_role_ons_defense;
-                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_DEFENSE;
-                       this.havocbot_role_timeout = 0;
-                       break;
-               case HAVOCBOT_ONS_ROLE_ASSISTANT:
-                       LOG_DEBUG("assistant");
-                       this.havocbot_role = havocbot_role_ons_assistant;
-                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_ASSISTANT;
-                       this.havocbot_role_timeout = 0;
-                       break;
-               case HAVOCBOT_ONS_ROLE_OFFENSE:
-                       LOG_DEBUG("offense");
-                       this.havocbot_role = havocbot_role_ons_offense;
-                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE;
-                       this.havocbot_role_timeout = 0;
-                       break;
-       }
-       LOG_DEBUG("");
-}
-
-void havocbot_goalrating_ons_controlpoints_attack(entity this, float ratingscale)
-{
-       entity cp, cp1, cp2, best, wp;
-       float radius, bestvalue;
-       int c;
-       bool found;
-
-       // Filter control points
-       for(cp2 = ons_worldcplist; cp2; cp2 = cp2.ons_worldcpnext)
-       {
-               cp2.wpcost = c = 0;
-               cp2.wpconsidered = false;
-
-               if(cp2.isshielded)
-                       continue;
-
-               // Ignore owned controlpoints
-               if(!(cp2.isgenneighbor[this.team] || cp2.iscpneighbor[this.team]))
-                       continue;
-
-               // Count team mates interested in this control point
-               // (easier and cleaner than keeping counters per cp and teams)
-               FOREACH_CLIENT(IS_PLAYER(it), {
-                       if(SAME_TEAM(it, this))
-                       if(it.havocbot_role_flags & HAVOCBOT_ONS_ROLE_OFFENSE)
-                       if(it.havocbot_ons_target == cp2)
-                               ++c;
-               });
-
-               // NOTE: probably decrease the cost of attackable control points
-               cp2.wpcost = c;
-               cp2.wpconsidered = true;
-       }
-
-       // We'll consider only the best case
-       bestvalue = 99999999999;
-       cp = NULL;
-       for(cp1 = ons_worldcplist; cp1; cp1 = cp1.ons_worldcpnext)
-       {
-               if (!cp1.wpconsidered)
-                       continue;
-
-               if(cp1.wpcost<bestvalue)
-               {
-                       bestvalue = cp1.wpcost;
-                       cp = cp1;
-                       this.havocbot_ons_target = cp1;
-               }
-       }
-
-       if (!cp)
-               return;
-
-       LOG_DEBUG(this.netname, " chose cp ranked ", ftos(bestvalue));
-
-       if(cp.goalentity)
-       {
-               // Should be attacked
-               // Rate waypoints near it
-               found = false;
-               best = NULL;
-               bestvalue = 99999999999;
-               for(radius=0; radius<1000 && !found; radius+=500)
-               {
-                       for(wp=findradius(cp.origin,radius); wp; wp=wp.chain)
-                       {
-                               if(!(wp.wpflags & WAYPOINTFLAG_GENERATED))
-                               if(wp.classname=="waypoint")
-                               if(checkpvs(wp.origin,cp))
-                               {
-                                       found = true;
-                                       if(wp.cnt<bestvalue)
-                                       {
-                                               best = wp;
-                                               bestvalue = wp.cnt;
-                                       }
-                               }
-                       }
-               }
-
-               if(best)
-               {
-                       navigation_routerating(this, best, ratingscale, 10000);
-                       best.cnt += 1;
-
-                       this.havocbot_attack_time = 0;
-                       if(checkpvs(this.view_ofs,cp))
-                       if(checkpvs(this.view_ofs,best))
-                               this.havocbot_attack_time = time + 2;
-               }
-               else
-               {
-                       navigation_routerating(this, cp, ratingscale, 10000);
-               }
-               LOG_DEBUG(this.netname, " found an attackable controlpoint at ", vtos(cp.origin));
-       }
-       else
-       {
-               // Should be touched
-               LOG_DEBUG(this.netname, " found a touchable controlpoint at ", vtos(cp.origin));
-               found = false;
-
-               // Look for auto generated waypoint
-               if (!bot_waypoints_for_items)
-               for (wp = findradius(cp.origin,100); wp; wp = wp.chain)
-               {
-                       if(wp.classname=="waypoint")
-                       {
-                               navigation_routerating(this, wp, ratingscale, 10000);
-                               found = true;
-                       }
-               }
-
-               // Nothing found, rate the controlpoint itself
-               if (!found)
-                       navigation_routerating(this, cp, ratingscale, 10000);
-       }
-}
-
-bool havocbot_goalrating_ons_generator_attack(entity this, float ratingscale)
-{
-       entity g, wp, bestwp;
-       bool found;
-       int best;
-
-       for(g = ons_worldgeneratorlist; g; g = g.ons_worldgeneratornext)
-       {
-               if(SAME_TEAM(g, this) || g.isshielded)
-                       continue;
-
-               // Should be attacked
-               // Rate waypoints near it
-               found = false;
-               bestwp = NULL;
-               best = 99999999999;
-
-               for(wp=findradius(g.origin,400); wp; wp=wp.chain)
-               {
-                       if(wp.classname=="waypoint")
-                       if(checkpvs(wp.origin,g))
-                       {
-                               found = true;
-                               if(wp.cnt<best)
-                               {
-                                       bestwp = wp;
-                                       best = wp.cnt;
-                               }
-                       }
-               }
-
-               if(bestwp)
-               {
-                       LOG_DEBUG("waypoints found around generator");
-                       navigation_routerating(this, bestwp, ratingscale, 10000);
-                       bestwp.cnt += 1;
-
-                       this.havocbot_attack_time = 0;
-                       if(checkpvs(this.view_ofs,g))
-                       if(checkpvs(this.view_ofs,bestwp))
-                               this.havocbot_attack_time = time + 5;
-
-                       return true;
-               }
-               else
-               {
-                       LOG_DEBUG("generator found without waypoints around");
-                       // if there aren't waypoints near the generator go straight to it
-                       navigation_routerating(this, g, ratingscale, 10000);
-                       this.havocbot_attack_time = 0;
-                       return true;
-               }
-       }
-       return false;
-}
-
-void havocbot_role_ons_offense(entity this)
-{
-       if(IS_DEAD(this))
-       {
-               this.havocbot_attack_time = 0;
-               havocbot_ons_reset_role(this);
-               return;
-       }
-
-       // Set the role timeout if necessary
-       if (!this.havocbot_role_timeout)
-               this.havocbot_role_timeout = time + 120;
-
-       if (time > this.havocbot_role_timeout)
-       {
-               havocbot_ons_reset_role(this);
-               return;
-       }
-
-       if(this.havocbot_attack_time>time)
-               return;
-
-       if (this.bot_strategytime < time)
-       {
-               navigation_goalrating_start(this);
-               havocbot_goalrating_enemyplayers(this, 20000, this.origin, 650);
-               if(!havocbot_goalrating_ons_generator_attack(this, 20000))
-                       havocbot_goalrating_ons_controlpoints_attack(this, 20000);
-               havocbot_goalrating_ons_offenseitems(this, 10000, this.origin, 10000);
-               navigation_goalrating_end(this);
-
-               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-       }
-}
-
-void havocbot_role_ons_assistant(entity this)
-{
-       havocbot_ons_reset_role(this);
-}
-
-void havocbot_role_ons_defense(entity this)
-{
-       havocbot_ons_reset_role(this);
-}
-
-void havocbot_ons_reset_role(entity this)
-{
-       if(IS_DEAD(this))
-               return;
-
-       this.havocbot_ons_target = NULL;
-
-       // TODO: Defend control points or generator if necessary
-
-       havocbot_role_ons_setrole(this, HAVOCBOT_ONS_ROLE_OFFENSE);
-}
-
-
-/*
- * Find control point or generator owned by the same team self which is nearest to pos
- * if max_dist is positive, only control points within this range will be considered
- */
-entity ons_Nearest_ControlPoint(entity this, vector pos, float max_dist)
-{
-       entity closest_target = NULL;
-       FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
-       {
-               if(SAME_TEAM(it, this))
-               if(it.iscaptured)
-               if(max_dist <= 0 || vdist(it.origin - pos, <=, max_dist))
-               if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL)
-                       closest_target = it;
-       });
-       FOREACH_ENTITY_CLASS("onslaught_generator", true,
-       {
-               if(SAME_TEAM(it, this))
-               if(max_dist <= 0 || vdist(it.origin - pos, <, max_dist))
-               if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL)
-                       closest_target = it;
-       });
-
-       return closest_target;
-}
-
-/*
- * Find control point or generator owned by the same team self which is nearest to pos
- * if max_dist is positive, only control points within this range will be considered
- * This function only check distances on the XY plane, disregarding Z
- */
-entity ons_Nearest_ControlPoint_2D(entity this, vector pos, float max_dist)
-{
-       entity closest_target = NULL;
-       vector delta;
-       float smallest_distance = 0, distance;
-
-       FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
-       {
-               delta = it.origin - pos;
-               delta_z = 0;
-               distance = vlen(delta);
-
-               if(SAME_TEAM(it, this))
-               if(it.iscaptured)
-               if(max_dist <= 0 || distance <= max_dist)
-               if(closest_target == NULL || distance <= smallest_distance )
-               {
-                       closest_target = it;
-                       smallest_distance = distance;
-               }
-       });
-       FOREACH_ENTITY_CLASS("onslaught_generator", true,
-       {
-               delta = it.origin - pos;
-               delta_z = 0;
-               distance = vlen(delta);
-
-               if(SAME_TEAM(it, this))
-               if(max_dist <= 0 || distance <= max_dist)
-               if(closest_target == NULL || distance <= smallest_distance )
-               {
-                       closest_target = it;
-                       smallest_distance = distance;
-               }
-       });
-
-       return closest_target;
-}
-/**
- * find the number of control points and generators in the same team as this
- */
-int ons_Count_SelfControlPoints(entity this)
-{
-       int n = 0;
-       FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
-       {
-               if(SAME_TEAM(it, this))
-               if(it.iscaptured)
-                       n++;
-       });
-       FOREACH_ENTITY_CLASS("onslaught_generator", true,
-       {
-               if(SAME_TEAM(it, this))
-                       n++;
-       });
-       return n;
-}
-
-/**
- * Teleport player to a random position near tele_target
- * if tele_effects is true, teleport sound+particles are created
- * return false on failure
- */
-bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effects)
-{
-       if ( !tele_target )
-               return false;
-
-       int i;
-       vector loc;
-       float theta;
-       // narrow the range for each iteration to increase chances that a spawnpoint
-       // can be found even if there's little room around the control point
-       float iteration_scale = 1;
-       for(i = 0; i < 16; ++i)
-       {
-               iteration_scale -= i / 16;
-               theta = random() * 2 * M_PI;
-               loc_y = sin(theta);
-               loc_x = cos(theta);
-               loc_z = 0;
-               loc *= random() * range * iteration_scale;
-
-               loc += tele_target.origin + '0 0 128' * iteration_scale;
-
-               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
-               if(trace_fraction == 1.0 && !trace_startsolid)
-               {
-                       traceline(tele_target.origin, loc, MOVE_NOMONSTERS, tele_target); // double check to make sure we're not spawning outside the NULL
-                       if(trace_fraction == 1.0 && !trace_startsolid)
-                       {
-                               if ( tele_effects )
-                               {
-                                       Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1);
-                                       sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM);
-                               }
-                               setorigin(player, loc);
-                               player.angles = '0 1 0' * ( theta * RAD2DEG + 180 );
-                               makevectors(player.angles);
-                               player.fixangle = true;
-                               player.teleport_antispam = time + autocvar_g_onslaught_teleport_wait;
-
-                               if ( tele_effects )
-                                       Send_Effect(EFFECT_TELEPORT, player.origin + v_forward * 32, '0 0 0', 1);
-                               return true;
-                       }
-               }
-       }
-
-       return false;
-}
-
-// ==============
-// Hook Functions
-// ==============
-
-MUTATOR_HOOKFUNCTION(ons, reset_map_global)
-{
-       FOREACH_CLIENT(IS_PLAYER(it), {
-               it.ons_roundlost = false;
-               it.ons_deathloc = '0 0 0';
-               PutClientInServer(it);
-       });
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(ons, ClientDisconnect)
-{
-       entity player = M_ARGV(0, entity);
-
-       player.ons_deathloc = '0 0 0';
-}
-
-MUTATOR_HOOKFUNCTION(ons, MakePlayerObserver)
-{
-       entity player = M_ARGV(0, entity);
-
-       player.ons_deathloc = '0 0 0';
-}
-
-MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
-{
-       entity player = M_ARGV(0, entity);
-
-       if(!round_handler_IsRoundStarted())
-       {
-               player.player_blocked = true;
-               return false;
-       }
-
-       entity l;
-       for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
-       {
-               l.sprite.SendFlags |= 16;
-       }
-       for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
-       {
-               l.sprite.SendFlags |= 16;
-       }
-
-       if(ons_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); }
-
-       if ( autocvar_g_onslaught_spawn_choose )
-       if ( player.ons_spawn_by )
-       if ( ons_Teleport(player,player.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) )
-       {
-               player.ons_spawn_by = NULL;
-               return false;
-       }
-
-       if(autocvar_g_onslaught_spawn_at_controlpoints)
-       if(random() <= autocvar_g_onslaught_spawn_at_controlpoints_chance)
-       {
-               float random_target = autocvar_g_onslaught_spawn_at_controlpoints_random;
-               entity tmp_entity, closest_target = NULL;
-               vector spawn_loc = player.ons_deathloc;
-
-               // new joining player or round reset, don't bother checking
-               if(spawn_loc == '0 0 0') { return false; }
-
-               if(random_target) { RandomSelection_Init(); }
-
-               for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext)
-               {
-                       if(SAME_TEAM(tmp_entity, player))
-                       if(random_target)
-                               RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
-                       else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL)
-                               closest_target = tmp_entity;
-               }
-
-               if(random_target) { closest_target = RandomSelection_chosen_ent; }
-
-               if(closest_target)
-               {
-                       float i;
-                       vector loc;
-                       float iteration_scale = 1;
-                       for(i = 0; i < 10; ++i)
-                       {
-                               iteration_scale -= i / 10;
-                               loc = closest_target.origin + '0 0 96' * iteration_scale;
-                               loc += ('0 1 0' * random()) * 128 * iteration_scale;
-                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
-                               if(trace_fraction == 1.0 && !trace_startsolid)
-                               {
-                                       traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL
-                                       if(trace_fraction == 1.0 && !trace_startsolid)
-                                       {
-                                               setorigin(player, loc);
-                                               player.angles = normalize(loc - closest_target.origin) * RAD2DEG;
-                                               return false;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       if(autocvar_g_onslaught_spawn_at_generator)
-       if(random() <= autocvar_g_onslaught_spawn_at_generator_chance)
-       {
-               float random_target = autocvar_g_onslaught_spawn_at_generator_random;
-               entity tmp_entity, closest_target = NULL;
-               vector spawn_loc = player.ons_deathloc;
-
-               // new joining player or round reset, don't bother checking
-               if(spawn_loc == '0 0 0') { return false; }
-
-               if(random_target) { RandomSelection_Init(); }
-
-               for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
-               {
-                       if(random_target)
-                               RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
-                       else
-                       {
-                               if(SAME_TEAM(tmp_entity, player))
-                               if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL)
-                                       closest_target = tmp_entity;
-                       }
-               }
-
-               if(random_target) { closest_target = RandomSelection_chosen_ent; }
-
-               if(closest_target)
-               {
-                       float i;
-                       vector loc;
-                       float iteration_scale = 1;
-                       for(i = 0; i < 10; ++i)
-                       {
-                               iteration_scale -= i / 10;
-                               loc = closest_target.origin + '0 0 128' * iteration_scale;
-                               loc += ('0 1 0' * random()) * 256 * iteration_scale;
-                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
-                               if(trace_fraction == 1.0 && !trace_startsolid)
-                               {
-                                       traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL
-                                       if(trace_fraction == 1.0 && !trace_startsolid)
-                                       {
-                                               setorigin(player, loc);
-                                               player.angles = normalize(loc - closest_target.origin) * RAD2DEG;
-                                               return false;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(ons, PlayerDies)
-{
-       entity frag_target = M_ARGV(2, entity);
-
-       frag_target.ons_deathloc = frag_target.origin;
-       entity l;
-       for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
-       {
-               l.sprite.SendFlags |= 16;
-       }
-       for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
-       {
-               l.sprite.SendFlags |= 16;
-       }
-
-       if ( autocvar_g_onslaught_spawn_choose )
-       if ( ons_Count_SelfControlPoints(frag_target) > 1 )
-               stuffcmd(frag_target, "qc_cmd_cl hud clickradar\n");
-
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(ons, MonsterMove)
-{
-       entity mon = M_ARGV(0, entity);
-
-       entity e = find(NULL, targetname, mon.target);
-       if (e != NULL)
-               mon.team = e.team;
-}
-
-void ons_MonsterSpawn_Delayed(entity this)
-{
-       entity own = this.owner;
-
-       if(!own) { delete(this); return; }
-
-       if(own.targetname)
-       {
-               entity e = find(NULL, target, own.targetname);
-               if(e != NULL)
-               {
-                       own.team = e.team;
-
-                       own.use(own, e, NULL);
-               }
-       }
-
-       delete(this);
-}
-
-MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
-{
-       entity mon = M_ARGV(0, entity);
-
-       entity e = spawn();
-       e.owner = mon;
-       InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET);
-}
-
-void ons_TurretSpawn_Delayed(entity this)
-{
-       entity own = this.owner;
-
-       if(!own) { delete(this); return; }
-
-       if(own.targetname)
-       {
-               entity e = find(NULL, target, own.targetname);
-               if(e != NULL)
-               {
-                       own.team = e.team;
-                       own.active = ACTIVE_NOT;
-
-                       own.use(own, e, NULL);
-               }
-       }
-
-       delete(this);
-}
-
-MUTATOR_HOOKFUNCTION(ons, TurretSpawn)
-{
-       entity turret = M_ARGV(0, entity);
-
-       entity e = spawn();
-       e.owner = turret;
-       InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET);
-
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(ons, HavocBot_ChooseRole)
-{
-       entity bot = M_ARGV(0, entity);
-
-       havocbot_ons_reset_role(bot);
-       return true;
-}
-
-MUTATOR_HOOKFUNCTION(ons, GetTeamCount)
-{
-       // onslaught is special
-       for(entity tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
-       {
-               switch(tmp_entity.team)
-               {
-                       case NUM_TEAM_1: c1 = 0; break;
-                       case NUM_TEAM_2: c2 = 0; break;
-                       case NUM_TEAM_3: c3 = 0; break;
-                       case NUM_TEAM_4: c4 = 0; break;
-               }
-       }
-
-       return true;
-}
-
-MUTATOR_HOOKFUNCTION(ons, SpectateCopy)
-{
-       entity spectatee = M_ARGV(0, entity);
-       entity client = M_ARGV(1, entity);
-
-       client.ons_roundlost = spectatee.ons_roundlost; // make spectators see it too
-}
-
-MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand)
-{
-       if(MUTATOR_RETURNVALUE) // command was already handled?
-               return false;
-
-       entity player = M_ARGV(0, entity);
-       string cmd_name = M_ARGV(1, string);
-       int cmd_argc = M_ARGV(2, int);
-
-       if ( cmd_name == "ons_spawn" )
-       {
-               vector pos = player.origin;
-               if(cmd_argc > 1)
-                       pos_x = stof(argv(1));
-               if(cmd_argc > 2)
-                       pos_y = stof(argv(2));
-               if(cmd_argc > 3)
-                       pos_z = stof(argv(3));
-
-               if ( IS_PLAYER(player) )
-               {
-                       if ( !STAT(FROZEN, player) )
-                       {
-                               entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius);
-
-                               if ( !source_point && player.health > 0 )
-                               {
-                                       sprint(player, "\nYou need to be next to a control point\n");
-                                       return true;
-                               }
-
-
-                               entity closest_target = ons_Nearest_ControlPoint_2D(player, pos, autocvar_g_onslaught_click_radius);
-
-                               if ( closest_target == NULL )
-                               {
-                                       sprint(player, "\nNo control point found\n");
-                                       return true;
-                               }
-
-                               if ( player.health <= 0 )
-                               {
-                                       player.ons_spawn_by = closest_target;
-                                       player.respawn_flags = player.respawn_flags | RESPAWN_FORCE;
-                               }
-                               else
-                               {
-                                       if ( source_point == closest_target )
-                                       {
-                                               sprint(player, "\nTeleporting to the same point\n");
-                                               return true;
-                                       }
-
-                                       if ( !ons_Teleport(player,closest_target,autocvar_g_onslaught_teleport_radius,true) )
-                                               sprint(player, "\nUnable to teleport there\n");
-                               }
-
-                               return true;
-                       }
-
-                       sprint(player, "\nNo teleportation for you\n");
-               }
-
-               return true;
-       }
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(ons, PlayerUseKey)
-{
-       if(MUTATOR_RETURNVALUE || gameover) { return false; }
-
-       entity player = M_ARGV(0, entity);
-
-       if((time > player.teleport_antispam) && (!IS_DEAD(player)) && !player.vehicle)
-       {
-               entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius);
-               if ( source_point )
-               {
-                       stuffcmd(player, "qc_cmd_cl hud clickradar\n");
-                       return true;
-               }
-       }
-}
-
-MUTATOR_HOOKFUNCTION(ons, PlayHitsound)
-{
-       entity frag_victim = M_ARGV(0, entity);
-
-       return (frag_victim.classname == "onslaught_generator" && !frag_victim.isshielded)
-               || (frag_victim.classname == "onslaught_controlpoint_icon" && !frag_victim.owner.isshielded);
-}
-
-MUTATOR_HOOKFUNCTION(ons, SendWaypoint)
-{
-    entity wp = M_ARGV(0, entity);
-    entity to = M_ARGV(1, entity);
-    int sf = M_ARGV(2, int);
-    int wp_flag = M_ARGV(3, int);
-
-       if(sf & 16)
-       {
-               if(wp.owner.classname == "onslaught_controlpoint")
-               {
-                       entity wp_owner = wp.owner;
-                       entity e = WaypointSprite_getviewentity(to);
-                       if(SAME_TEAM(e, wp_owner) && wp_owner.goalentity.health >= wp_owner.goalentity.max_health) { wp_flag |= 2; }
-                       if(!ons_ControlPoint_Attackable(wp_owner, e.team)) { wp_flag |= 2; }
-               }
-               if(wp.owner.classname == "onslaught_generator")
-               {
-                       entity wp_owner = wp.owner;
-                       if(wp_owner.isshielded && wp_owner.health >= wp_owner.max_health) { wp_flag |= 2; }
-                       if(wp_owner.health <= 0) { wp_flag |= 2; }
-               }
-       }
-
-       M_ARGV(3, int) = wp_flag;
-}
-
-MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget)
-{
-       entity turret_target = M_ARGV(1, entity);
-
-       if(substring(turret_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
-       {
-               M_ARGV(3, float) = -3;
-               return true;
-       }
-
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(ons, TurretThink)
-{
-    entity turret = M_ARGV(0, entity);
-
-       // ONS uses somewhat backwards linking.
-       if(turret.target)
-       {
-               entity e = find(NULL, targetname, turret.target);
-               if (e != NULL)
-                       turret.team = e.team;
-       }
-
-       if(turret.team != turret.tur_head.team)
-               turret_respawn(turret);
-}
-
-
-// ==========
-// Spawnfuncs
-// ==========
-
-/*QUAKED spawnfunc_onslaught_link (0 .5 .8) (-16 -16 -16) (16 16 16)
-  Link between control points.
-
-  This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams.
-
-keys:
-"target" - first control point.
-"target2" - second control point.
- */
-spawnfunc(onslaught_link)
-{
-       if(!g_onslaught) { delete(this); return; }
-
-       if (this.target == "" || this.target2 == "")
-               objerror(this, "target and target2 must be set\n");
-
-       this.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist
-       ons_worldlinklist = this;
-
-       InitializeEntity(this, ons_DelayedLinkSetup, INITPRIO_FINDTARGET);
-       Net_LinkEntity(this, false, 0, ons_Link_Send);
-}
-
-/*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128)
-  Control point. Be sure to give this enough clearance so that the shootable part has room to exist
-
-  This should link to an spawnfunc_onslaught_controlpoint entity or spawnfunc_onslaught_generator entity.
-
-keys:
-"targetname" - name that spawnfunc_onslaught_link entities will use to target this.
-"target" - target any entities that are tied to this control point, such as vehicles and buildable structure entities.
-"message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc)
- */
-
-spawnfunc(onslaught_controlpoint)
-{
-       if(!g_onslaught) { delete(this); return; }
-
-       ons_ControlPoint_Setup(this);
-}
-
-/*QUAKED spawnfunc_onslaught_generator (0 .5 .8) (-32 -32 -24) (32 32 64)
-  Base generator.
-
-  spawnfunc_onslaught_link entities can target this.
-
-keys:
-"team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET.
-"targetname" - name that spawnfunc_onslaught_link entities will use to target this.
- */
-spawnfunc(onslaught_generator)
-{
-       if(!g_onslaught) { delete(this); return; }
-       if(!this.team) { objerror(this, "team must be set"); }
-
-       ons_GeneratorSetup(this);
-}
-
-// scoreboard setup
-void ons_ScoreRules()
-{
-       CheckAllowedTeams(NULL);
-       int teams = 0;
-       if(c1 >= 0) teams |= BIT(0);
-       if(c2 >= 0) teams |= BIT(1);
-       if(c3 >= 0) teams |= BIT(2);
-       if(c4 >= 0) teams |= BIT(3);
-       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
-       ScoreInfo_SetLabel_TeamScore  (ST_ONS_CAPS,     "destroyed", SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS,    "caps",      SFL_SORT_PRIO_SECONDARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES,    "takes",     0);
-       ScoreRules_basics_end();
-}
-
-void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
-{
-       ons_ScoreRules();
-
-       round_handler_Spawn(Onslaught_CheckPlayers, Onslaught_CheckWinner, Onslaught_RoundStart);
-       round_handler_Init(5, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit);
-}
-
-void ons_Initialize()
-{
-       g_onslaught = true;
-       ons_captureshield_force = autocvar_g_onslaught_shield_force;
-
-       InitializeEntity(NULL, ons_DelayedInit, INITPRIO_GAMETYPE);
-}
-
-#endif
+#include "onslaught.qh"
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh
new file mode 100644 (file)
index 0000000..be9b820
--- /dev/null
@@ -0,0 +1,4 @@
+#pragma once
+
+REGISTER_NET_LINKED(ENT_CLIENT_GENERATOR)
+REGISTER_NET_LINKED(ENT_CLIENT_CONTROLPOINT_ICON)
index d76f0ea..d543733 100644 (file)
@@ -1,10 +1,7 @@
-#ifndef CONTROLPOINT_H
-#define CONTROLPOINT_H
+#pragma once
 
 const vector CPICON_MIN = '-32 -32 -9';
 const vector CPICON_MAX = '32 32 25';
 
 const int CPSF_STATUS = 4;
 const int CPSF_SETUP = 8;
-
-#endif
index 003c2b1..8356689 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef GENERATOR_H
-#define GENERATOR_H
+#pragma once
+
 const vector GENERATOR_MIN = '-52 -52 -14';
 const vector GENERATOR_MAX = '52 52 75';
 
@@ -7,4 +7,3 @@ const int GSF_STATUS = 4;
 const int GSF_SETUP = 8;
 
 bool generator_send(entity this, entity to, int sf);
-#endif
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
new file mode 100644 (file)
index 0000000..9551e9d
--- /dev/null
@@ -0,0 +1,2128 @@
+#include "sv_controlpoint.qh"
+#include "sv_generator.qh"
+
+bool g_onslaught;
+
+float autocvar_g_onslaught_teleport_wait;
+bool autocvar_g_onslaught_spawn_at_controlpoints;
+bool autocvar_g_onslaught_spawn_at_generator;
+float autocvar_g_onslaught_cp_proxydecap;
+float autocvar_g_onslaught_cp_proxydecap_distance = 512;
+float autocvar_g_onslaught_cp_proxydecap_dps = 100;
+float autocvar_g_onslaught_spawn_at_controlpoints_chance = 0.5;
+float autocvar_g_onslaught_spawn_at_controlpoints_random;
+float autocvar_g_onslaught_spawn_at_generator_chance;
+float autocvar_g_onslaught_spawn_at_generator_random;
+float autocvar_g_onslaught_cp_buildhealth;
+float autocvar_g_onslaught_cp_buildtime;
+float autocvar_g_onslaught_cp_health;
+float autocvar_g_onslaught_cp_regen;
+float autocvar_g_onslaught_gen_health;
+float autocvar_g_onslaught_shield_force = 100;
+float autocvar_g_onslaught_allow_vehicle_touch;
+float autocvar_g_onslaught_round_timelimit;
+float autocvar_g_onslaught_warmup;
+float autocvar_g_onslaught_teleport_radius;
+float autocvar_g_onslaught_spawn_choose;
+float autocvar_g_onslaught_click_radius;
+
+void FixSize(entity e);
+
+// =======================
+// CaptureShield Functions
+// =======================
+
+bool ons_CaptureShield_Customize(entity this, entity client)
+{
+       entity e = WaypointSprite_getviewentity(client);
+
+       if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, e.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return false; }
+       if(SAME_TEAM(this, e)) { return false; }
+
+       return true;
+}
+
+void ons_CaptureShield_Touch(entity this, entity toucher)
+{
+       if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, toucher.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; }
+       if(!IS_PLAYER(toucher)) { return; }
+       if(SAME_TEAM(toucher, this)) { return; }
+
+       vector mymid = (this.absmin + this.absmax) * 0.5;
+       vector theirmid = (toucher.absmin + toucher.absmax) * 0.5;
+
+       Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ons_captureshield_force);
+
+       if(IS_REAL_CLIENT(toucher))
+       {
+               play2(toucher, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
+
+               if(this.enemy.classname == "onslaught_generator")
+                       Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED);
+               else
+                       Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED);
+       }
+}
+
+void ons_CaptureShield_Reset(entity this)
+{
+       this.colormap = this.enemy.colormap;
+       this.team = this.enemy.team;
+}
+
+void ons_CaptureShield_Spawn(entity generator, bool is_generator)
+{
+       entity shield = new(ons_captureshield);
+
+       shield.enemy = generator;
+       shield.team = generator.team;
+       shield.colormap = generator.colormap;
+       shield.reset = ons_CaptureShield_Reset;
+       settouch(shield, ons_CaptureShield_Touch);
+       setcefc(shield, ons_CaptureShield_Customize);
+       shield.effects = EF_ADDITIVE;
+       set_movetype(shield, MOVETYPE_NOCLIP);
+       shield.solid = SOLID_TRIGGER;
+       shield.avelocity = '7 0 11';
+       shield.scale = 1;
+       shield.model = ((is_generator) ? "models/onslaught/generator_shield.md3" : "models/onslaught/controlpoint_shield.md3");
+
+       precache_model(shield.model);
+       setorigin(shield, generator.origin);
+       _setmodel(shield, shield.model);
+       setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs);
+}
+
+
+// ==========
+// Junk Pile
+// ==========
+
+void setmodel_fixsize(entity e, Model m)
+{
+       setmodel(e, m);
+       FixSize(e);
+}
+
+void onslaught_updatelinks()
+{
+       entity l;
+       // first check if the game has ended
+       LOG_DEBUG("--- updatelinks ---");
+       // mark generators as being shielded and networked
+       for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
+       {
+               if (l.iscaptured)
+                       LOG_DEBUG(etos(l), " (generator) belongs to team ", ftos(l.team));
+               else
+                       LOG_DEBUG(etos(l), " (generator) is destroyed");
+               l.islinked = l.iscaptured;
+               l.isshielded = l.iscaptured;
+               l.sprite.SendFlags |= 16;
+       }
+       // mark points as shielded and not networked
+       for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
+       {
+               l.islinked = false;
+               l.isshielded = true;
+               int i;
+               for(i = 0; i < 17; ++i) { l.isgenneighbor[i] = false; l.iscpneighbor[i] = false; }
+               LOG_DEBUG(etos(l), " (point) belongs to team ", ftos(l.team));
+               l.sprite.SendFlags |= 16;
+       }
+       // flow power outward from the generators through the network
+       bool stop = false;
+       while (!stop)
+       {
+               stop = true;
+               for(l = ons_worldlinklist; l; l = l.ons_worldlinknext)
+               {
+                       // if both points are captured by the same team, and only one of
+                       // them is powered, mark the other one as powered as well
+                       if (l.enemy.iscaptured && l.goalentity.iscaptured)
+                               if (l.enemy.islinked != l.goalentity.islinked)
+                                       if(SAME_TEAM(l.enemy, l.goalentity))
+                                       {
+                                               if (!l.goalentity.islinked)
+                                               {
+                                                       stop = false;
+                                                       l.goalentity.islinked = true;
+                                                       LOG_DEBUG(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)");
+                                               }
+                                               else if (!l.enemy.islinked)
+                                               {
+                                                       stop = false;
+                                                       l.enemy.islinked = true;
+                                                       LOG_DEBUG(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)");
+                                               }
+                                       }
+               }
+       }
+       // now that we know which points are powered we can mark their neighbors
+       // as unshielded if team differs
+       for(l = ons_worldlinklist; l; l = l.ons_worldlinknext)
+       {
+               if (l.goalentity.islinked)
+               {
+                       if(DIFF_TEAM(l.goalentity, l.enemy))
+                       {
+                               LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)");
+                               l.enemy.isshielded = false;
+                       }
+                       if(l.goalentity.classname == "onslaught_generator")
+                               l.enemy.isgenneighbor[l.goalentity.team] = true;
+                       else
+                               l.enemy.iscpneighbor[l.goalentity.team] = true;
+               }
+               if (l.enemy.islinked)
+               {
+                       if(DIFF_TEAM(l.goalentity, l.enemy))
+                       {
+                               LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)");
+                               l.goalentity.isshielded = false;
+                       }
+                       if(l.enemy.classname == "onslaught_generator")
+                               l.goalentity.isgenneighbor[l.enemy.team] = true;
+                       else
+                               l.goalentity.iscpneighbor[l.enemy.team] = true;
+               }
+       }
+       // now update the generators
+       for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
+       {
+               if (l.isshielded)
+               {
+                       LOG_DEBUG(etos(l), " (generator) is shielded");
+                       l.takedamage = DAMAGE_NO;
+                       l.bot_attack = false;
+               }
+               else
+               {
+                       LOG_DEBUG(etos(l), " (generator) is not shielded");
+                       l.takedamage = DAMAGE_AIM;
+                       l.bot_attack = true;
+               }
+
+               ons_Generator_UpdateSprite(l);
+       }
+       // now update the takedamage and alpha variables on control point icons
+       for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
+       {
+               if (l.isshielded)
+               {
+                       LOG_DEBUG(etos(l), " (point) is shielded");
+                       if (l.goalentity)
+                       {
+                               l.goalentity.takedamage = DAMAGE_NO;
+                               l.goalentity.bot_attack = false;
+                       }
+               }
+               else
+               {
+                       LOG_DEBUG(etos(l), " (point) is not shielded");
+                       if (l.goalentity)
+                       {
+                               l.goalentity.takedamage = DAMAGE_AIM;
+                               l.goalentity.bot_attack = true;
+                       }
+               }
+               ons_ControlPoint_UpdateSprite(l);
+       }
+       FOREACH_ENTITY_CLASS("ons_captureshield", true,
+       {
+               it.team = it.enemy.team;
+               it.colormap = it.enemy.colormap;
+       });
+}
+
+
+// ===================
+// Main Link Functions
+// ===================
+
+bool ons_Link_Send(entity this, entity to, int sendflags)
+{
+       WriteHeader(MSG_ENTITY, ENT_CLIENT_RADARLINK);
+       WriteByte(MSG_ENTITY, sendflags);
+       if(sendflags & 1)
+       {
+               WriteCoord(MSG_ENTITY, this.goalentity.origin_x);
+               WriteCoord(MSG_ENTITY, this.goalentity.origin_y);
+               WriteCoord(MSG_ENTITY, this.goalentity.origin_z);
+       }
+       if(sendflags & 2)
+       {
+               WriteCoord(MSG_ENTITY, this.enemy.origin_x);
+               WriteCoord(MSG_ENTITY, this.enemy.origin_y);
+               WriteCoord(MSG_ENTITY, this.enemy.origin_z);
+       }
+       if(sendflags & 4)
+       {
+               WriteByte(MSG_ENTITY, this.clientcolors); // which is goalentity's color + enemy's color * 16
+       }
+       return true;
+}
+
+void ons_Link_CheckUpdate(entity this)
+{
+       // TODO check if the two sides have moved (currently they won't move anyway)
+       float cc = 0, cc1 = 0, cc2 = 0;
+
+       if(this.goalentity.islinked || this.goalentity.iscaptured) { cc1 = (this.goalentity.team - 1) * 0x01; }
+       if(this.enemy.islinked || this.enemy.iscaptured) { cc2 = (this.enemy.team - 1) * 0x10; }
+
+       cc = cc1 + cc2;
+
+       if(cc != this.clientcolors)
+       {
+               this.clientcolors = cc;
+               this.SendFlags |= 4;
+       }
+
+       this.nextthink = time;
+}
+
+void ons_DelayedLinkSetup(entity this)
+{
+       this.goalentity = find(NULL, targetname, this.target);
+       this.enemy = find(NULL, targetname, this.target2);
+       if(!this.goalentity) { objerror(this, "can not find target\n"); }
+       if(!this.enemy) { objerror(this, "can not find target2\n"); }
+
+       LOG_DEBUG(etos(this.goalentity), " linked with ", etos(this.enemy));
+       this.SendFlags |= 3;
+       setthink(this, ons_Link_CheckUpdate);
+       this.nextthink = time;
+}
+
+
+// =============================
+// Main Control Point Functions
+// =============================
+
+int ons_ControlPoint_CanBeLinked(entity cp, int teamnumber)
+{
+       if(cp.isgenneighbor[teamnumber]) { return 2; }
+       if(cp.iscpneighbor[teamnumber]) { return 1; }
+
+       return 0;
+}
+
+int ons_ControlPoint_Attackable(entity cp, int teamnumber)
+       // -2: SAME TEAM, attackable by enemy!
+       // -1: SAME TEAM!
+       // 0: off limits
+       // 1: attack it
+       // 2: touch it
+       // 3: attack it (HIGH PRIO)
+       // 4: touch it (HIGH PRIO)
+{
+       int a;
+
+       if(cp.isshielded)
+       {
+               return 0;
+       }
+       else if(cp.goalentity)
+       {
+               // if there's already an icon built, nothing happens
+               if(cp.team == teamnumber)
+               {
+                       a = ons_ControlPoint_CanBeLinked(cp, teamnumber);
+                       if(a) // attackable by enemy?
+                               return -2; // EMERGENCY!
+                       return -1;
+               }
+               // we know it can be linked, so no need to check
+               // but...
+               a = ons_ControlPoint_CanBeLinked(cp, teamnumber);
+               if(a == 2) // near our generator?
+                       return 3; // EMERGENCY!
+               return 1;
+       }
+       else
+       {
+               // free point
+               if(ons_ControlPoint_CanBeLinked(cp, teamnumber))
+               {
+                       a = ons_ControlPoint_CanBeLinked(cp, teamnumber); // why was this here NUM_TEAM_1 + NUM_TEAM_2 - t
+                       if(a == 2)
+                               return 4; // GET THIS ONE NOW!
+                       else
+                               return 2; // TOUCH ME
+               }
+       }
+       return 0;
+}
+
+void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(damage <= 0) { return; }
+
+       if (this.owner.isshielded)
+       {
+               // this is protected by a shield, so ignore the damage
+               if (time > this.pain_finished)
+                       if (IS_PLAYER(attacker))
+                       {
+                               play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
+                               this.pain_finished = time + 1;
+                               attacker.typehitsound += 1; // play both sounds (shield is way too quiet)
+                       }
+
+               return;
+       }
+
+       if(IS_PLAYER(attacker))
+       if(time - ons_notification_time[this.team] > 10)
+       {
+               play2team(this.team, SND(ONS_CONTROLPOINT_UNDERATTACK));
+               ons_notification_time[this.team] = time;
+       }
+
+       this.health = this.health - damage;
+       if(this.owner.iscaptured)
+               WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
+       else
+               WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - this.health) / (this.count / ONS_CP_THINKRATE));
+       this.pain_finished = time + 1;
+       // particles on every hit
+       pointparticles(EFFECT_SPARKS, hitloc, force*-1, 1);
+       //sound on every hit
+       if (random() < 0.5)
+               sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM);
+       else
+               sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM);
+
+       if (this.health < 0)
+       {
+               sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
+               pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname);
+
+               PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
+               PlayerScore_Add(attacker, SP_SCORE, 10);
+
+               this.owner.goalentity = NULL;
+               this.owner.islinked = false;
+               this.owner.iscaptured = false;
+               this.owner.team = 0;
+               this.owner.colormap = 1024;
+
+               WaypointSprite_UpdateMaxHealth(this.owner.sprite, 0);
+
+               onslaught_updatelinks();
+
+               // Use targets now (somebody make sure this is in the right place..)
+               SUB_UseTargets(this.owner, this, NULL);
+
+               this.owner.waslinked = this.owner.islinked;
+               if(this.owner.model != "models/onslaught/controlpoint_pad.md3")
+                       setmodel_fixsize(this.owner, MDL_ONS_CP_PAD1);
+               //setsize(this, '-32 -32 0', '32 32 8');
+
+               delete(this);
+       }
+
+       this.SendFlags |= CPSF_STATUS;
+}
+
+void ons_ControlPoint_Icon_Think(entity this)
+{
+       this.nextthink = time + ONS_CP_THINKRATE;
+
+       if(autocvar_g_onslaught_cp_proxydecap)
+       {
+               int _enemy_count = 0;
+               int _friendly_count = 0;
+
+               FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
+                       if(vdist(it.origin - this.origin, <, autocvar_g_onslaught_cp_proxydecap_distance))
+                       {
+                               if(SAME_TEAM(it, this))
+                                       ++_friendly_count;
+                               else
+                                       ++_enemy_count;
+                       }
+               });
+
+               _friendly_count = _friendly_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
+               _enemy_count = _enemy_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
+
+               this.health = bound(0, this.health + (_friendly_count - _enemy_count), this.max_health);
+               this.SendFlags |= CPSF_STATUS;
+               if(this.health <= 0)
+               {
+                       ons_ControlPoint_Icon_Damage(this, this, this, 1, 0, this.origin, '0 0 0');
+                       return;
+               }
+       }
+
+       if (time > this.pain_finished + 5)
+       {
+               if(this.health < this.max_health)
+               {
+                       this.health = this.health + this.count;
+                       if (this.health >= this.max_health)
+                               this.health = this.max_health;
+                       WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
+               }
+       }
+
+       if(this.owner.islinked != this.owner.waslinked)
+       {
+               // unteam the spawnpoint if needed
+               int t = this.owner.team;
+               if(!this.owner.islinked)
+                       this.owner.team = 0;
+
+               SUB_UseTargets(this.owner, this, NULL);
+
+               this.owner.team = t;
+
+               this.owner.waslinked = this.owner.islinked;
+       }
+
+       // damaged fx
+       if(random() < 0.6 - this.health / this.max_health)
+       {
+               Send_Effect(EFFECT_ELECTRIC_SPARKS, this.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
+
+               if(random() > 0.8)
+                       sound(this, CH_PAIN, SND_ONS_SPARK1, VOL_BASE, ATTEN_NORM);
+               else if (random() > 0.5)
+                       sound(this, CH_PAIN, SND_ONS_SPARK2, VOL_BASE, ATTEN_NORM);
+       }
+}
+
+void ons_ControlPoint_Icon_BuildThink(entity this)
+{
+       int a;
+
+       this.nextthink = time + ONS_CP_THINKRATE;
+
+       // only do this if there is power
+       a = ons_ControlPoint_CanBeLinked(this.owner, this.owner.team);
+       if(!a)
+               return;
+
+       this.health = this.health + this.count;
+
+       this.SendFlags |= CPSF_STATUS;
+
+       if (this.health >= this.max_health)
+       {
+               this.health = this.max_health;
+               this.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on
+               setthink(this, ons_ControlPoint_Icon_Think);
+               sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM);
+               this.owner.iscaptured = true;
+               this.solid = SOLID_BBOX;
+
+               Send_Effect(EFFECT_CAP(this.owner.team), this.owner.origin, '0 0 0', 1);
+
+               WaypointSprite_UpdateMaxHealth(this.owner.sprite, this.max_health);
+               WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
+
+               if(IS_PLAYER(this.owner.ons_toucher))
+               {
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message);
+                       Send_Notification(NOTIF_ALL_EXCEPT, this.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(this.owner.ons_toucher.team, CENTER_ONS_CAPTURE), this.owner.message);
+                       Send_Notification(NOTIF_ONE, this.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, this.owner.message);
+                       PlayerScore_Add(this.owner.ons_toucher, SP_ONS_CAPS, 1);
+                       PlayerTeamScore_AddScore(this.owner.ons_toucher, 10);
+               }
+
+               this.owner.ons_toucher = NULL;
+
+               onslaught_updatelinks();
+
+               // Use targets now (somebody make sure this is in the right place..)
+               SUB_UseTargets(this.owner, this, NULL);
+
+               this.SendFlags |= CPSF_SETUP;
+       }
+       if(this.owner.model != MDL_ONS_CP_PAD2.model_str())
+               setmodel_fixsize(this.owner, MDL_ONS_CP_PAD2);
+
+       if(random() < 0.9 - this.health / this.max_health)
+               Send_Effect(EFFECT_RAGE, this.origin + 10 * randomvec(), '0 0 -1', 1);
+}
+
+void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc);
+
+void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
+{
+       entity e = new(onslaught_controlpoint_icon);
+
+       setsize(e, CPICON_MIN, CPICON_MAX);
+       setorigin(e, cp.origin + CPICON_OFFSET);
+
+       e.owner = cp;
+       e.max_health = autocvar_g_onslaught_cp_health;
+       e.health = autocvar_g_onslaught_cp_buildhealth;
+       e.solid = SOLID_NOT;
+       e.takedamage = DAMAGE_AIM;
+       e.bot_attack = true;
+       e.event_damage = ons_ControlPoint_Icon_Damage;
+       e.team = player.team;
+       e.colormap = 1024 + (e.team - 1) * 17;
+       e.count = (e.max_health - e.health) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
+
+       sound(e, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILD, VOL_BASE, ATTEN_NORM);
+
+       cp.goalentity = e;
+       cp.team = e.team;
+       cp.colormap = e.colormap;
+
+       Send_Effect(EFFECT_FLAG_TOUCH(player.team), e.origin, '0 0 0', 1);
+
+       WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - e.health) / (e.count / ONS_CP_THINKRATE));
+       WaypointSprite_UpdateRule(cp.sprite,cp.team,SPRITERULE_TEAMPLAY);
+       cp.sprite.SendFlags |= 16;
+
+       onslaught_controlpoint_icon_link(e, ons_ControlPoint_Icon_BuildThink);
+}
+
+entity ons_ControlPoint_Waypoint(entity e)
+{
+       if(e.team)
+       {
+               int a = ons_ControlPoint_Attackable(e, e.team);
+
+               if(a == -2) { return WP_OnsCPDefend; } // defend now
+               if(a == -1 || a == 1 || a == 2) { return WP_OnsCP; } // touch
+               if(a == 3 || a == 4) { return WP_OnsCPAttack; } // attack
+       }
+       else
+               return WP_OnsCP;
+
+       return WP_Null;
+}
+
+void ons_ControlPoint_UpdateSprite(entity e)
+{
+       entity s1 = ons_ControlPoint_Waypoint(e);
+       WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1);
+
+       bool sh;
+       sh = !(ons_ControlPoint_CanBeLinked(e, NUM_TEAM_1) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_2) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_3) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_4));
+
+       if(e.lastteam != e.team + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured)
+       {
+               if(e.iscaptured) // don't mess up build bars!
+               {
+                       if(sh)
+                       {
+                               WaypointSprite_UpdateMaxHealth(e.sprite, 0);
+                       }
+                       else
+                       {
+                               WaypointSprite_UpdateMaxHealth(e.sprite, e.goalentity.max_health);
+                               WaypointSprite_UpdateHealth(e.sprite, e.goalentity.health);
+                       }
+               }
+               if(e.lastshielded)
+               {
+                       if(e.team)
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, false));
+                       else
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5');
+               }
+               else
+               {
+                       if(e.team)
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, false));
+                       else
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75');
+               }
+               WaypointSprite_Ping(e.sprite);
+
+               e.lastteam = e.team + 2;
+               e.lastshielded = sh;
+               e.lastcaptured = e.iscaptured;
+       }
+}
+
+void ons_ControlPoint_Touch(entity this, entity toucher)
+{
+       int attackable;
+
+       if(IS_VEHICLE(toucher) && toucher.owner)
+       if(autocvar_g_onslaught_allow_vehicle_touch)
+               toucher = toucher.owner;
+       else
+               return;
+
+       if(!IS_PLAYER(toucher)) { return; }
+       if(STAT(FROZEN, toucher)) { return; }
+       if(IS_DEAD(toucher)) { return; }
+
+       if ( SAME_TEAM(this,toucher) )
+       if ( this.iscaptured )
+       {
+               if(time <= toucher.teleport_antispam)
+                       Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT_ANTISPAM, rint(toucher.teleport_antispam - time));
+               else
+                       Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
+       }
+
+       attackable = ons_ControlPoint_Attackable(this, toucher.team);
+       if(attackable != 2 && attackable != 4)
+               return;
+       // we've verified that this player has a legitimate claim to this point,
+       // so start building the captured point icon (which only captures this
+       // point if it successfully builds without being destroyed first)
+       ons_ControlPoint_Icon_Spawn(this, toucher);
+
+       this.ons_toucher = toucher;
+
+       onslaught_updatelinks();
+}
+
+void ons_ControlPoint_Think(entity this)
+{
+       this.nextthink = time + ONS_CP_THINKRATE;
+       CSQCMODEL_AUTOUPDATE(this);
+}
+
+void ons_ControlPoint_Reset(entity this)
+{
+       if(this.goalentity)
+               delete(this.goalentity);
+
+       this.goalentity = NULL;
+       this.team = 0;
+       this.colormap = 1024;
+       this.iscaptured = false;
+       this.islinked = false;
+       this.isshielded = true;
+       setthink(this, ons_ControlPoint_Think);
+       this.ons_toucher = NULL;
+       this.nextthink = time + ONS_CP_THINKRATE;
+       setmodel_fixsize(this, MDL_ONS_CP_PAD1);
+
+       WaypointSprite_UpdateMaxHealth(this.sprite, 0);
+       WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
+
+       onslaught_updatelinks();
+
+       SUB_UseTargets(this, this, NULL); // to reset the structures, playerspawns etc.
+
+       CSQCMODEL_AUTOUPDATE(this);
+}
+
+void ons_DelayedControlPoint_Setup(entity this)
+{
+       onslaught_updatelinks();
+
+       // captureshield setup
+       ons_CaptureShield_Spawn(this, false);
+
+       CSQCMODEL_AUTOINIT(this);
+}
+
+void ons_ControlPoint_Setup(entity cp)
+{
+       // main setup
+       cp.ons_worldcpnext = ons_worldcplist; // link control point into ons_worldcplist
+       ons_worldcplist = cp;
+
+       cp.netname = "Control point";
+       cp.team = 0;
+       cp.solid = SOLID_BBOX;
+       set_movetype(cp, MOVETYPE_NONE);
+       settouch(cp, ons_ControlPoint_Touch);
+       setthink(cp, ons_ControlPoint_Think);
+       cp.nextthink = time + ONS_CP_THINKRATE;
+       cp.reset = ons_ControlPoint_Reset;
+       cp.colormap = 1024;
+       cp.iscaptured = false;
+       cp.islinked = false;
+       cp.isshielded = true;
+
+       if(cp.message == "") { cp.message = "a"; }
+
+       // appearence
+       setmodel_fixsize(cp, MDL_ONS_CP_PAD1);
+
+       // control point placement
+       if((cp.spawnflags & 1) || cp.noalign) // don't drop to floor, just stay at fixed location
+       {
+               cp.noalign = true;
+               set_movetype(cp, MOVETYPE_NONE);
+       }
+       else // drop to floor, automatically find a platform and set that as spawn origin
+       {
+               setorigin(cp, cp.origin + '0 0 20');
+               cp.noalign = false;
+               droptofloor(cp);
+               set_movetype(cp, MOVETYPE_TOSS);
+       }
+
+       // waypointsprites
+       WaypointSprite_SpawnFixed(WP_Null, cp.origin + CPGEN_WAYPOINT_OFFSET, cp, sprite, RADARICON_NONE);
+       WaypointSprite_UpdateRule(cp.sprite, cp.team, SPRITERULE_TEAMPLAY);
+
+       InitializeEntity(cp, ons_DelayedControlPoint_Setup, INITPRIO_SETLOCATION);
+}
+
+
+// =========================
+// Main Generator Functions
+// =========================
+
+entity ons_Generator_Waypoint(entity e)
+{
+       if (e.isshielded)
+               return WP_OnsGenShielded;
+       return WP_OnsGen;
+}
+
+void ons_Generator_UpdateSprite(entity e)
+{
+       entity s1 = ons_Generator_Waypoint(e);
+       WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1);
+
+       if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded)
+       {
+               e.lastteam = e.team + 2;
+               e.lastshielded = e.isshielded;
+               if(e.lastshielded)
+               {
+                       if(e.team)
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, false));
+                       else
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5');
+               }
+               else
+               {
+                       if(e.team)
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, false));
+                       else
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75');
+               }
+               WaypointSprite_Ping(e.sprite);
+       }
+}
+
+void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(damage <= 0) { return; }
+       if(warmup_stage || gameover) { return; }
+       if(!round_handler_IsRoundStarted()) { return; }
+
+       if (attacker != this)
+       {
+               if (this.isshielded)
+               {
+                       // this is protected by a shield, so ignore the damage
+                       if (time > this.pain_finished)
+                               if (IS_PLAYER(attacker))
+                               {
+                                       play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
+                                       attacker.typehitsound += 1;
+                                       this.pain_finished = time + 1;
+                               }
+                       return;
+               }
+               if (time > this.pain_finished)
+               {
+                       this.pain_finished = time + 10;
+                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, this), Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK));
+                       play2team(this.team, SND(ONS_GENERATOR_UNDERATTACK));
+               }
+       }
+       this.health = this.health - damage;
+       WaypointSprite_UpdateHealth(this.sprite, this.health);
+       // choose an animation frame based on health
+       this.frame = 10 * bound(0, (1 - this.health / this.max_health), 1);
+       // see if the generator is still functional, or dying
+       if (this.health > 0)
+       {
+               this.lasthealth = this.health;
+       }
+       else
+       {
+               if (attacker == this)
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME));
+               else
+               {
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED));
+                       PlayerScore_Add(attacker, SP_SCORE, 100);
+               }
+               this.iscaptured = false;
+               this.islinked = false;
+               this.isshielded = false;
+               this.takedamage = DAMAGE_NO; // can't be hurt anymore
+               this.event_damage = func_null; // won't do anything if hurt
+               this.count = 0; // reset counter
+               setthink(this, func_null);
+               this.nextthink = 0;
+               //this.think(); // do the first explosion now
+
+               WaypointSprite_UpdateMaxHealth(this.sprite, 0);
+               WaypointSprite_Ping(this.sprite);
+               //WaypointSprite_Kill(this.sprite); // can't do this yet, code too poor
+
+               onslaught_updatelinks();
+       }
+
+       // Throw some flaming gibs on damage, more damage = more chance for gib
+       if(random() < damage/220)
+       {
+               sound(this, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+       }
+       else
+       {
+               // particles on every hit
+               Send_Effect(EFFECT_SPARKS, hitloc, force * -1, 1);
+
+               //sound on every hit
+               if (random() < 0.5)
+                       sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM);
+               else
+                       sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM);
+       }
+
+       this.SendFlags |= GSF_STATUS;
+}
+
+void ons_GeneratorThink(entity this)
+{
+       this.nextthink = time + GEN_THINKRATE;
+       if (!gameover)
+       {
+               if(!this.isshielded && this.wait < time)
+               {
+                       this.wait = time + 5;
+                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
+                               if(SAME_TEAM(it, this))
+                               {
+                                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_ONS_NOTSHIELDED_TEAM);
+                                       soundto(MSG_ONE, it, CHAN_AUTO, SND(KH_ALARM), VOL_BASE, ATTEN_NONE);    // FIXME: unique sound?
+                               }
+                               else
+                                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(this.team, CENTER_ONS_NOTSHIELDED));
+                       });
+               }
+       }
+}
+
+void ons_GeneratorReset(entity this)
+{
+       this.team = this.team_saved;
+       this.lasthealth = this.max_health = this.health = autocvar_g_onslaught_gen_health;
+       this.takedamage = DAMAGE_AIM;
+       this.bot_attack = true;
+       this.iscaptured = true;
+       this.islinked = true;
+       this.isshielded = true;
+       this.event_damage = ons_GeneratorDamage;
+       setthink(this, ons_GeneratorThink);
+       this.nextthink = time + GEN_THINKRATE;
+
+       Net_LinkEntity(this, false, 0, generator_send);
+
+       this.SendFlags = GSF_SETUP; // just incase
+       this.SendFlags |= GSF_STATUS;
+
+       WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
+       WaypointSprite_UpdateHealth(this.sprite, this.health);
+       WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
+
+       onslaught_updatelinks();
+}
+
+void ons_DelayedGeneratorSetup(entity this)
+{
+       // bot waypoints
+       waypoint_spawnforitem_force(this, this.origin);
+       this.nearestwaypointtimeout = 0; // activate waypointing again
+       this.bot_basewaypoint = this.nearestwaypoint;
+
+       // captureshield setup
+       ons_CaptureShield_Spawn(this, true);
+
+       onslaught_updatelinks();
+
+       Net_LinkEntity(this, false, 0, generator_send);
+}
+
+
+void onslaught_generator_touch(entity this, entity toucher)
+{
+       if ( IS_PLAYER(toucher) )
+       if ( SAME_TEAM(this,toucher) )
+       if ( this.iscaptured )
+       {
+               Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
+       }
+}
+
+void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc
+{
+       // declarations
+       int teamnumber = gen.team;
+
+       // main setup
+       gen.ons_worldgeneratornext = ons_worldgeneratorlist; // link generator into ons_worldgeneratorlist
+       ons_worldgeneratorlist = gen;
+
+       gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnumber));
+       gen.classname = "onslaught_generator";
+       gen.solid = SOLID_BBOX;
+       gen.team_saved = teamnumber;
+       set_movetype(gen, MOVETYPE_NONE);
+       gen.lasthealth = gen.max_health = gen.health = autocvar_g_onslaught_gen_health;
+       gen.takedamage = DAMAGE_AIM;
+       gen.bot_attack = true;
+       gen.event_damage = ons_GeneratorDamage;
+       gen.reset = ons_GeneratorReset;
+       setthink(gen, ons_GeneratorThink);
+       gen.nextthink = time + GEN_THINKRATE;
+       gen.iscaptured = true;
+       gen.islinked = true;
+       gen.isshielded = true;
+       settouch(gen, onslaught_generator_touch);
+
+       // appearence
+       // model handled by CSQC
+       setsize(gen, GENERATOR_MIN, GENERATOR_MAX);
+       setorigin(gen, (gen.origin + CPGEN_SPAWN_OFFSET));
+       gen.colormap = 1024 + (teamnumber - 1) * 17;
+
+       // generator placement
+       droptofloor(gen);
+
+       // waypointsprites
+       WaypointSprite_SpawnFixed(WP_Null, gen.origin + CPGEN_WAYPOINT_OFFSET, gen, sprite, RADARICON_NONE);
+       WaypointSprite_UpdateRule(gen.sprite, gen.team, SPRITERULE_TEAMPLAY);
+       WaypointSprite_UpdateMaxHealth(gen.sprite, gen.max_health);
+       WaypointSprite_UpdateHealth(gen.sprite, gen.health);
+
+       InitializeEntity(gen, ons_DelayedGeneratorSetup, INITPRIO_SETLOCATION);
+}
+
+
+// ===============
+//  Round Handler
+// ===============
+
+int total_generators;
+void Onslaught_count_generators()
+{
+       entity e;
+       total_generators = redowned = blueowned = yellowowned = pinkowned = 0;
+       for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext)
+       {
+               ++total_generators;
+               redowned += (e.team == NUM_TEAM_1 && e.health > 0);
+               blueowned += (e.team == NUM_TEAM_2 && e.health > 0);
+               yellowowned += (e.team == NUM_TEAM_3 && e.health > 0);
+               pinkowned += (e.team == NUM_TEAM_4 && e.health > 0);
+       }
+}
+
+int Onslaught_GetWinnerTeam()
+{
+       int winner_team = 0;
+       if(redowned > 0)
+               winner_team = NUM_TEAM_1;
+       if(blueowned > 0)
+       {
+               if(winner_team) return 0;
+               winner_team = NUM_TEAM_2;
+       }
+       if(yellowowned > 0)
+       {
+               if(winner_team) return 0;
+               winner_team = NUM_TEAM_3;
+       }
+       if(pinkowned > 0)
+       {
+               if(winner_team) return 0;
+               winner_team = NUM_TEAM_4;
+       }
+       if(winner_team)
+               return winner_team;
+       return -1; // no generators left?
+}
+
+void nades_Clear(entity e);
+
+#define ONS_OWNED_GENERATORS() ((redowned > 0) + (blueowned > 0) + (yellowowned > 0) + (pinkowned > 0))
+#define ONS_OWNED_GENERATORS_OK() (ONS_OWNED_GENERATORS() > 1)
+bool Onslaught_CheckWinner()
+{
+       if ((autocvar_timelimit && time > game_starttime + autocvar_timelimit * 60) || (round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0))
+       {
+               ons_stalemate = true;
+
+               if (!wpforenemy_announced)
+               {
+                       Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT);
+                       sound(NULL, CH_INFO, SND_ONS_GENERATOR_DECAY, VOL_BASE, ATTEN_NONE);
+
+                       wpforenemy_announced = true;
+               }
+
+               entity tmp_entity; // temporary entity
+               float d;
+               for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) if(time >= tmp_entity.ons_overtime_damagedelay)
+               {
+                       // tmp_entity.max_health / 300 gives 5 minutes of overtime.
+                       // control points reduce the overtime duration.
+                       d = 1;
+                       entity e;
+                       for(e = ons_worldcplist; e; e = e.ons_worldcpnext)
+                       {
+                               if(DIFF_TEAM(e, tmp_entity))
+                               if(e.islinked)
+                                       d = d + 1;
+                       }
+
+                       if(autocvar_g_campaign && autocvar__campaign_testrun)
+                               d = d * tmp_entity.max_health;
+                       else
+                               d = d * tmp_entity.max_health / max(30, 60 * autocvar_timelimit_suddendeath);
+
+                       Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER.m_id, tmp_entity.origin, '0 0 0');
+
+                       tmp_entity.sprite.SendFlags |= 16;
+
+                       tmp_entity.ons_overtime_damagedelay = time + 1;
+               }
+       }
+       else { wpforenemy_announced = false; ons_stalemate = false; }
+
+       Onslaught_count_generators();
+
+       if(ONS_OWNED_GENERATORS_OK())
+               return 0;
+
+       int winner_team = Onslaught_GetWinnerTeam();
+
+       if(winner_team > 0)
+       {
+               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN));
+               TeamScore_AddToTeam(winner_team, ST_ONS_CAPS, +1);
+       }
+       else if(winner_team == -1)
+       {
+               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_TIED);
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED);
+       }
+
+       ons_stalemate = false;
+
+       play2all(SND(CTF_CAPTURE(winner_team)));
+
+       round_handler_Init(7, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit);
+
+       FOREACH_CLIENT(IS_PLAYER(it), {
+               it.ons_roundlost = true;
+               it.player_blocked = true;
+
+               nades_Clear(it);
+       });
+
+       return 1;
+}
+
+bool Onslaught_CheckPlayers()
+{
+       return 1;
+}
+
+void Onslaught_RoundStart()
+{
+       entity tmp_entity;
+       FOREACH_CLIENT(IS_PLAYER(it), it.player_blocked = false);
+
+       for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext)
+               tmp_entity.sprite.SendFlags |= 16;
+
+       for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
+               tmp_entity.sprite.SendFlags |= 16;
+}
+
+
+// ================
+// Bot player logic
+// ================
+
+// NOTE: LEGACY CODE, needs to be re-written!
+
+void havocbot_goalrating_ons_offenseitems(entity this, float ratingscale, vector org, float sradius)
+{
+       bool needarmor = false, needweapons = false;
+
+       // Needs armor/health?
+       if(this.health<100)
+               needarmor = true;
+
+       // Needs weapons?
+       int c = 0;
+       FOREACH(Weapons, it != WEP_Null, {
+               if(this.weapons & (it.m_wepset))
+               if(++c >= 4)
+                       break;
+       });
+
+       if(c<4)
+               needweapons = true;
+
+       if(!needweapons && !needarmor)
+               return;
+
+       LOG_DEBUG(this.netname, " needs weapons ", ftos(needweapons));
+       LOG_DEBUG(this.netname, " needs armor ", ftos(needarmor));
+
+       // See what is around
+       FOREACH_ENTITY_FLOAT(bot_pickup, true,
+       {
+               // gather health and armor only
+               if (it.solid)
+               if ( ((it.health || it.armorvalue) && needarmor) || (it.weapons && needweapons ) )
+               if (vdist(it.origin - org, <, sradius))
+               {
+                       int t = it.bot_pickupevalfunc(this, it);
+                       if (t > 0)
+                               navigation_routerating(this, it, t * ratingscale, 500);
+               }
+       });
+}
+
+void havocbot_role_ons_setrole(entity this, int role)
+{
+       LOG_DEBUG(this.netname," switched to ");
+       switch(role)
+       {
+               case HAVOCBOT_ONS_ROLE_DEFENSE:
+                       LOG_DEBUG("defense");
+                       this.havocbot_role = havocbot_role_ons_defense;
+                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_DEFENSE;
+                       this.havocbot_role_timeout = 0;
+                       break;
+               case HAVOCBOT_ONS_ROLE_ASSISTANT:
+                       LOG_DEBUG("assistant");
+                       this.havocbot_role = havocbot_role_ons_assistant;
+                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_ASSISTANT;
+                       this.havocbot_role_timeout = 0;
+                       break;
+               case HAVOCBOT_ONS_ROLE_OFFENSE:
+                       LOG_DEBUG("offense");
+                       this.havocbot_role = havocbot_role_ons_offense;
+                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE;
+                       this.havocbot_role_timeout = 0;
+                       break;
+       }
+       LOG_DEBUG("");
+}
+
+void havocbot_goalrating_ons_controlpoints_attack(entity this, float ratingscale)
+{
+       entity cp, cp1, cp2, best, wp;
+       float radius, bestvalue;
+       int c;
+       bool found;
+
+       // Filter control points
+       for(cp2 = ons_worldcplist; cp2; cp2 = cp2.ons_worldcpnext)
+       {
+               cp2.wpcost = c = 0;
+               cp2.wpconsidered = false;
+
+               if(cp2.isshielded)
+                       continue;
+
+               // Ignore owned controlpoints
+               if(!(cp2.isgenneighbor[this.team] || cp2.iscpneighbor[this.team]))
+                       continue;
+
+               // Count team mates interested in this control point
+               // (easier and cleaner than keeping counters per cp and teams)
+               FOREACH_CLIENT(IS_PLAYER(it), {
+                       if(SAME_TEAM(it, this))
+                       if(it.havocbot_role_flags & HAVOCBOT_ONS_ROLE_OFFENSE)
+                       if(it.havocbot_ons_target == cp2)
+                               ++c;
+               });
+
+               // NOTE: probably decrease the cost of attackable control points
+               cp2.wpcost = c;
+               cp2.wpconsidered = true;
+       }
+
+       // We'll consider only the best case
+       bestvalue = 99999999999;
+       cp = NULL;
+       for(cp1 = ons_worldcplist; cp1; cp1 = cp1.ons_worldcpnext)
+       {
+               if (!cp1.wpconsidered)
+                       continue;
+
+               if(cp1.wpcost<bestvalue)
+               {
+                       bestvalue = cp1.wpcost;
+                       cp = cp1;
+                       this.havocbot_ons_target = cp1;
+               }
+       }
+
+       if (!cp)
+               return;
+
+       LOG_DEBUG(this.netname, " chose cp ranked ", ftos(bestvalue));
+
+       if(cp.goalentity)
+       {
+               // Should be attacked
+               // Rate waypoints near it
+               found = false;
+               best = NULL;
+               bestvalue = 99999999999;
+               for(radius=0; radius<1000 && !found; radius+=500)
+               {
+                       for(wp=findradius(cp.origin,radius); wp; wp=wp.chain)
+                       {
+                               if(!(wp.wpflags & WAYPOINTFLAG_GENERATED))
+                               if(wp.classname=="waypoint")
+                               if(checkpvs(wp.origin,cp))
+                               {
+                                       found = true;
+                                       if(wp.cnt<bestvalue)
+                                       {
+                                               best = wp;
+                                               bestvalue = wp.cnt;
+                                       }
+                               }
+                       }
+               }
+
+               if(best)
+               {
+                       navigation_routerating(this, best, ratingscale, 10000);
+                       best.cnt += 1;
+
+                       this.havocbot_attack_time = 0;
+                       if(checkpvs(this.view_ofs,cp))
+                       if(checkpvs(this.view_ofs,best))
+                               this.havocbot_attack_time = time + 2;
+               }
+               else
+               {
+                       navigation_routerating(this, cp, ratingscale, 10000);
+               }
+               LOG_DEBUG(this.netname, " found an attackable controlpoint at ", vtos(cp.origin));
+       }
+       else
+       {
+               // Should be touched
+               LOG_DEBUG(this.netname, " found a touchable controlpoint at ", vtos(cp.origin));
+               found = false;
+
+               // Look for auto generated waypoint
+               if (!bot_waypoints_for_items)
+               for (wp = findradius(cp.origin,100); wp; wp = wp.chain)
+               {
+                       if(wp.classname=="waypoint")
+                       {
+                               navigation_routerating(this, wp, ratingscale, 10000);
+                               found = true;
+                       }
+               }
+
+               // Nothing found, rate the controlpoint itself
+               if (!found)
+                       navigation_routerating(this, cp, ratingscale, 10000);
+       }
+}
+
+bool havocbot_goalrating_ons_generator_attack(entity this, float ratingscale)
+{
+       entity g, wp, bestwp;
+       bool found;
+       int best;
+
+       for(g = ons_worldgeneratorlist; g; g = g.ons_worldgeneratornext)
+       {
+               if(SAME_TEAM(g, this) || g.isshielded)
+                       continue;
+
+               // Should be attacked
+               // Rate waypoints near it
+               found = false;
+               bestwp = NULL;
+               best = 99999999999;
+
+               for(wp=findradius(g.origin,400); wp; wp=wp.chain)
+               {
+                       if(wp.classname=="waypoint")
+                       if(checkpvs(wp.origin,g))
+                       {
+                               found = true;
+                               if(wp.cnt<best)
+                               {
+                                       bestwp = wp;
+                                       best = wp.cnt;
+                               }
+                       }
+               }
+
+               if(bestwp)
+               {
+                       LOG_DEBUG("waypoints found around generator");
+                       navigation_routerating(this, bestwp, ratingscale, 10000);
+                       bestwp.cnt += 1;
+
+                       this.havocbot_attack_time = 0;
+                       if(checkpvs(this.view_ofs,g))
+                       if(checkpvs(this.view_ofs,bestwp))
+                               this.havocbot_attack_time = time + 5;
+
+                       return true;
+               }
+               else
+               {
+                       LOG_DEBUG("generator found without waypoints around");
+                       // if there aren't waypoints near the generator go straight to it
+                       navigation_routerating(this, g, ratingscale, 10000);
+                       this.havocbot_attack_time = 0;
+                       return true;
+               }
+       }
+       return false;
+}
+
+void havocbot_role_ons_offense(entity this)
+{
+       if(IS_DEAD(this))
+       {
+               this.havocbot_attack_time = 0;
+               havocbot_ons_reset_role(this);
+               return;
+       }
+
+       // Set the role timeout if necessary
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + 120;
+
+       if (time > this.havocbot_role_timeout)
+       {
+               havocbot_ons_reset_role(this);
+               return;
+       }
+
+       if(this.havocbot_attack_time>time)
+               return;
+
+       if (this.bot_strategytime < time)
+       {
+               navigation_goalrating_start(this);
+               havocbot_goalrating_enemyplayers(this, 20000, this.origin, 650);
+               if(!havocbot_goalrating_ons_generator_attack(this, 20000))
+                       havocbot_goalrating_ons_controlpoints_attack(this, 20000);
+               havocbot_goalrating_ons_offenseitems(this, 10000, this.origin, 10000);
+               navigation_goalrating_end(this);
+
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+       }
+}
+
+void havocbot_role_ons_assistant(entity this)
+{
+       havocbot_ons_reset_role(this);
+}
+
+void havocbot_role_ons_defense(entity this)
+{
+       havocbot_ons_reset_role(this);
+}
+
+void havocbot_ons_reset_role(entity this)
+{
+       if(IS_DEAD(this))
+               return;
+
+       this.havocbot_ons_target = NULL;
+
+       // TODO: Defend control points or generator if necessary
+
+       havocbot_role_ons_setrole(this, HAVOCBOT_ONS_ROLE_OFFENSE);
+}
+
+
+/*
+ * Find control point or generator owned by the same team self which is nearest to pos
+ * if max_dist is positive, only control points within this range will be considered
+ */
+entity ons_Nearest_ControlPoint(entity this, vector pos, float max_dist)
+{
+       entity closest_target = NULL;
+       FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
+       {
+               if(SAME_TEAM(it, this))
+               if(it.iscaptured)
+               if(max_dist <= 0 || vdist(it.origin - pos, <=, max_dist))
+               if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL)
+                       closest_target = it;
+       });
+       FOREACH_ENTITY_CLASS("onslaught_generator", true,
+       {
+               if(SAME_TEAM(it, this))
+               if(max_dist <= 0 || vdist(it.origin - pos, <, max_dist))
+               if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL)
+                       closest_target = it;
+       });
+
+       return closest_target;
+}
+
+/*
+ * Find control point or generator owned by the same team self which is nearest to pos
+ * if max_dist is positive, only control points within this range will be considered
+ * This function only check distances on the XY plane, disregarding Z
+ */
+entity ons_Nearest_ControlPoint_2D(entity this, vector pos, float max_dist)
+{
+       entity closest_target = NULL;
+       vector delta;
+       float smallest_distance = 0, distance;
+
+       FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
+       {
+               delta = it.origin - pos;
+               delta_z = 0;
+               distance = vlen(delta);
+
+               if(SAME_TEAM(it, this))
+               if(it.iscaptured)
+               if(max_dist <= 0 || distance <= max_dist)
+               if(closest_target == NULL || distance <= smallest_distance )
+               {
+                       closest_target = it;
+                       smallest_distance = distance;
+               }
+       });
+       FOREACH_ENTITY_CLASS("onslaught_generator", true,
+       {
+               delta = it.origin - pos;
+               delta_z = 0;
+               distance = vlen(delta);
+
+               if(SAME_TEAM(it, this))
+               if(max_dist <= 0 || distance <= max_dist)
+               if(closest_target == NULL || distance <= smallest_distance )
+               {
+                       closest_target = it;
+                       smallest_distance = distance;
+               }
+       });
+
+       return closest_target;
+}
+/**
+ * find the number of control points and generators in the same team as this
+ */
+int ons_Count_SelfControlPoints(entity this)
+{
+       int n = 0;
+       FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
+       {
+               if(SAME_TEAM(it, this))
+               if(it.iscaptured)
+                       n++;
+       });
+       FOREACH_ENTITY_CLASS("onslaught_generator", true,
+       {
+               if(SAME_TEAM(it, this))
+                       n++;
+       });
+       return n;
+}
+
+/**
+ * Teleport player to a random position near tele_target
+ * if tele_effects is true, teleport sound+particles are created
+ * return false on failure
+ */
+bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effects)
+{
+       if ( !tele_target )
+               return false;
+
+       int i;
+       vector loc;
+       float theta;
+       // narrow the range for each iteration to increase chances that a spawnpoint
+       // can be found even if there's little room around the control point
+       float iteration_scale = 1;
+       for(i = 0; i < 16; ++i)
+       {
+               iteration_scale -= i / 16;
+               theta = random() * 2 * M_PI;
+               loc_y = sin(theta);
+               loc_x = cos(theta);
+               loc_z = 0;
+               loc *= random() * range * iteration_scale;
+
+               loc += tele_target.origin + '0 0 128' * iteration_scale;
+
+               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
+               if(trace_fraction == 1.0 && !trace_startsolid)
+               {
+                       traceline(tele_target.origin, loc, MOVE_NOMONSTERS, tele_target); // double check to make sure we're not spawning outside the NULL
+                       if(trace_fraction == 1.0 && !trace_startsolid)
+                       {
+                               if ( tele_effects )
+                               {
+                                       Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1);
+                                       sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM);
+                               }
+                               setorigin(player, loc);
+                               player.angles = '0 1 0' * ( theta * RAD2DEG + 180 );
+                               makevectors(player.angles);
+                               player.fixangle = true;
+                               player.teleport_antispam = time + autocvar_g_onslaught_teleport_wait;
+
+                               if ( tele_effects )
+                                       Send_Effect(EFFECT_TELEPORT, player.origin + v_forward * 32, '0 0 0', 1);
+                               return true;
+                       }
+               }
+       }
+
+       return false;
+}
+
+// ==============
+// Hook Functions
+// ==============
+
+MUTATOR_HOOKFUNCTION(ons, reset_map_global)
+{
+       FOREACH_CLIENT(IS_PLAYER(it), {
+               it.ons_roundlost = false;
+               it.ons_deathloc = '0 0 0';
+               PutClientInServer(it);
+       });
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(ons, ClientDisconnect)
+{
+       entity player = M_ARGV(0, entity);
+
+       player.ons_deathloc = '0 0 0';
+}
+
+MUTATOR_HOOKFUNCTION(ons, MakePlayerObserver)
+{
+       entity player = M_ARGV(0, entity);
+
+       player.ons_deathloc = '0 0 0';
+}
+
+MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(!round_handler_IsRoundStarted())
+       {
+               player.player_blocked = true;
+               return false;
+       }
+
+       entity l;
+       for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
+       {
+               l.sprite.SendFlags |= 16;
+       }
+       for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
+       {
+               l.sprite.SendFlags |= 16;
+       }
+
+       if(ons_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); }
+
+       if ( autocvar_g_onslaught_spawn_choose )
+       if ( player.ons_spawn_by )
+       if ( ons_Teleport(player,player.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) )
+       {
+               player.ons_spawn_by = NULL;
+               return false;
+       }
+
+       if(autocvar_g_onslaught_spawn_at_controlpoints)
+       if(random() <= autocvar_g_onslaught_spawn_at_controlpoints_chance)
+       {
+               float random_target = autocvar_g_onslaught_spawn_at_controlpoints_random;
+               entity tmp_entity, closest_target = NULL;
+               vector spawn_loc = player.ons_deathloc;
+
+               // new joining player or round reset, don't bother checking
+               if(spawn_loc == '0 0 0') { return false; }
+
+               if(random_target) { RandomSelection_Init(); }
+
+               for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext)
+               {
+                       if(SAME_TEAM(tmp_entity, player))
+                       if(random_target)
+                               RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
+                       else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL)
+                               closest_target = tmp_entity;
+               }
+
+               if(random_target) { closest_target = RandomSelection_chosen_ent; }
+
+               if(closest_target)
+               {
+                       float i;
+                       vector loc;
+                       float iteration_scale = 1;
+                       for(i = 0; i < 10; ++i)
+                       {
+                               iteration_scale -= i / 10;
+                               loc = closest_target.origin + '0 0 96' * iteration_scale;
+                               loc += ('0 1 0' * random()) * 128 * iteration_scale;
+                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
+                               if(trace_fraction == 1.0 && !trace_startsolid)
+                               {
+                                       traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL
+                                       if(trace_fraction == 1.0 && !trace_startsolid)
+                                       {
+                                               setorigin(player, loc);
+                                               player.angles = normalize(loc - closest_target.origin) * RAD2DEG;
+                                               return false;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       if(autocvar_g_onslaught_spawn_at_generator)
+       if(random() <= autocvar_g_onslaught_spawn_at_generator_chance)
+       {
+               float random_target = autocvar_g_onslaught_spawn_at_generator_random;
+               entity tmp_entity, closest_target = NULL;
+               vector spawn_loc = player.ons_deathloc;
+
+               // new joining player or round reset, don't bother checking
+               if(spawn_loc == '0 0 0') { return false; }
+
+               if(random_target) { RandomSelection_Init(); }
+
+               for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
+               {
+                       if(random_target)
+                               RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
+                       else
+                       {
+                               if(SAME_TEAM(tmp_entity, player))
+                               if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL)
+                                       closest_target = tmp_entity;
+                       }
+               }
+
+               if(random_target) { closest_target = RandomSelection_chosen_ent; }
+
+               if(closest_target)
+               {
+                       float i;
+                       vector loc;
+                       float iteration_scale = 1;
+                       for(i = 0; i < 10; ++i)
+                       {
+                               iteration_scale -= i / 10;
+                               loc = closest_target.origin + '0 0 128' * iteration_scale;
+                               loc += ('0 1 0' * random()) * 256 * iteration_scale;
+                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
+                               if(trace_fraction == 1.0 && !trace_startsolid)
+                               {
+                                       traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL
+                                       if(trace_fraction == 1.0 && !trace_startsolid)
+                                       {
+                                               setorigin(player, loc);
+                                               player.angles = normalize(loc - closest_target.origin) * RAD2DEG;
+                                               return false;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(ons, PlayerDies)
+{
+       entity frag_target = M_ARGV(2, entity);
+
+       frag_target.ons_deathloc = frag_target.origin;
+       entity l;
+       for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
+       {
+               l.sprite.SendFlags |= 16;
+       }
+       for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
+       {
+               l.sprite.SendFlags |= 16;
+       }
+
+       if ( autocvar_g_onslaught_spawn_choose )
+       if ( ons_Count_SelfControlPoints(frag_target) > 1 )
+               stuffcmd(frag_target, "qc_cmd_cl hud clickradar\n");
+
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(ons, MonsterMove)
+{
+       entity mon = M_ARGV(0, entity);
+
+       entity e = find(NULL, targetname, mon.target);
+       if (e != NULL)
+               mon.team = e.team;
+}
+
+void ons_MonsterSpawn_Delayed(entity this)
+{
+       entity own = this.owner;
+
+       if(!own) { delete(this); return; }
+
+       if(own.targetname)
+       {
+               entity e = find(NULL, target, own.targetname);
+               if(e != NULL)
+               {
+                       own.team = e.team;
+
+                       own.use(own, e, NULL);
+               }
+       }
+
+       delete(this);
+}
+
+MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
+{
+       entity mon = M_ARGV(0, entity);
+
+       entity e = spawn();
+       e.owner = mon;
+       InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET);
+}
+
+void ons_TurretSpawn_Delayed(entity this)
+{
+       entity own = this.owner;
+
+       if(!own) { delete(this); return; }
+
+       if(own.targetname)
+       {
+               entity e = find(NULL, target, own.targetname);
+               if(e != NULL)
+               {
+                       own.team = e.team;
+                       own.active = ACTIVE_NOT;
+
+                       own.use(own, e, NULL);
+               }
+       }
+
+       delete(this);
+}
+
+MUTATOR_HOOKFUNCTION(ons, TurretSpawn)
+{
+       entity turret = M_ARGV(0, entity);
+
+       entity e = spawn();
+       e.owner = turret;
+       InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET);
+
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(ons, HavocBot_ChooseRole)
+{
+       entity bot = M_ARGV(0, entity);
+
+       havocbot_ons_reset_role(bot);
+       return true;
+}
+
+MUTATOR_HOOKFUNCTION(ons, GetTeamCount)
+{
+       // onslaught is special
+       for(entity tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
+       {
+               switch(tmp_entity.team)
+               {
+                       case NUM_TEAM_1: c1 = 0; break;
+                       case NUM_TEAM_2: c2 = 0; break;
+                       case NUM_TEAM_3: c3 = 0; break;
+                       case NUM_TEAM_4: c4 = 0; break;
+               }
+       }
+
+       return true;
+}
+
+MUTATOR_HOOKFUNCTION(ons, SpectateCopy)
+{
+       entity spectatee = M_ARGV(0, entity);
+       entity client = M_ARGV(1, entity);
+
+       client.ons_roundlost = spectatee.ons_roundlost; // make spectators see it too
+}
+
+MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand)
+{
+       if(MUTATOR_RETURNVALUE) // command was already handled?
+               return false;
+
+       entity player = M_ARGV(0, entity);
+       string cmd_name = M_ARGV(1, string);
+       int cmd_argc = M_ARGV(2, int);
+
+       if ( cmd_name == "ons_spawn" )
+       {
+               vector pos = player.origin;
+               if(cmd_argc > 1)
+                       pos_x = stof(argv(1));
+               if(cmd_argc > 2)
+                       pos_y = stof(argv(2));
+               if(cmd_argc > 3)
+                       pos_z = stof(argv(3));
+
+               if ( IS_PLAYER(player) )
+               {
+                       if ( !STAT(FROZEN, player) )
+                       {
+                               entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius);
+
+                               if ( !source_point && player.health > 0 )
+                               {
+                                       sprint(player, "\nYou need to be next to a control point\n");
+                                       return true;
+                               }
+
+
+                               entity closest_target = ons_Nearest_ControlPoint_2D(player, pos, autocvar_g_onslaught_click_radius);
+
+                               if ( closest_target == NULL )
+                               {
+                                       sprint(player, "\nNo control point found\n");
+                                       return true;
+                               }
+
+                               if ( player.health <= 0 )
+                               {
+                                       player.ons_spawn_by = closest_target;
+                                       player.respawn_flags = player.respawn_flags | RESPAWN_FORCE;
+                               }
+                               else
+                               {
+                                       if ( source_point == closest_target )
+                                       {
+                                               sprint(player, "\nTeleporting to the same point\n");
+                                               return true;
+                                       }
+
+                                       if ( !ons_Teleport(player,closest_target,autocvar_g_onslaught_teleport_radius,true) )
+                                               sprint(player, "\nUnable to teleport there\n");
+                               }
+
+                               return true;
+                       }
+
+                       sprint(player, "\nNo teleportation for you\n");
+               }
+
+               return true;
+       }
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(ons, PlayerUseKey)
+{
+       if(MUTATOR_RETURNVALUE || gameover) { return false; }
+
+       entity player = M_ARGV(0, entity);
+
+       if((time > player.teleport_antispam) && (!IS_DEAD(player)) && !player.vehicle)
+       {
+               entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius);
+               if ( source_point )
+               {
+                       stuffcmd(player, "qc_cmd_cl hud clickradar\n");
+                       return true;
+               }
+       }
+}
+
+MUTATOR_HOOKFUNCTION(ons, PlayHitsound)
+{
+       entity frag_victim = M_ARGV(0, entity);
+
+       return (frag_victim.classname == "onslaught_generator" && !frag_victim.isshielded)
+               || (frag_victim.classname == "onslaught_controlpoint_icon" && !frag_victim.owner.isshielded);
+}
+
+MUTATOR_HOOKFUNCTION(ons, SendWaypoint)
+{
+    entity wp = M_ARGV(0, entity);
+    entity to = M_ARGV(1, entity);
+    int sf = M_ARGV(2, int);
+    int wp_flag = M_ARGV(3, int);
+
+       if(sf & 16)
+       {
+               if(wp.owner.classname == "onslaught_controlpoint")
+               {
+                       entity wp_owner = wp.owner;
+                       entity e = WaypointSprite_getviewentity(to);
+                       if(SAME_TEAM(e, wp_owner) && wp_owner.goalentity.health >= wp_owner.goalentity.max_health) { wp_flag |= 2; }
+                       if(!ons_ControlPoint_Attackable(wp_owner, e.team)) { wp_flag |= 2; }
+               }
+               if(wp.owner.classname == "onslaught_generator")
+               {
+                       entity wp_owner = wp.owner;
+                       if(wp_owner.isshielded && wp_owner.health >= wp_owner.max_health) { wp_flag |= 2; }
+                       if(wp_owner.health <= 0) { wp_flag |= 2; }
+               }
+       }
+
+       M_ARGV(3, int) = wp_flag;
+}
+
+MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget)
+{
+       entity turret_target = M_ARGV(1, entity);
+
+       if(substring(turret_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
+       {
+               M_ARGV(3, float) = -3;
+               return true;
+       }
+
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(ons, TurretThink)
+{
+    entity turret = M_ARGV(0, entity);
+
+       // ONS uses somewhat backwards linking.
+       if(turret.target)
+       {
+               entity e = find(NULL, targetname, turret.target);
+               if (e != NULL)
+                       turret.team = e.team;
+       }
+
+       if(turret.team != turret.tur_head.team)
+               turret_respawn(turret);
+}
+
+
+// ==========
+// Spawnfuncs
+// ==========
+
+/*QUAKED spawnfunc_onslaught_link (0 .5 .8) (-16 -16 -16) (16 16 16)
+  Link between control points.
+
+  This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams.
+
+keys:
+"target" - first control point.
+"target2" - second control point.
+ */
+spawnfunc(onslaught_link)
+{
+       if(!g_onslaught) { delete(this); return; }
+
+       if (this.target == "" || this.target2 == "")
+               objerror(this, "target and target2 must be set\n");
+
+       this.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist
+       ons_worldlinklist = this;
+
+       InitializeEntity(this, ons_DelayedLinkSetup, INITPRIO_FINDTARGET);
+       Net_LinkEntity(this, false, 0, ons_Link_Send);
+}
+
+/*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128)
+  Control point. Be sure to give this enough clearance so that the shootable part has room to exist
+
+  This should link to an spawnfunc_onslaught_controlpoint entity or spawnfunc_onslaught_generator entity.
+
+keys:
+"targetname" - name that spawnfunc_onslaught_link entities will use to target this.
+"target" - target any entities that are tied to this control point, such as vehicles and buildable structure entities.
+"message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc)
+ */
+
+spawnfunc(onslaught_controlpoint)
+{
+       if(!g_onslaught) { delete(this); return; }
+
+       ons_ControlPoint_Setup(this);
+}
+
+/*QUAKED spawnfunc_onslaught_generator (0 .5 .8) (-32 -32 -24) (32 32 64)
+  Base generator.
+
+  spawnfunc_onslaught_link entities can target this.
+
+keys:
+"team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET.
+"targetname" - name that spawnfunc_onslaught_link entities will use to target this.
+ */
+spawnfunc(onslaught_generator)
+{
+       if(!g_onslaught) { delete(this); return; }
+       if(!this.team) { objerror(this, "team must be set"); }
+
+       ons_GeneratorSetup(this);
+}
+
+// scoreboard setup
+void ons_ScoreRules()
+{
+       CheckAllowedTeams(NULL);
+       int teams = 0;
+       if(c1 >= 0) teams |= BIT(0);
+       if(c2 >= 0) teams |= BIT(1);
+       if(c3 >= 0) teams |= BIT(2);
+       if(c4 >= 0) teams |= BIT(3);
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
+       ScoreInfo_SetLabel_TeamScore  (ST_ONS_CAPS,     "destroyed", SFL_SORT_PRIO_PRIMARY);
+       ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS,    "caps",      SFL_SORT_PRIO_SECONDARY);
+       ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES,    "takes",     0);
+       ScoreRules_basics_end();
+}
+
+void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
+{
+       ons_ScoreRules();
+
+       round_handler_Spawn(Onslaught_CheckPlayers, Onslaught_CheckWinner, Onslaught_RoundStart);
+       round_handler_Init(5, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit);
+}
+
+void ons_Initialize()
+{
+       g_onslaught = true;
+       ons_captureshield_force = autocvar_g_onslaught_shield_force;
+
+       InitializeEntity(NULL, ons_DelayedInit, INITPRIO_GAMETYPE);
+}
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh
new file mode 100644 (file)
index 0000000..c8f94c9
--- /dev/null
@@ -0,0 +1,117 @@
+float autocvar_g_onslaught_point_limit;
+void ons_Initialize();
+
+REGISTER_MUTATOR(ons, false)
+{
+       MUTATOR_ONADD
+       {
+               if (time > 1) // game loads at time 1
+                       error("This is a game type and it cannot be added at runtime.");
+               ons_Initialize();
+
+               ActivateTeamplay();
+               SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
+               have_team_spawns = -1; // request team spawns
+       }
+
+       MUTATOR_ONROLLBACK_OR_REMOVE
+       {
+               // we actually cannot roll back ons_Initialize here
+               // BUT: we don't need to! If this gets called, adding always
+               // succeeds.
+       }
+
+       MUTATOR_ONREMOVE
+       {
+               LOG_INFO("This is a game type and it cannot be removed at runtime.");
+               return -1;
+       }
+
+       return false;
+}
+
+.entity ons_toucher; // player who touched the control point
+
+// control point / generator constants
+const float ONS_CP_THINKRATE = 0.2;
+const float GEN_THINKRATE = 1;
+#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
+const vector CPGEN_WAYPOINT_OFFSET = ('0 0 128');
+const vector CPICON_OFFSET = ('0 0 96');
+
+// list of generators on the map
+entity ons_worldgeneratorlist;
+.entity ons_worldgeneratornext;
+.entity ons_stalegeneratornext;
+
+// list of control points on the map
+entity ons_worldcplist;
+.entity ons_worldcpnext;
+.entity ons_stalecpnext;
+
+// list of links on the map
+entity ons_worldlinklist;
+.entity ons_worldlinknext;
+.entity ons_stalelinknext;
+
+// definitions
+.entity sprite;
+.string target2;
+.int iscaptured;
+.int islinked;
+.int isshielded;
+.float lasthealth;
+.int lastteam;
+.int lastshielded;
+.int lastcaptured;
+
+.bool waslinked;
+
+bool ons_stalemate;
+
+.float teleport_antispam;
+
+.bool ons_roundlost = _STAT(ROUNDLOST);
+
+// waypoint sprites
+.entity bot_basewaypoint; // generator waypointsprite
+
+.bool isgenneighbor[17];
+.bool iscpneighbor[17];
+float ons_notification_time[17];
+
+.float ons_overtime_damagedelay;
+
+.vector ons_deathloc;
+
+.entity ons_spawn_by;
+
+// declarations for functions used outside gamemode_onslaught.qc
+void ons_Generator_UpdateSprite(entity e);
+void ons_ControlPoint_UpdateSprite(entity e);
+bool ons_ControlPoint_Attackable(entity cp, int teamnumber);
+
+// CaptureShield: Prevent capturing or destroying control point/generator if it is not available yet
+float ons_captureshield_force; // push force of the shield
+
+// bot player logic
+const int HAVOCBOT_ONS_ROLE_NONE               = 0;
+const int HAVOCBOT_ONS_ROLE_DEFENSE    = 2;
+const int HAVOCBOT_ONS_ROLE_ASSISTANT  = 4;
+const int HAVOCBOT_ONS_ROLE_OFFENSE    = 8;
+
+.entity havocbot_ons_target;
+
+.int havocbot_role_flags;
+.float havocbot_attack_time;
+
+void havocbot_role_ons_defense(entity this);
+void havocbot_role_ons_offense(entity this);
+void havocbot_role_ons_assistant(entity this);
+
+void havocbot_ons_reset_role(entity this);
+void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius);
+void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius);
+
+// score rule declarations
+const int ST_ONS_CAPS = 1;
diff --git a/qcsrc/common/items/item/jetpack.qh b/qcsrc/common/items/item/jetpack.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 43ad69d..66693ef 100644 (file)
@@ -1,5 +1,7 @@
 // generated file; do not modify
-#include <common/minigames/cl_minigames_hud.qc>
+#ifdef CSQC
+    #include <common/minigames/cl_minigames_hud.qc>
+#endif
 #include <common/minigames/minigames.qc>
 #ifdef CSQC
     #include <common/minigames/cl_minigames.qc>
index 36f5de2..9c33760 100644 (file)
@@ -1,3 +1,11 @@
 // generated file; do not modify
-#include <common/minigames/cl_minigames_hud.qh>
+#ifdef CSQC
+    #include <common/minigames/cl_minigames_hud.qh>
+#endif
 #include <common/minigames/minigames.qh>
+#ifdef CSQC
+    #include <common/minigames/cl_minigames.qh>
+#endif
+#ifdef SVQC
+    #include <common/minigames/sv_minigames.qh>
+#endif
diff --git a/qcsrc/common/minigames/minigame/bd.qh b/qcsrc/common/minigames/minigame/bd.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/minigames/minigame/c4.qh b/qcsrc/common/minigames/minigame/c4.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/minigames/minigame/nmm.qh b/qcsrc/common/minigames/minigame/nmm.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/minigames/minigame/pong.qh b/qcsrc/common/minigames/minigame/pong.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/minigames/minigame/pp.qh b/qcsrc/common/minigames/minigame/pp.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/minigames/minigame/ps.qh b/qcsrc/common/minigames/minigame/ps.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/minigames/minigame/snake.qh b/qcsrc/common/minigames/minigame/snake.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/minigames/minigame/ttt.qh b/qcsrc/common/minigames/minigame/ttt.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index f9d80b3..0478f09 100644 (file)
@@ -1,4 +1,6 @@
 // generated file; do not modify
 #include <common/monsters/all.qc>
 #include <common/monsters/spawn.qc>
-#include <common/monsters/sv_monsters.qc>
+#ifdef SVQC
+    #include <common/monsters/sv_monsters.qc>
+#endif
index 48427f9..39d594e 100644 (file)
@@ -1,4 +1,6 @@
 // generated file; do not modify
 #include <common/monsters/all.qh>
 #include <common/monsters/spawn.qh>
-#include <common/monsters/sv_monsters.qh>
+#ifdef SVQC
+    #include <common/monsters/sv_monsters.qh>
+#endif
diff --git a/qcsrc/common/monsters/monster/mage.qh b/qcsrc/common/monsters/monster/mage.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/monsters/monster/shambler.qh b/qcsrc/common/monsters/monster/shambler.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/monsters/monster/spider.qh b/qcsrc/common/monsters/monster/spider.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/monsters/monster/wyvern.qh b/qcsrc/common/monsters/monster/wyvern.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/common/monsters/monster/zombie.qh b/qcsrc/common/monsters/monster/zombie.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 8bc63f7..65d7092 100644 (file)
@@ -1,2 +1,4 @@
 #include "_all.qh"
 #include "_mod.inc"
+
+#include "mutator/_all.inc"
index 947026d..bae58a5 100644 (file)
@@ -1,2 +1,4 @@
 #pragma once
 #include "_mod.qh"
+
+#include "mutator/_all.qh"
index 8220b2d..98fb481 100644 (file)
@@ -1,2 +1 @@
 // generated file; do not modify
-#include <common/mutators/all.qc>
index 5d6ac56..98fb481 100644 (file)
@@ -1,2 +1 @@
 // generated file; do not modify
-#include <common/mutators/all.qh>
diff --git a/qcsrc/common/mutators/all.inc b/qcsrc/common/mutators/all.inc
deleted file mode 100644 (file)
index 6225872..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "mutator/waypoints/module.inc"
-
-#include "mutator/itemstime.qc"
-#include "mutator/multijump/module.inc"
-#include "mutator/nades/module.inc"
-#include "mutator/superspec/module.inc"
-
-// completely self contained
-
-#include "mutator/bloodloss/module.inc"
-#include "mutator/breakablehook/module.inc"
-#include "mutator/buffs/module.inc"
-#include "mutator/bugrigs/module.inc"
-#include "mutator/campcheck/module.inc"
-#include "mutator/cloaked/module.inc"
-#include "mutator/damagetext/module.inc"
-#include "mutator/dodging/module.inc"
-#include "mutator/doublejump/module.inc"
-#include "mutator/globalforces/module.inc"
-#include "mutator/hook/module.inc"
-#include "mutator/instagib/module.inc"
-#include "mutator/invincibleproj/module.inc"
-#include "mutator/melee_only/module.inc"
-#include "mutator/midair/module.inc"
-#include "mutator/new_toys/module.inc"
-#include "mutator/nix/module.inc"
-#include "mutator/overkill/module.inc"
-#include "mutator/physical_items/module.inc"
-#include "mutator/pinata/module.inc"
-#include "mutator/random_gravity/module.inc"
-#include "mutator/rocketflying/module.inc"
-#include "mutator/rocketminsta/module.inc"
-#include "mutator/running_guns/module.inc"
-#include "mutator/sandbox/module.inc"
-#include "mutator/spawn_near_teammate/module.inc"
-#include "mutator/touchexplode/module.inc"
-#include "mutator/vampirehook/module.inc"
-#include "mutator/vampire/module.inc"
-#include "mutator/weaponarena_random/module.inc"
diff --git a/qcsrc/common/mutators/all.qc b/qcsrc/common/mutators/all.qc
deleted file mode 100644 (file)
index f0fc719..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "all.qh"
-
-#define IMPLEMENTATION
-#include "all.inc"
-#undef IMPLEMENTATION
diff --git a/qcsrc/common/mutators/all.qh b/qcsrc/common/mutators/all.qh
deleted file mode 100644 (file)
index ceb4b51..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef MUTATORS_ALL_H
-#define MUTATORS_ALL_H
-
-#include "all.inc"
-
-#endif
diff --git a/qcsrc/common/mutators/mutator/_all.inc b/qcsrc/common/mutators/mutator/_all.inc
new file mode 100644 (file)
index 0000000..9b557a2
--- /dev/null
@@ -0,0 +1,43 @@
+#include "_all.qh"
+#include "_mod.inc"
+
+#include "waypoints/_mod.inc"
+
+#include "itemstime/_mod.inc"
+#include "multijump/_mod.inc"
+#include "nades/_mod.inc"
+#include "superspec/_mod.inc"
+
+// completely self contained
+
+#include "bloodloss/_mod.inc"
+#include "breakablehook/_mod.inc"
+#include "buffs/_mod.inc"
+#include "bugrigs/_mod.inc"
+#include "campcheck/_mod.inc"
+#include "cloaked/_mod.inc"
+#include "damagetext/_mod.inc"
+#include "dodging/_mod.inc"
+#include "doublejump/_mod.inc"
+#include "globalforces/_mod.inc"
+#include "hook/_mod.inc"
+#include "instagib/_mod.inc"
+#include "invincibleproj/_mod.inc"
+#include "melee_only/_mod.inc"
+#include "midair/_mod.inc"
+#include "new_toys/_mod.inc"
+#include "nix/_mod.inc"
+#include "overkill/_mod.inc"
+#include "physical_items/_mod.inc"
+#include "pinata/_mod.inc"
+#include "random_gravity/_mod.inc"
+#include "rocketflying/_mod.inc"
+#include "rocketminsta/_mod.inc"
+#include "running_guns/_mod.inc"
+#include "sandbox/_mod.inc"
+#include "spawn_near_teammate/_mod.inc"
+#include "touchexplode/_mod.inc"
+#include "vampirehook/_mod.inc"
+#include "vampire/_mod.inc"
+#include "weaponarena_random/_mod.inc"
+
diff --git a/qcsrc/common/mutators/mutator/_all.qh b/qcsrc/common/mutators/mutator/_all.qh
new file mode 100644 (file)
index 0000000..b49167e
--- /dev/null
@@ -0,0 +1,43 @@
+#pragma once
+#include "_mod.qh"
+
+#include "waypoints/_mod.qh"
+
+#include "itemstime/_mod.qh"
+#include "multijump/_mod.qh"
+#include "nades/_mod.qh"
+#include "superspec/_mod.qh"
+
+// completely self contained
+
+#include "bloodloss/_mod.qh"
+#include "breakablehook/_mod.qh"
+#include "buffs/_mod.qh"
+#include "bugrigs/_mod.qh"
+#include "campcheck/_mod.qh"
+#include "cloaked/_mod.qh"
+#include "damagetext/_mod.qh"
+#include "dodging/_mod.qh"
+#include "doublejump/_mod.qh"
+#include "globalforces/_mod.qh"
+#include "hook/_mod.qh"
+#include "instagib/_mod.qh"
+#include "invincibleproj/_mod.qh"
+#include "melee_only/_mod.qh"
+#include "midair/_mod.qh"
+#include "new_toys/_mod.qh"
+#include "nix/_mod.qh"
+#include "overkill/_mod.qh"
+#include "physical_items/_mod.qh"
+#include "pinata/_mod.qh"
+#include "random_gravity/_mod.qh"
+#include "rocketflying/_mod.qh"
+#include "rocketminsta/_mod.qh"
+#include "running_guns/_mod.qh"
+#include "sandbox/_mod.qh"
+#include "spawn_near_teammate/_mod.qh"
+#include "touchexplode/_mod.qh"
+#include "vampirehook/_mod.qh"
+#include "vampire/_mod.qh"
+#include "weaponarena_random/_mod.qh"
+
index 30d67e3..98fb481 100644 (file)
@@ -1,2 +1 @@
 // generated file; do not modify
-#include <common/mutators/mutator/itemstime.qc>
index ac056ac..98fb481 100644 (file)
@@ -1,2 +1 @@
 // generated file; do not modify
-#include <common/mutators/mutator/itemstime.qh>
index 16e6308..768808d 100644 (file)
@@ -1,2 +1,4 @@
 // generated file; do not modify
-#include <common/mutators/mutator/bloodloss/bloodloss.qc>
+#ifdef SVQC
+    #include <common/mutators/mutator/bloodloss/sv_bloodloss.qc>
+#endif
index b1d45e2..e6ad248 100644 (file)
@@ -1,2 +1,4 @@
 // generated file; do not modify
-#include <common/mutators/mutator/bloodloss/bloodloss.qh>
+#ifdef SVQC
+    #include <common/mutators/mutator/bloodloss/sv_bloodloss.qh>
+#endif
diff --git a/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc b/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc
deleted file mode 100644 (file)
index a335bf1..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifdef IMPLEMENTATION
-REGISTER_MUTATOR(bloodloss, cvar("g_bloodloss"));
-
-.float bloodloss_timer;
-
-MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
-{
-       entity player = M_ARGV(0, entity);
-
-       if(IS_PLAYER(player))
-       if(player.health <= autocvar_g_bloodloss && !IS_DEAD(player))
-       {
-               PHYS_INPUT_BUTTON_CROUCH(player) = true;
-
-               if(time >= player.bloodloss_timer)
-               {
-                       if(player.vehicle)
-                               vehicles_exit(player.vehicle, VHEF_RELEASE);
-                       if(player.event_damage)
-                               player.event_damage(player, player, player, 1, DEATH_ROT.m_id, player.origin, '0 0 0');
-                       player.bloodloss_timer = time + 0.5 + random() * 0.5;
-               }
-       }
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
-{
-       entity player = M_ARGV(0, entity);
-
-       if(player.health <= autocvar_g_bloodloss)
-               return true;
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsString)
-{
-       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString)
-{
-       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
-}
-#endif
diff --git a/qcsrc/common/mutators/mutator/bloodloss/module.inc b/qcsrc/common/mutators/mutator/bloodloss/module.inc
deleted file mode 100644 (file)
index d3f665a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#ifdef SVQC
-#include "bloodloss.qc"
-#endif
diff --git a/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc b/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc
new file mode 100644 (file)
index 0000000..61b0c06
--- /dev/null
@@ -0,0 +1,43 @@
+#include "sv_bloodloss.qh"
+
+REGISTER_MUTATOR(bloodloss, cvar("g_bloodloss"));
+
+.float bloodloss_timer;
+
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(IS_PLAYER(player))
+       if(player.health <= autocvar_g_bloodloss && !IS_DEAD(player))
+       {
+               PHYS_INPUT_BUTTON_CROUCH(player) = true;
+
+               if(time >= player.bloodloss_timer)
+               {
+                       if(player.vehicle)
+                               vehicles_exit(player.vehicle, VHEF_RELEASE);
+                       if(player.event_damage)
+                               player.event_damage(player, player, player, 1, DEATH_ROT.m_id, player.origin, '0 0 0');
+                       player.bloodloss_timer = time + 0.5 + random() * 0.5;
+               }
+       }
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.health <= autocvar_g_bloodloss)
+               return true;
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsString)
+{
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString)
+{
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
+}
diff --git a/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh b/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index bdbbae4..11a080e 100644 (file)
@@ -1,2 +1,4 @@
 // generated file; do not modify
-#include <common/mutators/mutator/breakablehook/breakablehook.qc>
+#ifdef SVQC
+    #include <common/mutators/mutator/breakablehook/sv_breakablehook.qc>
+#endif
index 8a41908..f8b2d1b 100644 (file)
@@ -1,2 +1,4 @@
 // generated file; do not modify
-#include <common/mutators/mutator/breakablehook/breakablehook.qh>
+#ifdef SVQC
+    #include <common/mutators/mutator/breakablehook/sv_breakablehook.qh>
+#endif
diff --git a/qcsrc/common/mutators/mutator/breakablehook/breakablehook.qc b/qcsrc/common/mutators/mutator/breakablehook/breakablehook.qc
deleted file mode 100644 (file)
index ca266eb..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifdef IMPLEMENTATION
-#include <common/deathtypes/all.qh>
-#include <server/g_hook.qh>
-
-REGISTER_MUTATOR(breakablehook, cvar("g_breakablehook"));
-
-bool autocvar_g_breakablehook; // allow toggling mid match?
-bool autocvar_g_breakablehook_owner;
-
-MUTATOR_HOOKFUNCTION(breakablehook, PlayerDamage_Calculate)
-{
-       entity frag_attacker = M_ARGV(1, entity);
-       entity frag_target = M_ARGV(2, entity);
-
-       if(frag_target.classname == "grapplinghook")
-       {
-               if((!autocvar_g_breakablehook)
-               || (!autocvar_g_breakablehook_owner && frag_attacker == frag_target.realowner)
-                       ) { M_ARGV(4, float) = 0; }
-
-               // hurt the owner of the hook
-               if(DIFF_TEAM(frag_attacker, frag_target.realowner))
-               {
-                       Damage (frag_target.realowner, frag_attacker, frag_attacker, 5, WEP_HOOK.m_id | HITTYPE_SPLASH, frag_target.realowner.origin, '0 0 0');
-                       RemoveGrapplingHook(frag_target.realowner);
-                       return; // dead
-               }
-       }
-}
-#endif
diff --git a/qcsrc/common/mutators/mutator/breakablehook/module.inc b/qcsrc/common/mutators/mutator/breakablehook/module.inc
deleted file mode 100644 (file)
index 484eb4c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#ifdef SVQC
-#include "breakablehook.qc"
-#endif
diff --git a/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc b/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc
new file mode 100644 (file)
index 0000000..fdb0dc3
--- /dev/null
@@ -0,0 +1,30 @@
+#include "sv_breakablehook.qh"
+
+#include <common/deathtypes/all.qh>
+#include <server/g_hook.qh>
+
+REGISTER_MUTATOR(breakablehook, cvar("g_breakablehook"));
+
+bool autocvar_g_breakablehook; // allow toggling mid match?
+bool autocvar_g_breakablehook_owner;
+
+MUTATOR_HOOKFUNCTION(breakablehook, PlayerDamage_Calculate)
+{
+       entity frag_attacker = M_ARGV(1, entity);
+       entity frag_target = M_ARGV(2, entity);
+
+       if(frag_target.classname == "grapplinghook")
+       {
+               if((!autocvar_g_breakablehook)
+               || (!autocvar_g_breakablehook_owner && frag_attacker == frag_target.realowner)
+                       ) { M_ARGV(4, float) = 0; }
+
+               // hurt the owner of the hook
+               if(DIFF_TEAM(frag_attacker, frag_target.realowner))
+               {
+                       Damage (frag_target.realowner, frag_attacker, frag_attacker, 5, WEP_HOOK.m_id | HITTYPE_SPLASH, frag_target.realowner.origin, '0 0 0');
+                       RemoveGrapplingHook(frag_target.realowner);
+                       return; // dead
+               }
+       }
+}
diff --git a/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qh b/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index c06263a..715a3ac 100644 (file)
@@ -1,3 +1,8 @@
 // generated file; do not modify
-#include <common/mutators/mutator/buffs/all.qc>
 #include <common/mutators/mutator/buffs/buffs.qc>
+#ifdef CSQC
+    #include <common/mutators/mutator/buffs/cl_buffs.qc>
+#endif
+#ifdef SVQC
+    #include <common/mutators/mutator/buffs/sv_buffs.qc>
+#endif
index 2133c72..78217bb 100644 (file)
@@ -1,3 +1,8 @@
 // generated file; do not modify
-#include <common/mutators/mutator/buffs/all.qh>
 #include <common/mutators/mutator/buffs/buffs.qh>
+#ifdef CSQC
+    #include <common/mutators/mutator/buffs/cl_buffs.qh>
+#endif
+#ifdef SVQC
+    #include <common/mutators/mutator/buffs/sv_buffs.qh>
+#endif
diff --git a/qcsrc/common/mutators/mutator/buffs/all.qc b/qcsrc/common/mutators/mutator/buffs/all.qc
deleted file mode 100644 (file)
index b056751..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "all.qh"
diff --git a/qcsrc/common/mutators/mutator/buffs/all.qh b/qcsrc/common/mutators/mutator/buffs/all.qh
deleted file mode 100644 (file)
index 79117c9..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef BUFFS_ALL_H
-#define BUFFS_ALL_H
-
-#include <common/teams.qh>
-#include <common/util.qh>
-
-REGISTER_WAYPOINT(Buff, _("Buff"), '1 0.5 0', 1);
-REGISTER_RADARICON(Buff, 1);
-
-REGISTRY(Buffs, BITS(5))
-#define Buffs_from(i) _Buffs_from(i, BUFF_Null)
-REGISTER_REGISTRY(Buffs)
-REGISTRY_CHECK(Buffs)
-
-#define REGISTER_BUFF(id) \
-    REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff))
-
-#include <common/items/item/pickup.qh>
-CLASS(Buff, Pickup)
-       /** bit index */
-       ATTRIB(Buff, m_itemid, int, 0);
-       ATTRIB(Buff, m_name, string, "buff");
-       ATTRIB(Buff, m_color, vector, '1 1 1');
-       ATTRIB(Buff, m_prettyName, string, "Buff");
-       ATTRIB(Buff, m_skin, int, 0);
-       ATTRIB(Buff, m_sprite, string, "");
-       METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) {
-               returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
-       }
-#ifdef SVQC
-       METHOD(Buff, m_time, float(Buff this))
-       { return cvar(strcat("g_buffs_", this.netname, "_time")); }
-#endif
-ENDCLASS(Buff)
-
-STATIC_INIT(REGISTER_BUFFS) {
-    FOREACH(Buffs, true, {
-        it.netname = it.m_name; \
-        it.m_itemid = BIT(it.m_id - 1); \
-        it.m_sprite = strzone(strcat("buff-", it.m_name)); \
-    });
-}
-
-#ifdef SVQC
-       // .int buffs = _STAT(BUFFS);
-       void buff_Init(entity ent);
-       void buff_Init_Compat(entity ent, entity replacement);
-       #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
-               this.buffs = b.m_itemid; \
-               this.team = t; \
-               buff_Init(this); \
-       }
-       #define BUFF_SPAWNFUNCS(e, b)                       \
-                       BUFF_SPAWNFUNC(e,           b,  0)          \
-                       BUFF_SPAWNFUNC(e##_team1,   b,  NUM_TEAM_1) \
-