Skip to content

Commit

Permalink
Merge branch 'master' into Thruster
Browse files Browse the repository at this point in the history
  • Loading branch information
Thera-Pissed committed May 28, 2024
2 parents c1c082d + dd87d96 commit 6f7fa4f
Show file tree
Hide file tree
Showing 169 changed files with 945 additions and 584 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/obj_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define IN_STORAGE (1<<11) //is this item in the storage item, such as backpack? used for tooltips
#define SURGICAL_TOOL (1<<12) //Tool commonly used for surgery: won't attack targets in an active surgical operation on help intent (in case of mistakes)
#define EYE_STAB (1<<13) /// Item can be used to eyestab
#define NO_PIXEL_RANDOM_DROP (1<<14) //if dropped, it wont have a randomized pixel_x/pixel_y

// Flags for the clothing_flags var on /obj/item/clothing

Expand Down
13 changes: 13 additions & 0 deletions code/__DEFINES/power.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,16 @@

#define TESLA_DEFAULT_POWER 1738260
#define TESLA_MINI_POWER 869130

#define LIGHT_DRAW 10 // mulitplied by brightness, typically 4-8

#define IDLE_DRAW_MINIMAL 50 // 20x = 1kw, used for small things and computers on stand-by
#define IDLE_DRAW_LOW 200 //5x = 1kw, used for always-active computers
#define IDLE_DRAW_MEDIUM 500 //2x = 1kw
#define IDLE_DRAW_HIGH 1000 //1kw

#define ACTIVE_DRAW_MINIMAL 200 //5x = 1kw
#define ACTIVE_DRAW_LOW 500 //2x = 1kw
#define ACTIVE_DRAW_MEDIUM 1000 //microwaves use this
#define ACTIVE_DRAW_HIGH 2000
#define ACTIVE_DRAW_EXTREME 5000 //highest this value should be in most cases
1 change: 1 addition & 0 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
#define FIRE_PRIORITY_PARALLAX 65
#define FIRE_PRIORITY_INSTRUMENTS 80
#define FIRE_PRIORITY_MOBS 100
#define FIRE_PRIORITY_MOVABLE_PHYSICS 105
#define FIRE_PRIORITY_TGUI 110
#define FIRE_PRIORITY_TICKER 200
#define FIRE_PRIORITY_ATMOS_ADJACENCY 300
Expand Down
2 changes: 0 additions & 2 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_NIGHT_VISION "night_vision"
#define TRAIT_LIGHT_STEP "light_step"
#define TRAIT_SPIRITUAL "spiritual"
#define TRAIT_FAN_CLOWN "fan_clown"
#define TRAIT_FAN_MIME "fan_mime"
#define TRAIT_FAN_RILENA "fan_rilena"
#define TRAIT_VORACIOUS "voracious"
#define TRAIT_SELF_AWARE "self_aware"
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ DEFINE_BITFIELD(item_flags, list(
"NOBLUDGEON" = NOBLUDGEON,
"NO_MAT_REDEMPTION" = NO_MAT_REDEMPTION,
"SLOWS_WHILE_IN_HAND" = SLOWS_WHILE_IN_HAND,
"NO_PIXEL_RANDOM_DROP" = NO_PIXEL_RANDOM_DROP,
))

DEFINE_BITFIELD(machine_stat, list(
Expand Down
2 changes: 0 additions & 2 deletions code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_NIGHT_VISION" = TRAIT_NIGHT_VISION,
"TRAIT_LIGHT_STEP" = TRAIT_LIGHT_STEP,
"TRAIT_SPIRITUAL" = TRAIT_SPIRITUAL,
"TRAIT_FAN_CLOWN" = TRAIT_FAN_CLOWN,
"TRAIT_FAN_MIME" = TRAIT_FAN_MIME,
"TRAIT_VORACIOUS" = TRAIT_VORACIOUS,
"TRAIT_SELF_AWARE" = TRAIT_SELF_AWARE,
"TRAIT_FREERUNNING" = TRAIT_FREERUNNING,
Expand Down
5 changes: 1 addition & 4 deletions code/controllers/subsystem/machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ SUBSYSTEM_DEF(machines)
while(currentrun.len)
var/obj/machinery/thing = currentrun[currentrun.len]
currentrun.len--
if(!QDELETED(thing) && thing.process(seconds) != PROCESS_KILL)
if(thing.use_power)
thing.auto_use_power() //add back the power state
else
if(QDELETED(thing) || thing.process(seconds) == PROCESS_KILL)
processing -= thing
if (!QDELETED(thing))
thing.datum_flags &= ~DF_ISPROCESSING
Expand Down
24 changes: 24 additions & 0 deletions code/controllers/subsystem/processing/movable_physics.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
///Real fast ticking subsystem for moving movables via modifying pixel_x/y/z
PROCESSING_SUBSYSTEM_DEF(movablephysics)
name = "Movable Physics"
wait = 0.05 SECONDS
stat_tag = "MP"
priority = FIRE_PRIORITY_MOVABLE_PHYSICS

/datum/controller/subsystem/processing/movablephysics/fire(resumed = FALSE)
if (!resumed)
currentrun = processing.Copy()
//cache for sanic speed (lists are references anyways)
var/list/current_run = currentrun

while(current_run.len)
var/datum/component/thing = current_run[current_run.len]
current_run.len--
if(QDELETED(thing))
processing -= thing
else
if(thing.process(wait * 0.1) == PROCESS_KILL)
// fully stop so that a future START_PROCESSING will work
STOP_PROCESSING(src, thing)
if (MC_TICK_CHECK)
return
1 change: 0 additions & 1 deletion code/controllers/subsystem/processing/quirks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
list("Ageusia","Vegetarian","Deviant Tastes"), \
list("Ananas Affinity","Ananas Aversion"), \
list("Alcohol Tolerance","Light Drinker"), \
list("Clown Fan","Mime Fan", "RILENA Super Fan"), \
list("Bad Touch", "Friendly"))

species_blacklist = list("Blood Deficiency" = list(SPECIES_IPC, SPECIES_JELLYPERSON, SPECIES_PLASMAMAN, SPECIES_VAMPIRE))
Expand Down
151 changes: 151 additions & 0 deletions code/datums/components/movable_physics.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#define PHYSICS_GRAV_STANDARD 9.80665

///Remove the component as soon as there's zero velocity, useful for movables that will no longer move after being initially moved (blood splatters)
#define QDEL_WHEN_NO_MOVEMENT (1<<0)

///Stores information related to the movable's physics and keeping track of relevant signals to trigger movement
/datum/component/movable_physics
///Modifies the pixel_x/pixel_y of an object every process()
var/horizontal_velocity
///Modifies the pixel_z of an object every process(), movables aren't Move()'d into another turf if pixel_z exceeds 16, so try not to supply a super high vertical value if you don't want the movable to clip through multiple turfs
var/vertical_velocity
///The horizontal_velocity is reduced by this every process(), this doesn't take into account the object being in the air vs gravity pushing it against the ground
var/horizontal_friction
///The vertical_velocity is reduced by this every process()
var/z_gravity
///The pixel_z that the object will no longer be influenced by gravity for a 32x32 turf, keep this value between -16 to 0 so it's visuals matches up with it physically being in the turf
var/z_floor
///The angle of the path the object takes on the x/y plane
var/angle_of_movement
///Flags for turning on certain physic properties, see the top of the file for more information on flags
var/physic_flags
///The cached animate_movement of the parent; any kind of gliding when doing Move() makes the physics look derpy, so we'll just make Move() be instant
var/cached_animate_movement
///The sound effect to play when bouncing off of something
var/bounce_sound

var/numbounce = 1

/datum/component/movable_physics/Initialize(_horizontal_velocity = 0, _vertical_velocity = 0, _horizontal_friction = 0, _z_gravity = 0, _z_floor = 0, _angle_of_movement = 0, _physic_flags = 0, _bounce_sound)
. = ..()
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(parent, COMSIG_MOVABLE_IMPACT, PROC_REF(throw_impact_ricochet), override = TRUE)
horizontal_velocity = _horizontal_velocity
vertical_velocity = _vertical_velocity
horizontal_friction = _horizontal_friction
z_gravity = _z_gravity
z_floor = _z_floor
angle_of_movement = _angle_of_movement
physic_flags = _physic_flags
bounce_sound = _bounce_sound
if(vertical_velocity || horizontal_velocity)
start_movement()

///Let's get moving
/datum/component/movable_physics/proc/start_movement()
var/atom/movable/moving_atom = parent
cached_animate_movement = moving_atom.animate_movement
moving_atom.animate_movement = NO_STEPS
START_PROCESSING(SSmovablephysics, src)
moving_atom.SpinAnimation(speed = 1 SECONDS, loops = 1)

///Alright it's time to stop
/datum/component/movable_physics/proc/stop_movement()
var/atom/movable/moving_atom = parent
moving_atom.animate_movement = cached_animate_movement
STOP_PROCESSING(SSmovablephysics, src)
if(physic_flags & QDEL_WHEN_NO_MOVEMENT)
qdel(src)

/datum/component/movable_physics/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_MOVABLE_IMPACT)

