sorcery  Diff

Differences From Artifact [e011f87b11]:

  • File portal.lua — part of check-in [96c5289a2a] at 2020-10-21 03:35:35 on branch trunk — add rune forges, runes, amulet frames, write sacrifice spell, touch up amulet graphics, enable enchantment of amulets (though spells cannot yet be cast), defuckulate syncresis core icon, unfuckitize sneaky leycalc bug that's probably been the cause of some long-standing wackiness, add item classes, add some more textures, disbungle various other asstastrophes, remove sneaky old debug code, improve library code, add utility for uploading merge requests (user: lexi, size: 13799) [annotate] [blame] [check-ins using]

To Artifact [daf126a7a3]:


   297    297   				local found = false
   298    298   				for _,u in pairs(dsp.users) do
   299    299   					if u.object:get_player_name() == name then
   300    300   						found = true
   301    301   					end
   302    302   				end
   303    303   				if not found then
          304  +					if user.sound then minetest.sound_fade(user.sound,1,0) end
   304    305   					portal_context.users[name] = nil
   305    306   				end
   306    307   			end
   307    308   		end
   308    309   
   309    310   		-- one user per pad only!
   310    311   		for _,n in pairs(dev.nodes) do
................................................................................
   311    312   			for _,u in pairs(dsp.users) do
   312    313   				if u.slot == n then
   313    314   					local pname = u.object:get_player_name()
   314    315   					if not portal_context.users[pname] then
   315    316   						portal_context.users[pname] = { time = 0, portal = pos } end
   316    317   					local user = portal_context.users[pname]
   317    318   					if not vector.equals(pos,user.portal) then
          319  +						if user.sound then
          320  +							minetest.sound_fade(user.sound,1,0)
          321  +							user.sound = nil
          322  +						end
   318    323   						user.time = 0
   319    324   						user.portal = pos
   320    325   					end
   321    326   					local cap = sorcery.ley.netcaps(pos,delta)
   322    327   					local jc = (constants.portal_jump_cost_local*delta)
   323    328   					if not user.dest and cap.freepower >= jc  then
   324    329   						user.dest = portal_pick_destination(dev,crc,partner)
   325    330   						sorcery.lib.node.preload(user.dest, u.object)
   326    331   					end
   327    332   					if not user.dest then goto skippad end
   328    333   					local fac = math.min(1,(user.time / constants.portal_jump_time))
          334  +					if user.time == 0 then
          335  +						user.sound = minetest.sound_play('sorcery_windup', {pos=pos})
          336  +					end
   329    337   					minetest.add_particlespawner {
   330    338   						time = 1, amount = 100 + (fac * 200);
   331    339   						minsize = 0.2 + fac*0.7, maxsize = 0.4 + fac*0.9;
   332    340   						minvel = {y = 0.2, x=0,z=0}, maxvel = {y = 0.5, x=0,z=0};
   333    341   						minacc = {y = 0.0, x=0,z=0}, maxacc = {y = 0.3, x=0,z=0};
   334    342   						minpos = vector.add(n.pad,{x = -0.5, y = 0.5, z = -0.5});
   335    343   						maxpos = vector.add(n.pad,{x =  0.5, y = 0.5, z =  0.5});
................................................................................
   362    370   								aspect_w = 16, aspect_h = 16;
   363    371   							};
   364    372   						}
   365    373   					end
   366    374   					-- hack to try and swat an unkillable fucking impossibug
   367    375   					if user.time > constants.portal_jump_time * 2 then
   368    376   						user.time = 0
          377  +						if user.sound then
          378  +							minetest.sound_stop(user.sound)
          379  +							user.sound = nil
          380  +						end
   369    381   					elseif user.time >= constants.portal_jump_time then
   370    382   						local dd = portal_disposition(portal_composition(user.dest))
   371    383   						if #dd.freepads > 0 then
   372    384   							local destpad = dd.freepads[math.random(#dd.freepads)].pad
   373    385   							local rng = function(min,max)
   374    386   								return (math.random() * (max - min)) + min
   375    387   							end
................................................................................
   392    404   									glow = 14;
   393    405   									animation = {
   394    406   										type = 'vertical_frames', length = life + 0.1;
   395    407   										aspect_w = 16, aspect_h = 16;
   396    408   									};
   397    409   								}
   398    410   							end
          411  +							if user.sound then
          412  +								minetest.sound_fade(user.sound,1,0)
          413  +								user.sound = nil
          414  +							end
   399    415   							user.dest = nil
   400    416   							user.time = 0
          417  +							user.sound = nil
          418  +							minetest.sound_play('sorcery_zap',{pos=pos},true)
          419  +							minetest.sound_play('sorcery_zap',{pos=destpad},true)
   401    420   							portal_context.users[pname] = nil
   402    421   							u.object:set_pos(vector.add(destpad, {y=0.5,z=0,x=0}))
   403    422   						end
   404    423   					else
   405    424   						user.time = user.time + delta
   406    425   					end
   407    426