Skip to content

Commit

Permalink
Basic Pirate NPCs (tgstation#79284)
Browse files Browse the repository at this point in the history
## About The Pull Request

Converts hostile pirate NPCs to basic mobs - specifically, a subtype of
trooper. As their behavior is not meaningfully distinct from other
troopers, this conversion mostly just sticks them on the existing AI
behavior while keeping the rest the same.

Pirates do have one new thing going for them, though, to differentiate
them from other troopers. They use the new **plundering attacks**
component, which means that every time they land a melee attack, they
steal money from the bank account of whoever they hit. This requires the
target to be wearing an ID with a linked bank account, so it's not the
hardest thing in the world to hide your money from them - but it's still
something to be wary of! If killed, any mob with this component will
drop everything they've stolen in a convenient holochip.
## Why It's Good For The Game

Takes down 5 more simplemobs, and (I think) converts the last remaining
trooper-type enemy to be a basic trooper. (It's possible there's more
I've forgotten that could use the same AI, though.)

The money-stealing behavior is mostly good because I think it's funny,
but it also makes the pirates something a little distinct from "yet
another mob that runs at you and punches you until you die". They still
do that, but now there's a little twist! This can be placed on other
mobs too, if we want to make any other sorts of thieves or brigands.
## Changelog
:cl:
refactor: Pirate NPCs now use the basic mob framework. They'll be a
little smarter in combat, and if you're wearing your ID they'll siphon
your bank account with every melee attack! Beware! Please report any
bugs.
/:cl:
  • Loading branch information
lizardqueenlexi authored Oct 30, 2023
1 parent 465fe99 commit 9e18c65
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 115 deletions.
8 changes: 4 additions & 4 deletions _maps/RandomRuins/SpaceRuins/caravanambush.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/area/template_noop)
"ah" = (
/obj/structure/lattice/catwalk,
/mob/living/simple_animal/hostile/pirate/ranged/space{
/mob/living/basic/trooper/pirate/ranged/space{
environment_smash = 0
},
/turf/template_noop,
Expand Down Expand Up @@ -587,7 +587,7 @@
dir = 4
},
/obj/effect/decal/cleanable/dirt,
/mob/living/simple_animal/hostile/pirate/ranged/space{
/mob/living/basic/trooper/pirate/ranged/space{
environment_smash = 0
},
/turf/open/floor/iron/airless,
Expand Down Expand Up @@ -736,7 +736,7 @@
/area/ruin/space/has_grav)
"Fr" = (
/obj/effect/decal/cleanable/dirt,
/mob/living/simple_animal/hostile/pirate/ranged/space{
/mob/living/basic/trooper/pirate/ranged/space{
environment_smash = 0
},
/turf/open/floor/plating/airless,
Expand Down Expand Up @@ -941,7 +941,7 @@
"Nm" = (
/obj/machinery/atmospherics/components/unary/vent_pump/on,
/obj/effect/decal/cleanable/dirt,
/mob/living/simple_animal/hostile/pirate/ranged/space{
/mob/living/basic/trooper/pirate/ranged/space{
environment_smash = 0
},
/turf/open/floor/iron/airless,
Expand Down
4 changes: 2 additions & 2 deletions _maps/RandomRuins/SpaceRuins/derelict_construction.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/area/ruin/space/has_grav/derelictconstruction)
"fa" = (
/obj/structure/lattice,
/mob/living/simple_animal/hostile/pirate/ranged/space,
/mob/living/basic/trooper/pirate/ranged/space,
/turf/template_noop,
/area/space/nearstation)
"gi" = (
Expand Down Expand Up @@ -416,7 +416,7 @@
/turf/open/floor/plating,
/area/ruin/space/has_grav/derelictconstruction)
"Za" = (
/mob/living/simple_animal/hostile/pirate/melee/space,
/mob/living/basic/trooper/pirate/melee/space,
/obj/structure/lattice/catwalk,
/turf/template_noop,
/area/ruin/space/has_grav/derelictconstruction)
Expand Down
6 changes: 3 additions & 3 deletions _maps/shuttles/ruin_pirate_cutter.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
/turf/open/floor/plating,
/area/shuttle/ruin/caravan/pirate)
"iN" = (
/mob/living/simple_animal/hostile/pirate/melee{
/mob/living/basic/trooper/pirate/melee{
environment_smash = 0
},
/turf/open/floor/iron,
Expand Down Expand Up @@ -139,7 +139,7 @@
pixel_y = -30;
req_access = null
},
/mob/living/simple_animal/hostile/pirate/ranged{
/mob/living/basic/trooper/pirate/ranged{
environment_smash = 0
},
/obj/effect/turf_decal/tile/neutral/fourcorners,
Expand Down Expand Up @@ -787,7 +787,7 @@
/area/shuttle/ruin/caravan/pirate)
"WV" = (
/obj/effect/decal/cleanable/dirt,
/mob/living/simple_animal/hostile/pirate/ranged{
/mob/living/basic/trooper/pirate/ranged{
environment_smash = 0
},
/turf/open/floor/iron,
Expand Down
14 changes: 7 additions & 7 deletions _maps/virtual_domains/pirates.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
dir = 8
},
/obj/effect/decal/cleanable/dirt/dust,
/mob/living/simple_animal/hostile/pirate/ranged/space,
/mob/living/basic/trooper/pirate/ranged/space,
/turf/open/floor/carpet/blue,
/area/virtual_domain/powered)
"iO" = (
Expand Down Expand Up @@ -293,7 +293,7 @@
/area/virtual_domain/powered)
"nX" = (
/obj/effect/decal/cleanable/dirt/dust,
/mob/living/simple_animal/hostile/pirate/melee/space,
/mob/living/basic/trooper/pirate/melee/space,
/turf/open/floor/wood/parquet,
/area/virtual_domain/powered)
"oo" = (
Expand Down Expand Up @@ -342,7 +342,7 @@
},
/obj/effect/mapping_helpers/burnt_floor,
/obj/effect/decal/cleanable/dirt/dust,
/mob/living/simple_animal/hostile/pirate/ranged,
/mob/living/basic/trooper/pirate/ranged,
/turf/open/floor/wood,
/area/virtual_domain/powered)
"qN" = (
Expand Down Expand Up @@ -385,7 +385,7 @@
/turf/open/misc/grass,
/area/virtual_domain/powered)
"to" = (
/mob/living/simple_animal/hostile/pirate/melee,
/mob/living/basic/trooper/pirate/melee,
/turf/open/misc/grass,
/area/virtual_domain/powered)
"ub" = (
Expand Down Expand Up @@ -472,7 +472,7 @@
/turf/open/misc/dirt/jungle,
/area/virtual_domain/powered)
"yi" = (
/mob/living/simple_animal/hostile/pirate/melee,
/mob/living/basic/trooper/pirate/melee,
/turf/open/misc/beach/sand,
/area/virtual_domain/powered)
"yq" = (
Expand All @@ -481,7 +481,7 @@
/area/virtual_domain/powered)
"yw" = (
/obj/effect/mapping_helpers/burnt_floor,
/mob/living/simple_animal/hostile/pirate/ranged,
/mob/living/basic/trooper/pirate/ranged,
/obj/structure/chair/wood,
/turf/open/floor/wood{
icon_state = "wood_large"
Expand Down Expand Up @@ -616,7 +616,7 @@
/area/virtual_domain/powered)
"Hp" = (
/obj/effect/turf_decal/siding/wood,
/mob/living/simple_animal/hostile/pirate/ranged,
/mob/living/basic/trooper/pirate/ranged,
/turf/open/floor/wood,
/area/virtual_domain/powered)
"HY" = (
Expand Down
54 changes: 54 additions & 0 deletions code/datums/components/plundering_attacks.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Component that makes basic mobs' melee attacks steal money from the target's ID card.
* Plundered money is stored and dropped on death or removal of the component.
*/
/datum/component/plundering_attacks
/// How many credits do we steal per attack?
var/plunder_amount = 25
/// How much plunder do we have stored?
var/plunder_stored = 0


/datum/component/plundering_attacks/Initialize(
plunder_amount = 25,
)
. = ..()
if(!isbasicmob(parent))
return COMPONENT_INCOMPATIBLE

src.plunder_amount = plunder_amount

/datum/component/plundering_attacks/RegisterWithParent()
. = ..()
RegisterSignal(parent, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(attempt_plunder))
RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(drop_plunder))

/datum/component/plundering_attacks/UnregisterFromParent()
. = ..()
UnregisterSignal(parent, list(COMSIG_HOSTILE_POST_ATTACKINGTARGET, COMSIG_LIVING_DEATH))
drop_plunder()

/datum/component/plundering_attacks/proc/attempt_plunder(mob/living/attacker, mob/living/carbon/human/target, success)
SIGNAL_HANDLER
if(!istype(target) || !success)
return
var/obj/item/card/id/id_card = target.wear_id?.GetID()
if(isnull(id_card))
return
var/datum/bank_account/account_to_rob = id_card.registered_account
if(isnull(account_to_rob) || account_to_rob.account_balance == 0)
return

var/amount_to_steal = plunder_amount
if(account_to_rob.account_balance < plunder_amount) //If there isn't enough, just take what's left
amount_to_steal = account_to_rob.account_balance
plunder_stored += amount_to_steal
account_to_rob.adjust_money(-amount_to_steal)
account_to_rob.bank_card_talk("Transaction confirmed! Transferred [amount_to_steal] credits to \<NULL_ACCOUNT\>!")

/datum/component/plundering_attacks/proc/drop_plunder()
SIGNAL_HANDLER
if(plunder_stored == 0)
return
new /obj/item/holochip(get_turf(parent), plunder_stored)
plunder_stored = 0
89 changes: 89 additions & 0 deletions code/modules/mob/living/basic/trooper/pirate.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/// Pirate trooper subtype
/mob/living/basic/trooper/pirate
name = "Pirate"
desc = "Does what he wants cause a pirate is free."
response_help_continuous = "pushes"
response_help_simple = "push"
speed = 0
speak_emote = list("yarrs")
faction = list(FACTION_PIRATE)
loot = list(/obj/effect/mob_spawn/corpse/human/pirate)
mob_spawner = /obj/effect/mob_spawn/corpse/human/pirate

/// The amount of money to steal with a melee attack
var/plunder_credits = 25

/mob/living/basic/trooper/pirate/Initialize(mapload)
. = ..()
AddComponent(/datum/component/plundering_attacks, plunder_amount = plunder_credits)

/mob/living/basic/trooper/pirate/melee
name = "Pirate Swashbuckler"
melee_damage_lower = 30
melee_damage_upper = 30
armour_penetration = 35
attack_verb_continuous = "slashes"
attack_verb_simple = "slash"
attack_sound = 'sound/weapons/blade1.ogg'
attack_vis_effect = ATTACK_EFFECT_SLASH
loot = list(/obj/effect/mob_spawn/corpse/human/pirate/melee)
light_range = 2
light_power = 2.5
light_color = COLOR_SOFT_RED
loot = list(
/obj/effect/mob_spawn/corpse/human/pirate/melee,
/obj/item/melee/energy/sword/pirate,
)
mob_spawner = /obj/effect/mob_spawn/corpse/human/pirate/melee
r_hand = /obj/item/melee/energy/sword/pirate
plunder_credits = 50 //they hit hard so they steal more

/mob/living/basic/trooper/pirate/melee/space
name = "Space Pirate Swashbuckler"
unsuitable_atmos_damage = 0
minimum_survivable_temperature = 0
speed = 1
loot = list(/obj/effect/mob_spawn/corpse/human/pirate/melee/space)
mob_spawner = /obj/effect/mob_spawn/corpse/human/pirate/melee/space

/mob/living/basic/trooper/pirate/melee/space/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)

/mob/living/basic/trooper/pirate/ranged
name = "Pirate Gunner"
loot = list(/obj/effect/mob_spawn/corpse/human/pirate/ranged)
mob_spawner = /obj/effect/mob_spawn/corpse/human/pirate/ranged
r_hand = /obj/item/gun/energy/laser
ai_controller = /datum/ai_controller/basic_controller/trooper/ranged
/// Type of bullet we use
var/casingtype = /obj/item/ammo_casing/energy/laser
/// Sound to play when firing weapon
var/projectilesound = 'sound/weapons/laser.ogg'
/// number of burst shots
var/burst_shots = 2
/// Time between taking shots
var/ranged_cooldown = 6 SECONDS

/mob/living/basic/trooper/pirate/ranged/Initialize(mapload)
. = ..()
AddComponent(\
/datum/component/ranged_attacks,\
casing_type = casingtype,\
projectile_sound = projectilesound,\
cooldown_time = ranged_cooldown,\
burst_shots = burst_shots,\
)

/mob/living/basic/trooper/pirate/ranged/space
name = "Space Pirate Gunner"
unsuitable_atmos_damage = 0
minimum_survivable_temperature = 0
speed = 1
loot = list(/obj/effect/mob_spawn/corpse/human/pirate/ranged/space)
mob_spawner = /obj/effect/mob_spawn/corpse/human/pirate/ranged/space
r_hand = /obj/item/gun/energy/e_gun/lethal

/mob/living/basic/trooper/pirate/ranged/space/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)
2 changes: 0 additions & 2 deletions code/modules/mob/living/basic/trooper/syndicate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
name = "Syndicate Operative"
desc = "Death to Nanotrasen."
speed = 1.1
melee_damage_lower = 10
melee_damage_upper = 10
faction = list(ROLE_SYNDICATE)
loot = list(/obj/effect/mob_spawn/corpse/human/syndicatesoldier)
mob_spawner = /obj/effect/mob_spawn/corpse/human/syndicatesoldier
Expand Down
91 changes: 0 additions & 91 deletions code/modules/mob/living/simple_animal/hostile/pirate.dm

This file was deleted.

Loading

0 comments on commit 9e18c65

Please sign in to comment.