diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-09-23 14:10:05 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-09-23 14:10:05 +0000 |
| commit | 815c55c4ce58995dcc34627bcbed956d1a1bc4dd (patch) | |
| tree | ae33fb8915f06865369208c5402122555b90d905 /src/game/server | |
| parent | 8f9e2031dcd562e72ac7e5ec9c00b8aed10b53a6 (diff) | |
| download | zcatch-815c55c4ce58995dcc34627bcbed956d1a1bc4dd.tar.gz zcatch-815c55c4ce58995dcc34627bcbed956d1a1bc4dd.zip | |
added death tile
Diffstat (limited to 'src/game/server')
| -rw-r--r-- | src/game/server/entities/character.cpp | 4 | ||||
| -rw-r--r-- | src/game/server/hooks.cpp | 19 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 98bfa862..05820102 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -2,6 +2,7 @@ #include <engine/e_server_interface.h> #include <engine/e_config.h> #include <game/server/gamecontext.hpp> +#include <game/mapitems.hpp> #include "character.hpp" #include "laser.hpp" @@ -588,6 +589,9 @@ void CHARACTER::tick() //core.jumped = jumped; core.input = input; core.tick(true); + + if(col_get(pos.x, pos.y)&COLFLAG_DEATH) + die(player->client_id, -1); // handle weapons handle_weapons(); diff --git a/src/game/server/hooks.cpp b/src/game/server/hooks.cpp index 41058dd1..bd2b5f4f 100644 --- a/src/game/server/hooks.cpp +++ b/src/game/server/hooks.cpp @@ -352,9 +352,22 @@ void mods_init() { for(int x = 0; x < tmap->width; x++) { - int index = tiles[y*tmap->width+x].index - ENTITY_OFFSET; - vec2 pos(x*32.0f+16.0f, y*32.0f+16.0f); - game.controller->on_entity(index, pos); + int index = tiles[y*tmap->width+x].index; + + if(index >= ENTITY_OFFSET) + { + vec2 pos(x*32.0f+16.0f, y*32.0f+16.0f); + game.controller->on_entity(index-ENTITY_OFFSET, pos); + } + else + { + if(index == TILE_DEATH) + tiles[y*tmap->width+x].index = COLFLAG_DEATH; + else if(index == TILE_SOLID) + tiles[y*tmap->width+x].index = COLFLAG_SOLID; + else + tiles[y*tmap->width+x].index = 0; + } } } |