Adding a chest for the water jet

This commit is contained in:
Anonymus Raccoon
2020-05-02 15:06:49 +02:00
parent 185dedc0ed
commit 0b58b30d11
5 changed files with 39 additions and 2 deletions
+2
View File
@@ -75,6 +75,8 @@ gc_vector2 pos, enum gc_mousekeys key);
void fisherman_setup(gc_engine *engine);
bool fisherman_next(gc_engine *engine, gc_entity *entity, \
gc_vector2 pos, enum gc_mousekeys key);
bool fisherman_chest(gc_engine *engine, gc_entity *entity, \
gc_vector2 pos, enum gc_mousekeys key);
bool lumberjack_yes(gc_engine *engine, gc_entity *entity, \
gc_vector2 pos, enum gc_mousekeys key);
+12
View File
@@ -264,6 +264,18 @@
</dialog_holder>
</gc_entity>
<gc_entity>
<transform_component>
<Position x="0" y="0" />
<Size x="50" y="50" />
</transform_component>
<renderer src="chest"/>
<map_linker x="49" y="56" centered="true" />
<dialog_holder x="48" y="56" tile_texture="npc_interact">
<Chest line="You found a chest." callback="fisherman_chest" />
</dialog_holder>
</gc_entity>
<gc_entity>
<transform_component>
<Position x="0" y="0" />
+1
View File
@@ -60,6 +60,7 @@ const struct gc_data game_data[] = {
{"dialog_callback", "mia_setup", &mia_setup, NULL},
{"input", "fisherman_next", &fisherman_next, NULL},
{"dialog_callback", "fisherman_setup", &fisherman_setup, NULL},
{"dialog_callback", "fisherman_chest", &fisherman_chest, NULL},
{"input", "lumberjack_yes", &lumberjack_yes, NULL},
{"dialog_callback", "smith_chest", &smith_chest, NULL},
{NULL, NULL, NULL, NULL}
+22
View File
@@ -7,6 +7,7 @@
#include "components/dialog_holder.h"
#include "systems/game_manager_system.h"
#include "components/player_component.h"
#include "engine.h"
@@ -37,4 +38,25 @@ that I will show up at...", NULL);
dialog_add_line(dialog, "Fisherman", "her house for dinner tonight.", NULL);
GETSYS(engine, game_manager_system)->has_message = true;
return (true);
}
bool fisherman_chest(gc_engine *engine, gc_entity *entity, \
gc_vector2 pos, enum gc_mousekeys key)
{
struct dialog_holder *dialog = dialog_get_current(engine);
gc_entity *player = engine->scene->get_entity(engine->scene, 50);
struct player_component *inv;
if (!player)
return (false);
inv = GETCMP(player, player_component);
if (!inv)
return (false);
dialog->text[1] = NULL;
if (inv->inventory_upgrades[1])
dialog_add_line(dialog, NULL, "This chest is empty.", NULL);
else
dialog_add_line(dialog, "", "You found the water jet upgrade!", NULL);
inv->inventory_upgrades[1] = true;
return (true);
}
+2 -2
View File
@@ -5,8 +5,8 @@
** smith.c
*/
#include <components/player_component.h>
#include <components/dialog_holder.h>
#include "components/player_component.h"
#include "components/dialog_holder.h"
#include "engine.h"
bool smith_chest(gc_engine *engine, gc_entity *entity, \