[Add] Lua logic for traders.
This commit is contained in:
parent
6c4983120d
commit
01243e12e3
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Fleets>
|
||||
<fleet name="Goddard Goddard">
|
||||
<ai>militia</ai>
|
||||
<ai>goddard</ai>
|
||||
<faction>Goddard</faction>
|
||||
<pilots>
|
||||
<pilot chance="100">Goddard</pilot>
|
||||
|
30
scripts/ai/trader.lua
Normal file
30
scripts/ai/trader.lua
Normal file
@ -0,0 +1,30 @@
|
||||
include("../scripts/ai/merchant.lua")
|
||||
|
||||
function sos()
|
||||
msg = {
|
||||
"Mayday! We are under attack!",
|
||||
"Requesting assistance. We are under attack!",
|
||||
"Merchant vessle here under attack! HELP!"
|
||||
}
|
||||
ai.broadcast(msg[rnd.int(1, #msg)])
|
||||
end
|
||||
|
||||
function create()
|
||||
ai.setcredits(rnd.int(100, ai.shipprice()/50))
|
||||
|
||||
-- Some stuff has more than others.
|
||||
num = rnd.int(12)
|
||||
if num < 5 then
|
||||
cargo = "Food"
|
||||
elseif num < 8 then
|
||||
cargo = "Ore"
|
||||
elseif num < 10 then
|
||||
cargo = "Industrial Goods"
|
||||
elseif num < 12 then
|
||||
cargo = "Luxury Goods"
|
||||
else
|
||||
cargo = "Medicine"
|
||||
end
|
||||
ai.setcargo(cargo, rnd.int(0, ai.cargofree()))
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ void expl_explode(double x, double y, double vx, double vy,
|
||||
/* Standard stuff. */
|
||||
exp_s = spfx_get("ExpS");
|
||||
exp_m = spfx_get("ExpM");
|
||||
exp_s = spfx_get("ExpL");
|
||||
exp_l = spfx_get("ExpL");
|
||||
layer = SPFX_LAYER_FRONT;
|
||||
|
||||
/* Number of explosions. */
|
||||
|
Loading…
Reference in New Issue
Block a user