Skip to content

Instantly share code, notes, and snippets.

@Pontiky
Last active December 24, 2020 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pontiky/a399ab09b12d4416eaaee0138618d866 to your computer and use it in GitHub Desktop.
Save Pontiky/a399ab09b12d4416eaaee0138618d866 to your computer and use it in GitHub Desktop.
Cadeau Riolue pour l'event Secret Santa 2020
for k,v in pairs({"disableAfkDeath","disableAutoTimeLeft","disableAutoShaman","disableAutoNewGame","disableMortCommand","disableDebugCommand"}) do
tfm.exec[v]()
end
tfm.exec.newGame("@7817986")
tfm.exec.snow(10000)
ui.setMapName("<b><font color='#FFBC08'>Joyeux Noël Riolue !</font></b>")
spawn = {{x=100, y=350}, {x=200, y=350}, {x=300, y=350}, {x=400, y=350}, {x=500, y=350}, {x=600, y=350}, {x=700, y=350}}
particles={1,9,0,4,2,11,13}
fire = {}
timer = 5
count = 1
function tirerFeuxDartifices(special)
fire = {}
for i=1,7 do
if not special then
if math.random(2)==1 then
local xf = spawn[i].x
local yf = math.random(50, 150)
tfm.exec.displayParticle(2, spawn[i].x, spawn[i].y, (xf-spawn[i].x)*5/145, (yf-spawn[i].y)*5/145, 0, 0, nil)
table.insert(fire, {x=xf, y=yf})
end
else
local xf = 500+190/2
local yf = 35+180/2
tfm.exec.displayParticle(2, spawn[i].x, spawn[i].y, (xf-spawn[i].x)*5/145, (yf-spawn[i].y)*5/145, 0, 0, nil)
end
end
end
function formerFeuDartifice(forme, center, p1, p2)
if forme == 1 then -- cercle
local rayon = 10
for i=1,20 do
local frag = 2*math.pi/20*i
for j=1,3 do
tfm.exec.displayParticle(p1, center.x+(rayon+20*(j-1))*math.cos(frag), center.y+(rayon+20*(j-1))*math.sin(frag), 30*math.cos(frag)*5/145, 30*math.sin(frag)*5/145, 0, 0, nil)
end
end
elseif forme == 2 then -- snowflake
local rayon = 50
tfm.exec.displayParticle(p1, center.x, center.y)
for i=1,6 do
local n1 = 2*math.pi/6*i+2*math.pi/12
for k=1,6 do
tfm.exec.displayParticle(p1, center.x+12*k*math.cos(n1), center.y+12*k*math.sin(n1))
end
for j=1,2 do
local center2 = {x=center.x+25*math.cos(n1), y=center.y+25*math.sin(n1)}
local center3 = {x=center.x+50*math.cos(n1), y=center.y+50*math.sin(n1)}
local n2 = n1 + 2*math.pi/6
local n3 = n1 - 2*math.pi/6
for l=1,2 do
tfm.exec.displayParticle(p1, center2.x+l*12*math.cos(n2), center2.y+l*12*math.sin(n2))
tfm.exec.displayParticle(p1, center2.x+l*12*math.cos(n3), center2.y+l*12*math.sin(n3))
tfm.exec.displayParticle(p1, center3.x+l*12*math.cos(n2), center3.y+l*12*math.sin(n2))
tfm.exec.displayParticle(p1, center3.x+l*12*math.cos(n3), center3.y+l*12*math.sin(n3))
end
end
end
elseif forme == 3 then -- spirale
local rayon = 10
for k=1,4 do
local gap = 2*math.pi/4*k
for i=1,20 do
local frag = 2*math.pi/20*i + gap
for j=1,3 do
tfm.exec.displayParticle((k%2==0 and p1 or p2), center.x+(rayon+2*(i-1))*math.cos(frag), center.y+(rayon+2*(i-1))*math.sin(frag), 30*math.cos(frag)*5/145, 30*math.sin(frag)*5/145, 0, 0, nil)
end
end
end
elseif forme == 4 then -- branches
for i=1,8 do
local frag = 2*math.pi/8*i+2*math.pi/16
for j=1,8 do
tfm.exec.displayParticle(p1, center.x+(-5+(j-1)*8)*math.cos(frag), center.y+(-5+(j-1)*8)*math.sin(frag), 30*math.cos(frag)*5/145, 30*math.sin(frag)*5/145, 0, 0, nil)
end
end
end
end
function eventLoop(ct, rt)
timer = timer - 0.5
if timer == 1 then
tirerFeuxDartifices(count==0)
elseif timer == 0 then
if count ~= 0 then
for _,center in pairs(fire) do
formerFeuDartifice(math.random(1,4), center, particles[math.random(#particles)], particles[math.random(#particles)])
end
timer = 2.5
else
rio1 = tfm.exec.addImage("176907ab3ae.png", "!3", 500, 35)
end
count = (count + 1)%5
elseif timer == -0.5 then
rio2 = tfm.exec.addImage("176909dba49.png", "!3", 500, 35)
tfm.exec.removeImage(rio1)
elseif timer == -1 then
rio3 = tfm.exec.addImage("176909dd9ae.png", "!3", 500, 35)
tfm.exec.removeImage(rio2)
elseif timer == -1.5 then
tfm.exec.removeImage(rio3)
timer = 1.5
end
if timer%1==0 then
msg1 = tfm.exec.addImage("176908cd527.png", "!1", 200, 40)
msg2 = tfm.exec.addImage("176908d03e6.png", "!2", 410, 40)
else
tfm.exec.removeImage(msg1)
tfm.exec.removeImage(msg2)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment