mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-27 05:57:24 +01:00
Lets dchat-controlled mobs fire guns (#21572)
* Lets dchat-controlled mobs fire guns * Better handling for abstract items, too * better text handling * Update code/modules/mob/living/carbon/human/human_mob.dm Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
This commit is contained in:
@@ -2119,6 +2119,12 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
var/obj/item/in_hand = get_active_hand()
|
||||
|
||||
if(in_hand)
|
||||
if(in_hand.flags & NODROP)
|
||||
visible_message("<span class='warning'>[src] attempts to drop [in_hand], but it seems to be stuck to [p_their()] hand!</span>")
|
||||
return
|
||||
if(in_hand.flags & ABSTRACT)
|
||||
visible_message("<span class='notice'>[src] seems to have [p_their()] hands full!</span>")
|
||||
return
|
||||
visible_message("<span class='notice'>[src] drops [in_hand] and picks up [thing] instead!</span>")
|
||||
unEquip(in_hand)
|
||||
in_hand.forceMove(old_loc)
|
||||
@@ -2127,8 +2133,8 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
put_in_active_hand(thing)
|
||||
|
||||
/mob/living/carbon/human/proc/dchat_throw()
|
||||
var/in_hand = get_active_hand()
|
||||
if(!in_hand)
|
||||
var/obj/item/in_hand = get_active_hand()
|
||||
if(!in_hand || in_hand.flags & ABSTRACT)
|
||||
visible_message("<span class='notice'>[src] makes a throwing motion!</span>")
|
||||
return
|
||||
var/atom/possible_target
|
||||
@@ -2144,9 +2150,11 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
break
|
||||
|
||||
if(!possible_target)
|
||||
throw_item(cur_turf)
|
||||
else
|
||||
throw_item(possible_target)
|
||||
possible_target = cur_turf
|
||||
if(in_hand.flags & NODROP)
|
||||
visible_message("<span class='warning'>[src] tries to throw [in_hand][isturf(possible_target) ? "" : " towards [possible_target]"], but it won't come off [p_their()] hand!</span>")
|
||||
return
|
||||
throw_item(possible_target)
|
||||
|
||||
/mob/living/carbon/human/proc/dchat_shove()
|
||||
var/turf/ahead = get_turf(get_step(src, dir))
|
||||
@@ -2156,6 +2164,29 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
return
|
||||
dna?.species.disarm(src, H)
|
||||
|
||||
/mob/living/carbon/human/proc/dchat_shoot()
|
||||
|
||||
var/atom/possible_target
|
||||
var/cur_turf = get_turf(src)
|
||||
for(var/i in 1 to 5)
|
||||
cur_turf = get_step(cur_turf, dir)
|
||||
possible_target = locate(/mob/living) in cur_turf
|
||||
if(possible_target)
|
||||
break
|
||||
|
||||
if(!possible_target)
|
||||
possible_target = cur_turf
|
||||
|
||||
var/obj/item/gun/held_gun = get_active_hand()
|
||||
if(!held_gun)
|
||||
visible_message("<span class='warning'>[src] makes fingerguns towards [possible_target]!</span>")
|
||||
return
|
||||
if(!istype(held_gun))
|
||||
visible_message("<span class='warning'>[src] points [held_gun] towards [possible_target]!</span>")
|
||||
return
|
||||
// for his neutral special, he wields a Gun
|
||||
held_gun.afterattack(possible_target, src)
|
||||
visible_message("<span class='danger'>[src] fires [held_gun][isturf(possible_target) ? "" : " towards [possible_target]!"]</span>")
|
||||
|
||||
/mob/living/carbon/human/deadchat_plays(mode = DEADCHAT_DEMOCRACY_MODE, cooldown = 7 SECONDS)
|
||||
var/list/inputs = list(
|
||||
@@ -2166,6 +2197,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
"throw" = CALLBACK(src, PROC_REF(dchat_throw)),
|
||||
"disarm" = CALLBACK(src, PROC_REF(dchat_shove)),
|
||||
"resist" = CALLBACK(src, PROC_REF(dchat_resist)),
|
||||
"shoot" = CALLBACK(src, PROC_REF(dchat_shoot)),
|
||||
)
|
||||
|
||||
AddComponent(/datum/component/deadchat_control/cardinal_movement, mode, inputs, cooldown)
|
||||
|
||||
Reference in New Issue
Block a user