Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TESTMERGE] Spacepods? #983

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fd59386
Spacepods?
MrRomainzZ Feb 2, 2024
19c1aa4
Spacepods?
MrRomainzZ Feb 2, 2024
04912bb
Merge branch 'spacepods' of https://github.com/MrRomainzZ/Paradise-SS…
MrRomainzZ Feb 2, 2024
fd70b1c
Small oversight from me
MrRomainzZ Feb 2, 2024
c1aa0da
Testmerge "is_helpers" fix + Indentation fix
MrRomainzZ Feb 2, 2024
b53b4f8
Small linter fix
MrRomainzZ Feb 2, 2024
ce4ddd8
Small linter fix x2
MrRomainzZ Feb 2, 2024
357bec6
Small linter fix x3
MrRomainzZ Feb 2, 2024
3334f27
Spacepods Test Map
MrRomainzZ Feb 2, 2024
866ba4c
Action buttons possible fix
MrRomainzZ Feb 2, 2024
db5222d
Merge branch 'spacepods' of https://github.com/MrRomainzZ/Paradise-SS…
MrRomainzZ Feb 2, 2024
8bc5ad9
Action-buttons possible fix x2
MrRomainzZ Feb 2, 2024
9288485
Runtime error possible fix 1 / 2
MrRomainzZ Feb 6, 2024
f023f7c
Make em slower
MrRomainzZ Feb 6, 2024
8858d7a
Mass comment update
MrRomainzZ Feb 6, 2024
990698a
Spacepods?
MrRomainzZ Feb 2, 2024
e8016d6
Small oversight from me
MrRomainzZ Feb 2, 2024
ee22e14
Testmerge "is_helpers" fix + Indentation fix
MrRomainzZ Feb 2, 2024
85ae2b5
Small linter fix
MrRomainzZ Feb 2, 2024
6485604
Small linter fix x2
MrRomainzZ Feb 2, 2024
75d7867
Action buttons possible fix
MrRomainzZ Feb 2, 2024
c2d7f85
Action-buttons possible fix x2
MrRomainzZ Feb 2, 2024
0a1e28c
Runtime error possible fix 1 / 2
MrRomainzZ Feb 6, 2024
e95a4c3
Make em slower
MrRomainzZ Feb 6, 2024
9be891a
Mass comment update
MrRomainzZ Feb 6, 2024
4f8dcac
Merge branches 'spacepods' and 'spacepods' of https://github.com/MrRo…
MrRomainzZ Feb 6, 2024
2c4e8ff
More drag in atmos + better bump variables + comment fix
MrRomainzZ Feb 7, 2024
0dae767
You should be able to insert objects in pod at any adjacent turf
MrRomainzZ Feb 7, 2024
0e28b24
Adapting to avoid merge conflicts
MrRomainzZ Mar 5, 2024
aecb799
Removes duplicate sprite of burst taser (?)
MrRomainzZ Mar 5, 2024
cc7f266
Merge branch 'master' into spacepods
MrRomainzZ Mar 8, 2024
39794e3
Fix status
MrRomainzZ Mar 8, 2024
e83c7f8
Merge branch 'master' into spacepods
MrRomainzZ Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

#define BELOW_MOB_LAYER 3.7
#define LYING_MOB_LAYER 3.8
#define SPACEPOD_LAYER 3.9 // yogs
//#define MOB_LAYER 4 //For easy recordkeeping; this is a byond define
#define ABOVE_MOB_LAYER 4.1
#define HITSCAN_LAYER 4.2
Expand Down
18 changes: 18 additions & 0 deletions code/__DEFINES/spacepods_defines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#define SPACEPOD_EMPTY 1
#define SPACEPOD_WIRES_LOOSE 2
#define SPACEPOD_WIRES_SECURED 3
#define SPACEPOD_CIRCUIT_LOOSE 4
#define SPACEPOD_CIRCUIT_SECURED 5
#define SPACEPOD_CORE_LOOSE 6
#define SPACEPOD_CORE_SECURED 7
#define SPACEPOD_BULKHEAD_LOOSE 8
#define SPACEPOD_BULKHEAD_SECURED 9
#define SPACEPOD_BULKHEAD_WELDED 10
#define SPACEPOD_ARMOR_LOOSE 11
#define SPACEPOD_ARMOR_SECURED 12
#define SPACEPOD_ARMOR_WELDED 13

#define SPACEPOD_SLOT_CARGO "cargo"
#define SPACEPOD_SLOT_MISC "misc"
#define SPACEPOD_SLOT_WEAPON "weapon"
#define SPACEPOD_SLOT_LOCK "lock"
2 changes: 2 additions & 0 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@
///If the lazy list is currently initialized find item I in list L
#define LAZYIN(L, I) (L && (I in L))

#define LAZYOR(L, I) if(!L) { L = list(); } L |= I;

//same, but returns nothing and acts on list in place
/proc/shuffle_inplace(list/L)
if(!L)
Expand Down
11 changes: 11 additions & 0 deletions code/_onclick/adjacent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/atom/proc/Adjacent(atom/neighbor) // basic inheritance, unused
return 0

/atom/proc/AdjacentByNeighbor(atom/movable/neighbor)
return 0

// Not a sane use of the function and (for now) indicative of an error elsewhere
/area/Adjacent(atom/neighbor)
CRASH("Call to /area/Adjacent(), unimplemented proc")
Expand Down Expand Up @@ -71,6 +74,14 @@
if(T.Adjacent(neighbor,src)) return 1
return 0

// RMNZ: Added different adjacent check for spacepods?
/atom/movable/AdjacentByNeighbor(atom/movable/neighbor)
if(neighbor == loc) return 1
if(!isturf(loc)) return 0
for(var/turf/T in neighbor.locs)
if(T.Adjacent(neighbor,src)) return 1
return 0

// This is necessary for storage items not on your person.
/obj/item/Adjacent(atom/neighbor, recurse = 1)
if(neighbor == loc) return 1
Expand Down
13 changes: 13 additions & 0 deletions code/_onclick/drag_drop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,16 @@ to inform the game this action was expected and its fine
*/
/atom/proc/MouseDrop_T(atom/dropping, mob/user, params) // return TRUE if you want to prevent us click the object after it
return

/client/MouseMove(object, location, control, params)
mouseParams = params
mouse_location_ref = location
mouse_object_ref = object
mouseControlObject = control
if(mob && LAZYLEN(mob.mousemove_intercept_objects))
for(var/datum/D in mob.mousemove_intercept_objects)
D.onMouseMove(object, location, control, params)
..()

/datum/proc/onMouseMove(object, location, control, params)
return
12 changes: 12 additions & 0 deletions code/controllers/subsystem/processing/spacepod.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Yogstation use fastprocess subsystem but for Paradise it causes
// movement lag (updates, like it should, 5 times / second).
// This wait time (0.075) is the closest (and laziest) I could get to
// Yogstation's movement speed

// RMNZ: Maybe performance issues?

PROCESSING_SUBSYSTEM_DEF(spacepod)
name = "Spacepod"
wait = 0.075
stat_tag = "SP"
offline_implications = "Spacepods will no longer process. Shuttle call recommended."
167 changes: 167 additions & 0 deletions code/datums/components/rotation.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
//RMNZ: Please, check if this component is really needed or not
#define ROTATION_ALTCLICK (1<<0)
#define ROTATION_WRENCH (1<<1)
#define ROTATION_VERBS (1<<2)
#define ROTATION_COUNTERCLOCKWISE (1<<3)
#define ROTATION_CLOCKWISE (1<<4)
#define ROTATION_FLIP (1<<5)

/datum/component/simple_rotation
var/datum/callback/can_user_rotate //Checks if user can rotate
var/datum/callback/can_be_rotated //Check if object can be rotated at all
var/datum/callback/after_rotation //Additional stuff to do after rotation

var/rotation_flags = NONE
var/default_rotation_direction = ROTATION_CLOCKWISE

/datum/component/simple_rotation/Initialize(rotation_flags = NONE, can_user_rotate, can_be_rotated, after_rotation)
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE

//throw if no rotation direction is specificed ?

src.rotation_flags = rotation_flags

if(can_user_rotate)
src.can_user_rotate = can_user_rotate
else
src.can_user_rotate = CALLBACK(src, PROC_REF(default_can_user_rotate))

if(can_be_rotated)
src.can_be_rotated = can_be_rotated
else
src.can_be_rotated = CALLBACK(src, PROC_REF(default_can_be_rotated))

if(after_rotation)
src.after_rotation = after_rotation
else
src.after_rotation = CALLBACK(src, PROC_REF(default_after_rotation))

//Try Clockwise,counter,flip in order
if(src.rotation_flags & ROTATION_FLIP)
default_rotation_direction = ROTATION_FLIP
if(src.rotation_flags & ROTATION_COUNTERCLOCKWISE)
default_rotation_direction = ROTATION_COUNTERCLOCKWISE
if(src.rotation_flags & ROTATION_CLOCKWISE)
default_rotation_direction = ROTATION_CLOCKWISE

/datum/component/simple_rotation/proc/add_signals()
if(rotation_flags & ROTATION_ALTCLICK)
RegisterSignal(parent, COMSIG_CLICK_ALT, PROC_REF(HandRot))
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(ExamineMessage))
if(rotation_flags & ROTATION_WRENCH)
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, PROC_REF(WrenchRot))

