Skip to content

Commit

Permalink
New mid-threat antag: Pirates (#8340)
Browse files Browse the repository at this point in the history
* Start working on pirates

* Add pirate roleset

* Continue working on pirates

* Add plunder objective

* Continue working on pirate stuff

* Increase plunder timer

* Plunder value scales with number of pirates

* Finish cleaning and tuning

* 10k to 15k

* Properly update explanation

* Don't get whole faction inventory

* Increase shuttle move time

* Add shield diffusers

* Shuttle lock system

* Slightly shift shuttle to avoid seeing the deges

* Update pirate welcome

* Hopefully fix pirate comms

* Remove useless helmet since they're already in void suits

* Oopsies

* Remove pirate shuttle docking controller

* Add hacked cigarette machine and rum keg

* Remove debug message

* Make pirate base item worthless

* Forgot that for shuttle controller
  • Loading branch information
hyperioo authored Oct 20, 2023
1 parent a2a27f7 commit 4b7e693
Show file tree
Hide file tree
Showing 29 changed files with 2,437 additions and 1,120 deletions.
6 changes: 6 additions & 0 deletions cev_eris.dme
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@
#include "code\datums\objective\merc_mission.dm"
#include "code\datums\objective\nuclear.dm"
#include "code\datums\objective\objective.dm"
#include "code\datums\objective\pirate_plunder.dm"
#include "code\datums\objective\plunder.dm"
#include "code\datums\objective\protect.dm"
#include "code\datums\objective\rev.dm"
#include "code\datums\objective\silence.dm"
Expand Down Expand Up @@ -435,6 +437,7 @@
#include "code\datums\outfits\outfit.dm"
#include "code\datums\outfits\antagonist\antagonist.dm"
#include "code\datums\outfits\antagonist\mercenary.dm"
#include "code\datums\outfits\antagonist\pirate.dm"
#include "code\datums\outfits\equipment\backpacks.dm"
#include "code\datums\outfits\jobs\_defines.dm"
#include "code\datums\outfits\jobs\church.dm"
Expand Down Expand Up @@ -552,6 +555,8 @@
#include "code\game\antagonist\outer\blitzshell\blitzshell.dm"
#include "code\game\antagonist\outer\mercenary\merc_faction.dm"
#include "code\game\antagonist\outer\mercenary\mercenary.dm"
#include "code\game\antagonist\outer\pirate\pirate.dm"
#include "code\game\antagonist\outer\pirate\pirate_faction.dm"
#include "code\game\antagonist\station\changeling.dm"
#include "code\game\antagonist\station\contractor.dm"
#include "code\game\antagonist\station\inquisitor.dm"
Expand Down Expand Up @@ -626,6 +631,7 @@
#include "code\game\gamemodes\roleset\simple.dm"
#include "code\game\gamemodes\roleset\faction\excelsior.dm"
#include "code\game\gamemodes\roleset\faction\mercenary.dm"
#include "code\game\gamemodes\roleset\faction\pirate.dm"
#include "code\game\gamemodes\roleset\faction\roleset_faction.dm"
#include "code\game\gamemodes\storytellers\chronicler.dm"
#include "code\game\gamemodes\storytellers\guide.dm"
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/gamemode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#define ROLE_DEATHSQUAD "deathsquad"
#define ROLE_ARTIST "artist"
#define ROLE_MERCENARY "mercenary"
#define ROLE_PIRATE "pirate"
#define ROLE_CARRION "carrion"
#define ROLE_MONKEY "monkey"
#define ROLE_MALFUNCTION "malf"
Expand All @@ -65,6 +66,7 @@
#define FACTION_EXCELSIOR "excelsior"
#define FACTION_BORERS "borers"
#define FACTION_SERBS "serbians"
#define FACTION_PIRATES "pirates"
#define FACTION_NEOTHEOLOGY "neotheologists"

#define ROLES_CONTRACT_COMPLETE list(ROLE_CONTRACTOR,ROLE_CARRION) // Blitz not included
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/items_clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#define DRAG_AND_DROP_UNEQUIP 0x80 // Allow you put intems in hands with drag and drop
#define EQUIP_SOUNDS 0x100// Play sound when equipped/unequipped
#define ABSTRACT 0x200//For items that don't really exist. Can't be put on tables or interacted with.
#define PIRATE_BASE 0x400//For items spawned in pirate base so that they are worthless if placed in the loot chests (otherwise pirates can loot their own gear)

// Flags for pass_flags.
#define PASSTABLE 0x1
Expand Down
4 changes: 3 additions & 1 deletion code/controllers/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ var/const/COMM_FREQ = 1353
var/const/AI_FREQ = 1343
var/const/DTH_FREQ = 1341
var/const/SYND_FREQ = 1213
var/const/YARR_FREQ = 1220

// department channels
var/const/PUB_FREQ = 1459
Expand All @@ -134,6 +135,7 @@ var/list/radiochannels = list(
"Security" = SEC_FREQ,
"Special Ops" = DTH_FREQ,
"Mercenary" = SYND_FREQ,
"Pirate" = YARR_FREQ,
"Supply" = SUP_FREQ,
"NT Voice" = NT_FREQ,
"Service" = SRV_FREQ,
Expand All @@ -146,7 +148,7 @@ var/list/radiochannels = list(
var/list/CENT_FREQS = list(DTH_FREQ)

// Antag channels, i.e. Syndicate
var/list/ANTAG_FREQS = list(SYND_FREQ)
var/list/ANTAG_FREQS = list(SYND_FREQ, YARR_FREQ)

//Department channels, arranged lexically
var/list/DEPT_FREQS = list(AI_FREQ, COMM_FREQ, ENG_FREQ, MED_FREQ, NT_FREQ, SEC_FREQ, SCI_FREQ, SRV_FREQ, SUP_FREQ)
Expand Down
111 changes: 111 additions & 0 deletions code/datums/objective/pirate_plunder.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//Possible mission states
#define PLUNDER_STATUS_SETUP 0 //Mercs are still at their base getting equipped
#define PLUNDER_STATUS_IN_PROGRESS 1 //Mission has started, timer is ticking
#define PLUNDER_STATUS_ABORTED 2 //Time limit expired, mission failed
#define PLUNDER_STATUS_POSTGAME 3 //Mercs returned to their base. They get half an hour to roleplay and debrief#
#define PLUNDER_STATUS_ENDED 4 //All pirates have been despawned

/datum/objective/timed/pirate
explanation_text = "Return to your ship and withdraw to base within X minutes."
var/mission_timer = 45 MINUTES
var/mission_status = PLUNDER_STATUS_SETUP
var/ended = FALSE

/datum/objective/timed/pirate/check_completion()
if (failed)
return FALSE

var/datum/shuttle/autodock/multi/antag/pirate/MS = SSshuttle.get_shuttle("Pirate")

if (!MS)
//Shuttle was destroyed?
return FALSE


if (MS.current_location != MS.home_waypoint && MS.next_location != MS.home_waypoint)
//The shuttle still near Eris, fail
//This will succeed as long as they're enroute away from eris
return FALSE

return TRUE


/datum/objective/timed/pirate/update_explanation()
explanation_text = "Return to your ship and withdraw to base within [round(mission_timer / (1 MINUTE), 1)] minutes."

/datum/objective/timed/pirate/get_panel_entry()
return "Withdraw to base within [round(mission_timer / (1 MINUTE), 1)] minutes. Time remaining: [time2text(mission_timer, "mm:ss")]."

/datum/objective/timed/pirate/get_info()
return "Time remaining at arrival: [time2text(mission_timer, "mm:ss")]."

/datum/objective/timed/pirate/proc/start_mission()
START_PROCESSING(SSobj, src)
mission_status = PLUNDER_STATUS_IN_PROGRESS

//The faction datum processes to tick down the mission timer
/datum/objective/timed/pirate/Process()
mission_timer -= 1 SECONDS
if (!ended && mission_timer <= 0)
end_mission()

/*
The timer keeps ticking even after its ended because later i plan to extend this to let them hang
around the pirate base for up to half an hour and then be despawned so the base can be reset
*/



//The mission ends when the pirates return to base or their time limit expires
/datum/objective/timed/pirate/proc/end_mission()
ended = TRUE
if (!check_completion())
abort_mission()
mission_status = PLUNDER_STATUS_ABORTED
else
for (var/datum/objective/O in owner_faction.objectives)
if (O.check_completion())
O.completed = TRUE
mission_status = PLUNDER_STATUS_POSTGAME

// Not going back to Eris once mission is over
var/datum/shuttle/autodock/multi/antag/pirate/MS = SSshuttle.get_shuttle("Pirate")
if(MS)
MS.lock_shuttle()

//This is one of the few times a world << call is actually intended functionality.
//This is not a debug message, it outputs the result of the mission, it should remain in
to_chat(world, owner_faction.print_success())



//This is called if the pirates' time limit expires while they're not at their base. Mission failure
/datum/objective/timed/pirate/proc/abort_mission()

//First of all, every pirate left on eris is executed by a little bomb in their skull
for (var/datum/antagonist/A in owner_faction.members)
if (!A || !A.owner)
continue

var/mob/living/carbon/human/H = A.owner.current
if (!H)
continue

if (isNotStationLevel(H.z))
continue

var/obj/item/organ/external/affecting = H.get_organ(BP_HEAD)
affecting.take_damage(9999) //Headgib. Very dead



//Secondly, fail all mission objectives
for (var/datum/objective/O in owner_faction.objectives)
O.failed = TRUE

/*
// Thirdly, the pirate ship selfdestructs
var/list/atoms = get_area_contents(/area/shuttle/pirate)
for (var/a in atoms)
qdel(a)
*/
58 changes: 58 additions & 0 deletions code/datums/objective/plunder.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/datum/objective/plunder
target_amount = 15000 // Cumulated value of loot to plunder
unique = TRUE

/datum/objective/plunder/New(datum/antagonist/new_owner, datum/mind/_target)
..()
if(owner_faction)
target_amount *= LAZYLEN(owner_faction.members)
update_explanation()

/datum/objective/plunder/check_completion()
if (failed)
return FALSE
if(owner && (!owner.current || owner.current.stat == DEAD))
return FALSE

return (get_loot_value() < target_amount) ? FALSE : TRUE

/datum/objective/plunder/proc/get_loot_value()
var/list/contents = list()

// Get inventory of the faction
if (owner_faction)
contents.Add(owner_faction.get_inventory())

var/cumulated_amount = 0

// Check cumulated loot value
for(var/atom/movable/A in contents)
if(isitem(A))
var/obj/item/I = A
if(I.item_flags & PIRATE_BASE) // Item spawned in pirate base are worthless for pirates
continue
cumulated_amount += SStrade.get_price(A, TRUE)

return cumulated_amount

/datum/objective/plunder/update_explanation()
explanation_text = "Plunder loot with a cumulated value of [target_amount] credits. Loot must be stored on the raid shuttle in a loot crate to be considered toward your objective."

/datum/objective/plunder/get_panel_entry()
return "Plunder loot with a cumulated value of <a href='?src=\ref[src];set_target=1'>[target_amount]</a> credits. \
Value of loot: <a href='?src=\ref[src];set_target=1'>[get_loot_value()]</a> credits."

/datum/objective/plunder/get_info()
return "Value of loot: [get_loot_value()] credits."

/datum/objective/plunder/Topic(href, href_list)
if(..())
return TRUE
if(href_list["set_target"])
var/new_target = input("Input target number:", "Value of loot to plunder", target_amount) as num|null
if(new_target < 1)
return
else
target_amount = new_target
update_explanation()
antag.antagonist_panel()
29 changes: 29 additions & 0 deletions code/datums/outfits/antagonist/pirate.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/decl/hierarchy/outfit/antagonist/pirate

hierarchy_type = /decl/hierarchy/outfit/antagonist/pirate

uniform = /obj/item/clothing/under/pirate
l_ear = /obj/item/device/radio/headset/pirates
shoes = /obj/item/clothing/shoes/jackboots
head = /obj/item/clothing/head/bandana
pda_slot = slot_belt
pda_type = /obj/item/modular_computer/pda

//The outfit that mercs spawn in. They get their armor and weapons from the merc base
/decl/hierarchy/outfit/antagonist/pirate/casual
name = "Pirate garb"

//He gets a snazzy beret
/decl/hierarchy/outfit/antagonist/pirate/commander
name = "Pirate Quartermaster garb"
glasses = /obj/item/clothing/glasses/eyepatch
head = /obj/item/clothing/head/pirate

//This outfit is just for admin fun. Spawns them fully equipped
//Actual pirates equip themselves by picking up their garb from their base
/decl/hierarchy/outfit/antagonist/pirate/equipped
name = "Pirate plundering gear"

suit = /obj/item/clothing/suit/pirate
back = /obj/item/storage/backpack/satchel
belt = /obj/item/melee/energy/sword/pirate
2 changes: 2 additions & 0 deletions code/game/antagonist/antagonist_equip.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@

if(freq == SYND_FREQ)
R = new/obj/item/device/radio/headset/syndicate(H)
else if(freq == YARR_FREQ)
R = new/obj/item/device/radio/headset/pirates(H)
else
R = new/obj/item/device/radio/headset(H)

Expand Down
1 change: 1 addition & 0 deletions code/game/antagonist/antagonist_factions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@

for(var/datum/objective/O in objectives)
text += "<br><b>Objective [num]:</b> [O.explanation_text] "
text += "[O.get_info()] "
if(O.check_completion())
text += "<font color='green'><B>Success!</B></font>"
else
Expand Down
Loading

0 comments on commit 4b7e693

Please sign in to comment.