/datum/component/movable_physics/proc/throw_impact_ricochet(datum/source, atom/hit_atom, datum/thrownthing/throwingdatum)
SIGNAL_HANDLER
var/atom/movable/atom_source = source
ricochet(atom_source, Get_Angle(atom_source, throwingdatum.target_turf))

/datum/component/movable_physics/proc/z_floor_bounce(atom/movable/moving_atom)
angle_of_movement += rand(-3000, 3000) / 100
var/turf/a_turf = get_turf(moving_atom)
if(istype(moving_atom, /obj/item/ammo_casing))
playsound(moving_atom, a_turf.bullet_bounce_sound, 50, TRUE)
else
playsound(moving_atom, bounce_sound, 50, TRUE)
moving_atom.SpinAnimation(speed = 1 SECONDS / numbounce, loops = 1)
moving_atom.pixel_z = z_floor
horizontal_velocity = max(0, horizontal_velocity + (vertical_velocity * -0.8))
vertical_velocity = max(0, ((vertical_velocity * -0.8) - 0.2))
numbounce += 0.5

/datum/component/movable_physics/proc/ricochet(atom/movable/moving_atom, bounce_angle)
angle_of_movement = ((180 - bounce_angle) - angle_of_movement)
if(angle_of_movement < 0)
angle_of_movement += 360
//var/turf/a_turf = get_turf(moving_atom)
//playsound(src, a_turf.bullet_bounce_sound, 50, TRUE)

/datum/component/movable_physics/proc/fix_angle(angle, atom/moving_atom)//fixes an angle below 0 or above 360
if(!(angle_of_movement > 360) && !(angle_of_movement < 0))
return angle //early return if it doesn't need to change
var/new_angle
if(angle_of_movement > 360)
new_angle = angle_of_movement - 360
if(angle_of_movement < 0)
new_angle = angle_of_movement + 360
return new_angle

/datum/component/movable_physics/process(delta_time)
var/atom/movable/moving_atom = parent
var/turf/location = get_turf(moving_atom)

angle_of_movement = fix_angle(angle_of_movement, moving_atom)
if(horizontal_velocity <= 0 && moving_atom.pixel_z == 0)
horizontal_velocity = 0
stop_movement()
return

moving_atom.pixel_x += (horizontal_velocity * (sin(angle_of_movement)))
moving_atom.pixel_y += (horizontal_velocity * (cos(angle_of_movement)))

horizontal_velocity = max(0, horizontal_velocity - horizontal_friction)

moving_atom.pixel_z = max(z_floor, moving_atom.pixel_z + vertical_velocity)
if(moving_atom.pixel_z > z_floor)
vertical_velocity -= (z_gravity * 0.05)

if(moving_atom.pixel_z <= z_floor && (vertical_velocity != 0) && moving_atom.has_gravity(location)) //z bounce
z_floor_bounce(moving_atom)

if(moving_atom.pixel_x > 16)
if(moving_atom.Move(get_step(moving_atom, EAST)))
moving_atom.pixel_x = -16
else
moving_atom.pixel_x = 16
ricochet(moving_atom, 0)
return

if(moving_atom.pixel_x < -16)
if(moving_atom.Move(get_step(moving_atom, WEST)))
moving_atom.pixel_x = 16
else
moving_atom.pixel_x = -16
ricochet(moving_atom, 0)
return

if(moving_atom.pixel_y > 16)
if(moving_atom.Move(get_step(moving_atom, NORTH)))
moving_atom.pixel_y = -16
else
moving_atom.pixel_y = 16
ricochet(moving_atom, 180)
return

if(moving_atom.pixel_y < -16)
if(moving_atom.Move(get_step(moving_atom, SOUTH)))
moving_atom.pixel_y = 16
else
moving_atom.pixel_y = -16
ricochet(moving_atom, 180)

8 changes: 0 additions & 8 deletions code/datums/mood_events/generic_positive_events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@
description = "<span class='nicegreen'>My family heirloom is safe with me.</span>\n"
mood_change = 1

/datum/mood_event/fan_clown_pin
description = "<span class='nicegreen'>I love showing off my clown pin!</span>\n"
mood_change = 1

/datum/mood_event/fan_mime_pin
description = "<span class='nicegreen'>I love showing off my mime pin!</span>\n"
mood_change = 1

/datum/mood_event/rilena_fan
description = "<span class='nicegreen'>I love my RILENA merch!</span>\n"
mood_change = 1
Expand Down
40 changes: 0 additions & 40 deletions code/datums/traits/good.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,6 @@
lose_text = "<span class='danger'>You feel isolated from others.</span>"
medical_record_text = "Patient is highly perceptive of and sensitive to social cues, or may possibly have ESP. Further testing needed."

