Skip to content

Commit

Permalink
* Attempt to clean up the whitespace mess in Lua a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
BTAxis committed May 4, 2016
1 parent 30b22ea commit f44eac6
Show file tree
Hide file tree
Showing 39 changed files with 2,629 additions and 2,632 deletions.
14 changes: 7 additions & 7 deletions dat/ai/include/attack_bomber.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ end
-- until out and then will melee.
--]]
function atk_b ()
target = ai.target()
target = ai.target()
ai.hostile(target) -- Mark as hostile

-- make sure pilot exists
if not target:exists() then
ai.poptask()
return
end
-- make sure pilot exists
if not target:exists() then
ai.poptask()
return
end
ai.settarget(target)

-- Get stats about enemy
dist = ai.dist( target ) -- get distance
dist = ai.dist( target ) -- get distance

-- Get bombing tool
secondary, special = ai.secondary("ranged")
Expand Down
36 changes: 18 additions & 18 deletions dat/ai/soromid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function create ()
mem.bribe_no = "\"I shall especially enjoy your death.\""
else
bribe_no = {
"\"Snivelling waste of carbon.\"",
"\"Money won't save you from being purged from the gene pool.\"",
"\"Culling you will be doing humanity a service.\"",
"\"We do not consort with vermin.\"",
"\"Who do you take us for, the Empire?\""
}
mem.bribe_no = bribe_no[ rnd.rnd(1,#bribe_no) ]
"\"Snivelling waste of carbon.\"",
"\"Money won't save you from being purged from the gene pool.\"",
"\"Culling you will be doing humanity a service.\"",
"\"We do not consort with vermin.\"",
"\"Who do you take us for, the Empire?\""
}
mem.bribe_no = bribe_no[ rnd.rnd(1,#bribe_no) ]
end

mem.loiter = 3 -- This is the amount of waypoints the pilot will pass through before leaving the system
Expand All @@ -61,20 +61,20 @@ function taunt ( target, offense )
-- some taunts
if offense then
taunts = {
"There is no room in this universe for scum like you!",
"Culling you will be doing humanity a service.",
"Enjoy your last moments, worm!",
"Time for a little natural selection!",
"Might makes right!",
"Embrace your weakness!"
"There is no room in this universe for scum like you!",
"Culling you will be doing humanity a service.",
"Enjoy your last moments, worm!",
"Time for a little natural selection!",
"Might makes right!",
"Embrace your weakness!"
}
else
taunts = {
"Cunning, but foolish.",
"Ambush! Defend yourselves!",
"You should have picked easier prey!",
"You'll regret that!",
"That was a fatal mistake!"
"Cunning, but foolish.",
"Ambush! Defend yourselves!",
"You should have picked easier prey!",
"You'll regret that!",
"That was a fatal mistake!"
}
end

Expand Down
4 changes: 2 additions & 2 deletions dat/ai/tpl/scout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ function control ()
-- nothing to do so check if we are too far form the planet (if there is one)
if mem.approach == nil then
local planet = ai.rndplanet()
if planet ~= nil then
if planet ~= nil then
mem.approach = planet:pos()
end
end
end
planet = mem.approach

Expand Down
116 changes: 58 additions & 58 deletions dat/ai/zalek.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,73 +10,73 @@ mem.armour_run = 75 -- Za'lek armour is pretty crap. They know this, and will di
mem.aggressive = true

function create()
-- Not too many credits.
ai.setcredits( rnd.rnd(ai.pilot():ship():price()/200, ai.pilot():ship():price()/50) )
-- Not too many credits.
ai.setcredits( rnd.rnd(ai.pilot():ship():price()/200, ai.pilot():ship():price()/50) )

-- Get refuel chance
p = player.pilot()
if p:exists() then
standing = ai.getstanding( p ) or -1
mem.refuel = rnd.rnd( 1000, 2000 )
if standing < -10 then
mem.refuel_no = "\"I do not have fuel to spare.\""
else
mem.refuel = mem.refuel * 0.6
end
-- Most likely no chance to refuel
mem.refuel_msg = string.format( "\"I will agree to refuel your ship for %d credits.\"", mem.refuel )
end
-- Get refuel chance
p = player.pilot()
if p:exists() then
standing = ai.getstanding( p ) or -1
mem.refuel = rnd.rnd( 1000, 2000 )
if standing < -10 then
mem.refuel_no = "\"I do not have fuel to spare.\""
else
mem.refuel = mem.refuel * 0.6
end
-- Most likely no chance to refuel
mem.refuel_msg = string.format( "\"I will agree to refuel your ship for %d credits.\"", mem.refuel )
end

-- See if can be bribed
if rnd.rnd() > 0.7 then
mem.bribe = math.sqrt( ai.pilot():stats().mass ) * (500. * rnd.rnd() + 1750.)
mem.bribe_prompt = string.format("\"We will agree to end the battle for %d credits.\"", mem.bribe )
mem.bribe_paid = "\"Temporarily stopping fire.\""
else
-- FIXME: Could be made more Za'lek-like.
-- Will this work? ~Areze
bribe_no = {
"\"Keep your cash, you troglodyte.\"",
"\"Don't make me laugh. Eat laser beam!\"",
"\"My drones aren't interested in your ill-gotten gains and neither am I!\"",
"\"Ahaha! Nice one! Oh, you're actually serious? Ahahahaha!\"",
"\"While I admire the spirit of it, testing my patience will is suicide, NOT science.\""
}
mem.bribe_no = bribe_no[ rnd.rnd(1,#bribe_no) ]
end
-- See if can be bribed
if rnd.rnd() > 0.7 then
mem.bribe = math.sqrt( ai.pilot():stats().mass ) * (500. * rnd.rnd() + 1750.)
mem.bribe_prompt = string.format("\"We will agree to end the battle for %d credits.\"", mem.bribe )
mem.bribe_paid = "\"Temporarily stopping fire.\""
else
-- FIXME: Could be made more Za'lek-like.
-- Will this work? ~Areze
bribe_no = {
"\"Keep your cash, you troglodyte.\"",
"\"Don't make me laugh. Eat laser beam!\"",
"\"My drones aren't interested in your ill-gotten gains and neither am I!\"",
"\"Ahaha! Nice one! Oh, you're actually serious? Ahahahaha!\"",
"\"While I admire the spirit of it, testing my patience will is suicide, NOT science.\""
}
mem.bribe_no = bribe_no[ rnd.rnd(1,#bribe_no) ]
end

mem.loiter = 2 -- This is the amount of waypoints the pilot will pass through before leaving the system
mem.loiter = 2 -- This is the amount of waypoints the pilot will pass through before leaving the system

-- Finish up creation
create_post()
-- Finish up creation
create_post()
end

function taunt ( target, offense )
-- Only 50% of actually taunting.
if rnd.rnd(0,1) == 0 then
return
end
-- Only 50% of actually taunting.
if rnd.rnd(0,1) == 0 then
return
end

-- XXX: Put something stupid instead of the Sirian taunts
if offense then
taunts = {
"Move drones in to engage. Cook this clown!",
"Say hello to my little friends!",
"Ooh, more victi- ah, volunteers for our experiments!",
"We need a test subject to test our attack on; you'll do nicely!",
"Ready for a physics lesson, punk?",
"After we wax you, we can return to our experiments!"
}
else
taunts = {
"We're being attacked! Prepare defence protocols!",
"You just made a big mistake!",
"Our technology will fix your attitude!",
"You wanna do this? Have it your way."
}
end
-- XXX: Put something stupid instead of the Sirian taunts
if offense then
taunts = {
"Move drones in to engage. Cook this clown!",
"Say hello to my little friends!",
"Ooh, more victi- ah, volunteers for our experiments!",
"We need a test subject to test our attack on; you'll do nicely!",
"Ready for a physics lesson, punk?",
"After we wax you, we can return to our experiments!"
}
else
taunts = {
"We're being attacked! Prepare defence protocols!",
"You just made a big mistake!",
"Our technology will fix your attitude!",
"You wanna do this? Have it your way."
}
end

ai.pilot():comm(target, taunts[ rnd.rnd(1,#taunts) ])
ai.pilot():comm(target, taunts[ rnd.rnd(1,#taunts) ])
end


2 changes: 1 addition & 1 deletion dat/events/neutral/npc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ else --default english
msg_mhint = {{"Shadowrun", "Apparently there's a woman who regularly turns up on planets in and around the Klantar system. I wonder what she's looking for?"},
{"Collective Espionage 1", "The Empire is trying to really do something about the Collective, I hear. Who knows, maybe you can even help them out if you make it to Omega Station."},
{"Hitman", "There are often shady characters hanging out in the Alteris system. I'd stay away from there if I were you, someone might offer you a dirty kind of job!"},
{"Za'lek Shipping Delivery", "So there's some Za'lek scientist looking for a cargo monkey out on Niflheim in the Dohriabi system. I hear it's pretty good money."},
{"Za'lek Shipping Delivery", "So there's some Za'lek scientist looking for a cargo monkey out on Niflheim in the Dohriabi system. I hear it's pretty good money."},
{"Sightseeing", "Rich folk will pay extra to go on an offworld sightseeing tour in a luxury yacht. Look like you can put a price on luxury!"},
}

Expand Down
122 changes: 61 additions & 61 deletions dat/events/pirate_fame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@
--[[
-- Pirate Fame/Faction Standing script
When the player enters a system, his fame has a chance of being lowered.
When the player enters a system, his fame has a chance of being lowered.
If he is using a pirate ship, the chances of his fame being lowered are
reduced. If the player is using an impressive non-pirate ship, like the
cruiser or carrier of a major faction, will lower a bit less often, but
will lower more often than if he was using a purely pirate ship.
If he is using a pirate ship, the chances of his fame being lowered are
reduced. If the player is using an impressive non-pirate ship, like the
cruiser or carrier of a major faction, will lower a bit less often, but
will lower more often than if he was using a purely pirate ship.
This event will not reduce the player’s fame below a given level.
This event will not reduce the player’s fame below a given level.
--]]

local function has(i,t)
for n = 1,#t do
if t[n] == i then
return true
end
end
return false
for n = 1,#t do
if t[n] == i then
return true
end
end
return false
end

--[[
-- Returns a boolean indicating whether or not the player is using a pirate
-- ship.
--]]
local function using_pirate_ship()
local s = player.pilot():ship():name()

return has(s, {
"Pirate Kestrel",
"Pirate Admonisher",
"Pirate Phalanx",
"Pirate Ancestor",
"Pirate Vendetta",
"Pirate Shark",
"Pirate Rhino"
})
local s = player.pilot():ship():name()

return has(s, {
"Pirate Kestrel",
"Pirate Admonisher",
"Pirate Phalanx",
"Pirate Ancestor",
"Pirate Vendetta",
"Pirate Shark",
"Pirate Rhino"
})
end

--[[
Expand All @@ -46,46 +46,46 @@ end
-- cruiser or carrier.
--]]
local function using_impressive_ship()
local s = player.pilot():ship():name()

return has(s, {
"Empire Peacemaker",
"Empire Hawking",
"Sirius Divinity",
"Sirius Dogma",
"Soromid Arx",
"Soromid Ira",
"Dvaered Goddard",
-- Still impressive, but purely “civilian”
"Goddard",
"Hawking",
"Kestrel"
})
local s = player.pilot():ship():name()

return has(s, {
"Empire Peacemaker",
"Empire Hawking",
"Sirius Divinity",
"Sirius Dogma",
"Soromid Arx",
"Soromid Ira",
"Dvaered Goddard",
-- Still impressive, but purely “civilian”
"Goddard",
"Hawking",
"Kestrel"
})
end

function create()
local fame = faction.playerStanding("Pirate")

-- If the player already has a low reputation, just stop there. 20 is the
-- minimum required to land on a pirate planet without having to bribe the
-- guy in charge of landing ships.
if fame <= 20 then
evt.finish()
end

local maybe
if using_pirate_ship() then
maybe = 0.05
elseif using_impressive_ship() then
maybe = 0.10
else
maybe = 0.15
end

if rnd.rnd() < maybe then
faction.modPlayerSingle("Pirate",-1)
end

evt.finish()
local fame = faction.playerStanding("Pirate")

-- If the player already has a low reputation, just stop there. 20 is the
-- minimum required to land on a pirate planet without having to bribe the
-- guy in charge of landing ships.
if fame <= 20 then
evt.finish()
end

local maybe
if using_pirate_ship() then
maybe = 0.05
elseif using_impressive_ship() then
maybe = 0.10
else
maybe = 0.15
end

if rnd.rnd() < maybe then
faction.modPlayerSingle("Pirate",-1)
end

evt.finish()
end

2 changes: 1 addition & 1 deletion dat/factions/equip/collective.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include("dat/factions/equip/generic.lua")
-- New script to equip the Collective drone swarm. Code probably crap.
--
-- TODO: Give Heavy Drones a proper, unique, and varied weapon loadout. Creativity is weak right now. Bleh.
-- ~Areze
-- ~Areze
--]]
function equip( p )
-- Get ship info
Expand Down
Loading

0 comments on commit f44eac6

Please sign in to comment.