Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function widget:GetInfo()
- return {
- name = "Shortmarkers",
- desc = "Shirtkeys for markers",
- author = "banana_Ai",
- date = "11 March 2014",
- license = "GNU GPL, v2 or later",
- layer = 0,
- enabled = true,
- }
- end
- include("keysym.h.lua")
- local activation_key=KEYSYMS.Z
- local texts={
- [KEYSYMS.N_1]="raiders",
- [KEYSYMS.N_2]="push",
- [KEYSYMS.N_3]="back",
- [KEYSYMS.N_4]="too many aa",
- [KEYSYMS.N_5]="help",
- [KEYSYMS.N_6]="Reinforce the front line",
- [KEYSYMS.N_7]="Into the motherland\nThe Robot's army march",
- [KEYSYMS.N_8]="It's time has come to an end\nThe end of an era is here\nIt's time to attack!",
- [KEYSYMS.N_9]="Banana wrath unleashed!",
- [KEYSYMS.N_0]="Send in all the reserves\nSecuring their defeat",
- }
- local function getText()
- for key,text in pairs(texts) do
- if Spring.GetKeyState(key) then
- return text
- end
- end
- return nil
- end
- function widget:MousePress(x,y,button)
- if Spring.GetKeyState(activation_key) then
- local txt=getText()
- if txt then
- local _,pos=Spring.TraceScreenRay(x,y,true)
- Spring.MarkerAddPoint(pos[1],pos[2],pos[3],txt,false)
- end
- end
- end
- function widget:DrawWorld()
- if Spring.GetKeyState(activation_key) then
- local txt=getText()
- if txt then
- local mx,my=Spring.GetMouseState()
- local _,pos=Spring.TraceScreenRay(mx,my,true)
- gl.PushMatrix()
- gl.Translate(pos[1],pos[2],pos[3])
- gl.Billboard()
- gl.Text(txt,10,20,18,"cvo")
- gl.PopMatrix()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment