Skip to content

Commit

Permalink
Ghost player fixups + centcom improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Feb 17, 2024
1 parent 5b45ef1 commit 0be6e71
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define COMSIG_AREA_INTERNAL_EXPLOSION "area_internal_explosion"
/// When returned on a signal hooked to [COMSIG_ATOM_EXPLODE], [COMSIG_ATOM_INTERNAL_EXPLOSION], or [COMSIG_AREA_INTERNAL_EXPLOSION] it prevents the explosion from being propagated further.
#define COMSIG_CANCEL_EXPLOSION (1<<0)
#define COMSIG_AREA_EXPLOSION_SHOCKWAVE "area_explosion_shockwave"

/// from [/atom/movable/proc/set_explosion_resistance] : (old_block, new_block)
#define COMSIG_MOVABLE_EXPLOSION_BLOCK_CHANGED "explosion_block_changed"
4 changes: 1 addition & 3 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
///is this a ghost accessible area?
#define GHOST_AREA (1<<18)
///can we explode during rounds?
#define NO_EXPLOSIONS_DURING (1<<19)
///are ghosts not allowed to enter during round
#define NO_GHOSTS_DURING_ROUND (1<<20)
#define NO_GHOSTS_DURING_ROUND (1<<19)

/*
These defines are used specifically with the atom/pass_flags bitmask
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/~monkestation/dcs/signals/signals_carbon.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
#define COMSIG_CARBON_EQUIP_EARS "carbon_ears_equip"
#define COMSIG_CARBON_UNEQUIP_EARS "carbon_ears_unequip"

#define COMSIG_HUMAN_BEGIN_DUEL "human_begin_duel"
#define COMSIG_HUMAN_END_DUEL "human_end_duel"
1 change: 0 additions & 1 deletion code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ DEFINE_BITFIELD(area_flags, list(
"XENOBIOLOGY_COMPATIBLE" = XENOBIOLOGY_COMPATIBLE,
"PASSIVE_AREA" = PASSIVE_AREA,
"GHOST_AREA" = GHOST_AREA,
"NO_EXPLOSIONS_DURING" = NO_EXPLOSIONS_DURING,
"NO_GHOSTS_DURING_ROUND" = NO_GHOSTS_DURING_ROUND,
))

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/explosions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ SUBSYSTEM_DEF(explosions)
epicenter = get_turf(epicenter)

var/area/checking = get_area(epicenter)
if((checking.area_flags & NO_EXPLOSIONS_DURING) && SSticker.current_state == GAME_STATE_PLAYING)
if(SEND_SIGNAL(checking, COMSIG_AREA_EXPLOSION_SHOCKWAVE) & COMSIG_CANCEL_EXPLOSION)
return

if(!epicenter)
Expand Down
64 changes: 46 additions & 18 deletions monkestation/code/modules/ghost_players/area_changes.dm
Original file line number Diff line number Diff line change
@@ -1,88 +1,116 @@
/area/centcom/central_command_areas
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA
ban_explosions = TRUE
grace = TRUE

/area/centcom/tdome
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA
ban_explosions = TRUE

/area/centcom/tdome/arena/actual
name = "Thunder Dome Arena Area"
ban_explosions = FALSE
// the grace effect has special handling for dueling

/area/centcom/central_command_areas/ghost_spawn
name = "Centcom Ghost Spawn"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "centcom_ghostspawn"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA

/area/centcom/central_command_areas/supply
area_flags = UNIQUE_AREA | NOTELEPORT | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT

/area/centcom/central_command_areas/pre_shuttle
name = "Centcomm Pre Shuttle"
area_flags = UNIQUE_AREA | NOTELEPORT | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT

/area/centcom/central_command_areas/supply
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING | NO_GHOSTS_DURING_ROUND
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_GHOSTS_DURING_ROUND

/area/centcom/central_command_areas/borbop
name = "Borbop's Bar"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "borbop"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA

/area/centcom/central_command_areas/kitchen
name = "Papa's Pizzeria"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "centcom_kitchen"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA

/area/centcom/central_command_areas/medical
name = "Centcom Medical"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "centcom_medical"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA

/area/centcom/central_command_areas/botany
name = "Centcom Botany"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "centcom_botany"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA

/area/centcom/central_command_areas/hall
name = "Centcom Hall"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "centcom_hall"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA

/area/centcom/central_command_areas/admin_hangout
name = "Admin Hangout"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "centcom_hangout"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING | NO_GHOSTS_DURING_ROUND
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_GHOSTS_DURING_ROUND

/area/centcom/central_command_areas/ghost_blocker
name = "During Round Ghost Blocker"
area_flags = NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING | NO_GHOSTS_DURING_ROUND
area_flags = NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_GHOSTS_DURING_ROUND

/area/centcom/central_command_areas/evacuation
area_flags = NOTELEPORT | GHOST_AREA | NO_EXPLOSIONS_DURING | NO_GHOSTS_DURING_ROUND
area_flags = NOTELEPORT | GHOST_AREA | NO_GHOSTS_DURING_ROUND

/area/centcom/central_command_areas/admin
area_flags = NOTELEPORT | GHOST_AREA | NO_EXPLOSIONS_DURING | NO_GHOSTS_DURING_ROUND
area_flags = NOTELEPORT | GHOST_AREA | NO_GHOSTS_DURING_ROUND

/area/centcom/central_command_areas/firing_range
name = "Centcom Firing Range"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "centcom_firingrange"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA
ban_explosions = FALSE
grace = FALSE

/area/centcom/central_command_areas/firing_range_checkpoint_control
area_flags = UNIQUE_AREA | NOTELEPORT | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT

/area/centcom/central_command_areas/arcade
name = "Centcom Arcade"
icon = 'monkestation/icons/area/areas_centcom.dmi'
icon_state = "centcom_arcade"
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA | NO_EXPLOSIONS_DURING
area_flags = UNIQUE_AREA | NOTELEPORT | GHOST_AREA | PASSIVE_AREA

/area/centcom
/// Whether to ban explosions in this area.
var/ban_explosions = FALSE
/// Whether this area gives the "grace" status effect or not.
var/grace = FALSE

/area/centcom/Initialize(mapload)
. = ..()
RegisterSignals(src, list(COMSIG_AREA_INTERNAL_EXPLOSION, COMSIG_AREA_EXPLOSION_SHOCKWAVE), PROC_REF(explosion_check))

/area/centcom/Entered(atom/movable/thing)
. = ..()
if(grace && isliving(thing))
var/mob/living/thingy = thing
thingy.apply_status_effect(/datum/status_effect/centcom_grace)

/area/centcom/proc/explosion_check()
SIGNAL_HANDLER
if(ban_explosions)
return COMSIG_CANCEL_EXPLOSION

// Override that handles teleporting ghost player's mobs back to Centcom ghostspawn, if they try to
// move out of it during the round.
Expand Down
8 changes: 6 additions & 2 deletions monkestation/code/modules/ghost_players/arena/fight_button.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,19 @@
spawned_weapons += WEAKREF(one_weapon)
var/turf/one_spot = locate(148, 34, SSmapping.levels_by_trait(ZTRAIT_CENTCOM)[1])
player_one.forceMove(one_spot)
player_one.equipOutfit(/datum/outfit/job/assistant)
player_one.equipOutfit(/datum/outfit/ghost_player)
player_one.put_in_active_hand(one_weapon, TRUE)
player_one.dueling = TRUE
SEND_SIGNAL(player_one, COMSIG_HUMAN_BEGIN_DUEL)

var/obj/item/two_weapon = new weapon_of_choice(src)
spawned_weapons += WEAKREF(two_weapon)
var/turf/two_spot = locate(164, 34, SSmapping.levels_by_trait(ZTRAIT_CENTCOM)[1])
player_two.forceMove(two_spot)
player_two.equipOutfit(/datum/outfit/job/assistant)
player_two.equipOutfit(/datum/outfit/ghost_player)
player_two.put_in_active_hand(two_weapon, TRUE)
player_two.dueling = TRUE
SEND_SIGNAL(player_two, COMSIG_HUMAN_BEGIN_DUEL)

/obj/structure/fight_button/proc/end_duel(mob/living/carbon/human/ghost/loser)
if(loser == player_one)
Expand All @@ -175,6 +177,8 @@
player_two.linked_button = null
player_one.dueling = FALSE
player_two.dueling = FALSE
SEND_SIGNAL(player_one, COMSIG_HUMAN_END_DUEL)
SEND_SIGNAL(player_two, COMSIG_HUMAN_END_DUEL)

player_one = null
player_two = null
Expand Down
67 changes: 67 additions & 0 deletions monkestation/code/modules/ghost_players/centcom_grace.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/datum/status_effect/centcom_grace
id = "centcom_grace"
tick_interval = -1
alert_type = null
var/last_active = FALSE

/datum/status_effect/centcom_grace/on_apply()
. = ..()
if(!.)
return
giveth_taketh()
RegisterSignals(owner, list(COMSIG_ENTER_AREA, COMSIG_HUMAN_BEGIN_DUEL, COMSIG_HUMAN_END_DUEL), PROC_REF(giveth_taketh))

/datum/status_effect/centcom_grace/on_remove()
. = ..()
take_traits()
UnregisterSignal(owner, list(COMSIG_ENTER_AREA, COMSIG_HUMAN_BEGIN_DUEL, COMSIG_HUMAN_END_DUEL))

/datum/status_effect/centcom_grace/proc/giveth_taketh()
SIGNAL_HANDLER
if(active())
if(!last_active)
owner.SetAllImmobility(0)
owner.set_safe_hunger_level()
owner.extinguish_mob()
give_traits()
last_active = TRUE
else
take_traits()
last_active = FALSE

/datum/status_effect/centcom_grace/proc/active()
. = TRUE
if(istype(owner, /mob/living/carbon/human/ghost))
var/mob/living/carbon/human/ghost/ghost_owner = owner
if(ghost_owner.dueling)
return FALSE
var/area/centcom/centcom_area = get_area(owner)
if(!istype(centcom_area) || !centcom_area.grace)
return FALSE

/datum/status_effect/centcom_grace/proc/give_traits()
if(QDELETED(owner))
qdel(src)
return
owner.add_traits(list(
TRAIT_RESISTCOLD,
TRAIT_RESISTHEAT,
TRAIT_RESISTLOWPRESSURE,
TRAIT_RESISTHIGHPRESSURE,
TRAIT_NOBREATH,
TRAIT_NOHUNGER,
TRAIT_STABLEHEART,
TRAIT_STABLELIVER,
TRAIT_BOMBIMMUNE,
TRAIT_RADIMMUNE,
TRAIT_TUMOR_SUPPRESSED,
TRAIT_IGNORESLOWDOWN,
TRAIT_NOFIRE,
TRAIT_NODISMEMBER
), id)

/datum/status_effect/centcom_grace/proc/take_traits()
if(QDELETED(owner))
qdel(src)
return
REMOVE_TRAITS_IN(owner, id)
16 changes: 10 additions & 6 deletions monkestation/code/modules/ghost_players/ghost_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,16 @@ GLOBAL_VAR_INIT(disable_ghost_spawning, FALSE)
brain.temporary_sleep = TRUE

var/client/our_client = client || GLOB.directory[ckey]
var/mob/living/carbon/human/ghost/new_existance = new(key, mind, can_reenter_corpse, brain)
our_client?.prefs.safe_transfer_prefs_to(new_existance, TRUE, FALSE)
new_existance.move_to_ghostspawn()
new_existance.key = key
new_existance.equipOutfit(/datum/outfit/job/assistant)
SSquirks.AssignQuirks(new_existance, our_client)
var/mob/living/carbon/human/ghost/new_existence = new(key, mind, can_reenter_corpse, brain)
our_client?.prefs.safe_transfer_prefs_to(new_existence, TRUE, FALSE)
new_existence.move_to_ghostspawn()
new_existence.key = key
new_existence.equip_outfit_and_loadout(/datum/outfit/ghost_player, our_client.prefs)
for(var/datum/loadout_item/item as anything in loadout_list_to_datums(our_client?.prefs?.loadout_list))
if(length(item.restricted_roles))
continue
item.post_equip_item(our_client.prefs, new_existence)
SSquirks.AssignQuirks(new_existence, our_client)
our_client?.init_verbs()
qdel(src)
return TRUE
Expand Down
17 changes: 17 additions & 0 deletions monkestation/code/modules/ghost_players/ghost_player_outfit.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/datum/outfit/ghost_player
name = "Ghost Player"
shoes = /obj/item/clothing/shoes/sneakers/black
box = /obj/item/storage/box/survival/engineer

/datum/outfit/ghost_player/pre_equip(mob/living/carbon/human/target, visualsOnly)
. = ..()
uniform = (target.jumpsuit_style == PREF_SKIRT) ? /obj/item/clothing/under/color/jumpskirt/grey : /obj/item/clothing/under/color/grey
switch(target.backpack)
if(GSATCHEL, DSATCHEL)
back = /obj/item/storage/backpack/satchel
if(GDUFFELBAG, DDUFFELBAG)
back = /obj/item/storage/backpack/duffelbag
if(LSATCHEL)
back = /obj/item/storage/backpack/satchel/leather
else
back = /obj/item/storage/backpack
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6154,8 +6154,10 @@
#include "monkestation\code\modules\food_and_drinks\recipes\boiling.dm"
#include "monkestation\code\modules\food_and_drinks\recipes\recipes_meat.dm"
#include "monkestation\code\modules\ghost_players\area_changes.dm"
#include "monkestation\code\modules\ghost_players\centcom_grace.dm"
#include "monkestation\code\modules\ghost_players\centcom_teleporter.dm"
#include "monkestation\code\modules\ghost_players\ghost_player.dm"
#include "monkestation\code\modules\ghost_players\ghost_player_outfit.dm"
#include "monkestation\code\modules\ghost_players\arena\arena_cleanser.dm"
#include "monkestation\code\modules\ghost_players\arena\arena_items.dm"
#include "monkestation\code\modules\ghost_players\arena\fight_button.dm"
Expand Down

0 comments on commit 0be6e71

Please sign in to comment.