aboutsummaryrefslogtreecommitdiff
path: root/plugins/cherry
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/cherry')
-rw-r--r--plugins/cherry/Makefile2
-rw-r--r--plugins/cherry/cherry.c8
-rw-r--r--plugins/cherry/cherry.h8
-rw-r--r--plugins/cherry/dependencies.txt1
4 files changed, 18 insertions, 1 deletions
diff --git a/plugins/cherry/Makefile b/plugins/cherry/Makefile
index edb1f44..a561baa 100644
--- a/plugins/cherry/Makefile
+++ b/plugins/cherry/Makefile
@@ -1,4 +1,4 @@
-plugins/cherry/cherry.so: plugins/cherry/cherry.c plugins/game/game.h plugins/score/score.h plugins/inventory/inventory.h
+plugins/cherry/cherry.so: plugins/cherry/cherry.c plugins/game/game.h plugins/score/score.h plugins/inventory/inventory.h plugins/loot/loot.h
cc -g -shared -fpic -o plugins/cherry/cherry.so plugins/cherry/cherry.c
PLUGINS := ${PLUGINS} plugins/cherry/cherry.so
diff --git a/plugins/cherry/cherry.c b/plugins/cherry/cherry.c
index 1b0ac8a..96f0a2a 100644
--- a/plugins/cherry/cherry.c
+++ b/plugins/cherry/cherry.c
@@ -3,6 +3,7 @@
#include "../game/game.h"
#include "../score/score.h"
#include "../inventory/inventory.h"
+#include "../loot/loot.h"
static bool use_cherry(struct itemstack *stack)
{
@@ -66,5 +67,12 @@ __attribute__((constructor)) static void init()
.room_chance = 100,
.callback = &spawn_cherry,
});
+
+ register_loot((struct loot) {
+ .item = &cherry_item,
+ .chance = 2,
+ .min = 3,
+ .max = 10,
+ });
}
diff --git a/plugins/cherry/cherry.h b/plugins/cherry/cherry.h
new file mode 100644
index 0000000..87ccbec
--- /dev/null
+++ b/plugins/cherry/cherry.h
@@ -0,0 +1,8 @@
+#ifndef _CHERRY_H_
+#define _CHERRY_H_
+
+#include "../inventory/inventory.h"
+
+extern struct item cherry_item;
+
+#endif
diff --git a/plugins/cherry/dependencies.txt b/plugins/cherry/dependencies.txt
index 4952514..d721cfd 100644
--- a/plugins/cherry/dependencies.txt
+++ b/plugins/cherry/dependencies.txt
@@ -1,3 +1,4 @@
game
score
inventory
+loot