Pruned the usage of the incomplete monster system
This commit is contained in:
@@ -22,6 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
--DOCS: a placeholder door utility
|
||||||
|
|
||||||
local doorUtility = {}
|
local doorUtility = {}
|
||||||
|
|
||||||
roomAPI = require("room")
|
roomAPI = require("room")
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
--DOCS: a placeholder map generator
|
||||||
|
|
||||||
local regionAPI = require("region")
|
local regionAPI = require("region")
|
||||||
|
|
||||||
local mapMaker = {}
|
local mapMaker = {}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@
|
|||||||
*/
|
*/
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
--DOCS: This script is run by the server on startup
|
||||||
|
|
||||||
print("Lua script check")
|
print("Lua script check")
|
||||||
|
|
||||||
--requirements
|
--requirements
|
||||||
roomManagerAPI = require("room_manager")
|
roomManagerAPI = require("room_manager")
|
||||||
roomAPI = require("room")
|
roomAPI = require("room")
|
||||||
monsterManagerAPI = require("monster_manager")
|
|
||||||
monsterAPI = require("monster")
|
|
||||||
|
|
||||||
mapMaker = require("map_maker")
|
mapMaker = require("map_maker")
|
||||||
mapSaver = require("map_saver")
|
mapSaver = require("map_saver")
|
||||||
@@ -43,10 +43,6 @@ roomManagerAPI.SetOnCreate(function(room, index)
|
|||||||
roomAPI.ForEachCharacter(room, function(character)
|
roomAPI.ForEachCharacter(room, function(character)
|
||||||
--
|
--
|
||||||
end)
|
end)
|
||||||
|
|
||||||
roomAPI.ForEachMonster(room, function(monster)
|
|
||||||
--TODO: move ForEachMonster to the monster manager API
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -63,16 +59,3 @@ roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrass
|
|||||||
|
|
||||||
--call the monstrosity
|
--call the monstrosity
|
||||||
doorUtility.createDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64)
|
doorUtility.createDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64)
|
||||||
|
|
||||||
--testing the monster creation
|
|
||||||
print("testing monsters")
|
|
||||||
local monsterMgr = roomAPI.GetMonsterMgr(overworld)
|
|
||||||
|
|
||||||
local monster, mIndex = monsterManagerAPI.Create(monsterMgr, "skume.bmp", 0)
|
|
||||||
|
|
||||||
print("Monster count: ", monsterManagerAPI.GetLoadedCount(monsterMgr))
|
|
||||||
print("Monster avatar: ", monsterAPI.GetAvatar(monster), mIndex)
|
|
||||||
|
|
||||||
monsterManagerAPI.UnloadAll(monsterMgr)
|
|
||||||
|
|
||||||
print("Finished the lua script")
|
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
/* Copyright: (c) Kayne Ruse 2013-2015
|
|
||||||
*
|
|
||||||
* This software is provided 'as-is', without any express or implied
|
|
||||||
* warranty. In no event will the authors be held liable for any damages
|
|
||||||
* arising from the use of this software.
|
|
||||||
*
|
|
||||||
* Permission is granted to anyone to use this software for any purpose,
|
|
||||||
* including commercial applications, and to alter it and redistribute it
|
|
||||||
* freely, subject to the following restrictions:
|
|
||||||
*
|
|
||||||
* 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
* claim that you wrote the original software. If you use this software
|
|
||||||
* in a product, an acknowledgment in the product documentation would be
|
|
||||||
* appreciated but is not required.
|
|
||||||
*
|
|
||||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
* misrepresented as being the original software.
|
|
||||||
*
|
|
||||||
* 3. This notice may not be removed or altered from any source
|
|
||||||
* distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
--TODO: might need a version number for database structures
|
|
||||||
|
|
||||||
--An example of a database update script.
|
|
||||||
--This is only rough right now, until I get some more eyes onto it
|
|
||||||
|
|
||||||
--moving old to new
|
|
||||||
CREATE TABLE tempCharacters (
|
|
||||||
uid INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
|
|
||||||
--metadata
|
|
||||||
owner INTEGER REFERENCES Accounts(uid),
|
|
||||||
handle varchar(100) UNIQUE,
|
|
||||||
avatar varchar(100),
|
|
||||||
birth timestamp NOT NULL DEFAULT (datetime()),
|
|
||||||
|
|
||||||
--physically exists in the world
|
|
||||||
roomIndex INTEGER DEFAULT 0,
|
|
||||||
originX INTEGER DEFAULT 0,
|
|
||||||
originY INTEGER DEFAULT 0,
|
|
||||||
boundsX INTEGER DEFAULT 0,
|
|
||||||
boundsY INTEGER DEFAULT 0,
|
|
||||||
boundsW INTEGER DEFAULT 0,
|
|
||||||
boundsH INTEGER DEFAULT 0
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO tempCharacters (uid, owner, handle, avatar, birth, roomIndex, originX, originY, boundsX, boundsY, boundsW, boundsH)
|
|
||||||
SELECT uid, owner, handle, avatar, birth, roomIndex, originX, originY, boundsX, boundsY, boundsW, boundsH
|
|
||||||
FROM LiveCharacters;
|
|
||||||
|
|
||||||
DROP TABLE LiveCharacters;
|
|
||||||
|
|
||||||
ALTER TABLE tempCharacters RENAME TO LiveCharacters;
|
|
||||||
+4
-4
@@ -41,8 +41,8 @@
|
|||||||
#include "character_manager_api.hpp"
|
#include "character_manager_api.hpp"
|
||||||
#include "region_api.hpp"
|
#include "region_api.hpp"
|
||||||
#include "region_pager_api.hpp"
|
#include "region_pager_api.hpp"
|
||||||
#include "monster_api.hpp"
|
//#include "monster_api.hpp"
|
||||||
#include "monster_manager_api.hpp"
|
//#include "monster_manager_api.hpp"
|
||||||
#include "network_api.hpp"
|
#include "network_api.hpp"
|
||||||
#include "room_api.hpp"
|
#include "room_api.hpp"
|
||||||
#include "room_manager_api.hpp"
|
#include "room_manager_api.hpp"
|
||||||
@@ -70,8 +70,8 @@ static const luaL_Reg preloadedlibs[] = {
|
|||||||
{TORTUGA_ENTITY_API, openEntityAPI}, //required by derived classes
|
{TORTUGA_ENTITY_API, openEntityAPI}, //required by derived classes
|
||||||
{TORTUGA_CHARACTER_API, openCharacterAPI},
|
{TORTUGA_CHARACTER_API, openCharacterAPI},
|
||||||
{TORTUGA_CHARACTER_MANAGER_API, openCharacterManagerAPI},
|
{TORTUGA_CHARACTER_MANAGER_API, openCharacterManagerAPI},
|
||||||
{TORTUGA_MONSTER_API, openMonsterAPI},
|
// {TORTUGA_MONSTER_API, openMonsterAPI},
|
||||||
{TORTUGA_MONSTER_MANAGER_API, openMonsterManagerAPI},
|
// {TORTUGA_MONSTER_MANAGER_API, openMonsterManagerAPI},
|
||||||
{TORTUGA_NETWORK_API, openNetworkAPI},
|
{TORTUGA_NETWORK_API, openNetworkAPI},
|
||||||
{TORTUGA_REGION_API, openRegionAPI},
|
{TORTUGA_REGION_API, openRegionAPI},
|
||||||
{TORTUGA_REGION_PAGER_API, openRegionPagerAPI},
|
{TORTUGA_REGION_PAGER_API, openRegionPagerAPI},
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
#include directories
|
#include directories
|
||||||
INCLUDES+=SDL . accounts characters clients entities monsters rooms server_utilities triggers ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities
|
INCLUDES+=SDL . accounts characters clients entities rooms server_utilities triggers ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities
|
||||||
|
|
||||||
#libraries
|
#libraries
|
||||||
#the order of the $(LIBS) is important, at least for MinGW
|
#the order of the $(LIBS) is important, at least for MinGW
|
||||||
@@ -33,7 +33,7 @@ all: $(OBJ) $(OUT)
|
|||||||
$(MAKE) -C characters
|
$(MAKE) -C characters
|
||||||
$(MAKE) -C clients
|
$(MAKE) -C clients
|
||||||
$(MAKE) -C entities
|
$(MAKE) -C entities
|
||||||
$(MAKE) -C monsters
|
# $(MAKE) -C monsters
|
||||||
$(MAKE) -C rooms
|
$(MAKE) -C rooms
|
||||||
$(MAKE) -C server_utilities
|
$(MAKE) -C server_utilities
|
||||||
$(MAKE) -C triggers
|
$(MAKE) -C triggers
|
||||||
|
|||||||
@@ -56,11 +56,13 @@ static int getPager(lua_State* L) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static int getMonsterMgr(lua_State* L) {
|
static int getMonsterMgr(lua_State* L) {
|
||||||
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
|
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
|
||||||
lua_pushlightuserdata(L, reinterpret_cast<void*>(room->GetMonsterMgr()) );
|
lua_pushlightuserdata(L, reinterpret_cast<void*>(room->GetMonsterMgr()) );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static int getTriggerMgr(lua_State* L) {
|
static int getTriggerMgr(lua_State* L) {
|
||||||
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
|
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
|
||||||
@@ -85,6 +87,7 @@ static int forEachCharacter(lua_State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static int forEachMonster(lua_State* L) {
|
static int forEachMonster(lua_State* L) {
|
||||||
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
|
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
|
||||||
MonsterManager* monsterMgr = room->GetMonsterMgr();
|
MonsterManager* monsterMgr = room->GetMonsterMgr();
|
||||||
@@ -102,6 +105,7 @@ static int forEachMonster(lua_State* L) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static int setOnTick(lua_State* L) {
|
static int setOnTick(lua_State* L) {
|
||||||
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
|
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
|
||||||
@@ -136,11 +140,11 @@ static const luaL_Reg roomLib[] = {
|
|||||||
{"GetTileset", getTilesetName},
|
{"GetTileset", getTilesetName},
|
||||||
|
|
||||||
{"GetPager",getPager},
|
{"GetPager",getPager},
|
||||||
{"GetMonsterMgr",getMonsterMgr},
|
// {"GetMonsterMgr",getMonsterMgr},
|
||||||
{"GetTriggerMgr",getTriggerMgr},
|
{"GetTriggerMgr",getTriggerMgr},
|
||||||
|
|
||||||
{"ForEachCharacter", forEachCharacter},
|
{"ForEachCharacter", forEachCharacter},
|
||||||
{"ForEachMonster", forEachMonster},
|
// {"ForEachMonster", forEachMonster},
|
||||||
|
|
||||||
{"SetOnTick", setOnTick},
|
{"SetOnTick", setOnTick},
|
||||||
{"GetOnTick", getOnTick},
|
{"GetOnTick", getOnTick},
|
||||||
|
|||||||
@@ -122,10 +122,6 @@ RegionPagerLua* RoomData::GetPager() {
|
|||||||
return &pager;
|
return &pager;
|
||||||
}
|
}
|
||||||
|
|
||||||
MonsterManager* RoomData::GetMonsterMgr() {
|
|
||||||
return &monsterMgr;
|
|
||||||
}
|
|
||||||
|
|
||||||
TriggerManager* RoomData::GetTriggerMgr() {
|
TriggerManager* RoomData::GetTriggerMgr() {
|
||||||
return &triggerMgr;
|
return &triggerMgr;
|
||||||
}
|
}
|
||||||
@@ -137,7 +133,6 @@ std::list<CharacterData*>* RoomData::GetCharacterList() {
|
|||||||
lua_State* RoomData::SetLuaState(lua_State* L) {
|
lua_State* RoomData::SetLuaState(lua_State* L) {
|
||||||
lua = L;
|
lua = L;
|
||||||
pager.SetLuaState(lua);
|
pager.SetLuaState(lua);
|
||||||
monsterMgr.SetLuaState(lua);
|
|
||||||
triggerMgr.SetLuaState(lua);
|
triggerMgr.SetLuaState(lua);
|
||||||
return lua;
|
return lua;
|
||||||
}
|
}
|
||||||
@@ -148,7 +143,6 @@ lua_State* RoomData::GetLuaState() {
|
|||||||
|
|
||||||
sqlite3* RoomData::SetDatabase(sqlite3* db) {
|
sqlite3* RoomData::SetDatabase(sqlite3* db) {
|
||||||
database = db;
|
database = db;
|
||||||
monsterMgr.SetDatabase(database);
|
|
||||||
return database;
|
return database;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,11 @@
|
|||||||
#define ROOMDATA_HPP_
|
#define ROOMDATA_HPP_
|
||||||
|
|
||||||
#include "character_data.hpp"
|
#include "character_data.hpp"
|
||||||
#include "monster_manager.hpp"
|
|
||||||
#include "region_pager_lua.hpp"
|
#include "region_pager_lua.hpp"
|
||||||
#include "trigger_manager.hpp"
|
#include "trigger_manager.hpp"
|
||||||
|
|
||||||
#include "lua.hpp"
|
#include "lua.hpp"
|
||||||
|
#include "sqlite3.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -47,7 +47,6 @@ public:
|
|||||||
std::string GetTileset();
|
std::string GetTileset();
|
||||||
|
|
||||||
RegionPagerLua* GetPager();
|
RegionPagerLua* GetPager();
|
||||||
MonsterManager* GetMonsterMgr();
|
|
||||||
TriggerManager* GetTriggerMgr();
|
TriggerManager* GetTriggerMgr();
|
||||||
std::list<CharacterData*>* GetCharacterList();
|
std::list<CharacterData*>* GetCharacterList();
|
||||||
|
|
||||||
@@ -69,7 +68,6 @@ private:
|
|||||||
|
|
||||||
//members
|
//members
|
||||||
RegionPagerLua pager;
|
RegionPagerLua pager;
|
||||||
MonsterManager monsterMgr;
|
|
||||||
TriggerManager triggerMgr;
|
TriggerManager triggerMgr;
|
||||||
std::list<CharacterData*> characterList;
|
std::list<CharacterData*> characterList;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "account_manager.hpp"
|
#include "account_manager.hpp"
|
||||||
#include "character_manager.hpp"
|
#include "character_manager.hpp"
|
||||||
#include "client_manager.hpp"
|
#include "client_manager.hpp"
|
||||||
#include "monster_manager.hpp"
|
|
||||||
#include "room_manager.hpp"
|
#include "room_manager.hpp"
|
||||||
|
|
||||||
//utilities
|
//utilities
|
||||||
@@ -105,9 +104,6 @@ private:
|
|||||||
void hCharacterAttack(CharacterPacket* const);
|
void hCharacterAttack(CharacterPacket* const);
|
||||||
void hCharacterDamage(CharacterPacket* const);
|
void hCharacterDamage(CharacterPacket* const);
|
||||||
|
|
||||||
//character management
|
|
||||||
void hMonsterDamage(MonsterPacket* const);
|
|
||||||
|
|
||||||
//chat
|
//chat
|
||||||
void hTextBroadcast(TextPacket* const);
|
void hTextBroadcast(TextPacket* const);
|
||||||
void hTextSpeech(TextPacket* const);
|
void hTextSpeech(TextPacket* const);
|
||||||
|
|||||||
@@ -327,11 +327,6 @@ void ServerApplication::HandlePacket(SerialPacket* const argPacket) {
|
|||||||
hCharacterDamage(static_cast<CharacterPacket*>(argPacket));
|
hCharacterDamage(static_cast<CharacterPacket*>(argPacket));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//monster management
|
|
||||||
case SerialPacketType::MONSTER_DAMAGE:
|
|
||||||
hMonsterDamage(static_cast<MonsterPacket*>(argPacket));
|
|
||||||
break;
|
|
||||||
|
|
||||||
//chat
|
//chat
|
||||||
case SerialPacketType::TEXT_BROADCAST:
|
case SerialPacketType::TEXT_BROADCAST:
|
||||||
hTextBroadcast(static_cast<TextPacket*>(argPacket));
|
hTextBroadcast(static_cast<TextPacket*>(argPacket));
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
/* Copyright: (c) Kayne Ruse 2013-2015
|
|
||||||
*
|
|
||||||
* This software is provided 'as-is', without any express or implied
|
|
||||||
* warranty. In no event will the authors be held liable for any damages
|
|
||||||
* arising from the use of this software.
|
|
||||||
*
|
|
||||||
* Permission is granted to anyone to use this software for any purpose,
|
|
||||||
* including commercial applications, and to alter it and redistribute it
|
|
||||||
* freely, subject to the following restrictions:
|
|
||||||
*
|
|
||||||
* 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
* claim that you wrote the original software. If you use this software
|
|
||||||
* in a product, an acknowledgment in the product documentation would be
|
|
||||||
* appreciated but is not required.
|
|
||||||
*
|
|
||||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
* misrepresented as being the original software.
|
|
||||||
*
|
|
||||||
* 3. This notice may not be removed or altered from any source
|
|
||||||
* distribution.
|
|
||||||
*/
|
|
||||||
#include "server_application.hpp"
|
|
||||||
|
|
||||||
void ServerApplication::hMonsterDamage(MonsterPacket* const argPacket) {
|
|
||||||
//TODO: (9) ServerApplication::hMonsterDamage()
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user