/datum/component/simple_rotation/proc/add_verbs()
if(rotation_flags & ROTATION_VERBS)
var/atom/movable/AM = parent
if(rotation_flags & ROTATION_FLIP)
AM.verbs += /atom/movable/proc/simple_rotate_flip
if(src.rotation_flags & ROTATION_CLOCKWISE)
AM.verbs += /atom/movable/proc/simple_rotate_clockwise
if(src.rotation_flags & ROTATION_COUNTERCLOCKWISE)
AM.verbs += /atom/movable/proc/simple_rotate_counterclockwise

/datum/component/simple_rotation/proc/remove_verbs()
if(parent)
var/atom/movable/AM = parent
AM.verbs -= /atom/movable/proc/simple_rotate_flip
AM.verbs -= /atom/movable/proc/simple_rotate_clockwise
AM.verbs -= /atom/movable/proc/simple_rotate_counterclockwise

/datum/component/simple_rotation/proc/remove_signals()
UnregisterSignal(parent, list(COMSIG_CLICK_ALT, COMSIG_PARENT_EXAMINE, COMSIG_PARENT_ATTACKBY))

/datum/component/simple_rotation/RegisterWithParent()
add_verbs()
add_signals()
. = ..()

/datum/component/simple_rotation/PostTransfer()
//Because of the callbacks which we don't track cleanly we can't transfer this
//item cleanly, better to let the new of the new item create a new rotation datum
//instead (there's no real state worth transferring)
return COMPONENT_NOTRANSFER

/datum/component/simple_rotation/UnregisterFromParent()
remove_verbs()
remove_signals()
. = ..()

/datum/component/simple_rotation/Destroy()
QDEL_NULL(can_user_rotate)
QDEL_NULL(can_be_rotated)
QDEL_NULL(after_rotation)
//Signals + verbs removed via UnRegister
. = ..()

/datum/component/simple_rotation/RemoveComponent()
remove_verbs()
. = ..()

/datum/component/simple_rotation/proc/ExamineMessage(datum/source, mob/user, list/examine_list)
if(rotation_flags & ROTATION_ALTCLICK)
examine_list += "<span class='notice'>Alt-click to rotate it clockwise."

/datum/component/simple_rotation/proc/HandRot(datum/source, mob/user, rotation = default_rotation_direction)
if(!can_be_rotated.Invoke(user, rotation) || !can_user_rotate.Invoke(user, rotation))
return
BaseRot(user, rotation)

/datum/component/simple_rotation/proc/WrenchRot(datum/source, obj/item/I, mob/living/user)
if(!can_be_rotated.Invoke(user,default_rotation_direction) || !can_user_rotate.Invoke(user,default_rotation_direction))
return
if(I.tool_behaviour == TOOL_WRENCH)
BaseRot(user,default_rotation_direction)
return COMPONENT_NO_AFTERATTACK

/datum/component/simple_rotation/proc/BaseRot(mob/user,rotation_type)
var/atom/movable/AM = parent
var/rot_degree
switch(rotation_type)
if(ROTATION_CLOCKWISE)
rot_degree = -90
if(ROTATION_COUNTERCLOCKWISE)
rot_degree = 90
if(ROTATION_FLIP)
rot_degree = 180
AM.setDir(turn(AM.dir,rot_degree))
after_rotation.Invoke(user,rotation_type)

/datum/component/simple_rotation/proc/default_can_user_rotate(mob/living/user, rotation_type)
//RMNZ: Check if be_close needed or not (NO_DEXTERY isn't used in this build it seems)
// if(!istype(user) || !user.canUseTopic(parent, BE_CLOSE, NO_DEXTERY))
if(!istype(user) || !user.can_use(parent))
return FALSE
return TRUE

/datum/component/simple_rotation/proc/default_can_be_rotated(mob/user, rotation_type)
var/atom/movable/AM = parent
return !AM.anchored

/datum/component/simple_rotation/proc/default_after_rotation(mob/user, rotation_type)
to_chat(user, "<span class='notice'>You [rotation_type == ROTATION_FLIP ? "flip" : "rotate"] [parent].")

/atom/movable/proc/simple_rotate_clockwise()
set name = "Rotate Clockwise"
set category = "Object"
set src in oview(1)
var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation)
if(rotcomp)
rotcomp.HandRot(null,usr,ROTATION_CLOCKWISE)

/atom/movable/proc/simple_rotate_counterclockwise()
set name = "Rotate Counter-Clockwise"
set category = "Object"
set src in oview(1)
var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation)
if(rotcomp)
rotcomp.HandRot(null,usr,ROTATION_COUNTERCLOCKWISE)

