Skip to content

Commit

Permalink
Merge branch 'mission_script' of github.com:voxelinc/voxellancer into…
Browse files Browse the repository at this point in the history
… final_presentation

Conflicts:
	data/config.ini
  • Loading branch information
xchrdw committed Mar 23, 2014
2 parents 08e8b2f + 4fbecdd commit 34a537f
Show file tree
Hide file tree
Showing 111 changed files with 2,139 additions and 454 deletions.
3 changes: 3 additions & 0 deletions data/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ infinityAimInterpolation = 0.3

cameraOffset = 0.0, 0.6, 1.5

# cheat for presentations or something
playerShipUndestroyable = false

[window]
width = 1280
height = 800
Expand Down
16 changes: 16 additions & 0 deletions data/equipment/engines/candle.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[general]
directionalAcceleration=10.0,10.0,10.0,10.0
angularAcceleration=600.0,600.0,600.0
type=engine

[trail]
lifetime = 10
color=0xFFFF00
emissiveness=1.0

[visuals]
color=0xFFFF00
emissiveness=0.7

[sound]
name=null
2 changes: 1 addition & 1 deletion data/equipment/engines/mginemk1.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[general]
directionalAcceleration=12000.0,12000.0,40000.0,10000.0
angularAcceleration=1200.0,1200.0,1200.0
angularAcceleration=1000.0,1000.0,1000.0
type=engine

[trail]
Expand Down
2 changes: 1 addition & 1 deletion data/equipment/engines/rocketthrustermk1.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[general]
directionalAcceleration=300.0,300.0,1500.0,300.0
directionalAcceleration=300.0,300.0,3000.0,300.0
angularAcceleration=80,80,80
type=engine

Expand Down
66 changes: 66 additions & 0 deletions data/scripts/missions/getkilledbyall.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
function main()
showMessage("Welcome to another mission script")

ships = {}
count = 4
radius = 40

playerPos = position(playerShip())

for i = 1, count do
local type
if i > 3 then
type = "eagle"
else
type = "mox"
end

local ship = createShip(type)
local angle = (i/count) * (2 * math.pi)

local position = vec3(playerPos.x - 10 + math.cos(angle) * radius, playerPos.y -10 + math.sin(angle) * radius, playerPos.z - 60)

setPosition(ship, position)

task = createFightTask(ship)
addFightTaskTarget(task, playerShip())

spawn(ship)
ships[i] = ship

onWorldObjectDestroyed(ship, "destroyed")
end

missionMessage("...and go!")
playVoice("data/sound/mission/woken_the_dragon.ogg")

createSingleShotTimer("timeWarning", 10)
end

function missionTitle()
return "They will kill you"
end

function missionCaption()
return "Now you have woken the dragon"
end

function missionBriefing()
return "Kill the ships, and yep, that's difficult"
end

function destroyed(ship)
count = count - 1
if count == 0 then
missionSucceed()
end
end

function timeout()
missionFail()
end

function timeWarning()
missionMessage("You're not supposed to merely survive. Kill or be killed!")
playVoice("data/sound/mission/not_supposed_to_survive.ogg")
end
98 changes: 98 additions & 0 deletions data/scripts/missions/killemall.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
function main()
showMessage("Welcome to a mission script")

ships = {}
count = 6
radius = 40

playerPos = position(playerShip())

for i = 1, count do
local ship = createShip("basicship")
print("Created ship with key", ship)
local angle = (i/count) * (2 * math.pi)

local position = vec3(playerPos.x - 10 + math.cos(angle) * radius, playerPos.y -10 + math.sin(angle) * radius, playerPos.z - 60)

setPosition(ship, position)

flyAnywhere(ship)

spawn(ship)
ships[i] = ship

onWorldObjectDestroyed(ship, "destroyed")
end

missionMessage("...and go!")

playVoice("data/sound/mission/kill_the_ships.ogg")

