-
Notifications
You must be signed in to change notification settings - Fork 40
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
[modpack] Adds pixel shifting #197
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef MODPACK_PIXELSHIFTING | ||
#define MODPACK_PIXELSHIFTING | ||
#include "pixel_shifting.dm" | ||
#include "keybindings\mob.dm" | ||
#endif | ||
// BEGIN_INTERNALS | ||
// END_INTERNALS | ||
// BEGIN_FILE_DIR | ||
#define FILE_DIR . | ||
// END_FILE_DIR | ||
// BEGIN_PREFERENCES | ||
// END_PREFERENCES | ||
// BEGIN_INCLUDE | ||
// END_INCLUDE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/datum/keybinding/mob/pixel_shift | ||
hotkey_keys = list("Alt") | ||
name = "pixel_shifting" | ||
full_name = "Pixel shift" | ||
description = "Hold this down to pixel shift the icon of your current mob." | ||
|
||
/datum/keybinding/mob/pixel_shift/down(client/user) | ||
var/mob/client_mob = user.mob | ||
client_mob.shifting = TRUE | ||
return TRUE | ||
|
||
/datum/keybinding/mob/pixel_shift/up(client/user) | ||
var/mob/client_mob = user.mob | ||
client_mob.shifting = FALSE | ||
return TRUE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/mob | ||
/// Wether the mob is currently pixel shifted or not | ||
var/is_shifted | ||
/// If the mob is currently pixel shifting | ||
var/shifting | ||
|
||
/mob/proc/unpixel_shift() | ||
return | ||
|
||
/mob/living/unpixel_shift() | ||
if(is_shifted) | ||
is_shifted = FALSE | ||
pixel_x = initial(pixel_x) | ||
pixel_y = initial(pixel_y) | ||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Some species/mobs have their own default pixel. Use them. |
||
|
||
/mob/proc/pixel_shift(direction) | ||
return | ||
|
||
/mob/living/pixel_shift(direction) | ||
switch(direction) | ||
if(NORTH) | ||
if(!canface()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be the first check inside this function. No need to duplicate it for every direction.
|
||
return FALSE | ||
if(pixel_y <= 16) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can replace magic numbers like 16 with define like |
||
pixel_y++ | ||
is_shifted = TRUE | ||
if(EAST) | ||
if(!canface()) | ||
return FALSE | ||
if(pixel_x <= 16) | ||
pixel_x++ | ||
is_shifted = TRUE | ||
if(SOUTH) | ||
if(!canface()) | ||
return FALSE | ||
if(pixel_y >= -16) | ||
pixel_y-- | ||
is_shifted = TRUE | ||
if(WEST) | ||
if(!canface()) | ||
return FALSE | ||
if(pixel_x >= -16) | ||
pixel_x-- | ||
is_shifted = TRUE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or you can just copypaste my proc:
Note about the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This edit will conflict with upstream.
You probably want to move it to modpack as well, since those functions work only if you include it.
I used this code in my downstream to separate from core to modpack:
After some tweaks for you, it will look like this:
I use this code to separate from core to modpack: