Crossfire Server, Trunk  R20513
citylife.c
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* Template for version 2.0 plugins. */
3 /* Contact: yann.chachkoff@myrealbox.com */
4 /*****************************************************************************/
5 /* That code is placed under the GNU General Public Licence (GPL) */
6 /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
7 /*****************************************************************************/
8 /* CrossFire, A Multiplayer game for X-windows */
9 /* */
10 /* Copyright (C) 2000 Mark Wedel */
11 /* Copyright (C) 1992 Frank Tore Johansen */
12 /* */
13 /* This program is free software; you can redistribute it and/or modify */
14 /* it under the terms of the GNU General Public License as published by */
15 /* the Free Software Foundation; either version 2 of the License, or */
16 /* (at your option) any later version. */
17 /* */
18 /* This program is distributed in the hope that it will be useful, */
19 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
20 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
21 /* GNU General Public License for more details. */
22 /* */
23 /* You should have received a copy of the GNU General Public License */
24 /* along with this program; if not, write to the Free Software */
25 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
26 /* */
27 /*****************************************************************************/
28 
61 #include <stdarg.h>
62 #include <stdlib.h>
63 #include <string.h>
64 
65 #include "citylife.h"
66 #include "citylife_proto.h"
67 #include "svnversion.h"
68 
69 CF_PLUGIN char SvnRevPlugin[] = SVN_REV;
70 
71 CF_PLUGIN int initPlugin(const char *iversion, f_plug_api gethooksptr) {
72  cf_init_plugin(gethooksptr);
73 
74  cf_log(llevDebug, PLUGIN_VERSION " init\n");
75 
76  return 0;
77 }
78 
79 CF_PLUGIN void *getPluginProperty(int *type, ...) {
80  va_list args;
81  const char *propname;
82  int size;
83  char *buf;
84 
85  va_start(args, type);
86  propname = va_arg(args, const char *);
87 
88  if (!strcmp(propname, "Identification")) {
89  buf = va_arg(args, char *);
90  size = va_arg(args, int);
91  va_end(args);
92  snprintf(buf, size, PLUGIN_NAME);
93  return NULL;
94  } else if (!strcmp(propname, "FullName")) {
95  buf = va_arg(args, char *);
96  size = va_arg(args, int);
97  va_end(args);
98  snprintf(buf, size, PLUGIN_VERSION);
99  return NULL;
100  }
101  va_end(args);
102  return NULL;
103 }
104 
105 CF_PLUGIN int citylife_runPluginCommand(object *op, char *params) {
106  return -1;
107 }
108 
110 #define FIRST_MOVE_KEY "citylife_first_move"
111 
115 typedef struct {
116  int x;
117  int y;
118 } spawn_point;
119 
124 typedef struct {
125  int sx, sy, ex, ey;
126 } spawn_zone;
127 
131 typedef struct {
134  const spawn_zone *zones;
137  const char *mapname;
138  const char *const *available_archetypes;
140 } mapzone;
151 static const spawn_zone scorn_nw_zones[] = {
152  { 40, 26, 50, 50 }
153 };
154 
156 static const spawn_point scorn_nw_points[] = {
157  { 41, 37 },
158  { 48, 35 },
159  { 49, 40 },
160  { 47, 22 },
161  { 49, 37 }
162 };
163 
165 static const spawn_zone scorn_ne_zones[] = {
166  { 0, 26, 22, 50 }
167 };
168 
170 static const spawn_point scorn_ne_points[] = {
171  { 15, 42 },
172  { 9, 35 },
173  { 15, 29 },
174  { 1, 25 },
175  { 1, 29 }
176 };
177 
179 static const spawn_zone scorn_sw_zones[] = {
180  { 41, 0, 50, 10 }
181 };
182 
184 static const spawn_point scorn_sw_points[] = {
185  { 41, 2 },
186  { 46, 8 },
187  { 42, 8 }
188 };
189 
191 static const spawn_zone scorn_se_zones[] = {
192  { 0, 0, 13, 10 }
193 };
194 
196 static const spawn_point scorn_se_points[] = {
197  { 2, 8 },
198  { 11, 8 },
199  { 8, 1 },
200  { 5, 8 }
201 };
202 
204 static const char *const scorn_archs[] = {
205  "c_man",
206  "c_woman",
207  "child",
208  "farmer",
209  "fatman",
210  "fatwoman",
211  "guard",
212  "knight",
213  "man",
214  "nun",
215  "sage",
216  "woman"
217 };
218 
229 static const spawn_zone darcap_zones[] = {
230  { 19, 24, 32, 33 },
231  { 19, 35, 30, 44 },
232  { 31, 14, 41, 25 }
233 };
234 
236 static const spawn_point darcap_points[] = {
237  { 23, 25 },
238  { 19, 27 },
239  { 28, 25 },
240  { 28, 30 },
241  { 26, 33 },
242  { 28, 35 },
243  { 19, 37 },
244  { 25, 37 },
245  { 19, 43 },
246  { 32, 44 },
247  { 25, 43 },
248  { 31, 16 },
249  { 31, 18 },
250  { 31, 20 },
251  { 41, 16 },
252  { 41, 18 },
253  { 41, 20 },
254  { 34, 17 },
255  { 37, 22 }
256 };
257 
258 
260 static const char *const darcap_archs[] = {
261  "c_man",
262  "c_woman",
263  "child",
264  "farmer",
265  "fatman",
266  "fatwoman",
267  "guard",
268  "knight",
269  "man",
270  "nun",
271  "sage",
272  "woman"
273 };
274 
275 
286 static const spawn_zone navar_nw_zones[] = {
287  { 38, 29, 48, 35 },
288  { 36, 38, 49, 44 },
289  { 39, 45, 49, 49 },
290  { 36, 48, 38, 49 }
291 };
292 
294 static const spawn_point navar_nw_points[] = {
295  { 39, 29 },
296  { 41, 31 },
297  { 48, 29 },
298  { 38, 35 },
299  { 43, 39 },
300  { 38, 46 },
301  { 36, 48 },
302  { 45, 47 }
303 };
304 
306 static const spawn_zone navar_ne_zones[] = {
307  { 0, 33, 7, 49 },
308  { 10, 38, 19, 44},
309  { 11, 45, 19, 49}
310 };
311 
313 static const spawn_point navar_ne_points[] = {
314  { 4, 34 },
315  { 2, 39 },
316  { 2, 45 },
317  { 8, 46 },
318  { 13, 47 },
319  { 21, 42 }
320 };
321 
323 static const spawn_zone navar_sw_zones[] = {
324  { 36, 0, 49, 5 },
325  { 39, 6, 49, 15}
326 };
327 
329 static const spawn_point navar_sw_points[] = {
330  { 42, 7 },
331  { 37, 4 },
332  { 46, 11 }
333 };
334 
336 static const spawn_zone navar_se_zones[] = {
337  { 0, 0, 8, 15 },
338  { 4, 16, 13, 18},
339  { 9, 4, 18, 14},
340  { 10, 0, 18, 1}
341 };
342 
344 static const spawn_point navar_se_points[] = {
345  { 3, 0 },
346  { 1, 1 },
347  { 3, 9 },
348  { 5, 16 },
349  { 18, 14 },
350  { 12, 11 },
351  { 14, 4 },
352  { 12, 0 }
353 };
354 
356 static const char *const navar_archs[] = {
357  "c_man",
358  "c_woman",
359  "child",
360  "elf_man",
361  "courier",
362  "fatwoman",
363  "guard",
364  "knight",
365  "dwarf_wiz",
366  "clown",
367  "sage",
368  "woman",
369  "fighter",
370  "halfling",
371  "sailor"
372 };
373 
374 
385 static const spawn_zone port_joseph_zones[] = {
386  { 10, 27, 19, 43 }
387 };
388 
390 static const spawn_point port_joseph_points[] = {
391  { 14, 31 },
392  { 17, 32 },
393  { 13, 35 },
394  { 17, 42 },
395  { 13, 38 },
396  { 17, 36 }
397 };
398 
399 
401 static const char *const port_joseph_archs[] = {
402  "c_man",
403  "c_woman",
404  "pirate",
405  "fatman",
406  "fatwoman",
407  "man",
408  "sailor",
409  "woman3"
410 };
411 
422 static const spawn_zone stoneville_zones[] = {
423  { 0, 8, 14, 23 }
424 };
425 
427 static const spawn_point stoneville_points[] = {
428  { 3, 9 },
429  { 8, 15 },
430  { 1, 21 },
431  { 2, 17 },
432  { 12, 9 }
433 };
434 
435 
437 static const char *const stoneville_archs[] = {
438  "c_man",
439  "c_woman",
440  "pirate",
441  "fatman",
442  "fatwoman",
443  "man",
444  "sailor",
445  "woman3"
446 };
447 
448 
459 static const spawn_zone wolfsburg_zones[] = {
460  { 13, 1, 45, 17 }
461 };
462 
464 static const spawn_point wolfsburg_points[] = {
465  { 15, 1 },
466  { 19, 7 },
467  { 22, 10 },
468  { 29, 7 },
469  { 42, 2 },
470  { 35, 1 },
471  { 43, 8 },
472  { 33, 11 }
473 };
474 
475 
477 static const char *const wolfsburg_archs[] = {
478  "c_man",
479  "c_woman",
480 /* "prisoner", Why? They don't move. They look ridiculous spawning on the main map. */
481  "fatman",
482  "fatwoman",
483  "man",
484  "sailor",
485  "woman3",
486  "merchant"
487 };
488 
489 
501  { 9, 14, 25, 20 },
502  { 15, 6, 23, 13 }
503 };
504 
507  { 15, 6 },
508  { 18, 5 },
509  { 14, 9 },
510  { 15, 16 },
511  { 31, 15 },
512  { 22, 20 },
513  { 11, 19 },
514  { 26, 11 }
515 };
516 
517 
519 static const char *const santo_dominion_archs[] = {
520  "c_man",
521  "c_woman",
522 /* "prisoner", */
523  "fatman",
524  "fatwoman",
525  "man",
526  "sailor",
527  "woman3",
528  "merchant"
529 };
530 
538 static const mapzone available_zones[] = {
539  { scorn_nw_points, 5, scorn_nw_zones, 1, 2, "/world/world_104_115", scorn_archs, 12 },
540  { scorn_ne_points, 1, scorn_ne_zones, 1, 5, "/world/world_105_115", scorn_archs, 12 },
541  { scorn_sw_points, 3, scorn_sw_zones, 1, 5, "/world/world_104_116", scorn_archs, 12 },
542  { scorn_se_points, 1, scorn_se_zones, 1, 5, "/world/world_105_116", scorn_archs, 12 },
543  { darcap_points, 19, darcap_zones, 3, 4, "/world/world_116_102", darcap_archs, 12},
544  { navar_nw_points, 8, navar_nw_zones, 4, 2, "/world/world_121_116", navar_archs, 15 },
545  { navar_ne_points, 6, navar_ne_zones, 3, 5, "/world/world_122_116", navar_archs, 15 },
546  { navar_sw_points, 3, navar_sw_zones, 2, 3, "/world/world_121_117", navar_archs, 15 },
547  { navar_se_points, 8, navar_se_zones, 4, 5, "/world/world_122_117", navar_archs, 15 },
548  { port_joseph_points, 6, port_joseph_zones, 1, 3, "/world/world_101_114", port_joseph_archs, 8 },
549  { stoneville_points, 5, stoneville_zones, 1, 2, "/world/world_103_127", stoneville_archs, 8 },
550  { wolfsburg_points, 8, wolfsburg_zones, 1, 4, "/world/world_128_109", wolfsburg_archs, 8 },
551  { santo_dominion_points, 8, santo_dominion_zones, 2, 3, "/world/world_102_108", santo_dominion_archs, 8 },
552  { NULL, -1, NULL, -1, 1, "", NULL, 0 },
553 };
554 
563 static const mapzone *get_zone_for_map(mapstruct *map) {
564  int test;
565 
566  for (test = 0; available_zones[test].count_points != -1; test++) {
567  if (strcmp(available_zones[test].mapname, map->path) == 0)
568  return &available_zones[test];
569  }
570  return NULL;
571 }
572 
580 static object *get_npc(const mapzone *zone) {
581  int arch = RANDOM()%zone->archetypes_count;
582  object *npc = cf_create_object_by_name(zone->available_archetypes[arch]);
583  object *evt;
584 
585  if (!npc) {
586  cf_log(llevError, PLUGIN_NAME ": get_npc() got NULL object for %s!\n", zone->available_archetypes[arch]);
587  return NULL;
588  }
589 
591  /* Prevent disease spreading in cities, mostly rabies. */
593  /* add a key so NPC will not disappear in the house it came from */
594  cf_object_set_key(npc, FIRST_MOVE_KEY, "1", 1);
595 
596  evt = cf_create_object_by_name("event_time");
599  cf_object_insert_object(evt, npc);
600 
601  return npc;
602 }
603 
611 static void add_npc_to_zone(const mapzone *zone, mapstruct *map) {
612  int which;
613  object *npc = get_npc(zone);
614 
615  if (!npc)
616  return;
617  which = RANDOM()%zone->count_zones;
618  if (cf_object_teleport(npc, map, zone->zones[which].sx+RANDOM()%(zone->zones[which].ex-zone->zones[which].sx), zone->zones[which].sy+RANDOM()%(zone->zones[which].ey-zone->zones[which].sy))) {
620  }
621 }
622 
630 static void add_npc_to_point(const mapzone *zone, mapstruct *map) {
631  int which;
632  object *npc = get_npc(zone);
633 
634  which = RANDOM()%zone->count_points;
635  if (cf_object_teleport(npc, map, zone->points[which].x, zone->points[which].y)) {
637  }
638 }
639 
645 static void add_npcs_to_map(mapstruct *map) {
646  int add;
647  const mapzone *zone = get_zone_for_map(map);
648 
649  if (!zone)
650  return;
651 
652  add = 1+RANDOM()%zone->population;
653  cf_log(llevDebug, PLUGIN_NAME ": adding %d NPC to map %s.\n", add, map->path);
654 
655  while (add-- >= 0) {
656  add_npc_to_zone(zone, map);
657  }
658 }
659 
663 static void add_npc_to_random_map(void) {
664  int count, test;
665  mapstruct *list[50];
666  int zones[50];
667  count = 0;
668 
669  for (test = 0; available_zones[test].count_points != -1 && count < 50; test++) {
670  if ((list[count] = cf_map_has_been_loaded(available_zones[test].mapname)) && (list[count]->in_memory == MAP_IN_MEMORY)) {
671  zones[count] = test;
672  count++;
673  }
674  }
675  if (!count)
676  return;
677 
678  test = RANDOM()%count;
679  add_npc_to_point(&available_zones[zones[test]], list[test]);
680 }
681 
683  va_list args;
684  int rv = 0;
685  mapstruct *map;
686  int code;
687 
688  va_start(args, type);
689  code = va_arg(args, int);
690 
691  switch (code) {
692  case EVENT_MAPLOAD:
693  map = va_arg(args, mapstruct *);
694  add_npcs_to_map(map);
695  break;
696 
697  case EVENT_CLOCK:
698  if (RANDOM()%40 == 0)
700  }
701  va_end(args);
702 
703  return rv;
704 }
705 
707  cf_log(llevDebug, PLUGIN_VERSION " post init\n");
708 
709  /* Pick the global events you want to monitor from this plugin */
710 
711 /*
712  cf_system_register_global_event(EVENT_BORN, PLUGIN_NAME, citylife_globalEventListener);
713  cf_system_register_global_event(EVENT_CRASH, PLUGIN_NAME, citylife_globalEventListener);
714  cf_system_register_global_event(EVENT_PLAYER_DEATH, PLUGIN_NAME, citylife_globalEventListener);
715  cf_system_register_global_event(EVENT_GKILL, PLUGIN_NAME, citylife_globalEventListener);
716  cf_system_register_global_event(EVENT_LOGIN, PLUGIN_NAME, citylife_globalEventListener);
717  cf_system_register_global_event(EVENT_LOGOUT, PLUGIN_NAME, citylife_globalEventListener);
718  cf_system_register_global_event(EVENT_MAPENTER, PLUGIN_NAME, citylife_globalEventListener);
719  cf_system_register_global_event(EVENT_MAPLEAVE, PLUGIN_NAME, citylife_globalEventListener);
720  cf_system_register_global_event(EVENT_MAPRESET, PLUGIN_NAME, citylife_globalEventListener);
721  cf_system_register_global_event(EVENT_REMOVE, PLUGIN_NAME, citylife_globalEventListener);
722  cf_system_register_global_event(EVENT_SHOUT, PLUGIN_NAME, citylife_globalEventListener);
723  cf_system_register_global_event(EVENT_TELL, PLUGIN_NAME, citylife_globalEventListener);
724  cf_system_register_global_event(EVENT_MUZZLE, PLUGIN_NAME, citylife_globalEventListener);
725  cf_system_register_global_event(EVENT_KICK, PLUGIN_NAME, citylife_globalEventListener);
726 */
729 /*
730  cf_system_register_global_event(EVENT_MAPRESET, PLUGIN_NAME, citylife_globalEventListener);
731 */
732 
733  return 0;
734 }
735 
736 CF_PLUGIN int eventListener(int *type, ...) {
737  int rv = 1;
738  va_list args;
739  /*char *buf;*/
740  object *ground, *who/*, *activator, *third, *event*/;
741  /*int fix;*/
742  const char *value;
743 
744  va_start(args, type);
745 
746  who = va_arg(args, object *);
747  /*activator =*/ va_arg(args, object *);
748  /*third =*/ va_arg(args, object *);
749  /*buf =*/ va_arg(args, char *);
750  /*fix =*/ va_arg(args, int);
751  /*event =*/ va_arg(args, object *);
752  va_arg(args, talk_info *); /* ignored for now */
753  va_end(args);
754 
755  /* should our npc disappear? */
756  if (RANDOM()%100 < 30) {
757  for (ground = cf_map_get_object_at(who->map, who->x, who->y); ground; ground = cf_object_get_object_property(ground, CFAPI_OBJECT_PROP_OB_ABOVE)) {
758  if (ground->type == EXIT) {
759  object *inv;
760 
761  value = cf_object_get_key(who, FIRST_MOVE_KEY);
762  if (strcmp(value, "1") == 0) {
763  cf_object_set_key(who, FIRST_MOVE_KEY, "0", 1);
764  break;
765  }
766 
767  /* must set inventory as no drop, else it'll just drop on the ground */
770 
771  cf_object_remove(who);
773  return rv;
774  }
775  }
776  }
777 
778  /* we have to move manually, because during the night NPCs don't move. */
779  cf_object_move(who, 1+RANDOM()%8, NULL);
780 
781  return rv;
782 }
783 
785  cf_log(llevDebug, PLUGIN_VERSION " closing\n");
786  return 0;
787 }
static const spawn_point scorn_se_points[]
Points for map 105_116.
Definition: citylife.c:196
static const spawn_zone scorn_nw_zones[]
Zones for map 104_115.
Definition: citylife.c:151
Error, serious thing.
Definition: logger.h:11
char path[HUGE_BUF]
Filename of the map.
Definition: map.h:365
#define FLAG_NO_DROP
Object can&#39;t be dropped.
Definition: define.h:289
void cf_object_free_drop_inventory(object *ob)
Wrapper for object_free_drop_inventory().
#define CFAPI_OBJECT_PROP_OB_BELOW
Definition: plugin.h:172
static const spawn_zone navar_nw_zones[]
Zones for map 121_116.
Definition: citylife.c:286
static const spawn_zone port_joseph_zones[]
Zones for map 101_114.
Definition: citylife.c:385
const char * cf_object_get_key(object *op, const char *keyname)
Gets value for specified key, equivalent of object_get_value().
static const char *const wolfsburg_archs[]
Archetypes to spawn in wolfsburg.
Definition: citylife.c:477
static const spawn_point scorn_nw_points[]
Points for map 104_115.
Definition: citylife.c:156
Options for a map.
Definition: citylife.c:131
void cf_object_set_flag(object *ob, int flag, int value)
static const spawn_point scorn_ne_points[]
Points for map 105_115.
Definition: citylife.c:170
static const char *const darcap_archs[]
Archetypes to spawn in Darcap.
Definition: citylife.c:260
#define CFAPI_OBJECT_PROP_INVENTORY
Definition: plugin.h:175
int count_points
How many items in points.
Definition: citylife.c:133
static const house_zone_struct zones[]
Maps we work on.
Definition: cfrhg.c:67
const char * slaying
Which race to do double damage to.
Definition: object.h:319
CF_PLUGIN char SvnRevPlugin[]
Definition: citylife.c:69
static const spawn_point navar_nw_points[]
Points for map 121_116.
Definition: citylife.c:294
#define FLAG_RANDOM_MOVE
NPC will move randomly.
Definition: define.h:310
#define FIRST_MOVE_KEY
Key to contain whether it&#39;s the first move of the NPC or not.
Definition: citylife.c:110
Point from which a NPC can come when the map is loaded.
Definition: citylife.c:115
sstring cf_add_string(const char *str)
Wrapper for add_string().
const spawn_zone * zones
Zones where to spawn at load time.
Definition: citylife.c:134
CF_PLUGIN int postInitPlugin(void)
Plugin was initialized, now to finish.
Definition: citylife.c:706
static const char *const navar_archs[]
Archetypes to spawn in Navar.
Definition: citylife.c:356
static const spawn_zone navar_se_zones[]
Zones for map 122_117.
Definition: citylife.c:336
CF_PLUGIN int closePlugin(void)
Close the plugin.
Definition: citylife.c:784
static object * get_npc(const mapzone *zone)
Creates a NPC for the specified zone, and do needed initialization.
Definition: citylife.c:580
static const spawn_point scorn_sw_points[]
Points for map 104_116.
Definition: citylife.c:184
static void add_npc_to_random_map(void)
Find a suitable map loaded and add an NPC to it.
Definition: citylife.c:663
void cf_log(LogLevel logLevel, const char *format,...)
Wrapper for LOG().
CF_PLUGIN void * getPluginProperty(int *type,...)
Gets a plugin property.
Definition: citylife.c:79
#define FLAG_UNDEAD
Monster is undead.
Definition: define.h:270
static const spawn_point stoneville_points[]
Points for map 103_127.
Definition: citylife.c:427
#define MAP_IN_MEMORY
Map is fully loaded.
Definition: map.h:130
const char * title
Of foo, etc.
Definition: object.h:317
int16_t y
Position in the map for this object.
Definition: object.h:326
static const char *const santo_dominion_archs[]
Archetypes to spawn in santo_dominion.
Definition: citylife.c:519
static const spawn_zone stoneville_zones[]
Zones for map 103_127.
Definition: citylife.c:422
int cf_init_plugin(f_plug_api getHooks)
See Exit.
Definition: object.h:181
static const char *const stoneville_archs[]
Archetypes to spawn in stoneville.
Definition: citylife.c:437
Zone in which to add NPCs when the map was just loaded.
Definition: citylife.c:124
Structure used to build up dialog information when a player says something.
Definition: dialog.h:51
static const spawn_zone navar_sw_zones[]
Zones for map 121_117.
Definition: citylife.c:323
struct mapdef * map
Pointer to the map in which this object is present.
Definition: object.h:297
#define snprintf
Definition: win32.h:46
static void add_npc_to_zone(const mapzone *zone, mapstruct *map)
Add an NPC somewhere in a spawn zone.
Definition: citylife.c:611
#define PLUGIN_NAME
Definition: cfanim.h:32
static const mapzone available_zones[]
All maps we work on.
Definition: citylife.c:538
void cf_system_register_global_event(int event, const char *name, f_plug_event hook)
static const spawn_point navar_sw_points[]
Points for map 121_117.
Definition: citylife.c:329
object * cf_object_insert_object(object *op, object *container)
const spawn_point * points
Points to spawn from when there is a player on the map.
Definition: citylife.c:132
static void add_npc_to_point(const mapzone *zone, mapstruct *map)
Add an NPC somewhere at a spawn point.
Definition: citylife.c:630
#define EVENT_MAPLOAD
A map is loaded.
Definition: plugin.h:99
static const spawn_zone darcap_zones[]
Zones for map 116_102.
Definition: citylife.c:229
int16_t x
Definition: object.h:326
static const spawn_zone scorn_ne_zones[]
Zones for map 105_115.
Definition: citylife.c:165
void cf_object_remove(object *op)
Wrapper for object_remove().
object * cf_map_get_object_at(mapstruct *m, int x, int y)
Wrapper for GET_MAP_OB().
CF_PLUGIN int citylife_runPluginCommand(object *op, char *params)
Definition: citylife.c:105
static const spawn_zone scorn_se_zones[]
Zones for map 105_116.
Definition: citylife.c:191
static const spawn_zone navar_ne_zones[]
Zones for map 122_116.
Definition: citylife.c:306
object * cf_object_get_object_property(object *op, int propcode)
#define EVENT_CLOCK
Global time event.
Definition: plugin.h:84
CF_PLUGIN int citylife_globalEventListener(int *type,...)
Definition: citylife.c:682
static const spawn_point port_joseph_points[]
Points for map 101_114.
Definition: citylife.c:390
#define CF_PLUGIN
Definition: plugin_common.h:38
#define RANDOM()
Definition: define.h:679
int cf_object_move(object *op, int dir, object *originator)
static const spawn_zone scorn_sw_zones[]
Zones for map 104_116.
Definition: citylife.c:179
Only for debugging purposes.
Definition: logger.h:13
uint8_t type
PLAYER, BULLET, etc.
Definition: object.h:338
static const spawn_point wolfsburg_points[]
Points for map 128_109.
Definition: citylife.c:464
mapstruct * cf_map_has_been_loaded(const char *name)
Wrapper for has_been_loaded().
static const spawn_point santo_dominion_points[]
Points for map 102_108.
Definition: citylife.c:506
static const spawn_point navar_se_points[]
Points for map 122_117.
Definition: citylife.c:344
int count_zones
How many items in zones.
Definition: citylife.c:135
static const char *const scorn_archs[]
Archetypes to spawn in Scorn.
Definition: citylife.c:204
static const mapzone * get_zone_for_map(mapstruct *map)
Finds if a map has a zone defined.
Definition: citylife.c:563
int cf_object_teleport(object *ob, mapstruct *map, int x, int y)
static const char *const port_joseph_archs[]
Archetypes to spawn in Port Joseph.
Definition: citylife.c:401
static const spawn_point navar_ne_points[]
Points for map 122_116.
Definition: citylife.c:313
static void add_npcs_to_map(mapstruct *map)
Add some NPCs to the map, based on the zone definition.
Definition: citylife.c:645
This is a game-map.
Definition: map.h:325
static const spawn_zone santo_dominion_zones[]
Zones for map 102_108.
Definition: citylife.c:500
static const spawn_point darcap_points[]
Points for map 116_102.
Definition: citylife.c:236
const char * mapname
Map path.
Definition: citylife.c:137
#define CFAPI_OBJECT_PROP_OB_ABOVE
Definition: plugin.h:171
object * cf_create_object_by_name(const char *name)
Wrapper for create_archetype() and create_archetype_by_object_name().
int archetypes_count
Number of items in available_archetypes.
Definition: citylife.c:139
const char *const * available_archetypes
What archetypes can we chose from for an NPC?
Definition: citylife.c:138
int population
Maximum of NPCs to add at load time.
Definition: citylife.c:136
void(* f_plug_api)(int *type,...)
General API function.
Definition: plugin.h:125
CF_PLUGIN int initPlugin(const char *iversion, f_plug_api gethooksptr)
Plugin initialisation function.
Definition: citylife.c:71
CF_PLUGIN int eventListener(int *type,...)
Handles an object-related event.
Definition: citylife.c:736
static const spawn_zone wolfsburg_zones[]
Zones for map 128_109.
Definition: citylife.c:459
int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key)
Sets a value for specified key, equivalent to object_set_value().
#define PLUGIN_VERSION
Definition: cfanim.h:33