Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --edit to debug_cmd_list.script
- function cmd.heli(me,txt,owner,p)
- local wrd = check_and_set_help(me,txt,owner,"[spawn|move|mount|dismount|clean_big|clean_small]")
- if not (wrd) then return end
- if (wrd == "spawn") then
- local se_heli = stpk_utils.spawn_heli()
- if (se_heli) then
- heli_id = se_heli.id
- return "heli:= Spawned at actor position"
- end
- return "heli:= Spawning failed"
- end
- if (wrd == "move") then
- local str
- if (string.find(txt,"pos:")) then
- for s in string.gmatch(txt,"pos:(.%S+)") do
- str = s
- end
- end
- if (str and str ~= "") then
- str = str_explode(str,",")
- str.x = tonumber(str[1])
- str.y = tonumber(str[2])
- str.z = tonumber(str[3])
- end
- local obj = level.object_by_id(heli_id)
- local heli = obj and obj:get_helicopter()
- if (heli) then
- local pos = str or db.actor:position()
- heli:SetDestPosition(vector():set(pos.x,pos.y,pos.z))
- return "heli:= destination set to actor position"
- end
- return "heli:= move failed"
- end
- if (wrd == "mount") then
- local heli
- for id,o in pairs(db.heli) do
- heli = o
- break
- end
- if (heli) then
- db.actor:attach_vehicle(heli)
- return "heli:= mounted"
- end
- return "heli:= not found"
- elseif (wrd == "dismount") then
- db.actor:detach_vehicle()
- return "heli:= dismounted"
- end
- if (wrd == "clean_big") or wrd == "clean_small" then
- local sim = alife()
- for id=1,65534 do
- if (story_objects.story_id_by_object_id[id] == nil) then
- local squad = sim:object(id)
- local sec = squad and squad:section_name()
- if sec and ((wrd == "clean_big" and sec == "simulation_helicopter_strong") or (wrd == "clean_small" and sec == "simulation_helicopter_weak")) then
- if (sim:level_name(game_graph():vertex(squad.m_game_vertex_id):level_id()) == level.name()) then
- sim:release(squad, true)
- --squad:remove_squad()
- end
- end
- end
- end
- return (wrd == "clean_big" and "heli:= removed all strong heli") or (wrd == "clean_small" and "heli:= removed all weak heli")
- end
- return "heli:= type heli help for list of sub commands"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement