mirror of
https://github.com/p2r3/bareiron.git
synced 2025-10-01 23:25:09 +02:00

* send server brand to client * send brand regardless of `0x02` being recieved by server or not * send brand regardless of `0x02` being recieved by server or not + if statement to match previous lines * ifdef check for brand sending * commit main.c for ifdef check (i forgot) * commit main.c for ifdef check (i forgot) * change sc_pluginMessage to sc_sendPluginMessage - added params to it for use in other cases - other changes to fit PR reviews * revert .gitignore * revert unrelated changes * send byte instead of varint for constant packet id * gate declaration of brand string behind ifdef * make logging consistent with codebase --------- Co-authored-by: p2r3 <p2r3@p2r3.com>
52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <arpa/inet.h>
|
|
#include <unistd.h>
|
|
|
|
#include "globals.h"
|
|
|
|
#ifdef ESP_PLATFORM
|
|
#include "esp_task_wdt.h"
|
|
#include "esp_timer.h"
|
|
|
|
// Time between vTaskDelay calls in microseconds
|
|
#define TASK_YIELD_INTERVAL 1000 * 1000
|
|
// How many ticks to delay for on each yield
|
|
#define TASK_YIELD_TICKS 1
|
|
|
|
int64_t last_yield = 0;
|
|
void task_yield () {
|
|
int64_t time_now = esp_timer_get_time();
|
|
if (time_now - last_yield < TASK_YIELD_INTERVAL) return;
|
|
vTaskDelay(TASK_YIELD_TICKS);
|
|
last_yield = time_now;
|
|
}
|
|
#endif
|
|
|
|
ssize_t recv_count;
|
|
uint8_t recv_buffer[256] = {0};
|
|
|
|
uint32_t world_seed = INITIAL_WORLD_SEED;
|
|
uint32_t rng_seed = INITIAL_RNG_SEED;
|
|
|
|
uint16_t world_time = 0;
|
|
uint32_t server_ticks = 0;
|
|
|
|
char motd[] = { "A bareiron server" };
|
|
uint8_t motd_len = sizeof(motd) - 1;
|
|
|
|
#ifdef SEND_BRAND
|
|
char brand[] = { "bareiron" };
|
|
uint8_t brand_len = sizeof(brand) - 1;
|
|
#endif
|
|
|
|
uint16_t client_count;
|
|
|
|
BlockChange block_changes[MAX_BLOCK_CHANGES];
|
|
int block_changes_count = 0;
|
|
|
|
PlayerData player_data[MAX_PLAYERS];
|
|
int player_data_count = 0;
|
|
|
|
MobData mob_data[MAX_MOBS];
|