Untitled
unknown
plain_text
2 years ago
7.7 kB
5
Indexable
bool ar_turi_noclipa(World* world_, int x, int y, WorldBlock* target_, ENetPeer* p_) {
//try {
vector<int> new_tiles{};
if (items[world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].fg].collisionType != 1 or items[world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].fg].entrance or items[world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].fg].toggleable or items[world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].fg].vipentrance) {
if (items[world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].fg].vipentrance and not world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].limit_admins and world_->owner_name != pInfo(p_)->tankIDName and not world_->owner_name.empty() and find(world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].admins.begin(), world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].admins.end(), pInfo(p_)->tankIDName) == world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].admins.end()) {
}
else if (items[world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].fg].entrance and is_false_state(world_->blocks[(int)x / 32 + ((int)y / 32 * 100)], 0x00800000) and world_->owner_name != pInfo(p_)->tankIDName and not world_->open_to_public and not world_->owner_name.empty() and !guild_access(p_, world_->guild_id) and find(world_->admins.begin(), world_->admins.end(), pInfo(p_)->tankIDName) == world_->admins.end()) {
}
else if (items[world_->blocks[(int)x / 32 + ((int)y / 32 * 100)].fg].toggleable and is_false_state(world_->blocks[(int)x / 32 + ((int)y / 32 * 100)], 0x00400000)) {
}
else {
new_tiles.push_back((int)x / 32 + ((int)y / 32 * 100));
}
} int ySize = world_->blocks.size() / 100, xSize = world_->blocks.size() / ySize;
vector<WorldBlock> shadow_copy = world_->blocks;
for (int i2 = 0; i2 < new_tiles.size(); i2++) {
int x_ = new_tiles[i2] % 100, y_ = new_tiles[i2] / 100;
/*if (abs(x_ - x) >= 10 and abs(y_ - y) >= 10) {
return true;
}*/
if (&world_->blocks[x_ + (y_ * 100)] == target_ and items[shadow_copy[x_ + (y_ * 100)].fg].collisionType != 1) {
return false;
} if (x_ < 99 and items[shadow_copy[x_ + 1 + (y_ * 100)].fg].collisionType != 1 or x_ < 99 and items[shadow_copy[x_ + 1 + (y_ * 100)].fg].entrance or x_ < 99 and items[shadow_copy[x_ + 1 + (y_ * 100)].fg].toggleable) {
if (items[shadow_copy[x_ + 1 + (y_ * 100)].fg].vipentrance and not shadow_copy[x_ + 1 + (y_ * 100)].limit_admins and world_->owner_name != pInfo(p_)->tankIDName and not world_->owner_name.empty() and find(shadow_copy[x_ + 1 + (y_ * 100)].admins.begin(), shadow_copy[x_ + 1 + (y_ * 100)].admins.end(), pInfo(p_)->tankIDName) == shadow_copy[x_ + 1 + (y_ * 100)].admins.end()) {
}
else if (items[shadow_copy[x_ + 1 + (y_ * 100)].fg].entrance and is_false_state(shadow_copy[x_ + 1 + (y_ * 100)], 0x00800000) and world_->owner_name != pInfo(p_)->tankIDName and not world_->open_to_public and not world_->owner_name.empty() and !guild_access(p_, world_->guild_id) and find(world_->admins.begin(), world_->admins.end(), pInfo(p_)->tankIDName) == world_->admins.end()) {
}
else if (items[shadow_copy[x_ + 1 + (y_ * 100)].fg].toggleable and is_false_state(shadow_copy[x_ + 1 + (y_ * 100)], 0x00400000)) {
}
else {
if (not shadow_copy[x_ + 1 + (y_ * 100)].scanned) {
shadow_copy[x_ + 1 + (y_ * 100)].scanned = true;
new_tiles.push_back(x_ + 1 + (y_ * 100));
}
}
} if (x_ > 0 and items[shadow_copy[x_ - 1 + (y_ * 100)].fg].collisionType != 1 or x_ > 0 and items[shadow_copy[x_ - 1 + (y_ * 100)].fg].entrance or x_ > 0 and items[shadow_copy[x_ - 1 + (y_ * 100)].fg].toggleable) {
if (items[shadow_copy[x_ - 1 + (y_ * 100)].fg].vipentrance and not shadow_copy[x_ - 1 + (y_ * 100)].limit_admins and world_->owner_name != pInfo(p_)->tankIDName and not world_->owner_name.empty() and find(shadow_copy[x_ - 1 + (y_ * 100)].admins.begin(), shadow_copy[x_ - 1 + (y_ * 100)].admins.end(), pInfo(p_)->tankIDName) == shadow_copy[x_ - 1 + (y_ * 100)].admins.end()) {
}
else if (items[shadow_copy[x_ - 1 + (y_ * 100)].fg].entrance and is_false_state(shadow_copy[x_ - 1 + (y_ * 100)], 0x00800000) and world_->owner_name != pInfo(p_)->tankIDName and not world_->open_to_public and not world_->owner_name.empty() and !guild_access(p_, world_->guild_id) and find(world_->admins.begin(), world_->admins.end(), pInfo(p_)->tankIDName) == world_->admins.end()) {
}
else if (items[shadow_copy[x_ - 1 + (y_ * 100)].fg].toggleable and is_false_state(shadow_copy[x_ - 1 + (y_ * 100)], 0x00400000)) {
}
else {
if (not shadow_copy[x_ - 1 + (y_ * 100)].scanned) {
shadow_copy[x_ - 1 + (y_ * 100)].scanned = true;
new_tiles.push_back(x_ - 1 + (y_ * 100));
}
}
} if (y_ < 59 and items[shadow_copy[x_ + ((y_ + 1) * 100)].fg].collisionType != 1 or y_ < 59 and items[shadow_copy[x_ + ((y_ + 1) * 100)].fg].entrance or y_ < 59 and items[shadow_copy[x_ + ((y_ + 1) * 100)].fg].toggleable) {
if (items[shadow_copy[x_ + ((y_ + 1) * 100)].fg].vipentrance and not shadow_copy[x_ + ((y_ + 1) * 100)].limit_admins and world_->owner_name != pInfo(p_)->tankIDName and not world_->owner_name.empty() and find(shadow_copy[x_ + ((y_ + 1) * 100)].admins.begin(), shadow_copy[x_ + ((y_ + 1) * 100)].admins.end(), pInfo(p_)->tankIDName) == shadow_copy[x_ + ((y_ + 1) * 100)].admins.end()) {
}
else if (items[shadow_copy[x_ + ((y_ + 1) * 100)].fg].entrance and is_false_state(shadow_copy[x_ + ((y_ + 1) * 100)], 0x00800000) and world_->owner_name != pInfo(p_)->tankIDName and not world_->open_to_public and not world_->owner_name.empty() and !guild_access(p_, world_->guild_id) and find(world_->admins.begin(), world_->admins.end(), pInfo(p_)->tankIDName) == world_->admins.end()) {
}
else if (items[shadow_copy[x_ + ((y_ + 1) * 100)].fg].toggleable and is_false_state(shadow_copy[x_ + ((y_ + 1) * 100)], 0x00400000)) {
}
else {
if (not shadow_copy[x_ + ((y_ + 1) * 100)].scanned) {
shadow_copy[x_ + ((y_ + 1) * 100)].scanned = true;
new_tiles.push_back(x_ + ((y_ + 1) * 100));
}
}
} if (y_ > 0 and items[shadow_copy[x_ + ((y_ - 1) * 100)].fg].collisionType != 1 or y_ > 0 and items[shadow_copy[x_ + 1 + ((y_ - 1) * 100)].fg].entrance or y_ > 0 and items[shadow_copy[x_ + 1 + ((y_ - 1) * 100)].fg].toggleable) {
if (items[shadow_copy[x_ + ((y_ - 1) * 100)].fg].vipentrance and not shadow_copy[x_ + ((y_ - 1) * 100)].limit_admins and world_->owner_name != pInfo(p_)->tankIDName and not world_->owner_name.empty() and find(shadow_copy[x_ + ((y_ - 1) * 100)].admins.begin(), shadow_copy[x_ + ((y_ - 1) * 100)].admins.end(), pInfo(p_)->tankIDName) == shadow_copy[x_ + ((y_ - 1) * 100)].admins.end()) {
}
else if (items[shadow_copy[x_ + ((y_ - 1) * 100)].fg].entrance and is_false_state(shadow_copy[x_ + ((y_ - 1) * 100)], 0x00800000) and world_->owner_name != pInfo(p_)->tankIDName and not world_->open_to_public and not world_->owner_name.empty() and !guild_access(p_, world_->guild_id) and find(world_->admins.begin(), world_->admins.end(), pInfo(p_)->tankIDName) == world_->admins.end()) {
}
else if (items[shadow_copy[x_ + ((y_ - 1) * 100)].fg].toggleable and is_false_state(shadow_copy[x_ + ((y_ - 1) * 100)], 0x00400000)) {
}
else {
if (not shadow_copy[x_ + ((y_ - 1) * 100)].scanned) {
shadow_copy[x_ + ((y_ - 1) * 100)].scanned = true;
new_tiles.push_back(x_ + ((y_ - 1) * 100));
}
}
}
}
return true;
//}
//catch (out_of_range) {
//return false;
//}
}
bool impossible = ar_turi_noclipa(world_, pInfo(peer)->x, pInfo(peer)->y, block_, peer);
if (impossible) {
break;
}
Editor is loading...