forked from Bubberstation/Bubberstation
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
875 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* # COMSIG_MICRO_PICKUP_FEET | ||
* From /datum/element/mob_holder/micro | ||
* Used by signals for determining whether you can pick up someone with your feet, kinky. | ||
*/ | ||
#define COMSIG_MICRO_PICKUP_FEET "micro_force_grabbed" | ||
|
||
/* | ||
* # COMSIG_MOB_RESIZED | ||
* From /mob/living | ||
* Used by signals for whenever a mob has changed sizes. | ||
*/ | ||
#define COMSIG_MOB_RESIZED "mob_resized" |
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,46 @@ | ||
//I am not a coder. Please fucking tear apart my code, and insult me for how awful I am at coding. Please and thank you. -Dahlular | ||
//alright bet -BoxBoy | ||
#define RESIZE_MACRO 6 | ||
#define RESIZE_HUGE 4 | ||
#define RESIZE_BIG 2 | ||
#define RESIZE_NORMAL 1 | ||
#define RESIZE_SMALL 0.75 | ||
#define RESIZE_TINY 0.50 | ||
#define RESIZE_MICRO 0.25 | ||
|
||
//averages | ||
#define RESIZE_A_MACROHUGE (RESIZE_MACRO + RESIZE_HUGE) / 2 | ||
#define RESIZE_A_HUGEBIG (RESIZE_HUGE + RESIZE_BIG) / 2 | ||
#define RESIZE_A_BIGNORMAL (RESIZE_BIG + RESIZE_NORMAL) / 2 | ||
#define RESIZE_A_NORMALSMALL (RESIZE_NORMAL + RESIZE_SMALL) / 2 | ||
#define RESIZE_A_SMALLTINY (RESIZE_SMALL + RESIZE_TINY) / 2 | ||
#define RESIZE_A_TINYMICRO (RESIZE_TINY + RESIZE_MICRO) / 2 | ||
|
||
/* | ||
* # get_size(mob/living/target) | ||
* Grabs the size of your critter, works for any living creature even carbons with dna | ||
* Now, please don't tell me your creature has a dna but it's very snowflakey, then i say you should rewrite your mob | ||
* instead of touching this file. | ||
*/ | ||
/proc/get_size(mob/living/target) | ||
if(!target) | ||
CRASH("get_size(NULL) was called") | ||
if(!istype(target)) | ||
CRASH("get_size() called with an invalid target, only use this for /mob/living!") | ||
var/datum/dna/has_dna = target.has_dna() | ||
if(ishuman(target) && has_dna) | ||
return has_dna.features["body_size"] | ||
else | ||
return target.size_multiplier | ||
|
||
/* | ||
* # COMPARE_SIZES(mob/living/user, mob/living/target) | ||
* Returns how bigger or smaller the target is in comparison to user | ||
* Example: | ||
* - user = 2, target = 1, result = 0.5 | ||
* - user = 1, target = 2, result = 2 | ||
* Args: | ||
* - user = /mob/living | ||
* - target = /mob/living | ||
*/ | ||
#define COMPARE_SIZES(user, target) abs((get_size(user) / get_size(target))) |
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,79 @@ | ||
/datum/element/mob_holder | ||
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY | ||
argument_hash_start_idx = 2 | ||
var/worn_state | ||
var/alt_worn | ||
var/right_hand | ||
var/left_hand | ||
var/inv_slots | ||
var/proctype //if present, will be invoked on headwear generation. | ||
|
||
/datum/element/mob_holder/Attach(datum/target, worn_state, alt_worn, right_hand, left_hand, inv_slots = NONE, proctype) | ||
. = ..() | ||
|
||
if(!isliving(target)) | ||
return ELEMENT_INCOMPATIBLE | ||
|
||
src.worn_state = worn_state | ||
src.alt_worn = alt_worn | ||
src.right_hand = right_hand | ||
src.left_hand = left_hand | ||
src.inv_slots = inv_slots | ||
src.proctype = proctype | ||
|
||
RegisterSignal(target, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, PROC_REF(on_requesting_context_from_item)) | ||
RegisterSignal(target, COMSIG_CLICK_ALT, PROC_REF(mob_try_pickup)) | ||
RegisterSignal(target, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) | ||
|
||
/datum/element/mob_holder/Detach(datum/source, force) | ||
. = ..() | ||
UnregisterSignal(source, list(COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, COMSIG_CLICK_ALT, COMSIG_ATOM_EXAMINE)) | ||
|
||
/datum/element/mob_holder/proc/on_examine(mob/living/source, mob/user, list/examine_list) | ||
if(ishuman(user) && !istype(source.loc, /obj/item/clothing/head/mob_holder)) | ||
examine_list += span_notice("Looks like [source.p_they(FALSE)] can be picked up with <b>Alt+Click</b>!") | ||
|
||
/datum/element/mob_holder/proc/on_requesting_context_from_item( | ||
obj/source, | ||
list/context, | ||
obj/item/held_item, | ||
mob/living/user, | ||
) | ||
SIGNAL_HANDLER | ||
|
||
if(ishuman(user)) | ||
LAZYSET(context, SCREENTIP_CONTEXT_ALT_LMB, "Pick up") | ||
return CONTEXTUAL_SCREENTIP_SET | ||
|
||
/datum/element/mob_holder/proc/mob_try_pickup(mob/living/source, mob/user) | ||
if(!ishuman(user) || !user.Adjacent(source) || user.incapacitated()) | ||
return FALSE | ||
if(user.get_active_held_item()) | ||
to_chat(user, span_warning("Your hands are full!")) | ||
return FALSE | ||
if(source.buckled) | ||
to_chat(user, span_warning("[source] is buckled to something!")) | ||
return FALSE | ||
if(source == user) | ||
to_chat(user, span_warning("You can't pick yourself up.")) | ||
return FALSE | ||
source.visible_message(span_warning("[user] starts picking up [source]."), \ | ||
span_userdanger("[user] starts picking you up!")) | ||
if(!do_after(user, 2 SECONDS, target = source) || source.buckled) | ||
return FALSE | ||
|
||
source.visible_message(span_warning("[user] picks up [source]!"), \ | ||
span_userdanger("[user] picks you up!")) | ||
to_chat(user, span_notice("You pick [source] up.")) | ||
source.drop_all_held_items() | ||
var/obj/item/clothing/head/mob_holder/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) | ||
|
||
if(proctype) | ||
INVOKE_ASYNC(src, proctype, source, holder, user) | ||
user.put_in_hands(holder) | ||
return TRUE | ||
|
||
/datum/element/mob_holder/proc/drone_worn_icon(mob/living/basic/drone/D, obj/item/clothing/head/mob_holder/holder, mob/user) | ||
var/new_state = "[D.visualAppearance]_hat" | ||
holder.inhand_icon_state = new_state | ||
holder.icon_state = new_state |
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
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
Oops, something went wrong.