Entropie git · main
Entropie festival game; first steps
C 88.5% Markdown 9.1% GLSL 2.3%git clone https://git.christianimmanuel.de/games/Entropie.gitwget https://git.christianimmanuel.de/games/Entropie/archive/Entropie.tar.gzentropie/src/people/pockets.h raw
#ifndef PEOPLE_POCKETS_H
#define PEOPLE_POCKETS_H
/*
* What people carry in their pockets: Urinellas (one-time use, up to
* POCKET_URINELLAS), a lighter (it runs empty; it can be lent, and not
* always given back), cigarettes, or the makings to roll them: tobacco,
* papers and (for most) filter tips - shared, used up, asked for. Keys.
*/
#include <stdbool.h>
#include "world/object.h"
/* Uses who's lighter once: false if there's none, or it's empty. */
bool Pockets_light(Object *who);
/* Somebody within range with a lighter that works (not who). */
Object *Pockets_lighterNear(Object *who, Object *const *objects, int count, float range);
/* The lighter goes from one pocket to the other (whose it is stays known). */
void Pockets_passLighter(Object *from, Object *to);
/* Someone else's lighter in who's pocket goes back to its owner (if they have none). */
bool Pockets_giveBack(Object *who);
/* Something to smoke in the pocket (a cigarette, or tobacco and a paper to roll one). */
bool Pockets_hasSmoke(const Object *who);
/* Takes one out: the makings first if they may roll (can_roll: both hands free), else a ready one.
*rolled: it has to be rolled first (a paper, tobacco, a filter if there is one). False: nothing (that they can use now). */
bool Pockets_takeSmoke(Object *who, bool can_roll, bool *rolled);
/* Somebody within range with something to smoke (not who). */
Object *Pockets_smokesNear(Object *who, Object *const *objects, int count, float range);
/* One cigarette from one pocket to the other (they roll one if they have no ready ones). */
bool Pockets_giveSmoke(Object *from, Object *to);
/* What who lacks to roll one (they have tobacco or papers, not both - or no
filter and they use them): POCKET_NOTHING when they can, or have ready ones. */
typedef enum { POCKET_NOTHING, POCKET_PAPERS, POCKET_FILTERS, POCKET_TOBACCO, POCKET_ASHTRAY } PocketNeed;
PocketNeed Pockets_need(const Object *who);
/* Somebody within range who has that to spare (not who). */
Object *Pockets_hasNear(Object *who, PocketNeed what, Object *const *objects, int count, float range);
/* Gives some of it (3 papers, 5 filters, a pinch for 2; the pocket ashtray: to's butt goes into from's): how many. */
int Pockets_give(Object *from, Object *to, PocketNeed what);
/* "a paper", "a filter", "a bit of tobacco" */
const char *Pockets_needName(PocketNeed what);
/* A finished cigarette: into who's pocket ashtray (or wrapped up in the pocket: tidy ones without one). */
void Pockets_keepButt(Object *who);
/* Pockets: how many (by what they wear) and how many have something in them. */
int Pockets_slots(const Object *who);
int Pockets_used(const Object *who);
/* Takes Urinellas from a box: how many were taken. */
int Pockets_refill(Object *who);
#endif /* PEOPLE_POCKETS_H */