Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion Battle Damage

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Causes damage to your hull when hit while shields are down. The damage should be repaired promptly to avoid problems. Causes damage to your hull when hit while shields are down. The damage should be repaired promptly to avoid problems.
Identifier oolite.oxp.smivs.BattleDamage oolite.oxp.smivs.BattleDamage
Title Battle Damage Battle Damage
Category Ambience Ambience
Author Smivs Smivs
Version 1.5 1.5
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL https://wiki.alioth.net/index.php/BattleDamage n/a
Download URL https://wiki.alioth.net/img_auth.php/2/29/BattleDamage_1.5.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1710030423

Documentation

Also read http://wiki.alioth.net/index.php/Battle%20Damage

readme.txt

Battle Damage OXP v1.4

This OXP adds an immersive factor into the game. 

When your shields are gone, your opponents' lasers are directly hitting your hull, but in the 'core' game this has no obvious impact or repercussions. This OXP adds this 'realism' into the game by causing damage to your ship's hull, which if not repaired promptly will lead to problems such as fuel leaks and mis-jumps.

If you take an un-shielded hit, a console message will alert you to the fact with a warning:- 'WARNING! HULL DAMAGE' and further hits will be notified with another console message:- 'Hull taking further damage'.

Upon docking, someone will point out this damage to you and urge you to have emergency repairs made at the Ship Outfitters (F3). 

Here you will find 'Emergency Hull Repairs' offered for 75Cr. These repairs are fairly basic and consist of new Duralium plates welded over the damaged areas to ensure structural integrity and airtightness where needed. Repairs will take around six to eight hours of game time, after which your ship will be spaceworthy again. 

If you are offered a Maintenance Overhaul, this WILL include any emergency repairs. 'Emergency Hull Repairs' will also be offered, so you can still make repairs even if you wish to defer the Overhaul at this time. Choose one or the other.

Any damaged equipment will need to be repaired separately.

If you do not have repairs made, you may experience mis-jumps or fuel leaks as a consequence of the damage. If you launch damaged the station staff will sometimes overlook this if the damage is not too severe although you may be reminded about the damage when you next dock. Sometimes the station you are leaving will point out the damage but let you go on your way, or you may encounter problems on launching and be urged to re-dock immediately for repairs, and you might even get a telling-off from one of the Dock officials and a small fine.

Author:- Smivs
Licence:- Creative Commons Attribution - Non-Commercial - Share Alike 4.0 license"

Updates:
Version 1.5 (phkb)
- Made the Emergency Hull Repair item orange on the F3 to make it more obvious.
- Added an item that is only visible on the F5 screen that shows when the Hull is damaged.

Version 1.4 (phkb)
- Utilised equipment-overrides.plist to change description of EQ_RENOVATION. Minimum Oolite version is now 1.90.
- Fixed issue with Emergency Hull Repairs remaining on the F3 screen after purchasing.

Equipment

Name Visible Cost [deci-credits] Tech-Level
Hull (Damaged) yes 0 1+
Emergency Hull Repairs no 750 1+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Scripts/battle_damage_conditions.js
"use strict";
this.name = "battle_damage_conditions";
this.author = "phkb";
this.copyright = "© 2023 phkb";
this.description = "Condition script for equipment.";
this.licence = "CC BY-NC-SA 4.0";

//-------------------------------------------------------------------------------------------------------------
this.allowAwardEquipment = function (equipment, ship, context) {
    if (context === "scripted") return true;
    if (equipment == "EQ_HULL_REPAIR") {
        if (!player.ship.hasEquipmentProviding("EQ_HULL_REPAIR") && missionVariables.BattleDamage_status != "OK") return true;
    }
    return false;
}
Scripts/battle_damage_script.js
"use strict";

// Standard attributes
this.name = "Battle Damage";
this.author = "Smivs";
this.copyright = "Smivs";
this.license = "Creative Commons Attribution - Non-Commercial - Share Alike 4.0 license";
this.description = "Script to control hull damage and repair";
this.version = "1.4";