/datum/quirk/fan_clown
name = "Clown Fan"
desc = "You enjoy clown antics and get a mood boost from wearing your clown pin."
value = 1
mob_traits = list(TRAIT_FAN_CLOWN)
gain_text = "<span class='notice'>You are a big fan of clowns.</span>"
lose_text = "<span class='danger'>The clown doesn't seem so great.</span>"
medical_record_text = "Patient reports being a big fan of clowns."

/datum/quirk/fan_clown/on_spawn()
var/mob/living/carbon/human/H = quirk_holder
var/obj/item/clothing/accessory/fan_clown_pin/B = new(get_turf(H))
var/list/slots = list (
"backpack" = ITEM_SLOT_BACKPACK,
"hands" = ITEM_SLOT_HANDS,
)
H.equip_in_one_of_slots(B, slots , qdel_on_fail = TRUE)
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
fan.add_hud_to(H)

/datum/quirk/fan_rilena
name = "RILENA Super Fan"
desc = "You are a major fan of the popular webseries RILENA: LMR. You get a mood boost from plushies of your favorite characters, and wearing your Xader pin."
Expand All @@ -102,26 +82,6 @@
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
fan.add_hud_to(H)

/datum/quirk/fan_mime
name = "Mime Fan"
desc = "You enjoy mime antics and get a mood boost from wearing your mime pin."
value = 1
mob_traits = list(TRAIT_FAN_MIME)
gain_text = "<span class='notice'>You are a big fan of the Mime.</span>"
lose_text = "<span class='danger'>The mime doesn't seem so great.</span>"
medical_record_text = "Patient reports being a big fan of mimes."

/datum/quirk/fan_mime/on_spawn()
var/mob/living/carbon/human/H = quirk_holder
var/obj/item/clothing/accessory/fan_mime_pin/B = new(get_turf(H))
var/list/slots = list (
"backpack" = ITEM_SLOT_BACKPACK,
"hands" = ITEM_SLOT_HANDS,
)
H.equip_in_one_of_slots(B, slots , qdel_on_fail = TRUE)
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
fan.add_hud_to(H)

/datum/quirk/freerunning
name = "Freerunning"
desc = "You're great at quick moves! You can climb tables more quickly."
Expand Down
18 changes: 0 additions & 18 deletions code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,24 +216,6 @@ Medical HUD! Basic mode needs suit sensors on.
holder.icon_state = "hudhealthy"


/***********************************************
FAN HUDs! For identifying other fans on-sight.
************************************************/

//HOOKS

/mob/living/carbon/human/proc/fan_hud_set_fandom()
var/image/holder = hud_list[FAN_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
holder.icon_state = "hudfan_no"
var/obj/item/clothing/under/U = get_item_by_slot(ITEM_SLOT_ICLOTHING)
if(U)
if(istype(U.attached_accessory, /obj/item/clothing/accessory/fan_mime_pin))
holder.icon_state = "fan_mime_pin"
else if(istype(U.attached_accessory, /obj/item/clothing/accessory/fan_clown_pin))
holder.icon_state = "fan_clown_pin"

/***********************************************
Security HUDs! Basic mode shows only the job.
************************************************/
Expand Down
2 changes: 2 additions & 0 deletions code/game/machinery/PDApainter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
icon_state = "pdapainter"
base_icon_state = "pdapainter"
density = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = IDLE_DRAW_MINIMAL
max_integrity = 200
var/obj/item/pda/storedpda = null
var/list/colorlist = list()
Expand Down
7 changes: 5 additions & 2 deletions code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
icon_state = "sleeper"
base_icon_state = "sleeper"
density = FALSE
use_power = IDLE_POWER_USE
idle_power_usage = IDLE_DRAW_LOW
state_open = TRUE
circuit = /obj/item/circuitboard/machine/sleeper
clicksound = 'sound/machines/pda_button1.ogg'
Expand Down Expand Up @@ -100,7 +102,7 @@
playsound(src, 'sound/machines/synth_yes.ogg', 50, TRUE, frequency = rand(5120, 8800))
target.apply_status_effect(STATUS_EFFECT_STASIS, STASIS_MACHINE_EFFECT)
target.ExtinguishMob()
use_power = ACTIVE_POWER_USE
set_active_power()

/obj/machinery/sleeper/proc/thaw_them(mob/living/target)
if(IS_IN_STASIS(target))
Expand All @@ -109,7 +111,8 @@

/obj/machinery/sleeper/process()
if(!occupant || !isliving(occupant))
use_power = IDLE_POWER_USE
if(use_static_power != IDLE_POWER_USE)
set_idle_power()
return
var/mob/living/L_occupant = occupant
if(stasis_running())
Expand Down
Loading

0 comments on commit 6f7fa4f

Please sign in to comment.