Rename CharacterViewpoint to Viewpoint
As I was writing the documentation, this just feels like added complexity that we don't need.
This commit is contained in:
+4
-4
@@ -8,7 +8,7 @@ use Monolog\Logger;
|
||||
|
||||
use LotGD\Core\Models\ {
|
||||
Character,
|
||||
CharacterViewpoint,
|
||||
Viewpoint,
|
||||
Scene
|
||||
};
|
||||
use LotGD\Core\Exceptions\ {
|
||||
@@ -181,9 +181,9 @@ class Game
|
||||
|
||||
/**
|
||||
* Return the viewpoint for the current user.
|
||||
* @return CharacterViewpoint
|
||||
* @return Viewpoint
|
||||
*/
|
||||
public function getViewpoint(): CharacterViewpoint
|
||||
public function getViewpoint(): Viewpoint
|
||||
{
|
||||
$v = $this->getCharacter()->getViewpoint();
|
||||
|
||||
@@ -201,7 +201,7 @@ class Game
|
||||
throw new InvalidConfigurationException("No subscriber to h/lotgd/core/default-scene returned a scene.");
|
||||
}
|
||||
|
||||
$v = new CharacterViewpoint();
|
||||
$v = new Viewpoint();
|
||||
$v->setOwner($this->getCharacter());
|
||||
$this->getCharacter()->setViewpoint($v);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class Character implements CharacterInterface, CreateableInterface
|
||||
private $level = 1;
|
||||
/** @OneToMany(targetEntity="CharacterProperty", mappedBy="owner", cascade={"persist", "remove"}) */
|
||||
private $properties;
|
||||
/** @OneToOne(targetEntity="CharacterViewpoint", mappedBy="owner", cascade={"persist", "remove"}) */
|
||||
/** @OneToOne(targetEntity="Viewpoint", mappedBy="owner", cascade={"persist", "remove"}) */
|
||||
private $viewpoint;
|
||||
/**
|
||||
* @ManyToMany(targetEntity="MessageThread", inversedBy="participants", cascade={"persist"})
|
||||
@@ -248,7 +248,7 @@ class Character implements CharacterInterface, CreateableInterface
|
||||
|
||||
/**
|
||||
* Returns the current character viewpoint or null if one is not set.
|
||||
* @return \LotGD\Core\Models\CharacterViewpoint|null
|
||||
* @return \LotGD\Core\Models\Viewpoint|null
|
||||
*/
|
||||
public function getViewpoint()
|
||||
{
|
||||
@@ -258,7 +258,7 @@ class Character implements CharacterInterface, CreateableInterface
|
||||
/**
|
||||
* Sets the current character viewpoint.
|
||||
*/
|
||||
public function setViewpoint(CharacterViewpoint $v)
|
||||
public function setViewpoint(Viewpoint $v)
|
||||
{
|
||||
$this->viewpoint = $v;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ use LotGD\Core\Tools\Model\SceneBasics;
|
||||
/**
|
||||
* A scene is a location within the game, such as the Village or the Tavern. Designed
|
||||
* to be a kind of "template" for generating the specific location information for
|
||||
* a specific user, which then becomes a CharacterViewpoint.
|
||||
* a specific user, which then becomes a Viewpoint.
|
||||
* @Entity
|
||||
* @Table(name="scenes")
|
||||
*/
|
||||
|
||||
@@ -11,12 +11,12 @@ use LotGD\Core\Tools\Model\Creator;
|
||||
use LotGD\Core\Tools\Model\SceneBasics;
|
||||
|
||||
/**
|
||||
* A CharacterViewpoint is the current Scene a character is experiencing with
|
||||
* A Viewpoint is the current Scene a character is experiencing with
|
||||
* all changes from modules included.
|
||||
* @Entity
|
||||
* @Table(name="character_viewpoints")
|
||||
* @Table(name="viewpoints")
|
||||
*/
|
||||
class CharacterViewpoint implements CreateableInterface
|
||||
class Viewpoint implements CreateableInterface
|
||||
{
|
||||
use Creator;
|
||||
use SceneBasics;
|
||||
@@ -56,7 +56,7 @@ class CharacterViewpoint implements CreateableInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the static data from a scene to this CharacterViewpoint entity
|
||||
* Copies the static data from a scene to this Viewpoint entity
|
||||
* @param \LotGD\Core\Models\Scene $scene
|
||||
*/
|
||||
public function changeFromScene(Scene $scene)
|
||||
@@ -9,7 +9,7 @@ use LotGD\Core\{
|
||||
Game
|
||||
};
|
||||
use LotGD\Core\Exceptions\IsNullException;
|
||||
use LotGD\Core\Models\CharacterViewpoint;
|
||||
use LotGD\Core\Models\Viewpoint;
|
||||
|
||||
/**
|
||||
* Provides basic implementation to mock CharacterInterface.
|
||||
@@ -81,7 +81,7 @@ trait MockCharacter
|
||||
throw new IsNullException();
|
||||
}
|
||||
|
||||
public function getViewpoint(): CharacterViewpoint
|
||||
public function getViewpoint(): Viewpoint
|
||||
{
|
||||
throw new IsNullException();
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ use LotGD\Core\Game;
|
||||
use LotGD\Core\TimeKeeper;
|
||||
use LotGD\Core\ModuleManager;
|
||||
use LotGD\Core\Models\Character;
|
||||
use LotGD\Core\Models\CharacterViewpoint;
|
||||
use LotGD\Core\Models\Viewpoint;
|
||||
use LotGD\Core\Models\Scene;
|
||||
use LotGD\Core\Exceptions\ {
|
||||
ActionNotFoundException,
|
||||
|
||||
@@ -7,7 +7,7 @@ use LotGD\Core\Action;
|
||||
use LotGD\Core\ActionGroup;
|
||||
use LotGD\Core\Attachment;
|
||||
use LotGD\Core\Models\Character;
|
||||
use LotGD\Core\Models\CharacterViewpoint;
|
||||
use LotGD\Core\Models\Viewpoint;
|
||||
use LotGD\Core\Models\Scene;
|
||||
use LotGD\Core\Tests\CoreModelTestCase;
|
||||
|
||||
@@ -28,12 +28,12 @@ class SampleAttachment extends Attachment
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the management of CharacterViewpoints
|
||||
* Tests the management of Viewpoints
|
||||
*/
|
||||
class CharacterViewpointTest extends CoreModelTestCase
|
||||
class ViewpointTest extends CoreModelTestCase
|
||||
{
|
||||
/** @var string default data set */
|
||||
protected $dataset = "characterViewpoints";
|
||||
protected $dataset = "viewpoints";
|
||||
|
||||
public function testGetters()
|
||||
{
|
||||
@@ -44,7 +44,7 @@ class CharacterViewpointTest extends CoreModelTestCase
|
||||
$this->assertSame(2, $testCharacter->getId());
|
||||
$characterScene = $testCharacter->getViewpoint();
|
||||
|
||||
$this->assertInstanceOf(CharacterViewpoint::class, $characterScene);
|
||||
$this->assertInstanceOf(Viewpoint::class, $characterScene);
|
||||
$this->assertSame("The Village", $characterScene->getTitle());
|
||||
$this->assertSame("This is the village.", $characterScene->getDescription());
|
||||
|
||||
@@ -95,13 +95,13 @@ class CharacterViewpointTest extends CoreModelTestCase
|
||||
$ag2
|
||||
];
|
||||
|
||||
$input = $em->getRepository(CharacterViewpoint::class)->find(2);
|
||||
$input = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$input->setActionGroups($actionGroups);
|
||||
$input->save($em);
|
||||
|
||||
$em->clear();
|
||||
|
||||
$output = $em->getRepository(CharacterViewpoint::class)->find(2);
|
||||
$output = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$this->assertEquals($actionGroups, $output->getActionGroups());
|
||||
|
||||
$this->assertEquals($ag2, $input->findActionGroupById('id2'));
|
||||
@@ -124,13 +124,13 @@ class CharacterViewpointTest extends CoreModelTestCase
|
||||
|
||||
$attachments = [$a1, $a2];
|
||||
|
||||
$input = $em->getRepository(CharacterViewpoint::class)->find(2);
|
||||
$input = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$input->setAttachments($attachments);
|
||||
$input->save($em);
|
||||
|
||||
$em->clear();
|
||||
|
||||
$output = $em->getRepository(CharacterViewpoint::class)->find(2);
|
||||
$output = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$this->assertEquals($attachments, $output->getAttachments());
|
||||
$this->assertEquals('baz', $output->getAttachments()[0]->getFoo());
|
||||
$this->assertEquals('fiz', $output->getAttachments()[1]->getFoo());
|
||||
@@ -11,7 +11,7 @@ characters:
|
||||
id: 3
|
||||
name: "Char without a Scene"
|
||||
displayName: "C"
|
||||
character_viewpoints:
|
||||
viewpoints:
|
||||
-
|
||||
owner_id: 2
|
||||
title: "The Village"
|
||||
|
||||
@@ -7,7 +7,7 @@ characters:
|
||||
id: 2
|
||||
name: "Char with a Scene"
|
||||
displayName: "B"
|
||||
character_viewpoints:
|
||||
viewpoints:
|
||||
-
|
||||
owner_id: 2
|
||||
title: "The Village"
|
||||
Reference in New Issue
Block a user