forked from tgstation/tgstation
-
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.
## 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
1 parent
465fe99
commit 9e18c65
Showing
11 changed files
with
162 additions
and
115 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
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
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 |
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,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) |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.