Skip to content

Commit 5274ab0

Browse files
committed
Removed several continues, made some fixes, added TO-DO.
1 parent d86f284 commit 5274ab0

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

src/ai.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,15 @@ int ai_shouldnearestattackabletarget(struct world* world, struct entity* entity,
601601
struct entity* ce = NULL;
602602
BEGIN_HASHMAP_ITERATION(world->entities);
603603
struct entity* ie = value;
604-
if (!entity_has_flag(entity_get_info(ie->type), "livingbase") || ie == entity) continue;
604+
if (!entity_has_flag(entity_get_info(ie->type), "livingbase") || ie == entity) {
605+
606+
}
605607
double dsq = entity_distsq(entity, value);
606608
if (ie->type == ENT_PLAYER) {
607609
struct player* pl = ie->data.player.player;
608-
if (pl->gamemode == 1 || pl->gamemode == 3 || pl->invulnerable) continue;
610+
if (pl->gamemode == 1 || pl->gamemode == 3 || pl->invulnerable) {
611+
612+
}
609613
int sk = entity_has_flag(entity_get_info(entity->type), "skeleton");
610614
int zo = entity_has_flag(entity_get_info(entity->type), "zombie");
611615
int cr = entity_has_flag(entity_get_info(entity->type), "creeper");

src/entity_impl.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
1+
#include <basin/server.h>
22
#include <basin/entity_impl.h>
33
#include <basin/entity.h>
4-
#include <basin/server.h>
54
#include <basin/game.h>
65
#include <basin/packet.h>
76
#include <avuna/pmem.h>
@@ -218,14 +217,18 @@ void tick_arrow(struct world* world, struct entity* entity) {
218217
void tick_itemstack(struct world* world, struct entity* entity) {
219218
if (entity->data.itemstack.delayBeforeCanPickup > 0) {
220219
entity->data.itemstack.delayBeforeCanPickup--;
221-
return 0;
222220
}
223221
if (entity->age >= 6000) {
224-
world_despawn_entity(world, entity);
222+
world_despawn_entity(world, entity);
223+
/*
224+
TODO: Make this a configurable option and improve the mechanics of despawning.
225+
All nametagged entities (as well as wolves) must be excluded.
226+
*/
225227
freeEntity(entity);
226-
return 1;
227228
}
228-
if (tick_counter % 10 != 0) return 0;
229+
if (world->tick_counter % 10 != 0) {
230+
231+
}
229232
struct boundingbox cebb;
230233
getEntityCollision(entity, &cebb);
231234
cebb.minX -= .625;

0 commit comments

Comments
 (0)