Skip to content

Allow a Drone to be created from the location and direction of another Drone#323

Merged
walterhiggins merged 1 commit intowalterhiggins:developmentfrom
softwaremaverick:development
Sep 16, 2017
Merged

Allow a Drone to be created from the location and direction of another Drone#323
walterhiggins merged 1 commit intowalterhiggins:developmentfrom
softwaremaverick:development

Conversation

@softwaremaverick
Copy link
Copy Markdown
Contributor

In my pursuit for creating more comprehensive worlds I need to be able to spin Drones off from the current position of another Drone without affecting the first one in any way.

@TonyGravagno
Copy link
Copy Markdown
Collaborator

I don't know how much time @walterhiggins has for evaluation of PRs but please don't lose faith. There's a lot going on and we simply have too much to do and not enough time. But your contribution won't be ignored or lost. Thanks.

@TonyGravagno
Copy link
Copy Markdown
Collaborator

It took a while to get through this to ensure that the new drone is still correctly created. The Drone constructor function isn't very elegant in how it checks args, or for self, and now for Drone. At some point it would be nice to clean it up a little, perhaps to get a new Drone from other object types.

There's some elegance to being able to clone a drone so I don't see anything wrong with this enhancement. However, the first parameter of the constructor can already be a Location object. The drone doesn't have a "location", it has properties that would otherwise be included in a location object. For this mod we're adding support for a concrete type Drone, where it would probably be better to give the Drone type a Location. Then we could use:

var clone = new Drone(original.location);

... and other code that wants the Drone's location could also be more standardized. It would allow for code like:

var angleRadians = drone.location.getVector().angle(townCenter.location.getVector());

With the current change, I'm also updating the inline doc to show that a Drone can be passed as a constructor parameter, but that wouldn't be necessary if Drone had a Location.

The support for a Drone object in the constructor, and related documentation, has been incorporated into working code set 3.2.2 Bad Zombie.

But I'll leave this PR open for comments from @walterhiggins and anyone else who may wish to contribute.

@softwaremaverick
Copy link
Copy Markdown
Contributor Author

softwaremaverick commented Aug 20, 2017 via email

@softwaremaverick
Copy link
Copy Markdown
Contributor Author

Actually looking at the code again I cannot see the location.dir / location.direction thing I mentioned earlier but it could still make sense to be able to create a new Drone using a utility method which takes as a parameter any of the location related objects.

@walterhiggins walterhiggins merged commit 8cc703d into walterhiggins:development Sep 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants