forked from daid/EmptyEpsilon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scenario-plots: artifacts and more terrain
- Loading branch information
Pithlit
committed
Jul 16, 2024
1 parent
8dcff2e
commit ec2ec79
Showing
5 changed files
with
266 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
wh_artifacts = {} | ||
|
||
function wh_artifacts:init() | ||
self.callsign_counter = 1000 | ||
|
||
end | ||
|
||
function wh_artifacts:placeArtifact(x,y,name,info) | ||
local freq = math.floor(random(20, 40)) * 20 | ||
self.callsign_counter = self.callsign_counter + math.floor(random(1,200)) | ||
local callsign = self.callsign_counter | ||
debris = Artifact():setPosition(x, y):setDescriptions(_("A piece of space junk. Scan to find out the capturing frequency"), name.._("\nCapturing frequency:").." "..freq.. ".\nCalibrate your shields to this frequency and activate them to capture it.") | ||
debris:setScanningParameters(4, 1) | ||
debris.freq=freq | ||
if freq < 595 then | ||
debris:setModel("debris-cubesat") | ||
else | ||
debris:setModel("debris-blob") | ||
end | ||
debris:allowPickup(true) | ||
debris:setCallSign(callsign):setRadarTraceColor(255,235,170) | ||
if name ~= nil then | ||
debris.resource_name = name | ||
debris.info_collected = "Collected "..name.."." | ||
debris.info_destroyed = name .. " was destroyed.\n\nTo collect artifacts you need to have shields active and calibrated to the capturing frequency of the artifact." | ||
if info ~= nil then | ||
debris.resource_descr = info | ||
debris.info_collected = debris.info_collected .. "\n\n"..info.."\n\nDeliver it to the fleet command station to upload strategic information for the fleet.\nEach recovered artifact can be used to upgrade the fleet command station." | ||
debris.info_destroyed = debris.info_destroyed .. "\n\nYou may still deliver the broken thing to the fleet command station, so they can recover strategic information from it." | ||
end | ||
end | ||
|
||
debris:onPickUp(function(art, player) | ||
shieldfreq = 400+(player:getShieldsFrequency())*20 | ||
local ax, ay = art:getPosition() | ||
local x, y = player:getPosition() | ||
if shieldfreq == art.freq and player:getShieldsActive() == true then | ||
ElectricExplosionEffect():setPosition(x,y):setSize(200) | ||
player:takeDamage(1, "kinetic", ax, ay) | ||
player:addReputationPoints(20) | ||
player:increaseResourceAmount("Artifacts", 1) | ||
player:setResourceDescription("Artifacts", "Deliver Artifacts to the fleet command station.") | ||
if art.resource_name ~= nil and art.resource_descr ~= nil then | ||
player:increaseResourceAmount(art.resource_name, 1) | ||
player:setResourceCategory(art.resource_name, "Strategic Information") | ||
player:setResourceDescription(art.resource_name, art.resource_descr) | ||
end | ||
player:addCustomMessage("science", "artifact_gathered", art.info_collected) | ||
player:addCustomMessage("operations", "artifact_gathered", art.info_collected) | ||
player:addCustomMessage("single", "artifact_gathered", art.info_collected) | ||
player:addToShipLog(art.info_collected.."\n(Reputation +20)", "magenta") | ||
else | ||
ExplosionEffect():setPosition(ax,ay):setSize(200) | ||
player:takeDamage(50, "kinetic", ax, ay) | ||
player:addCustomMessage("science", "artifact_destroyed", art.info_destroyed) | ||
player:addCustomMessage("operations", "artifact_destroyed", art.info_destroyed) | ||
player:addCustomMessage("single", "artifact_destroyed", art.info_destroyed) | ||
player:addToShipLog(art.info_destroyed, "magenta") | ||
end | ||
end) | ||
|
||
end | ||
|
||
function wh_artifacts:update() | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters