Last active
June 15, 2017 13:48
-
-
Save mkarneim/f252db3875b59470abcd42f3b6259ced to your computer and use it in GitHub Desktop.
Some random notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- notes.lua | |
| -- (https://gist.github.com/f252db3875b59470abcd42f3b6259ced) | |
| function how_to_set_a_block() | |
| -- set a block at the spell's location | |
| spell.block = "stone" | |
| end | |
| function how_to_handle_a_left_click_event() | |
| local q=Events.register('LeftClickBlockEvent') | |
| for e in q.next do | |
| say("Left Click!") | |
| end | |
| end | |
| -- AnimationHandEvent, ChatEvent, ClickWindowEvent, LeftClickBlockEvent, PlayerLoggedInEvent, PlayerLoggedOutEvent, PlayerRespawnEvent, RightClickBlockEvent, WhisperEvent | |
| function how_to_check_player_item() | |
| local p = spell.owner | |
| local item = "stick" | |
| if p.mainHand ~= nil and p.mainHand.name == item then | |
| say("Du hast einen Stock!") | |
| end | |
| end | |
| function how_to_draw_a_circle() | |
| local c = 10 | |
| local center = spell.pos | |
| local blk = spell.block | |
| for a= -c,c do | |
| for b= -c,c do | |
| spell.pos = center + Vec3.from(a,0,b) | |
| if a*a + b*b <= c*c then | |
| spell.block = blk | |
| end | |
| end | |
| end | |
| end | |
| function bat_cloud() | |
| local p = spell.owner | |
| while true do | |
| sleep(1) | |
| spell.pos = p.pos | |
| spell:execute("summon Bat") | |
| spell:execute("kill @e[type=Bat,rm=5]") | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment