Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Terraformer
- terraformer = elements.allocate("JosephMA", "TFRM");
- elements.element(terraformer, elements.element(elements.DEFAULT_PT_PROT));
- elements.property(terraformer, "HighTemperature", 1273.15);
- elements.property(terraformer, "HighTemperatureTransition", elements.DEFAULT_PT_BRMT);
- elements.property(terraformer, "Name", "TFRM");
- elements.property(terraformer, "Description", "Terraforming ship, makes planets more suitable for life.");
- elements.property(terraformer, "MenuSection", elem.SC_SPECIAL);
- local function terraformerUpdate(i, x, y, s, n)
- --tmp is current team
- local life = tpt.get_property("life", i);
- if life == 0 then
- tpt.set_property("life", mothershipLife, i);
- life = mothershipLife;
- end
- local rand = math.random(1, 30);
- if rand <= 15 then
- for r in sim.neighbors(x,y,1,1) do
- local partType = sim.partProperty(r, "type");
- if partType == laser and sim.partProperty(r, "tmp") ~= tpt.get_property("tmp", i) then
- sim.partKill(r);
- tpt.set_property("life", life - 1, i);
- life = life - 1;
- if life - 1 <= -1 then
- sim.partKill(i);
- return 1;
- end
- elseif partType == explosion or partType == elements.DEFAULT_PT_EMBR then
- tpt.set_property("life", life - 1, i);
- if life - 1 <= -1 then
- sim.partKill(i);
- return 1;
- end
- end
- end
- end
- --Movement
- if math.random(1, 100) == 1 then
- if math.random(1, 2) == 1 then
- tpt.set_property("vx", math.random(-1, 1), i);
- else
- tpt.set_property("vy", math.random(-1, 1), i);
- end
- end
- --Shooting
- if math.random(1, 50) == 1 then
- for r in sim.neighbors(x,y,10,10) do
- local partType = sim.partProperty(r, "type");
- local partcType = sim.partProperty(r, "ctype");
- local tmp = tpt.get_property("tmp", i);
- if partType == rock and sim.partProperty(r, "temp") < 400 then
- sim.partChangeType(r, continent);
- sim.partProperty(r, "tmp", tmp);
- sim.partProperty(r, "tmp2", 1);
- end
- if partType == desert and sim.partProperty(r, "temp") < 400 then
- sim.partChangeType(r, ocean);
- end
- if partType == rock or partType == desert or partcType == rock or partcType == desert and sim.partProperty(r, "temp") > 400 and sim.partProperty(r, "temp") < 3273 then
- sim.partProperty(r, "temp", sim.partProperty(r, "temp")-500);
- end
- end
- end
- end
- elements.property(terraformer, "Update", terraformerUpdate);
- local function terraformerGraphics(i, colr, colg, colb)
- local r;
- local g;
- local b;
- local tmp = tpt.get_property("tmp", i);
- if tmp == 0 then
- r = 255;
- g = 0;
- b = 0;
- elseif tmp == 1 then
- r = 0;
- g = 255;
- b = 0;
- elseif tmp == 2 then
- r = 0;
- g = 0;
- b = 255;
- elseif tmp == 3 then
- r = 255;
- g = 204;
- b = 0;
- elseif tmp == 4 then
- r = 255;
- g = 255;
- b = 255;
- elseif tmp == 5 then
- r = 153;
- g = 153;
- b = 153;
- end
- -- local x = tpt.get_property("x",i);
- -- local y = tpt.get_property("y",i);
- -- graphics.fillRect(x - 4, y - 4, 9, 9, r, g, b);
- end
- elements.property(terraformer, "Graphics", terraformerGraphics);
Advertisement
Add Comment
Please, Sign In to add comment