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
298
299
300
301
302
303

304
305
306
307
308
309
310
...
311
312
313
314
315
316
317




318
319
320
321
322
323
324
325
326
327
328



329
330
331
332
333
334
335
...
362
363
364
365
366
367
368




369
370
371
372
373
374
375
...
392
393
394
395
396
397
398




399
400



401
402
403
404
405
406
407
				local found = false
				for _,u in pairs(dsp.users) do
					if u.object:get_player_name() == name then
						found = true
					end
				end
				if not found then

					portal_context.users[name] = nil
				end
			end
		end

		-- one user per pad only!
		for _,n in pairs(dev.nodes) do
................................................................................
			for _,u in pairs(dsp.users) do
				if u.slot == n then
					local pname = u.object:get_player_name()
					if not portal_context.users[pname] then
						portal_context.users[pname] = { time = 0, portal = pos } end
					local user = portal_context.users[pname]
					if not vector.equals(pos,user.portal) then




						user.time = 0
						user.portal = pos
					end
					local cap = sorcery.ley.netcaps(pos,delta)
					local jc = (constants.portal_jump_cost_local*delta)
					if not user.dest and cap.freepower >= jc  then
						user.dest = portal_pick_destination(dev,crc,partner)
						sorcery.lib.node.preload(user.dest, u.object)
					end
					if not user.dest then goto skippad end
					local fac = math.min(1,(user.time / constants.portal_jump_time))



					minetest.add_particlespawner {
						time = 1, amount = 100 + (fac * 200);
						minsize = 0.2 + fac*0.7, maxsize = 0.4 + fac*0.9;
						minvel = {y = 0.2, x=0,z=0}, maxvel = {y = 0.5, x=0,z=0};
						minacc = {y = 0.0, x=0,z=0}, maxacc = {y = 0.3, x=0,z=0};
						minpos = vector.add(n.pad,{x = -0.5, y = 0.5, z = -0.5});
						maxpos = vector.add(n.pad,{x =  0.5, y = 0.5, z =  0.5});
................................................................................
								aspect_w = 16, aspect_h = 16;
							};
						}
					end
					-- hack to try and swat an unkillable fucking impossibug
					if user.time > constants.portal_jump_time * 2 then
						user.time = 0




					elseif user.time >= constants.portal_jump_time then
						local dd = portal_disposition(portal_composition(user.dest))
						if #dd.freepads > 0 then
							local destpad = dd.freepads[math.random(#dd.freepads)].pad
							local rng = function(min,max)
								return (math.random() * (max - min)) + min
							end
................................................................................
									glow = 14;
									animation = {
										type = 'vertical_frames', length = life + 0.1;
										aspect_w = 16, aspect_h = 16;
									};
								}
							end




							user.dest = nil
							user.time = 0



							portal_context.users[pname] = nil
							u.object:set_pos(vector.add(destpad, {y=0.5,z=0,x=0}))
						end
					else
						user.time = user.time + delta
					end








>







 







>
>
>
>











>
>
>







 







>
>
>
>







 







>
>
>
>


>
>
>







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
...
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
...
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
...
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
				local found = false
				for _,u in pairs(dsp.users) do
					if u.object:get_player_name() == name then
						found = true
					end
				end
				if not found then
					if user.sound then minetest.sound_fade(user.sound,1,0) end
					portal_context.users[name] = nil
				end
			end
		end

		-- one user per pad only!
		for _,n in pairs(dev.nodes) do
................................................................................
			for _,u in pairs(dsp.users) do
				if u.slot == n then
					local pname = u.object:get_player_name()
					if not portal_context.users[pname] then
						portal_context.users[pname] = { time = 0, portal = pos } end
					local user = portal_context.users[pname]
					if not vector.equals(pos,user.portal) then
						if user.sound then
							minetest.sound_fade(user.sound,1,0)
							user.sound = nil
						end
						user.time = 0
						user.portal = pos
					end
					local cap = sorcery.ley.netcaps(pos,delta)
					local jc = (constants.portal_jump_cost_local*delta)
					if not user.dest and cap.freepower >= jc  then
						user.dest = portal_pick_destination(dev,crc,partner)
						sorcery.lib.node.preload(user.dest, u.object)
					end
					if not user.dest then goto skippad end
					local fac = math.min(1,(user.time / constants.portal_jump_time))
					if user.time == 0 then
						user.sound = minetest.sound_play('sorcery_windup', {pos=pos})
					end
					minetest.add_particlespawner {
						time = 1, amount = 100 + (fac * 200);
						minsize = 0.2 + fac*0.7, maxsize = 0.4 + fac*0.9;
						minvel = {y = 0.2, x=0,z=0}, maxvel = {y = 0.5, x=0,z=0};
						minacc = {y = 0.0, x=0,z=0}, maxacc = {y = 0.3, x=0,z=0};
						minpos = vector.add(n.pad,{x = -0.5, y = 0.5, z = -0.5});
						maxpos = vector.add(n.pad,{x =  0.5, y = 0.5, z =  0.5});
................................................................................
								aspect_w = 16, aspect_h = 16;
							};
						}
					end
					-- hack to try and swat an unkillable fucking impossibug
					if user.time > constants.portal_jump_time * 2 then
						user.time = 0
						if user.sound then
							minetest.sound_stop(user.sound)
							user.sound = nil
						end
					elseif user.time >= constants.portal_jump_time then
						local dd = portal_disposition(portal_composition(user.dest))
						if #dd.freepads > 0 then
							local destpad = dd.freepads[math.random(#dd.freepads)].pad
							local rng = function(min,max)
								return (math.random() * (max - min)) + min
							end
................................................................................
									glow = 14;
									animation = {
										type = 'vertical_frames', length = life + 0.1;
										aspect_w = 16, aspect_h = 16;
									};
								}
							end
							if user.sound then
								minetest.sound_fade(user.sound,1,0)
								user.sound = nil
							end
							user.dest = nil
							user.time = 0
							user.sound = nil
							minetest.sound_play('sorcery_zap',{pos=pos},true)
							minetest.sound_play('sorcery_zap',{pos=destpad},true)
							portal_context.users[pname] = nil
							u.object:set_pos(vector.add(destpad, {y=0.5,z=0,x=0}))
						end
					else
						user.time = user.time + delta
					end