sorcery  Diff

Differences From Artifact [92125c4f2c]:

To Artifact [4f39d5643f]:


    28     28   --    disjunction is cast on one of them, they will be removed from the
    29     29   --    table. each entry should have at least a 'player' field; they can
    30     30   --    also contain any other data useful to the spell. if a subject has
    31     31   --    a 'disjoin' field it must be a function called when they are removed
    32     32   --    from the list of spell targets.
    33     33   --  * caster is the individual who cast the spell, if any. a disjunction
    34     34   --    against their person will totally disrupt the spell.
    35         -local log = function(...) sorcery.log('spell',...) end
           35  +local log = sorcery.logger 'spell'
    36     36   
    37     37   -- FIXME saving object refs is iffy, find a better alternative
    38     38   sorcery.spell = {
    39     39   	active = {}
    40     40   }
    41     41   
    42     42   local get_spell_positions = function(spell)
................................................................................
   224    224   		local t if type(when) == 'number' then
   225    225   			t = s.duration * when
   226    226   		else
   227    227   			t = (s.duration * (when.whence or 0)) + when.secs
   228    228   		end
   229    229   		if t then return math.min(s.duration,math.max(0,t)) end
   230    230   
   231         -		log('invalid timespec ' .. dump(when))
          231  +		log.err('invalid timespec ' .. dump(when))
   232    232   		return 0
   233    233   	end
   234    234   	s.queue = function(when,fn)
   235    235   		local elapsed = s.starttime and minetest.get_server_uptime() - s.starttime or 0
   236    236   		local timepast = interpret_timespec(when)
   237    237   		if not timepast then timepast = 0 end
   238    238   		local timeleft = s.duration - timepast
   239    239   		local howlong = (s.delay + timepast) - elapsed
   240    240   		if howlong < 0 then
   241         -			log('cannot time-travel! queue() called with `when` specifying timepoint that has already passed')
          241  +			log.err('cannot time-travel! queue() called with `when` specifying timepoint that has already passed')
   242    242   			howlong = 0
   243    243   		end
   244    244   		s.jobs[#s.jobs+1] = minetest.after(howlong, function()
   245    245   			-- this is somewhat awkward. since we're using a non-polling approach, we
   246    246   			-- need to find a way to account for a caster or subject walking into an
   247    247   			-- existing antimagic field, or someone with an existing antimagic aura
   248    248   			-- walking into range of the anchor. so every time a spell effect would
................................................................................
   334    334   					termqueued = true
   335    335   					s.queue(1,function(s,...)
   336    336   						what(s,...)
   337    337   						if s.terminate then s:terminate() end
   338    338   						sorcery.spell.active[myid] = nil
   339    339   					end)
   340    340   				else
   341         -					log('multiple final timeline events not possible, ignoring')
          341  +					log.warn('multiple final timeline events not possible, ignoring')
   342    342   				end
   343    343   			elseif when == 0 and s.disjunction then
   344    344   				startqueued = true
   345    345   				s.queue(when_raw,function(...)
   346    346   					perform_disjunction_calls()
   347    347   					what(...)
   348    348   				end)