Skip to content
Permalink
Browse files

Add "developer" script & fix UI & move scripts

  • Loading branch information...
TotallyNotElite committed Dec 2, 2018
1 parent 683784f commit 4bae67c40508afc52c7ba601edfcfb278b3be590
@@ -7,6 +7,12 @@
- Git knowledge
- Ability to ask for help (Feel free to create empty pull-request or PM a maintainer in [Telegram](https://t.me/nullifiedcat))

### Setting up cathook

Cathook reduces its git repository size automatically by using a "shallow repository". This makes developing difficult by not providing branches and omitting the commit history.

The easiest way to undo this is by running the `developer` script located in `scripts`.

### Pull requests and Branches

In order to send code back to the official cathook repository, you must first create a copy of cathook on your github account ([fork](https://help.github.com/articles/creating-a-pull-request-from-a-fork/)) and then [create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) back to cathook.
@@ -1,18 +1,18 @@
<Tab name="IRC">
<Box width="content" height="content" padding="12 6 6 6">
<List width="250">
<AutoVariable width="fill" target="irc.enabled" label="Enable"/>
<AutoVariable width="fill" target="irc.anon" label="Be Anonymous"/>
<AutoVariable width="fill" target="irc.auth" label="Auth with cathook users"/>
<AutoVariable width="fill" target="irc.channel" label="Channel"/>
<AutoVariable width="fill" target="irc.enabled" label="Enabled"/>
<AutoVariable width="fill" target="irc.anon" label="Hide real name"/>
<AutoVariable width="fill" target="irc.auth" label="Reveal yourself to cathook users"/>
<AutoVariable width="fill" target="irc.address" label="Address"/>
<AutoVariable width="fill" target="irc.port" label="Port"/>
<AutoVariable width="fill" target="irc.cc.channel" label="Command Center Channel"/>
<AutoVariable width="fill" target="irc.cc.password" label="Command Center Password"/>
<AutoVariable width="fill" target="irc.cc.party" label="Command Center Autoparty"/>
<AutoVariable width="fill" target="irc.cc.respondparty" label="Command Center respond Autoparty"/>
<AutoVariable width="fill" target="irc.cc.party-cooldown" label="Command Center Party cooldown"/>
<AutoVariable width="fill" target="irc.cc.party-size" label="Command Center Party maxsize"/>
<AutoVariable width="fill" target="irc.channel" label="Channel"/>
<AutoVariable width="fill" target="irc.cc.channel" label="Command & Control Channel"/>
<AutoVariable width="fill" target="irc.cc.password" label="Command & Control Password"/>
<AutoVariable width="fill" target="irc.cc.party" label="Command & Control Autoparty"/>
<AutoVariable width="fill" target="irc.cc.respondparty" label="Command & Control Respond Autoparty"/>
<AutoVariable width="fill" target="irc.cc.party-cooldown" label="Command & Control Party cooldown"/>
<AutoVariable width="fill" target="irc.cc.party-size" label="Command & Control Party maxsize"/>
</List>
</Box>
</Tab>
</Tab>
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
if [ $EUID == 0 ]; then
echo "This script must not be run as root"
exit
fi

if [ ! -f ./scripts/updater-preferences ]; then
while true; do
read -p "Do you want to switch your cathook repository into developer mode? y/n " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
fi

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --unshallow
git fetch --all
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -12,7 +12,7 @@ echo $$ > ${LOCKFILE}

echo -e "\033[1;34m \n \nAuto Updater: Updating cathook in the background\n\033[0m"

if [ `git rev-parse --is-shallow-repository` == "true" ]; then
if [ "$(git rev-parse --is-shallow-repository)" == "true" ]; then
sudo -u $LOGNAME bash -c 'git fetch --depth 1 origin >/dev/null && git reset --hard @{upstream} >/dev/null && git submodule update --depth 1 --init --recursive >/dev/null' || { echo -e "\033[1;31m \n \nAuto Updater: Failed to pull from github!\n\033[0m"; exit 1; }
else
sudo -u $LOGNAME bash -c 'git pull origin >/dev/null && git submodule update --init --recursive >/dev/null' || { echo -e "\033[1;31m \n \nAuto Updater: Failed to pull from github!\n\033[0m"; exit 1; }
@@ -12,7 +12,7 @@ static settings::Bool heavy_mode("navbot.other-mode", "false");
static settings::Bool get_health("navbot.get-health-and-ammo", "true");
static settings::Float jump_distance("navbot.autojump.trigger-distance", "300");
static settings::Bool autojump("navbot.autojump.enabled", "false");
static settings::Bool primary_only{ "navbot.primary-only", "true" };
static settings::Bool primary_only("navbot.primary-only", "true");

// -Forward declarations-
bool init(bool first_cm);
@@ -174,7 +174,7 @@ static bool stayNearPlayer(CachedEntity *&ent, const bot_class_config &config,

// Get some areas that are close to the player
std::vector<CNavArea *> preferred_areas(areas.begin(), areas.end());
preferred_areas.resize(size/2);
preferred_areas.resize(size / 2);
if (preferred_areas.empty())
return false;
std::sort(preferred_areas.begin(), preferred_areas.end(),
@@ -183,7 +183,7 @@ static bool stayNearPlayer(CachedEntity *&ent, const bot_class_config &config,
b->m_center.DistTo(g_pLocalPlayer->v_Origin);
});

preferred_areas.resize(size/4);
preferred_areas.resize(size / 4);
if (preferred_areas.empty())
return false;
for (auto &i : preferred_areas)
@@ -304,7 +304,7 @@ static bool stayNear()
// Are we doing nothing? Check if our current location can still attack our
// last target
if (current_task == task::none && CE_GOOD(last_target) &&
last_target->m_bAlivePlayer() && last_target->m_bEnemy())
last_target->m_bAlivePlayer() && last_target->m_bEnemy())
{
if (stayNearHelpers::isValidNearPosition(
g_pLocalPlayer->v_Origin, last_target->m_vecOrigin(), *config))
@@ -457,4 +457,13 @@ static void updateSlot()
static HookedFunction cm(HookedFunctions_types::HF_CreateMove, "NavBot", 16,
&CreateMove);

void change(settings::VariableBase<bool> &, bool)
{
nav::clearInstructions();
}

static InitRoutine routine([](){
enabled.installChangeCallback(change);
});

} // namespace hacks::tf2::NavBot
2 update
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#Get updated source code
if [ `git rev-parse --is-shallow-repository` == "true" ]; then
if [ "$(git rev-parse --is-shallow-repository)" == "true" ]; then
git fetch --depth 1 origin && git reset --hard @{upstream} && git submodule update --depth 1 --init --recursive || { echo -e "\033[1;31m \n \nFailed to pull from github!"; exit 1; }
else
git pull origin && git submodule update --init --recursive || { echo -e "\033[1;31m \n \nFailed to pull from github!"; exit 1; }

0 comments on commit 4bae67c

Please sign in to comment.
You can’t perform that action at this time.