• 96.00% Rate
  • 24 Hits
  • 1 Missed
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 1x
  • 1x
  • 1x
  • 1x
  • 1x
  • 1x
  • 1x
  • 4x
  • 1x
  • 3x
  • 3x
  • 1x
  • 4x
  • 6x
  • 3x
  • 3x
  • 1x
  • 2x
  • 1x
  • 1x
  • 1x
  • 1x
  • 1x
  • 1x
  • -------------------------------------------------------------------------------
  • -- The transparent medium placeholder
  • -- Author: Valentin Niess
  • -- License: GNU LGPL-3.0
  • -------------------------------------------------------------------------------
  • local clib = require('pumas.clib')
  • local error = require('pumas.error')
  • local base = require('pumas.medium.base')
  • local transparent = {}
  • -------------------------------------------------------------------------------
  • -- Metatype for the transparent medium
  • -------------------------------------------------------------------------------
  • local TransparentMedium = {}
  • local strtype = 'TransparentMedium'
  • function TransparentMedium:__index (k)
  • if k == 'density' then
  • return 0
  • elseif (k == 'magnet') or (k == 'material') then
  • return nil
  • else
  • return base.BaseMedium.__index(self, k, strtype)
  • end
  • end
  • function TransparentMedium:__newindex (k, v)
  • if (k == 'density') or (k == 'magnet') or (k == 'material') then
  • error.raise{
  • ['type'] = strtype,
  • not_mutable = k
  • }
  • else
  • base.BaseMedium.__newindex(self, k, v, strtype)
  • end
  • end
  • -------------------------------------------------------------------------------
  • -- Instantiate and register the transparent medium
  • -------------------------------------------------------------------------------
  • do
  • local m = setmetatable({
  • _c = clib.PUMAS_MEDIUM_TRANSPARENT,
  • }, TransparentMedium)
  • error.register('TranparentMedium', TransparentMedium)
  • base.add(m)
  • transparent.transparent_medium = m
  • end
  • -------------------------------------------------------------------------------
  • -- Return the package
  • -------------------------------------------------------------------------------
  • return transparent