mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
This reverts commit 38d1837824.
This commit is contained in:
@@ -499,39 +499,48 @@
|
|||||||
/proc/is_blocked_turf(var/turf/T, var/atom/movable/exclude)
|
/proc/is_blocked_turf(var/turf/T, var/atom/movable/exclude)
|
||||||
return T.density || T.has_dense_content(exclude) != 0
|
return T.density || T.has_dense_content(exclude) != 0
|
||||||
|
|
||||||
/image/progressbar
|
|
||||||
icon = 'icons/effects/doafter_icon.dmi'
|
|
||||||
icon_state = "prog_bar_0"
|
|
||||||
pixel_z = WORLD_ICON_SIZE
|
|
||||||
plane = HUD_PLANE
|
|
||||||
layer = HUD_ABOVE_ITEM_LAYER
|
|
||||||
appearance_flags = RESET_COLOR | RESET_TRANSFORM
|
|
||||||
|
|
||||||
//if needs_item is 0 it won't need any item that existed in "holding" to finish
|
//if needs_item is 0 it won't need any item that existed in "holding" to finish
|
||||||
/proc/do_mob(var/mob/user , var/mob/target, var/delay = 30, var/numticks = 10, var/needs_item = 1, var/showtarget = TRUE) //This is quite an ugly solution but i refuse to use the old request system.
|
/proc/do_mob(var/mob/user , var/mob/target, var/delay = 30, var/numticks = 10, var/needs_item = 1) //This is quite an ugly solution but i refuse to use the old request system.
|
||||||
if(!user || !target)
|
if(!user || !target)
|
||||||
return 0
|
return 0
|
||||||
var/user_loc = user.loc
|
var/user_loc = user.loc
|
||||||
var/target_loc = target.loc
|
var/target_loc = target.loc
|
||||||
var/holding = user.get_active_hand()
|
var/holding = user.get_active_hand()
|
||||||
var/delayfraction = round(delay/numticks)
|
var/delayfraction = round(delay/numticks)
|
||||||
var/image/progressbar/progbar = new("icon" = 'icons/effects/doafter_icon.dmi', "loc" = target, "icon_state" = "prog_bar_0")
|
var/image/progbar
|
||||||
//if(!barbar)
|
if(user && user.client && user.client.prefs.progress_bars)
|
||||||
//barbar = image("icon" = 'icons/effects/doafter_icon.dmi', "loc" = user, "icon_state" = "none")
|
if(!progbar)
|
||||||
//barbar.pixel_y = 36
|
progbar = image("icon" = 'icons/effects/doafter_icon.dmi', "loc" = target, "icon_state" = "prog_bar_0")
|
||||||
|
progbar.plane = HUD_PLANE
|
||||||
|
progbar.layer = HUD_ABOVE_ITEM_LAYER
|
||||||
|
progbar.pixel_z = WORLD_ICON_SIZE
|
||||||
|
//if(!barbar)
|
||||||
|
//barbar = image("icon" = 'icons/effects/doafter_icon.dmi', "loc" = user, "icon_state" = "none")
|
||||||
|
//barbar.pixel_y = 36
|
||||||
//var/oldstate
|
//var/oldstate
|
||||||
for (var/i = 1 to numticks)
|
for (var/i = 1 to numticks)
|
||||||
if(progbar)
|
if(user && user.client && user.client.prefs.progress_bars && progbar)
|
||||||
//oldstate = progbar.icon_state
|
//oldstate = progbar.icon_state
|
||||||
progbar.icon_state = "prog_bar_[round(((i / numticks) * 100), 10)]"
|
progbar.icon_state = "prog_bar_[round(((i / numticks) * 100), 10)]"
|
||||||
if(user && user.client && user.client.prefs.progress_bars)
|
user.client.images |= progbar
|
||||||
user.client.images |= progbar
|
|
||||||
if(target && target.client && target.client.prefs.progress_bars && showtarget)
|
|
||||||
target.client.images |= progbar
|
|
||||||
sleep(delayfraction)
|
sleep(delayfraction)
|
||||||
if (!user || !target || user.loc != user_loc || target.loc != target_loc || (needs_item && (holding && !user.is_holding_item(holding)) || (!holding && user.get_active_hand())) || user.isStunned())
|
if(!user || !target)
|
||||||
if(progbar)
|
if(progbar)
|
||||||
stop_progress_bar(user,target,progbar)
|
progbar.icon_state = "prog_bar_stopped"
|
||||||
|
spawn(2)
|
||||||
|
if(user && user.client)
|
||||||
|
user.client.images -= progbar
|
||||||
|
if(progbar)
|
||||||
|
progbar.loc = null
|
||||||
|
return 0
|
||||||
|
if ( user.loc != user_loc || target.loc != target_loc || (needs_item && (holding && !user.is_holding_item(holding)) || (!holding && user.get_active_hand())) || user.isStunned())
|
||||||
|
if(progbar)
|
||||||
|
progbar.icon_state = "prog_bar_stopped"
|
||||||
|
spawn(2)
|
||||||
|
if(user && user.client)
|
||||||
|
user.client.images -= progbar
|
||||||
|
if(progbar)
|
||||||
|
progbar.loc = null
|
||||||
return 0
|
return 0
|
||||||
if(user && user.client)
|
if(user && user.client)
|
||||||
user.client.images -= progbar
|
user.client.images -= progbar
|
||||||
@@ -539,7 +548,7 @@
|
|||||||
progbar.loc = null
|
progbar.loc = null
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/proc/do_after_many(var/mob/user, var/list/targets, var/delay, var/numticks = 10, var/needhand = TRUE, var/use_user_turf = FALSE, var/showtarget = TRUE)
|
/proc/do_after_many(var/mob/user, var/list/targets, var/delay, var/numticks = 10, var/needhand = TRUE, var/use_user_turf = FALSE)
|
||||||
if(!user || numticks == 0 || !targets || !targets.len)
|
if(!user || numticks == 0 || !targets || !targets.len)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -555,13 +564,9 @@
|
|||||||
if(user.client && user.client.prefs.progress_bars)
|
if(user.client && user.client.prefs.progress_bars)
|
||||||
for(var/target in targets)
|
for(var/target in targets)
|
||||||
if(!targets[target])
|
if(!targets[target])
|
||||||
var/image/progressbar/new_progress_bar = new("icon" = 'icons/effects/doafter_icon.dmi', "loc" = target, "icon_state" = "prog_bar_0")
|
var/image/new_progress_bar = create_progress_bar_on(target)
|
||||||
targets[target] = new_progress_bar
|
targets[target] = new_progress_bar
|
||||||
user.client.images += new_progress_bar
|
user.client.images += new_progress_bar
|
||||||
if(showtarget && ismob(target))
|
|
||||||
var/mob/mtarget = target
|
|
||||||
if(mtarget.client && mtarget.client.prefs.progress_bars)
|
|
||||||
mtarget.client.images += new_progress_bar
|
|
||||||
for(var/i = 1 to numticks)
|
for(var/i = 1 to numticks)
|
||||||
for(var/target in targets)
|
for(var/target in targets)
|
||||||
var/image/target_progress_bar = targets[target]
|
var/image/target_progress_bar = targets[target]
|
||||||
@@ -573,31 +578,37 @@
|
|||||||
if(!user || user.isStunned() || user_loc_to_check != initial_user_location || !target || target.loc != initial_target_location)
|
if(!user || user.isStunned() || user_loc_to_check != initial_user_location || !target || target.loc != initial_target_location)
|
||||||
for(var/target_ in targets)
|
for(var/target_ in targets)
|
||||||
var/image/target_progress_bar = targets[target_]
|
var/image/target_progress_bar = targets[target_]
|
||||||
stop_progress_bar(user, target_, target_progress_bar)
|
stop_progress_bar(user, target_progress_bar)
|
||||||
return FALSE
|
return FALSE
|
||||||
if(needhand && ((holding && !user.is_holding_item(holding)) || (!holding && user.get_active_hand())))
|
if(needhand && ((holding && !user.is_holding_item(holding)) || (!holding && user.get_active_hand())))
|
||||||
for(var/target_ in targets)
|
for(var/target_ in targets)
|
||||||
var/image/target_progress_bar = targets[target_]
|
var/image/target_progress_bar = targets[target_]
|
||||||
stop_progress_bar(user, target_, target_progress_bar)
|
stop_progress_bar(user, target_progress_bar)
|
||||||
return FALSE
|
return FALSE
|
||||||
for(var/target in targets)
|
for(var/target in targets)
|
||||||
var/image/target_progress_bar = targets[target]
|
var/image/target_progress_bar = targets[target]
|
||||||
remove_progress_bar(user, target, target_progress_bar)
|
remove_progress_bar(user, target_progress_bar)
|
||||||
|
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/proc/remove_progress_bar(var/mob/user, var/mob/target, var/image/progress_bar)
|
/proc/create_progress_bar_on(var/atom/target)
|
||||||
if(istype(user) && user.client)
|
var/image/progress_bar = image("icon" = 'icons/effects/doafter_icon.dmi', "loc" = target, "icon_state" = "prog_bar_0")
|
||||||
|
progress_bar.pixel_z = WORLD_ICON_SIZE
|
||||||
|
progress_bar.plane = HUD_PLANE
|
||||||
|
progress_bar.layer = HUD_ABOVE_ITEM_LAYER
|
||||||
|
progress_bar.appearance_flags = RESET_COLOR | RESET_TRANSFORM
|
||||||
|
return progress_bar
|
||||||
|
|
||||||
|
/proc/remove_progress_bar(var/mob/user, var/image/progress_bar)
|
||||||
|
if(user && user.client)
|
||||||
user.client.images -= progress_bar
|
user.client.images -= progress_bar
|
||||||
if(istype(target) && target.client)
|
|
||||||
target.client.images -= progress_bar
|
|
||||||
if(progress_bar)
|
if(progress_bar)
|
||||||
progress_bar.loc = null
|
progress_bar.loc = null
|
||||||
|
|
||||||
/proc/stop_progress_bar(var/mob/user, var/mob/target, var/image/progress_bar)
|
/proc/stop_progress_bar(var/mob/user, var/image/progress_bar)
|
||||||
progress_bar.icon_state = "prog_bar_stopped"
|
progress_bar.icon_state = "prog_bar_stopped"
|
||||||
spawn(0.2 SECONDS)
|
spawn(0.2 SECONDS)
|
||||||
remove_progress_bar(user, target, progress_bar)
|
remove_progress_bar(user, progress_bar)
|
||||||
|
|
||||||
// Returns TRUE if the checks passed
|
// Returns TRUE if the checks passed
|
||||||
/proc/do_after_default_checks(mob/user, use_user_turf, user_original_location, atom/target, target_original_location, needhand, obj/item/originally_held_item)
|
/proc/do_after_default_checks(mob/user, use_user_turf, user_original_location, atom/target, target_original_location, needhand, obj/item/originally_held_item)
|
||||||
@@ -634,7 +645,7 @@
|
|||||||
* * use_user_turf - if TRUE, the turf of the user is checked instead of its location. default FALSE
|
* * use_user_turf - if TRUE, the turf of the user is checked instead of its location. default FALSE
|
||||||
* * custom_checks - if specified, the return value of this callback (called every `delay/numticks` seconds) will determine whether the action succeeded
|
* * custom_checks - if specified, the return value of this callback (called every `delay/numticks` seconds) will determine whether the action succeeded
|
||||||
*/
|
*/
|
||||||
/proc/do_after(var/mob/user as mob, var/atom/target, var/delay as num, var/numticks = 10, var/needhand = TRUE, var/use_user_turf = FALSE, callback/custom_checks, var/showtarget = TRUE)
|
/proc/do_after(var/mob/user as mob, var/atom/target, var/delay as num, var/numticks = 10, var/needhand = TRUE, var/use_user_turf = FALSE, callback/custom_checks)
|
||||||
if(!user || isnull(user))
|
if(!user || isnull(user))
|
||||||
return 0
|
return 0
|
||||||
if(numticks == 0)
|
if(numticks == 0)
|
||||||
@@ -650,17 +661,25 @@
|
|||||||
Location = user.loc
|
Location = user.loc
|
||||||
var/holding = user.get_active_hand()
|
var/holding = user.get_active_hand()
|
||||||
var/target_location = target.loc
|
var/target_location = target.loc
|
||||||
var/image/progressbar/progbar = new("icon" = 'icons/effects/doafter_icon.dmi', "loc" = target, "icon_state" = "prog_bar_0")
|
var/image/progbar
|
||||||
|
//var/image/barbar
|
||||||
|
if(user && user.client && user.client.prefs.progress_bars && target)
|
||||||
|
if(!progbar)
|
||||||
|
progbar = image("icon" = 'icons/effects/doafter_icon.dmi', "loc" = target, "icon_state" = "prog_bar_0")
|
||||||
|
progbar.pixel_z = WORLD_ICON_SIZE
|
||||||
|
progbar.plane = HUD_PLANE
|
||||||
|
progbar.layer = HUD_ABOVE_ITEM_LAYER
|
||||||
|
progbar.appearance_flags = RESET_COLOR | RESET_TRANSFORM
|
||||||
for (var/i = 1 to numticks)
|
for (var/i = 1 to numticks)
|
||||||
if(!progbar && target)
|
if(user && user.client && user.client.prefs.progress_bars && target)
|
||||||
progbar = new("icon" = 'icons/effects/doafter_icon.dmi', "loc" = target, "icon_state" = "prog_bar_0")
|
if(!progbar)
|
||||||
progbar.icon_state = "prog_bar_[round(((i / numticks) * 100), 10)]"
|
progbar = image("icon" = 'icons/effects/doafter_icon.dmi', "loc" = target, "icon_state" = "prog_bar_0")
|
||||||
if(user && user.client && user.client.prefs.progress_bars)
|
progbar.pixel_z = WORLD_ICON_SIZE
|
||||||
|
progbar.plane = HUD_PLANE
|
||||||
|
progbar.layer = HUD_ABOVE_ITEM_LAYER
|
||||||
|
progbar.appearance_flags = RESET_COLOR | RESET_TRANSFORM
|
||||||
|
progbar.icon_state = "prog_bar_[round(((i / numticks) * 100), 10)]"
|
||||||
user.client.images |= progbar
|
user.client.images |= progbar
|
||||||
if(showtarget && ismob(target))
|
|
||||||
var/mob/mtarget = target
|
|
||||||
if(mtarget.client && mtarget.client.prefs.progress_bars)
|
|
||||||
mtarget.client.images |= progbar
|
|
||||||
sleep(delayfraction)
|
sleep(delayfraction)
|
||||||
var/success
|
var/success
|
||||||
if(custom_checks)
|
if(custom_checks)
|
||||||
@@ -669,9 +688,12 @@
|
|||||||
success = do_after_default_checks(user, use_user_turf, Location, target, target_location, needhand, holding)
|
success = do_after_default_checks(user, use_user_turf, Location, target, target_location, needhand, holding)
|
||||||
if(!success)
|
if(!success)
|
||||||
if(progbar)
|
if(progbar)
|
||||||
stop_progress_bar(user, target, progbar)
|
stop_progress_bar(user, progbar)
|
||||||
return 0
|
return 0
|
||||||
remove_progress_bar(user,target,progbar)
|
if(user && user.client)
|
||||||
|
user.client.images -= progbar
|
||||||
|
if(progbar)
|
||||||
|
progbar.loc = null
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/proc/do_flick(var/atom/A, var/icon_state, var/time)
|
/proc/do_flick(var/atom/A, var/icon_state, var/time)
|
||||||
|
|||||||
@@ -175,7 +175,7 @@
|
|||||||
|
|
||||||
target.assaulted_by(assailant)
|
target.assaulted_by(assailant)
|
||||||
var/initial_silentbite = silentbite //No switching bite types after latching onto someone
|
var/initial_silentbite = silentbite //No switching bite types after latching onto someone
|
||||||
while(do_mob(assailant, target, (5 SECONDS) * (initial_silentbite + 1), showtarget = !initial_silentbite))
|
while(do_mob(assailant, target, (5 SECONDS) * (initial_silentbite + 1)))
|
||||||
if(!isvampire(assailant))
|
if(!isvampire(assailant))
|
||||||
to_chat(assailant, "<span class='warning'>Your fangs have disappeared!</span>")
|
to_chat(assailant, "<span class='warning'>Your fangs have disappeared!</span>")
|
||||||
draining = null
|
draining = null
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
target_item.add_fingerprint(user) //We don't need to be successful in order to get our prints on the thing
|
target_item.add_fingerprint(user) //We don't need to be successful in order to get our prints on the thing
|
||||||
|
|
||||||
if(do_mob(user, src, strip_time(), 10, 0, !pickpocket)) //Fails if the user moves, changes held item, is incapacitated, etc.
|
if(do_mob(user, src, strip_time(), 10, 0)) //Fails if the user moves, changes held item, is incapacitated, etc.
|
||||||
if(temp_loc != target_item.loc) //This will also fail if the item to strip went anywhere, necessary because do_mob() doesn't keep track of it.
|
if(temp_loc != target_item.loc) //This will also fail if the item to strip went anywhere, necessary because do_mob() doesn't keep track of it.
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
var/obj/item/held = user.get_active_hand()
|
var/obj/item/held = user.get_active_hand()
|
||||||
|
|
||||||
if(do_mob(user, src, reversestrip_time(), showtarget = !pickpocket)) //Fails if the user moves, changes held item, is incapacitated, etc.
|
if(do_mob(user, src, reversestrip_time())) //Fails if the user moves, changes held item, is incapacitated, etc.
|
||||||
if(held.mob_can_equip(src, slot, disable_warning = 1) == CAN_EQUIP) //Do not accept CAN_EQUIP_BUT_SLOT_TAKEN as valid!
|
if(held.mob_can_equip(src, slot, disable_warning = 1) == CAN_EQUIP) //Do not accept CAN_EQUIP_BUT_SLOT_TAKEN as valid!
|
||||||
user.drop_from_inventory(held)
|
user.drop_from_inventory(held)
|
||||||
src.equip_to_slot(held, slot) //Not using equip_to_slot_if_possible() because we want to check that the guy can wear this before dropping it
|
src.equip_to_slot(held, slot) //Not using equip_to_slot_if_possible() because we want to check that the guy can wear this before dropping it
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
/mob/living/proc/reversestrip_into_hand(var/mob/living/user, var/index, var/pickpocket = FALSE)
|
/mob/living/proc/reversestrip_into_hand(var/mob/living/user, var/index, var/pickpocket = FALSE)
|
||||||
var/obj/item/held = user.get_active_hand()
|
var/obj/item/held = user.get_active_hand()
|
||||||
|
|
||||||
if(do_mob(user, src, reversestrip_time(), showtarget = !pickpocket)) //Fails if the user moves, changes held item, is incapacitated, etc.
|
if(do_mob(user, src, reversestrip_time())) //Fails if the user moves, changes held item, is incapacitated, etc.
|
||||||
if(src.put_in_hand_check(held, index))
|
if(src.put_in_hand_check(held, index))
|
||||||
user.drop_from_inventory(held)
|
user.drop_from_inventory(held)
|
||||||
src.put_in_hand(index, held)
|
src.put_in_hand(index, held)
|
||||||
@@ -269,10 +269,9 @@
|
|||||||
if(suit.has_sensor >= 2)
|
if(suit.has_sensor >= 2)
|
||||||
to_chat(user, "<span class='warning'>\The [src]'s suit sensor controls are locked.</span>")
|
to_chat(user, "<span class='warning'>\The [src]'s suit sensor controls are locked.</span>")
|
||||||
return
|
return
|
||||||
var/pickpocket = user.isGoodPickpocket()
|
if(!user.isGoodPickpocket())
|
||||||
if(!pickpocket)
|
|
||||||
visible_message("<span class='warning'>\The [user] is trying to set [src]'s suit sensors.</span>", "<span class='danger'>\The [user] is trying to set your suit sensors!</span>")
|
visible_message("<span class='warning'>\The [user] is trying to set [src]'s suit sensors.</span>", "<span class='danger'>\The [user] is trying to set your suit sensors!</span>")
|
||||||
if(do_mob(user, src, user.strip_time(), showtarget = !pickpocket))
|
if(do_mob(user, src, user.strip_time()))
|
||||||
var/newmode = suit.set_sensors(user)
|
var/newmode = suit.set_sensors(user)
|
||||||
if(newmode)
|
if(newmode)
|
||||||
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their sensors set to [newmode] by [user.name] ([user.ckey])</font>")
|
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their sensors set to [newmode] by [user.name] ([user.ckey])</font>")
|
||||||
@@ -297,10 +296,9 @@
|
|||||||
to_chat(user, "<span class='warning'>\The [src] does not have a tank to connect to.</span>")
|
to_chat(user, "<span class='warning'>\The [src] does not have a tank to connect to.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
var/pickpocket = user.isGoodPickpocket()
|
if(!user.isGoodPickpocket())
|
||||||
if(!pickpocket)
|
|
||||||
visible_message("<span class='warning'>\The [user] is trying to set [src]'s internals.</span>", "<span class='danger'>\The [user] is trying to set your internals!</span>")
|
visible_message("<span class='warning'>\The [user] is trying to set [src]'s internals.</span>", "<span class='danger'>\The [user] is trying to set your internals!</span>")
|
||||||
|
|
||||||
if(do_mob(user, src, user.strip_time(), showtarget = !pickpocket))
|
if(do_mob(user, src, user.strip_time()))
|
||||||
src.toggle_internals(user, T)
|
src.toggle_internals(user, T)
|
||||||
show_inv(user)
|
show_inv(user)
|
||||||
|
|||||||
Reference in New Issue
Block a user