mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 02:54:41 +01:00
camera bugs now stick to things they're thrown at (#24053)
* Implements camera fu * camera bugs now stick on things they're thrown at * removes dupe code
This commit is contained in:
@@ -243,6 +243,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
|
||||
#define TRAIT_OBSCURED_WIRES "obscured_wires"
|
||||
/// Forces open doors after a delay specific to the item
|
||||
#define TRAIT_FORCES_OPEN_DOORS_ITEM "forces_open_doors_item_varient"
|
||||
/// Makes the item no longer spit out a visible message when thrown
|
||||
#define TRAIT_NO_THROWN_MESSAGE "no_message_when_thrown"
|
||||
|
||||
/// A surgical tool; when in hand in help intent (and with a surgery in progress) won't attack the user
|
||||
#define TRAIT_SURGICAL "surgical_tool"
|
||||
|
||||
@@ -102,7 +102,8 @@ GLOBAL_LIST_INIT(traits_by_type, list(
|
||||
"TRAIT_CMAGGED" = TRAIT_CMAGGED,
|
||||
"TRAIT_FORCES_OPEN_DOORS" = TRAIT_FORCES_OPEN_DOORS_ITEM,
|
||||
"TRAIT_OBSCURED_WIRES" = TRAIT_OBSCURED_WIRES,
|
||||
"TRAIT_XENO_INTERACTABLE" = TRAIT_XENO_INTERACTABLE
|
||||
"TRAIT_XENO_INTERACTABLE" = TRAIT_XENO_INTERACTABLE,
|
||||
"TRAIT_NO_THROWN_MESSAGE" = TRAIT_NO_THROWN_MESSAGE
|
||||
),
|
||||
/turf = list(
|
||||
"bluespace_speed_trait" = TRAIT_BLUESPACE_SPEED
|
||||
|
||||
@@ -24,9 +24,11 @@
|
||||
|
||||
/datum/component/sticky/RegisterWithParent()
|
||||
RegisterSignal(parent, COMSIG_ITEM_PRE_ATTACK, PROC_REF(stick_to_it))
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_IMPACT, PROC_REF(stick_to_it_throwing))
|
||||
|
||||
/datum/component/sticky/UnregisterFromParent()
|
||||
UnregisterSignal(parent, COMSIG_ITEM_PRE_ATTACK)
|
||||
UnregisterSignal(parent, COMSIG_MOVABLE_IMPACT)
|
||||
|
||||
/datum/component/sticky/proc/stick_to_it(obj/item/I, atom/target, mob/user, params)
|
||||
SIGNAL_HANDLER
|
||||
@@ -58,8 +60,23 @@
|
||||
overlay.Shift(EAST, clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2))
|
||||
overlay.Shift(NORTH, clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2))
|
||||
|
||||
attach_signals(I)
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/datum/component/sticky/proc/stick_to_it_throwing(obj/item/thrown_item, atom/hit_target, throwingdatum, params)
|
||||
SIGNAL_HANDLER
|
||||
if(hit_target.GetComponent(/datum/component/sticky))
|
||||
return
|
||||
|
||||
attached_to = hit_target
|
||||
move_to_the_thing(parent)
|
||||
|
||||
overlay = icon(thrown_item.icon, thrown_item.icon_state)
|
||||
attach_signals(thrown_item)
|
||||
|
||||
/datum/component/sticky/proc/attach_signals(obj/item/attached)
|
||||
attached_to.add_overlay(overlay, priority = TRUE)
|
||||
I.invisibility = INVISIBILITY_ABSTRACT
|
||||
attached.invisibility = INVISIBILITY_ABSTRACT
|
||||
|
||||
RegisterSignal(attached_to, COMSIG_HUMAN_MELEE_UNARMED_ATTACKBY, PROC_REF(pick_up))
|
||||
RegisterSignal(attached_to, COMSIG_PARENT_EXAMINE, PROC_REF(add_sticky_text))
|
||||
@@ -67,7 +84,6 @@
|
||||
if(ismovable(attached_to))
|
||||
RegisterSignal(attached_to, COMSIG_MOVABLE_MOVED, PROC_REF(on_move))
|
||||
START_PROCESSING(SSobj, src)
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/datum/component/sticky/proc/pick_up(atom/A, mob/living/carbon/human/user)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
@@ -62,10 +62,11 @@
|
||||
. = ..()
|
||||
link_to_camera(the_bug)
|
||||
AddComponent(/datum/component/sticky)
|
||||
ADD_TRAIT(src, TRAIT_NO_THROWN_MESSAGE, ROUNDSTART_TRAIT)
|
||||
|
||||
/obj/item/wall_bug/Destroy()
|
||||
QDEL_NULL(camera)
|
||||
. = ..()
|
||||
return ..()
|
||||
|
||||
/obj/item/wall_bug/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -697,7 +697,8 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
|
||||
return
|
||||
|
||||
if(thrown_thing)
|
||||
visible_message("<span class='danger'>[src] has thrown [thrown_thing].</span>")
|
||||
if(!HAS_TRAIT(thrown_thing, TRAIT_NO_THROWN_MESSAGE))
|
||||
visible_message("<span class='danger'>[src] has thrown [thrown_thing].</span>")
|
||||
newtonian_move(get_dir(target, src))
|
||||
thrown_thing.throw_at(target, thrown_thing.throw_range, thrown_thing.throw_speed, src, null, null, null, move_force)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user