Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function widget:GetInfo()
- return {
- name = "Shortmarkers",
- desc = "Shortkeys 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]="enemies incoming!",
- [KEYSYMS.N_2]="push now!",
- [KEYSYMS.N_3]="back! retreat fast!",
- [KEYSYMS.N_4]="too much Anti-Air!",
- [KEYSYMS.N_5]="help here fast!",
- [KEYSYMS.N_6]="Reinforce the front line. NOW.",
- [KEYSYMS.N_7]="Connect Eco/Grid!",
- [KEYSYMS.N_8]="Wait for me. lets attack together.",
- [KEYSYMS.N_9]="Valuable target to attack/bomb.",
- [KEYSYMS.N_0]="This is doomed to fail. Please stop.",
- }
- 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
Advertisement