Skip to content

Commit

Permalink
TGS Test Merge (#5584)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Feb 13, 2024
2 parents 4bff4d7 + 78ca1d9 commit 7084b11
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 30 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ GLOBAL_LIST(trait_name_map)
#define XENO_WEED_TRAIT "xeno_weed"
/// traits associated with actively interacted machinery
#define INTERACTION_TRAIT "interaction"
/// traits associated with interacting with a dropship
#define TRAIT_SOURCE_DROPSHIP_INTERACTION "dropship_interaction"
/// traits bound by stunned status effects
#define STUNNED_TRAIT "stunned"
/// traits bound by knocked_down status effect
Expand Down
16 changes: 2 additions & 14 deletions code/controllers/subsystem/shuttles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ SUBSYSTEM_DEF(shuttle)
// First, determine the size of the needed zone
// Because of shuttle rotation, the "width" of the shuttle is not
// always x.
var/travel_dir = M.preferred_direction
// Remember, the direction is the direction we appear to be
// coming from
var/dock_angle = dir2angle(M.preferred_direction) + dir2angle(M.port_direction) + 180
var/dock_dir = angle2dir(dock_angle)

Expand All @@ -185,19 +182,10 @@ SUBSYSTEM_DEF(shuttle)

/*
to_chat(world, "The attempted transit dock will be [transit_width] width, and \)
[transit_height] in height. The travel dir is [travel_dir]."
[transit_height] in height. The travel dir is [M.preferred_direction]."
*/

var/transit_path = /turf/open/space/transit
switch(travel_dir)
if(NORTH)
transit_path = /turf/open/space/transit/north
if(SOUTH)
transit_path = /turf/open/space/transit/south
if(EAST)
transit_path = /turf/open/space/transit/east
if(WEST)
transit_path = /turf/open/space/transit/west
var/transit_path = M.get_transit_path_type()

var/datum/turf_reservation/proposal = SSmapping.RequestBlockReservation(transit_width, transit_height, null, /datum/turf_reservation/transit, transit_path)

Expand Down
113 changes: 105 additions & 8 deletions code/game/turfs/transit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,116 @@
if(isobserver(crosser) || crosser.anchored)
return

if(!(isitem(crosser) || isliving(crosser)))
if(!isitem(crosser) && !isliving(crosser))
return

var/turf/open/floor/floor = old_loc
if(istype(floor))
var/fling_dir = get_dir(floor, crosser.loc)

var/turf/near_turf = get_step(crosser.loc, get_step(crosser.loc, fling_dir))
var/turf/projected = get_ranged_target_turf(near_turf, fling_dir, 50)
if(!istype(old_loc, /turf/open/space))
var/turf/near_turf = get_step(crosser.loc, get_step(crosser.loc, dir))
var/turf/projected = get_ranged_target_turf(near_turf, dir, 50)

INVOKE_ASYNC(crosser, TYPE_PROC_REF(/atom/movable, throw_atom), projected, 50, SPEED_FAST, null, TRUE)

QDEL_IN(crosser, 0.5 SECONDS)
addtimer(CALLBACK(src, PROC_REF(handle_crosser), crosser), 0.5 SECONDS)

/turf/open/space/transit/proc/handle_crosser(atom/movable/crosser)
if(QDELETED(crosser))
return
qdel(crosser)

/turf/open/space/transit/dropship
var/shuttle_tag

/turf/open/space/transit/dropship/handle_crosser(atom/movable/crosser)
if(QDELETED(crosser))
return
if(!shuttle_tag)
return ..()

var/obj/docking_port/mobile/marine_dropship/dropship = SSshuttle.getShuttle(shuttle_tag)
if(!istype(dropship) || dropship.mode != SHUTTLE_CALL)
return ..()

if(dropship.destination.id != DROPSHIP_LZ1 && dropship.destination.id != DROPSHIP_LZ2)
return ..() // we're not heading towards the LZs

// you just jumped out of a dropship heading towards the LZ, if you're lucky, maybe you'll live!
var/list/ground_z_levels = SSmapping.levels_by_trait(ZTRAIT_GROUND)
if(!length(ground_z_levels))
return ..()

var/list/area/potential_areas = shuffle(SSmapping.areas_in_z["[ground_z_levels[1]]"])

for(var/area/maybe_this_area in potential_areas)
if(CEILING_IS_PROTECTED(maybe_this_area.ceiling, CEILING_PROTECTION_TIER_1)) // prevents out of bounds too
continue
if(istype(maybe_this_area, /area/space)) // make sure its not space, just in case
continue

var/turf/open/possible_turf = null
var/list/area_turfs = get_area_turfs(maybe_this_area)
for(var/i in 1 to 10)
possible_turf = pick_n_take(area_turfs)
// we're looking for an open, non-dense, and non-space turf.
if(!istype(possible_turf) || is_blocked_turf(possible_turf) || istype(possible_turf, /turf/open/space))
continue

if(!istype(possible_turf) || is_blocked_turf(possible_turf) || istype(possible_turf, /turf/open/space))
continue // couldnt find one in 10 loops, check another area

// we found a good turf, lets drop em
INVOKE_ASYNC(src, PROC_REF(handle_drop), crosser, possible_turf, dropship.name)
return

return ..() // they couldn't be dropped, just delete them

/turf/open/space/transit/dropship/proc/handle_drop(atom/movable/crosser, turf/target, dropship_name)
ADD_TRAIT(crosser, TRAIT_IMMOBILIZED, TRAIT_SOURCE_DROPSHIP_INTERACTION)

crosser.pixel_z = 300
crosser.forceMove(target)
crosser.visible_message(SPAN_WARNING("[crosser] falls out of the sky."), SPAN_HIGHDANGER("As you fall out of the [dropship_name], you plummet towards the ground."))
animate(crosser, time = 5, pixel_z = 0, flags = ANIMATION_PARALLEL)

REMOVE_TRAIT(crosser, TRAIT_IMMOBILIZED, TRAIT_SOURCE_DROPSHIP_INTERACTION)
if(isitem(crosser))
var/obj/item/item = crosser
item.explosion_throw(200) // give it a bit of a kick
return

if(!isliving(crosser))
return // don't know how you got here, but you shouldnt be here.
var/mob/living/fallen_mob = crosser

playsound(target, "punch", rand(20, 70), TRUE)
playsound(target, "punch", rand(20, 70), TRUE)
playsound(target, "bone_break", rand(20, 70), TRUE)
playsound(target, "bone_break", rand(20, 70), TRUE)

fallen_mob.KnockDown(10) // 10 seconds
fallen_mob.Stun(3) // 3 seconds


if(ishuman(fallen_mob))
var/mob/living/carbon/human/human = fallen_mob
human.last_damage_data = create_cause_data("falling from [dropship_name]", human)
// I'd say falling from space is pretty much like getting hit by an explosion
human.take_overall_armored_damage(300, ARMOR_BOMB, limb_damage_chance = 100)
// but just in case, you will still take a ton of damage.
human.take_overall_damage(200, used_weapon = "falling", limb_damage_chance = 100)
if(human.stat != DEAD)
human.death(create_cause_data("falling from [dropship_name]", human))
fallen_mob.status_flags |= PERMANENTLY_DEAD
return
// take a little bit more damage otherwise
fallen_mob.take_overall_damage(400, used_weapon = "falling", limb_damage_chance = 100)

/turf/open/space/transit/dropship/alamo
shuttle_tag = DROPSHIP_ALAMO
dir = SOUTH

/turf/open/space/transit/dropship/normandy
shuttle_tag = DROPSHIP_NORMANDY
dir = SOUTH

/turf/open/space/transit/south
dir = SOUTH
Expand Down
12 changes: 7 additions & 5 deletions code/modules/mob/living/carbon/human/human_damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -311,25 +311,27 @@ In most cases it makes more sense to use apply_damage() instead! And make sure t
if(update) UpdateDamageIcon()

// damage MANY limbs, in random order
/mob/living/carbon/human/take_overall_damage(brute, burn, sharp = 0, edge = 0, used_weapon = null)
/mob/living/carbon/human/take_overall_damage(brute, burn, used_weapon = null, limb_damage_chance = 80)
if(status_flags & GODMODE)
return //godmode
var/list/obj/limb/parts = get_damageable_limbs(80)
var/list/obj/limb/parts = get_damageable_limbs(limb_damage_chance)
var/amount_of_parts = length(parts)
for(var/obj/limb/L as anything in parts)
L.take_damage(brute / amount_of_parts, burn / amount_of_parts, sharp, edge, used_weapon)
L.take_damage(brute / amount_of_parts, burn / amount_of_parts, sharp = FALSE, edge = FALSE, used_weapon = used_weapon)
updatehealth()
UpdateDamageIcon()

// damage MANY LIMBS, in random order
/mob/living/carbon/human/proc/take_overall_armored_damage(damage, armour_type = ARMOR_MELEE, damage_type = BRUTE, limb_damage_chance = 80, penetration = 0, armour_break_pr_pen = 0, armour_break_flat = 0)
// damage MANY LIMBS, in random order, but consider armor
/mob/living/carbon/human/proc/take_overall_armored_damage(damage, armour_type = ARMOR_MELEE, damage_type = BRUTE, limb_damage_chance = 80, penetration = 0)
if(status_flags & GODMODE)
return //godmode
var/list/obj/limb/parts = get_damageable_limbs(limb_damage_chance)
var/amount_of_parts = length(parts)
var/armour_config = GLOB.marine_ranged
if(armour_type == ARMOR_MELEE)
armour_config = GLOB.marine_melee
if(armour_type == ARMOR_BOMB)
armour_config = GLOB.marine_explosive
for(var/obj/limb/L as anything in parts)
var/armor = getarmor(L, armour_type)
var/modified_damage = armor_damage_reduction(armour_config, damage, armor, penetration, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living_health_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
src.updatehealth()

// damage MANY limbs, in random order
/mob/living/proc/take_overall_damage(brute, burn, used_weapon = null)
/mob/living/proc/take_overall_damage(brute, burn, used_weapon = null, limb_damage_chance = 80)
if(status_flags & GODMODE) return 0 //godmode
apply_damage(brute, BRUTE)
apply_damage(burn, BURN)
Expand Down
12 changes: 12 additions & 0 deletions code/modules/shuttle/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1004,3 +1004,15 @@
to_chat(user, SPAN_WARNING("Shuttle already in transit."))
return FALSE
return TRUE

/obj/docking_port/mobile/proc/get_transit_path_type()
. = /turf/open/space/transit
switch(preferred_direction)
if(NORTH)
return /turf/open/space/transit/north
if(SOUTH)
return /turf/open/space/transit/south
if(EAST)
return /turf/open/space/transit/east
if(WEST)
return /turf/open/space/transit/west
10 changes: 8 additions & 2 deletions code/modules/shuttle/shuttles/dropship.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,18 @@
/obj/docking_port/mobile/marine_dropship/alamo
name = "Alamo"
id = DROPSHIP_ALAMO
preferred_direction = SOUTH
preferred_direction = SOUTH // If you are changing this, please update the dir of the path below as well

/obj/docking_port/mobile/marine_dropship/alamo/get_transit_path_type()
return /turf/open/space/transit/dropship/alamo

/obj/docking_port/mobile/marine_dropship/normandy
name = "Normandy"
id = DROPSHIP_NORMANDY
preferred_direction = SOUTH
preferred_direction = SOUTH // If you are changing this, please update the dir of the path below as well

/obj/docking_port/mobile/marine_dropship/normandy/get_transit_path_type()
return /turf/open/space/transit/dropship/normandy

/obj/docking_port/mobile/marine_dropship/check()
. = ..()
Expand Down

0 comments on commit 7084b11

Please sign in to comment.