/atom/movable/proc/simple_rotate_flip()
set name = "Flip"
set category = "Object"
set src in oview(1)
var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation)
if(rotcomp)
rotcomp.HandRot(null,usr,ROTATION_FLIP)
7 changes: 7 additions & 0 deletions code/game/objects/items/stacks/rods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ GLOBAL_LIST_INIT(rod_recipes, list (
new /datum/stack_recipe("chainlink fence door", /obj/structure/fence/door, 10, time = 1 SECONDS, one_per_turf = TRUE, on_floor = TRUE),
new /datum/stack_recipe("chainlink fence end", /obj/structure/fence/end, 3, time = 1 SECONDS, one_per_turf = TRUE, on_floor = TRUE),
)),
null,
new /datum/stack_recipe_list("octagon spacepod...", list(
new /datum/stack_recipe("aft starboard pod frame", /obj/item/pod_parts/pod_frame/aft_starboard, 15, time = 1 SECONDS, one_per_turf = TRUE, on_floor = TRUE),
new /datum/stack_recipe("aft port pod frame", /obj/item/pod_parts/pod_frame/aft_port, 15, time = 1 SECONDS, one_per_turf = TRUE, on_floor = TRUE),
new /datum/stack_recipe("fore port pod frame", /obj/item/pod_parts/pod_frame/fore_port, 15, time = 1 SECONDS, one_per_turf = TRUE, on_floor = TRUE),
new /datum/stack_recipe("fore starboard pod frame", /obj/item/pod_parts/pod_frame/fore_starboard, 15, time = 1 SECONDS, one_per_turf = TRUE, on_floor = TRUE),
)),
))

/obj/item/stack/rods
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/!mob_vars.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,9 @@
var/next_click_modifier = 1
/// Tracks the open UIs that a mob has, used in TGUI for various things, such as updating UIs
var/list/open_uis = list()

///Allows a datum to intercept all click calls this mob is the so
var/datum/click_intercept

///List of datums that this has which make use of MouseMove()
var/list/mousemove_intercept_objects
9 changes: 9 additions & 0 deletions code/modules/mob/living/carbon/human/human_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@
if(V)
status_tab_data[++status_tab_data.len] = list("Total Blood:", "[V.bloodtotal]")
status_tab_data[++status_tab_data.len] = list("Usable Blood:", "[V.bloodusable]")
if(istype(loc, /obj/spacepod)) // Spacepods!
var/obj/spacepod/S = loc
// If we want numbers instead of percents
// [S.cell ? "[round(S.cell.charge,0.1)]/[S.cell.maxcharge] KJ" : "NONE"]
status_tab_data[++status_tab_data.len] = list("Spacepod Charge:", "[S.cell ? "[round((S.cell.charge / S.cell.maxcharge) * 100, 0.1)]" : "No cell detected"]")
// Same here
// [round((S.obj_integrity / S.max_integrity) * 100, 0.1)]
status_tab_data[++status_tab_data.len] = list("Spacepod Integrity:", "[!S.obj_integrity ? "0" : "[round(S.obj_integrity, 0.1)]/[S.max_integrity]"]")
status_tab_data[++status_tab_data.len] = list("Spacepod Velocity:", "[round(sqrt(S.velocity_x*S.velocity_x+S.velocity_y*S.velocity_y), 0.1)] m/s")

/mob/living/carbon/human/ex_act(severity)
if(status_flags & GODMODE)
Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,11 @@
var/obj/mecha/M = loc
loc_temp = M.return_temperature()

#define isspacepod(A) (istype(A, /obj/spacepod)) // RMNZ: Temporary solution for testmerge. Should be in is_helpers
else if(isspacepod(loc))
var/obj/spacepod/S = loc
loc_temp = S.return_temperature()

else if(istype(loc, /obj/structure/transit_tube_pod))
loc_temp = environment.temperature

Expand Down
11 changes: 11 additions & 0 deletions code/modules/research/designs/mecha_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,14 @@
materials = list(MAT_GLASS = 1000)
build_path = /obj/item/circuitboard/mecha/reticence/targeting
category = list("Exosuit Modules")

// Pod
/datum/design/spacepod_main
name = "Circuit Design (Space Pod Mainboard)"
desc = "Allows for the construction of a spacepod mainboard."
id = "spacepod_main"
req_tech = list("programming" = 1) //RMNZ: Change req_tech
build_type = IMPRINTER
materials = list(MAT_GLASS = 1000)
build_path = /obj/item/circuitboard/mecha/pod
category = list("Exosuit Modules")
Loading
Loading