this.startUp = function () {
    if (missionVariables.BattleDamage_status !== "DAMAGED") {
        player.ship.awardEquipment("EQ_HULL_REPAIR"); //Ensures that repair does not appear on F3 screen
        missionVariables.BattleDamage_status = "OK";
    }
}

this.playerBoughtNewShip = function () {
    player.ship.awardEquipment("EQ_HULL_REPAIR"); //Ensures that repair does not appear on F3 screen
    missionVariables.BattleDamage_status = "OK";
}

this.shipWillDockWithStation = function (station) {
    if (missionVariables.BattleDamage_status == "DAMAGED") {
        player.addMessageToArrivalReport(expandDescription("[HULL_DAMAGE_MESSAGE]"));
    }
    else if (missionVariables.BattleDamage_status == "DAMAGED1") {
        missionVariables.BattleDamage_status = "DAMAGED"; // set to damaged
        player.addMessageToArrivalReport(expandDescription("[HULL_DAMAGE_MESSAGE_TWO]"));
        player.credits -= 25;
    }
}

this.guiScreenChanged = function(to, from) {
    if (to == "GUI_SCREEN_STATUS" && missionVariables.BattleDamage_status != "OK") {
        player.ship.awardEquipment("EQ_HULL_DISPLAY");
    }
    if (from == "GUI_SCREEN_STATUS") {
        player.ship.removeEquipment("EQ_HULL_DISPLAY");
    }
}

this.shipWillLaunchFromStation = function (station) {
    if (missionVariables.BattleDamage_status == "OK") //Ensures that there are no issues when player launches after un-repaired launch/re-dock/repair/re-launch
    {
        player.ship.fuelLeakRate = 0;
        player.ship.scriptedMisjump = false;
    }
}

this.shipLaunchedFromStation = function (station) { // to handle ship launching with damage un-repaired
    if (missionVariables.BattleDamage_status == "DAMAGED" && (Math.random() <= 0.50)) {
        this.station = station;
        this.station.commsMessage("Commander, your ship appears to be badly damaged. Take care!"), player.ship;
        missionVariables.BattleDamage_status = "DAMAGED"; // set to damaged
    }
    else if (missionVariables.BattleDamage_status == "DAMAGED" && (Math.random() > 0.50)) {
        player.ship.fuelLeakRate = 0.5;
        player.consoleMessage("WARNING! FUEL LEAK.", 5);
        this.station = station;
        this.station.commsMessage("Commander, your ship is venting fuel due to a hull breach. You must dock for repairs immediately."), player.ship;
        player.ship.scriptedMisjump = true;
        missionVariables.BattleDamage_status = "DAMAGED1"; // set to damaged1
    }
}

this.shipTakingDamage = function (amount) {
    if (amount === 0) return;
    else if (missionVariables.BattleDamage_status == "DAMAGED") {
        player.consoleMessage("Hull taking further damage.", 1);
    }
    else {
        player.ship.removeEquipment("EQ_HULL_REPAIR"); //remove 'repair' to allow 'repair' to be applied again. This should happen before any risk of damage to 'repair'
        missionVariables.BattleDamage_status = "DAMAGED"; // set to damaged
        player.consoleMessage("WARNING! HULL DAMAGE", 6);
    }
}

this.playerBoughtEquipment = function (equipment) {
    if (equipment == "EQ_HULL_REPAIR") {
        clock.addSeconds("35000");
        missionVariables.BattleDamage_status = "OK"; // set to OK
    }
    if (equipment == "EQ_RENOVATION") {
        player.ship.awardEquipment("EQ_HULL_REPAIR");
        missionVariables.BattleDamage_status = "OK"; // set to OK
    }
}

this.shipLaunchedEscapePod = function (escapepod) {// resets everything after ejecting so new ship is undamaged
    missionVariables.BattleDamage_status = "OK"; //set to OK
    player.ship.awardEquipment("EQ_HULL_REPAIR"); //Ensures that repair does not appear on F3 screen
}