|
@@ -65,6 +65,10 @@ Block* BasicBlockType::createBlock(
|
|
|
|
|
|
Item* BasicBlockType::createItem() const
|
|
Item* BasicBlockType::createItem() const
|
|
{
|
|
{
|
|
|
|
+ if (getItemTypeName().istGleich(""))
|
|
|
|
+ {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
return Game::INSTANCE->zItemType(itemTypeId)->createItem();
|
|
return Game::INSTANCE->zItemType(itemTypeId)->createItem();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -75,6 +79,10 @@ Framework::Text BasicBlockType::getItemTypeName() const
|
|
|
|
|
|
ItemType* BasicBlockType::createItemType() const
|
|
ItemType* BasicBlockType::createItemType() const
|
|
{
|
|
{
|
|
|
|
+ if (getItemTypeName().istGleich(""))
|
|
|
|
+ {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
return new BasicBlockItemType(getItemTypeName(),
|
|
return new BasicBlockItemType(getItemTypeName(),
|
|
new ModelInfo(zModel()->getModelPath(),
|
|
new ModelInfo(zModel()->getModelPath(),
|
|
zModel()->getTexturePaths(),
|
|
zModel()->getTexturePaths(),
|
|
@@ -154,7 +162,15 @@ BasicBlockType* BasicBlockTypeFactory::fromJson(
|
|
Framework::JSON::JSONObject* zJson) const
|
|
Framework::JSON::JSONObject* zJson) const
|
|
{
|
|
{
|
|
BasicBlockType* result = BlockTypeFactoryBase::fromJson(zJson);
|
|
BasicBlockType* result = BlockTypeFactoryBase::fromJson(zJson);
|
|
- result->setItemTypeName(zJson->zValue("itemType")->asString()->getString());
|
|
|
|
|
|
+ if (zJson->zValue("itemType")->getType() == Framework::AbstractType::STRING)
|
|
|
|
+ {
|
|
|
|
+ result->setItemTypeName(
|
|
|
|
+ zJson->zValue("itemType")->asString()->getString());
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ result->setItemTypeName("");
|
|
|
|
+ }
|
|
result->setTransparent(zJson->zValue("transparent")->asBool()->getBool());
|
|
result->setTransparent(zJson->zValue("transparent")->asBool()->getBool());
|
|
result->setPassable(zJson->zValue("passable")->asBool()->getBool());
|
|
result->setPassable(zJson->zValue("passable")->asBool()->getBool());
|
|
result->setSpeedModifier(
|
|
result->setSpeedModifier(
|
|
@@ -169,8 +185,15 @@ Framework::JSON::JSONObject* BasicBlockTypeFactory::toJsonObject(
|
|
{
|
|
{
|
|
Framework::JSON::JSONObject* result
|
|
Framework::JSON::JSONObject* result
|
|
= BlockTypeFactoryBase::toJsonObject(zObject);
|
|
= BlockTypeFactoryBase::toJsonObject(zObject);
|
|
- result->addValue("itemType",
|
|
|
|
- new Framework::JSON::JSONString(zObject->getItemTypeName()));
|
|
|
|
|
|
+ if (zObject->getItemTypeName().istGleich(""))
|
|
|
|
+ {
|
|
|
|
+ result->addValue("itemType", new Framework::JSON::JSONValue());
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ result->addValue("itemType",
|
|
|
|
+ new Framework::JSON::JSONString(zObject->getItemTypeName()));
|
|
|
|
+ }
|
|
result->addValue(
|
|
result->addValue(
|
|
"transparent", new Framework::JSON::JSONBool(zObject->isTransparent()));
|
|
"transparent", new Framework::JSON::JSONBool(zObject->isTransparent()));
|
|
result->addValue(
|
|
result->addValue(
|
|
@@ -189,7 +212,9 @@ JSONObjectValidationBuilder* BasicBlockTypeFactory::addToValidator(
|
|
builder
|
|
builder
|
|
->withRequiredAttribute("itemType",
|
|
->withRequiredAttribute("itemType",
|
|
Game::INSTANCE->zTypeRegistry()->getValidator<Framework::Text>(
|
|
Game::INSTANCE->zTypeRegistry()->getValidator<Framework::Text>(
|
|
- ItemTypeNameFactory::TYPE_ID))
|
|
|
|
|
|
+ ItemTypeNameFactory::TYPE_ID),
|
|
|
|
+ true,
|
|
|
|
+ false)
|
|
->withRequiredBool("transparent")
|
|
->withRequiredBool("transparent")
|
|
->withDefault(false)
|
|
->withDefault(false)
|
|
->finishBool()
|
|
->finishBool()
|