createSingleShotTimer("timeWarning1", 15)
createSingleShotTimer("timeWarning2", 20)
createSingleShotTimer("timeout", 40)
end

function missionTitle()
return "Kill'em all"
end

function missionCaption()
return "Killing is not nice but it works"
end

function missionBriefing()
return "Kill the ships, that's really not that difficult"
end

function flyAnywhere(ship)
local task = createFlyToTask(ship)
local position = position(ship)

onAiTaskFinished(task, "nextTask")

setTargetPoint(task, vec3(position.x + math.random(-100, 100), position.y + math.random(-100, 100), position.z + math.random(-100, 100)))
end

function nextTask(task)
ship = taskExecutor(task)
flyAnywhere(ship)
end

function destroyed(ship)
count = count - 1
if count == 0 then
missionSucceed()
end
end

function timeout()
missionFail()
end

function timeWarning1()
missionMessage("Time is ticking, dude.")
playVoice("data/sound/mission/time_is_ticking.ogg")
end

function timeWarning2()
missionMessage("Get your stuff done")
playVoice("data/sound/mission/get_your_stuff_done.ogg")
end

function onFailure()
missionFailureMessage("That really took too long. You failed!")
playVoice("data/sound/mission/that_took_too_long.ogg")

for k, v in pairs(ships) do
if valid(v) then
remove(v)
end
end
end

function onSuccess()
missionSuccessMessage("Yeah, you're so awsome, dude!")
playVoice("data/sound/mission/youre_awesome.ogg")
end

60 changes: 60 additions & 0 deletions data/scripts/scenarios/demo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
function main()
reset(0)
end

function startMission(player)
local mission = missionStart("killemall")
remove(missionStartBanner)
onMissionFailure(mission, "reset")
onMissionSuccess(mission, "firstChallengeTaken")
end

function startFightingMission(player)
local mission = missionStart("getkilledbyall")
remove(dareyouBanner)
onMissionFailure(mission, "reset")
onMissionSuccess(mission, "firework")
end

function reset(dummy)
missionStartBanner = createWorldObject("missionstart")
setShowOnHud(missionStartBanner, true)
setCanLockOn(missionStartBanner, false)

setPosition(missionStartBanner, vec3(-40, 50, -100))
spawn(missionStartBanner)

onAABBEntered(playerShip(), vec3(-60, 30, -120), vec3(-20, 70, -80), "startMission")
end

function firstChallengeTaken(dummy)
createSingleShotTimer("startSecondChallenge", 3)
end

function startSecondChallenge()
print("lol, mission over")

dareyouBanner = createWorldObject("idareyou")
setShowOnHud(dareyouBanner, true)
setCanLockOn(dareyouBanner, false)

setPosition(dareyouBanner, vec3(-100, 50, -360))
spawn(dareyouBanner)

onAABBEntered(playerShip(), vec3(-120, 30, -380), vec3(-80, 70, -340), "startFightingMission")
end

function secondChallengeTaken(dummy)
createSingleShotTimer("firework", 3)
end

function firework()
showMessage("Unbelievable, you survived! I got something for you!")
playVoice("data/sound/mission/got_something.ogg")

cake = createWorldObject("cake")
setPosition(cake, vec3(0,0,-1000))
setShowOnHud(cake, true)
setCanLockOn(cake, false)
spawn(cake)
end
Binary file added data/sound/mission/got_something.ogg
Binary file not shown.
Binary file removed data/sound/mission/hell_is_empty.ogg
Binary file not shown.
Binary file modified data/sound/mission/kill_the_ships.ogg
Binary file not shown.
Binary file added data/sound/mission/not_supposed_to_survive.ogg
Binary file not shown.
Binary file added data/sound/mission/that_took_too_long.ogg
Binary file not shown.
Binary file added data/sound/mission/woken_the_dragon.ogg
Binary file not shown.
Loading

0 comments on commit 34a537f

Please sign in to comment.