Navigation Menu

Skip to content

Commit

Permalink
Comment updates, change default log level to info
Browse files Browse the repository at this point in the history
Also adds Location#direction_to helper
  • Loading branch information
movitto committed Sep 27, 2014
1 parent 3a6f17e commit 08b9756
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions bin/omega-server
Expand Up @@ -94,6 +94,8 @@ def main()
opts.on("-c", "--constraints", "Enable entity constraints") do
enforce_constraints = true
end

# TODO logging filter option
end

# parse cmd line
Expand Down
9 changes: 9 additions & 0 deletions lib/motel/mixins/location/has_coordinates.rb
Expand Up @@ -98,6 +98,15 @@ def distance_from(cx, cy, cz)
Math.sqrt(dx ** 2 + dy ** 2 + dz ** 2)
end

# Return normalized direction vector from this location's coordinates to specified ones
def direction_to(tx, ty, tz)
dx = x - tx
dy = y - ty
dz = z - tz
d = Math.sqrt(dx ** 2 + dy ** 2 + dz ** 2)
[dx / d, dy / d, dz / d]
end

# Add specified quantities to each coordinate component and return new location
#
# @param [Array<Integer,Integer,Integer>,Array<Float,Float,Float>] values values to add to x,y,z coordinates respectively
Expand Down
2 changes: 2 additions & 0 deletions lib/motel/rjr/inspect.rb
Expand Up @@ -15,6 +15,8 @@ module Motel::RJR
get_status = proc {
by_strategy =
Motel::MovementStrategies.constants.collect { |s|
# FIXME this is pulling in all movement strategy mixins,
# need to restrict to just strategies themselves
ms = Motel::MovementStrategies.const_get(s)
num = registry.entities.select { |e|
e.is_a?(Motel::Location) && e.ms.is_a?(ms)
Expand Down
2 changes: 1 addition & 1 deletion omega.yml
Expand Up @@ -2,7 +2,7 @@
omega_url: 'http://localhost/womega/'
backup_dir: './backups/'

log_level: 'debug'
log_level: 'info'

# logging filters - specify regexes to exclude from the omega logs
#log_filters: ['users::login', 'subscribe_to']
Expand Down
2 changes: 2 additions & 0 deletions site/source/javascripts/omega/callbacks/motel.js
Expand Up @@ -17,6 +17,8 @@ Omega.Callbacks.motel = function(evnt, event_args){
if(entity == null) return;
var new_loc = new Omega.Location(event_args[0]);

/// TODO accomodate for lag, need timestamp from server

// update last moved
entity.last_moved = new Date();

Expand Down
2 changes: 2 additions & 0 deletions site/source/javascripts/omega/ship/gfx/init.js
Expand Up @@ -154,6 +154,8 @@ Omega.ShipGfxInitializer = {
var missiles = new Omega.ShipMissiles({type : _this.type,
template: template});

/// TODO update missiles from gfx stub missiles before replacing
/// (also w/ mesh and missle bays)
_this.missiles = missiles;
_this.missiles.omega_entity = _this;

Expand Down
1 change: 1 addition & 0 deletions site/source/javascripts/ui/canvas/mixins/entities.js
Expand Up @@ -58,6 +58,7 @@ Omega.UI.CanvasEntitiesManager = {
for(var ec = 0; ec < entity.components.length; ec++){
var component = entity.components[ec];
scene.remove(component);
/// TODO renderer.deallocate(component);

var index = this.rendered_in.indexOf(component);
if(index != -1) this.rendered_in.splice(index, 1);
Expand Down
4 changes: 2 additions & 2 deletions spec/motel/location_spec.rb
@@ -1,6 +1,6 @@
# location module tests
# Location Module Tests
#
# Copyright (C) 2010-2013 Mohammed Morsi <mo@morsi.org>
# Copyright (C) 2010-2014 Mohammed Morsi <mo@morsi.org>
# Licensed under the AGPLv3 http://www.gnu.org/licenses/agpl.txt

require 'spec_helper'
Expand Down

0 comments on commit 08b9756

Please sign in to comment.