瀏覽代碼

Remove setPassive; HC updates;

bjorn 9 年之前
父節點
當前提交
366de4ca7d

+ 0 - 1
data/prop/boundswall.lua

@@ -4,7 +4,6 @@ BoundsWall.code = 'boundswall'
 
 BoundsWall.collision = {}
 BoundsWall.collision.shape = 'rectangle'
-BoundsWall.collision.static = true
 BoundsWall.collision.tag = 'wall'
 
 function BoundsWall:activate()

+ 0 - 1
data/prop/crate.lua

@@ -8,7 +8,6 @@ Crate.z = 32
 
 Crate.collision = {}
 Crate.collision.shape = 'rectangle'
-Crate.collision.static = true
 Crate.collision.tag = 'shortwall'
 
 local function perim(x, y, l, t, w, h)

+ 0 - 1
data/prop/rune.lua

@@ -8,7 +8,6 @@ Rune.effects = {'refillAmmo', 'refillHealth', 'speedBoost'}
 
 Rune.collision = {}
 Rune.collision.shape = 'rectangle'
-Rune.collision.static = true
 Rune.collision.tag = 'rune'
 Rune.collision.with = {
   player = function(self, other, dx, dy)

+ 0 - 1
data/prop/spawnroom.lua

@@ -4,7 +4,6 @@ SpawnRoom.code = 'spawnroom'
 
 SpawnRoom.collision = {}
 SpawnRoom.collision.shape = 'rectangle'
-SpawnRoom.collision.static = true
 SpawnRoom.collision.tag = 'spawnroom'
 
 function SpawnRoom:activate()

+ 0 - 1
data/prop/teamwall.lua

@@ -4,7 +4,6 @@ TeamWall.code = 'teamwall'
 
 TeamWall.collision = {}
 TeamWall.collision.shape = 'rectangle'
-TeamWall.collision.static = true
 TeamWall.collision.tag = 'teamwall'
 
 function TeamWall:activate()

+ 0 - 1
data/prop/tree.lua

@@ -4,7 +4,6 @@ Tree.code = 'tree'
 
 Tree.collision = {}
 Tree.collision.shape = 'circle'
-Tree.collision.static = true
 
 function Tree:activate(map)
   ctx.event:emit('collision.attach', {object = self})

+ 3 - 10
lib/core/collision.lua

@@ -1,5 +1,3 @@
-local hardon = require 'lib/deps/hardon'
-
 Collision = class()
 Collision.cellSize = 128
 Collision.onCollide = function(_, a, b, dx, dy)
@@ -9,8 +7,7 @@ Collision.onCollide = function(_, a, b, dx, dy)
 end
 
 function Collision:init()
-  self.hc = hardon(self.cellSize, self.onCollide)
-
+  self.hc = require 'lib/deps/hc'
   ctx.event:on('collision.attach', f.cur(self.attach, self))
   ctx.event:on('collision.detach', f.cur(self.detach, self))
   ctx.event:on('collision.move', f.cur(self.move, self))
@@ -21,13 +18,9 @@ function Collision:attach(data)
 
   local shape
   if obj.collision.shape == 'rectangle' then
-    shape = self.hc:addRectangle(obj.x, obj.y, obj.width, obj.height)
+    shape = self.hc.rectangle(obj.x, obj.y, obj.width, obj.height)
   elseif obj.collision.shape == 'circle' then
-    shape = self.hc:addCircle(obj.x, obj.y, obj.radius)
-  end
-
-  if obj.collision.static then
-    self.hc:setPassive(shape)
+    shape = self.hc.circle(obj.x, obj.y, obj.radius)
   end
 
   obj.shape = shape

+ 0 - 0
lib/deps/hardon/class.lua → lib/deps/hc/class.lua


+ 0 - 0
lib/deps/hardon/gjk.lua → lib/deps/hc/gjk.lua


+ 0 - 0
lib/deps/hardon/init.lua → lib/deps/hc/init.lua


+ 0 - 0
lib/deps/hardon/polygon.lua → lib/deps/hc/polygon.lua


+ 0 - 0
lib/deps/hardon/shapes.lua → lib/deps/hc/shapes.lua


+ 0 - 0
lib/deps/hardon/spatialhash.lua → lib/deps/hc/spatialhash.lua


+ 0 - 0
lib/deps/hardon/vector-light.lua → lib/deps/hc/vector-light.lua


+ 5 - 0
lib/goregous/goregous.lua

@@ -1,5 +1,7 @@
 Goregous = {}
 
+Goregous.mock = true
+
 local function explode(line)
   local res = {}
   while true do
@@ -48,6 +50,7 @@ function Goregous:patch(version, os)
 end
 
 function Goregous:login(username, password)
+  if self.mock then return true end
   if not self:getConnection() then return false end
 
   self:send({'login', username})
@@ -60,6 +63,7 @@ function Goregous:login(username, password)
 end
 
 function Goregous:createServer()
+  if self.mock then return true end
   if not self:getConnection() then return false end
 
   self:send({'createServer'})
@@ -72,6 +76,7 @@ function Goregous:createServer()
 end
 
 function Goregous:listServers()
+  if self.mock then return {} end
   if not self:getConnection() then return false end
 
   self:send({'listServers'})